@camstack/addon-osd-manager 0.1.248 → 0.1.250

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 (18) hide show
  1. package/dist/{MotionZonesSettings-HrX-wNkL.mjs → MotionZonesSettings-CuVGpqin.mjs} +2 -2
  2. package/dist/{PrivacyMaskSettings-EteKw4Vd.mjs → PrivacyMaskSettings-DpPryOCL.mjs} +4 -4
  3. package/dist/{SceneMonitorEditor-C3tgLFLN.mjs → SceneMonitorEditor-CXYKPMh5.mjs} +3 -3
  4. package/dist/_stub.js +89 -89
  5. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-YqeJHMK-.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-CrojrVmU.mjs} +4 -4
  6. package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-8VQRbAFi.mjs +26 -0
  7. package/dist/{hostInit-BVtOu0Ky.mjs → hostInit-Dv8vQoH1.mjs} +3 -3
  8. package/dist/index.js +392 -296
  9. package/dist/index.mjs +392 -296
  10. package/dist/{player-overlays-DuLBNXrX.mjs → player-overlays-B7TjrFms.mjs} +1 -1
  11. package/dist/remoteEntry.js +1 -1
  12. package/dist/{responsive-Cgk8F071.mjs → responsive-DoJ7-xFA.mjs} +1 -1
  13. package/dist/{scene-monitor-copy-DZCYlDNg.mjs → scene-monitor-copy-Cyi7io8H.mjs} +1 -1
  14. package/dist/{square-CJIMX4Xi.mjs → square-CSXpu5JD.mjs} +1 -1
  15. package/dist/{trash-2-C9OfSkTN.mjs → trash-2-DeIekKzZ.mjs} +1 -1
  16. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-Dbu6IP7N.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-C1MytOf_.mjs} +1 -1
  17. package/package.json +1 -1
  18. package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BQo33Q2m.mjs +0 -26
package/dist/index.js CHANGED
@@ -5417,7 +5417,7 @@ var ZodIssueCode = {
5417
5417
  var ZodFirstPartyTypeKind;
5418
5418
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5419
5419
  //#endregion
5420
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5420
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5421
5421
  /**
5422
5422
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5423
5423
  * window to float samples (D455).
@@ -7799,6 +7799,12 @@ function normalizeAddonInitResult(result) {
7799
7799
  if (Array.isArray(result)) return { providers: result };
7800
7800
  return result;
7801
7801
  }
7802
+ /**
7803
+ * The share-view scope kinds a share-link token can carry. The hub mints
7804
+ * and validates them (`ShareViewGrantSchema` builds its
7805
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7806
+ */
7807
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7802
7808
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
7803
7809
  var PeerBytesTicketSchema = object({
7804
7810
  /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
@@ -12383,6 +12389,280 @@ var ConvertResultSchema = object({
12383
12389
  files: array(string()).readonly()
12384
12390
  })).readonly()
12385
12391
  });
12392
+ /**
12393
+ * Zod schemas for persisted record types.
12394
+ *
12395
+ * These schemas serve as the single source of truth for types that are
12396
+ * stored in the settings-store backend and retrieved via tRPC. They
12397
+ * replace the manual TypeScript interfaces with schema-derived types,
12398
+ * enabling runtime validation when reading from the backend.
12399
+ *
12400
+ * Convention: each schema is named `<Type>Schema`, the inferred TS type
12401
+ * keeps the original name for backward compatibility.
12402
+ */
12403
+ /**
12404
+ * Auth model (v2 — 2026-05-12 caps-only):
12405
+ *
12406
+ * Two principals:
12407
+ * - `isAdmin: true` — full bypass. Admin scope set is ignored.
12408
+ * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
12409
+ *
12410
+ * No role enum. There used to be `viewer / agent / scoped` and earlier
12411
+ * `super_admin` — collapsed onto the single boolean because every
12412
+ * non-admin caller is governed by the same scope-check rules; the
12413
+ * distinction was only ever used to route role-specific procedures
12414
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12415
+ * with `isAdmin: false` + an explicit scope list.
12416
+ */
12417
+ /** Per-method access flavour. Materialised on every cap method via codegen. */
12418
+ var MethodAccessSchema = _enum([
12419
+ "view",
12420
+ "create",
12421
+ "delete"
12422
+ ]);
12423
+ /**
12424
+ * A single scope grant. Three forms — checked in matcher with OR
12425
+ * semantics; the first match decides whether the call passes:
12426
+ *
12427
+ * - `category` — broadest. `target: 'device' | 'system'` selects every
12428
+ * cap with the matching `scope` declaration. New caps inherit grants
12429
+ * automatically — adding a device cap to the codebase makes it
12430
+ * reachable to every user with `category:device [...]` without a
12431
+ * re-grant. Use this for "family viewer" / "operator" tiers.
12432
+ *
12433
+ * - `addon` — every cap that ships inside a given addon id. Niche;
12434
+ * useful when an integration needs to interact with one specific
12435
+ * addon's surface regardless of how many caps it exports.
12436
+ *
12437
+ * - `capability` — the most precise form. Single cap name. Use for
12438
+ * integration tokens where you want to grant `addons.installPackage`
12439
+ * and nothing else.
12440
+ *
12441
+ * `access` is REQUIRED with min 1 element. `admin` bypass is the
12442
+ * "give me everything" escape; there is no wildcard scope.
12443
+ */
12444
+ var AllowedProviderSchema = union([literal("*"), array(string())]);
12445
+ var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
12446
+ var CapScopeSchema = _enum(["device", "system"]);
12447
+ /**
12448
+ * DeviceSelector (scope model v3 — 2026-08-12).
12449
+ *
12450
+ * A `device` grant no longer carries a frozen list of deviceIds. It carries
12451
+ * a SELECTOR the matcher resolves against the live fleet, so the grant can be
12452
+ * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
12453
+ * AFTER the grant was minted — no re-grant, no re-login.
12454
+ *
12455
+ * - `all` — every device in the deployment. The broad viewer/operator
12456
+ * lever without a `category` grant (a `category` grant also covers device
12457
+ * caps that carry no deviceId; `all` is specifically the device set).
12458
+ * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
12459
+ * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
12460
+ * is NOT covered until the grant is edited.
12461
+ * - `types` — every device of a `DeviceType` (e.g. every `camera`).
12462
+ * DYNAMIC. A device that changes type, or a new device of the type,
12463
+ * re-resolves on the next request.
12464
+ * - `locations` — every device whose operator-assigned `location` label is
12465
+ * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
12466
+ * null/unset location matches NO `locations` selector.
12467
+ */
12468
+ var DeviceSelectorSchema = discriminatedUnion("kind", [
12469
+ object({ kind: literal("all") }),
12470
+ object({
12471
+ kind: literal("ids"),
12472
+ ids: array(number().int()).min(1)
12473
+ }),
12474
+ object({
12475
+ kind: literal("types"),
12476
+ types: array(_enum(DeviceType)).min(1)
12477
+ }),
12478
+ object({
12479
+ kind: literal("locations"),
12480
+ locations: array(string().min(1)).min(1)
12481
+ })
12482
+ ]);
12483
+ var DeviceTokenScopeSchema = object({
12484
+ type: literal("device"),
12485
+ /** The device SET this grant covers — resolved against the live fleet. */
12486
+ selector: DeviceSelectorSchema,
12487
+ access: array(MethodAccessSchema).min(1),
12488
+ /**
12489
+ * Whether a grant on a PARENT device transparently covers its accessory
12490
+ * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
12491
+ * Direction is parent → children ONLY.
12492
+ *
12493
+ * Absent → the matcher DERIVES it from the access flavour: `view`
12494
+ * inherits (a camera viewer sees the camera's accessories), `create` /
12495
+ * `delete` do NOT (actuating/removing a child is an explicit act the
12496
+ * operator must grant on the child, not inherit from the parent). Set it
12497
+ * explicitly to override that default per grant.
12498
+ */
12499
+ includeLinked: boolean().optional()
12500
+ });
12501
+ /**
12502
+ * v2 → v3 lazy migration. A pre-v3 `device` grant carried
12503
+ * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
12504
+ * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
12505
+ * EVERY parse path — stored records AND the JWT-carried scope arrays
12506
+ * normalised at the request boundary ({@link normalizeTokenScopes} in
12507
+ * `device-selector.ts`). Chosen over a one-time DB migration because a
12508
+ * migration cannot reach a JWT already in a client's hands; parse-time
12509
+ * migration covers both without a flag day. No cast — the raw object is read
12510
+ * through `Reflect.get` (its static type is `unknown`).
12511
+ */
12512
+ function migrateLegacyTokenScope(raw) {
12513
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
12514
+ if (Reflect.get(raw, "type") !== "device") return raw;
12515
+ if (Reflect.get(raw, "selector") !== void 0) return raw;
12516
+ const targets = Reflect.get(raw, "targets");
12517
+ if (!Array.isArray(targets)) return raw;
12518
+ return {
12519
+ type: "device",
12520
+ selector: {
12521
+ kind: "ids",
12522
+ ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
12523
+ },
12524
+ access: Reflect.get(raw, "access")
12525
+ };
12526
+ }
12527
+ var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
12528
+ object({
12529
+ type: literal("category"),
12530
+ target: CapScopeSchema,
12531
+ access: array(MethodAccessSchema).min(1)
12532
+ }),
12533
+ object({
12534
+ type: literal("capability"),
12535
+ target: string(),
12536
+ access: array(MethodAccessSchema).min(1)
12537
+ }),
12538
+ object({
12539
+ type: literal("addon"),
12540
+ target: string(),
12541
+ access: array(MethodAccessSchema).min(1)
12542
+ }),
12543
+ DeviceTokenScopeSchema
12544
+ ]));
12545
+ object({
12546
+ id: string(),
12547
+ username: string(),
12548
+ passwordHash: string(),
12549
+ /**
12550
+ * Admin bypass. When true, the middleware skips the scope-access
12551
+ * check entirely. There is no other axis of privilege; the legacy
12552
+ * role enum collapsed onto this boolean in v2.
12553
+ */
12554
+ isAdmin: boolean().default(false),
12555
+ allowedProviders: AllowedProviderSchema,
12556
+ allowedDevices: AllowedDevicesSchema,
12557
+ /**
12558
+ * Scopes granted to this user. Admins bypass; their `scopes` is
12559
+ * ignored. Non-admins without scopes are locked out of every
12560
+ * protected call.
12561
+ */
12562
+ scopes: array(TokenScopeSchema).default([]),
12563
+ createdAt: number(),
12564
+ updatedAt: number()
12565
+ });
12566
+ object({
12567
+ id: string(),
12568
+ label: string(),
12569
+ isAdmin: boolean().default(false),
12570
+ allowedProviders: AllowedProviderSchema,
12571
+ allowedDevices: AllowedDevicesSchema,
12572
+ tokenHash: string(),
12573
+ tokenPrefix: string(),
12574
+ createdAt: number(),
12575
+ lastUsedAt: number().optional()
12576
+ });
12577
+ object({
12578
+ id: string(),
12579
+ userId: string(),
12580
+ name: string(),
12581
+ tokenHash: string(),
12582
+ tokenPrefix: string(),
12583
+ scopes: array(TokenScopeSchema),
12584
+ expiresAt: number().nullish(),
12585
+ lastUsedAt: number().nullish(),
12586
+ createdAt: number()
12587
+ });
12588
+ /** What a share-view grant lets its holder see. */
12589
+ var ShareViewGrantSchema = object({
12590
+ kind: _enum(SHARE_VIEW_KINDS),
12591
+ deviceIds: array(number().int().nonnegative()).min(1).max(64),
12592
+ /** Talk-back, opt-in at mint time; absent means off. */
12593
+ talk: boolean().optional()
12594
+ });
12595
+ var ShareViewScopeSchema = object({
12596
+ type: literal("share-view"),
12597
+ grant: ShareViewGrantSchema
12598
+ });
12599
+ var AddonRoutesScopeSchema = object({
12600
+ type: literal("addon-routes"),
12601
+ access: array(MethodAccessSchema).min(1)
12602
+ });
12603
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
12604
+ var CredentialScopeSchema = union([
12605
+ literal("*"),
12606
+ ShareViewScopeSchema,
12607
+ AddonRoutesScopeSchema,
12608
+ PreferencesSelfScopeSchema,
12609
+ TokenScopeSchema
12610
+ ]);
12611
+ object({
12612
+ kind: literal("credential"),
12613
+ sub: string().min(1),
12614
+ jti: string().min(16),
12615
+ scopes: array(CredentialScopeSchema).min(1)
12616
+ });
12617
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
12618
+ /** A namespace's value: a JSON object, opaque to the hub. */
12619
+ var PreferenceValueSchema = record(string(), unknown());
12620
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
12621
+ /** A stored row, as the owner reads it. */
12622
+ var PreferenceRowSchema = object({
12623
+ namespace: PreferenceNamespaceSchema,
12624
+ value: PreferenceValueSchema,
12625
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
12626
+ revision: number().int().positive(),
12627
+ updatedAt: number().int(),
12628
+ /** The client id the last writer sent; `null` when it sent none. */
12629
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
12630
+ });
12631
+ object({
12632
+ /** Absent: every namespace the caller holds. */
12633
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
12634
+ object({ rows: array(PreferenceRowSchema) });
12635
+ object({
12636
+ namespace: PreferenceNamespaceSchema,
12637
+ value: PreferenceValueSchema,
12638
+ /**
12639
+ * The revision the edit was based on. Absent: last write wins. `0`: the
12640
+ * namespace must not exist yet. Any other value that is not the current
12641
+ * revision answers `conflict` and writes nothing.
12642
+ */
12643
+ baseRevision: number().int().nonnegative().optional(),
12644
+ deviceId: PreferenceDeviceIdSchema.optional()
12645
+ });
12646
+ discriminatedUnion("status", [object({
12647
+ status: literal("saved"),
12648
+ row: PreferenceRowSchema
12649
+ }), object({
12650
+ status: literal("conflict"),
12651
+ current: PreferenceRowSchema.nullable()
12652
+ })]);
12653
+ object({ namespace: PreferenceNamespaceSchema });
12654
+ object({
12655
+ /** `false` when the namespace did not exist. */
12656
+ deleted: boolean() });
12657
+ object({
12658
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
12659
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
12660
+ object({
12661
+ /** Every row whose revision differs from the client's, and every row it did not list. */
12662
+ rows: array(PreferenceRowSchema),
12663
+ /** Namespaces the client listed that no longer exist. */
12664
+ deleted: array(PreferenceNamespaceSchema)
12665
+ });
12386
12666
  _enum(["new-session", "step-up"]);
12387
12667
  /** The languages the hub's app landing pages are written in (D858). */
12388
12668
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -39323,38 +39603,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
39323
39603
  auth: "admin",
39324
39604
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
39325
39605
  });
39606
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
39607
+ /** What a model (or, by default, every model of a kind) can do. */
39608
+ var LlmModelFeaturesSchema = object({
39609
+ vision: boolean(),
39610
+ tools: boolean(),
39611
+ streaming: boolean()
39612
+ });
39613
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
39614
+ var LlmModelInfoSchema = object({
39615
+ id: string(),
39616
+ label: string().optional(),
39617
+ contextLength: number().int().positive().optional(),
39618
+ features: LlmModelFeaturesSchema.partial().optional()
39619
+ });
39326
39620
  /**
39327
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
39328
- * methods concat-fan across providers; single-row methods route to ONE
39329
- * provider by the `addonId` in the call input (the notification-output
39330
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
39331
- * (hub-placed); the cap stays open for future providers.
39332
- *
39333
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
39334
- * `apiKey` is a password field — providers REDACT it on read and merge on
39335
- * write; a stored key NEVER round-trips to a client.
39621
+ * The provider-specific part of a profile, validated by the provider that owns
39622
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
39623
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
39624
+ * keychain, never in the row, and reads back as the redaction marker.
39336
39625
  */
39337
- var LlmProfileKindSchema = _enum([
39338
- "openai-compatible",
39339
- "openai",
39340
- "anthropic",
39341
- "google",
39342
- "managed-local",
39343
- "apple-foundation"
39344
- ]);
39626
+ var LlmProviderConfigSchema = record(string(), unknown());
39345
39627
  var LlmProfileSchema = object({
39346
39628
  id: string(),
39347
39629
  name: string(),
39630
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
39348
39631
  kind: LlmProfileKindSchema,
39349
39632
  /** Stamped by the provider — keeps the fanned catalog routable. */
39350
39633
  addonId: string(),
39351
39634
  enabled: boolean(),
39352
39635
  /** Vendor model id, or the managed runtime's loaded model. */
39353
39636
  model: string(),
39354
- /** Required for openai-compatible; override for cloud kinds. */
39355
- baseUrl: string().optional(),
39356
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
39357
- apiKey: string().optional(),
39358
39637
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
39359
39638
  * degraded to text — that shipped once and produced a confident answer to a
39360
39639
  * question about a picture nobody sent. */
@@ -39362,15 +39641,11 @@ var LlmProfileSchema = object({
39362
39641
  temperature: number().min(0).max(2).optional(),
39363
39642
  /** Nucleus sampling. Every wire we speak has it. */
39364
39643
  topP: number().min(0).max(1).optional(),
39365
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
39366
- * wire does, and the client drops it there (measured: the request body gets
39367
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
39368
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
39644
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
39645
+ * field in its editor only when its descriptor lists it in `profileFields`. */
39369
39646
  topK: number().int().positive().optional(),
39370
39647
  maxTokens: number().int().positive().optional(),
39371
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
39372
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
39373
- * the model with, so it is the one field that changes a PROCESS. */
39648
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
39374
39649
  contextLength: number().int().positive().optional(),
39375
39650
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
39376
39651
  * two system prompts fighting is worse than either alone). */
@@ -39396,16 +39671,37 @@ var LlmProfileSchema = object({
39396
39671
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
39397
39672
  * `true` here buys the wiring, not behaviour, until tools are registered. */
39398
39673
  toolsEnabled: boolean().default(false),
39399
- extraHeaders: record(string(), string()).optional(),
39400
- /** kind === 'managed-local' only (spec §4). */
39401
- runtime: ManagedRuntimeConfigSchema.optional(),
39402
- /**
39403
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
39404
- * to configure (no key, no URL, no download; `model` is `apple-system`).
39405
- * `supportsVision` on such a row is stamped by the provider from the node's
39406
- * reported `imageInput`, never taken from the operator (D62).
39407
- */
39408
- appleFoundation: object({ nodeId: string() }).optional()
39674
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
39675
+ providerConfig: LlmProviderConfigSchema.default({})
39676
+ });
39677
+ /**
39678
+ * The common profile fields a kind's editor offers. The editor owns how each
39679
+ * one is drawn; the provider says which of them mean something on its wire.
39680
+ */
39681
+ var LlmProfileFieldSchema = _enum([
39682
+ "temperature",
39683
+ "topP",
39684
+ "topK",
39685
+ "maxTokens",
39686
+ "contextLength",
39687
+ "systemPrompt",
39688
+ "timeoutMs",
39689
+ "connectTimeoutMs",
39690
+ "firstTokenTimeoutMs",
39691
+ "idleTimeoutMs",
39692
+ "retry",
39693
+ "toolsEnabled"
39694
+ ]);
39695
+ /**
39696
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
39697
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
39698
+ * picker: that widget owns the model choice.
39699
+ */
39700
+ var LlmProviderWidgetSchema = object({
39701
+ id: string(),
39702
+ placement: _enum(["connection", "model"]),
39703
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
39704
+ requires: array(string()).optional()
39409
39705
  });
39410
39706
  /** ConfigUISchema tree passed through untyped on the wire (the
39411
39707
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -39414,11 +39710,56 @@ var ConfigSchemaPassthrough$3 = unknown();
39414
39710
  var LlmProfileKindDescriptorSchema = object({
39415
39711
  kind: LlmProfileKindSchema,
39416
39712
  label: string(),
39713
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
39417
39714
  icon: string(),
39418
39715
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
39419
39716
  addonId: string(),
39420
- configSchema: ConfigSchemaPassthrough$3
39717
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
39718
+ connectionSchema: ConfigSchemaPassthrough$3,
39719
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
39720
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
39721
+ /** The kind's defaults; a model from `listModels` may override any of them. */
39722
+ features: LlmModelFeaturesSchema,
39723
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
39724
+ visionEditable: boolean(),
39725
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
39726
+ modelCatalog: _enum([
39727
+ "fetch",
39728
+ "static",
39729
+ "none"
39730
+ ]),
39731
+ staticModels: array(LlmModelInfoSchema).optional(),
39732
+ /** The common fields that mean something on this kind's wire. */
39733
+ profileFields: array(LlmProfileFieldSchema),
39734
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
39735
+ });
39736
+ /**
39737
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
39738
+ * (the editor's form); with `profileId` too, a secret the draft leaves
39739
+ * untouched (absent or the redaction marker) is resolved server-side from the
39740
+ * stored profile — the browser never receives it.
39741
+ */
39742
+ var LlmListModelsInputSchema = object({
39743
+ addonId: string(),
39744
+ kind: LlmProfileKindSchema,
39745
+ profileId: string().optional(),
39746
+ connection: LlmProviderConfigSchema.optional()
39421
39747
  });
39748
+ var LlmListModelsErrorCodeSchema = _enum([
39749
+ "auth",
39750
+ "network",
39751
+ "unsupported",
39752
+ "invalid"
39753
+ ]);
39754
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
39755
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
39756
+ ok: literal(true),
39757
+ models: array(LlmModelInfoSchema)
39758
+ }), object({
39759
+ ok: literal(false),
39760
+ code: LlmListModelsErrorCodeSchema,
39761
+ message: string()
39762
+ })]);
39422
39763
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
39423
39764
  var LlmDefaultSchema = object({
39424
39765
  selector: LlmDefaultSelectorSchema,
@@ -39518,7 +39859,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39518
39859
  kind: "mutation",
39519
39860
  auth: "admin",
39520
39861
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
39521
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
39862
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
39863
+ kind: "mutation",
39864
+ auth: "admin"
39865
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
39522
39866
  selector: LlmDefaultSelectorSchema,
39523
39867
  profileId: string().nullable()
39524
39868
  }), _void(), {
@@ -44162,202 +44506,6 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
44162
44506
  auth: "admin"
44163
44507
  }), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
44164
44508
  /**
44165
- * Zod schemas for persisted record types.
44166
- *
44167
- * These schemas serve as the single source of truth for types that are
44168
- * stored in the settings-store backend and retrieved via tRPC. They
44169
- * replace the manual TypeScript interfaces with schema-derived types,
44170
- * enabling runtime validation when reading from the backend.
44171
- *
44172
- * Convention: each schema is named `<Type>Schema`, the inferred TS type
44173
- * keeps the original name for backward compatibility.
44174
- */
44175
- /**
44176
- * Auth model (v2 — 2026-05-12 caps-only):
44177
- *
44178
- * Two principals:
44179
- * - `isAdmin: true` — full bypass. Admin scope set is ignored.
44180
- * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
44181
- *
44182
- * No role enum. There used to be `viewer / agent / scoped` and earlier
44183
- * `super_admin` — collapsed onto the single boolean because every
44184
- * non-admin caller is governed by the same scope-check rules; the
44185
- * distinction was only ever used to route role-specific procedures
44186
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
44187
- * with `isAdmin: false` + an explicit scope list.
44188
- */
44189
- /** Per-method access flavour. Materialised on every cap method via codegen. */
44190
- var MethodAccessSchema = _enum([
44191
- "view",
44192
- "create",
44193
- "delete"
44194
- ]);
44195
- /**
44196
- * A single scope grant. Three forms — checked in matcher with OR
44197
- * semantics; the first match decides whether the call passes:
44198
- *
44199
- * - `category` — broadest. `target: 'device' | 'system'` selects every
44200
- * cap with the matching `scope` declaration. New caps inherit grants
44201
- * automatically — adding a device cap to the codebase makes it
44202
- * reachable to every user with `category:device [...]` without a
44203
- * re-grant. Use this for "family viewer" / "operator" tiers.
44204
- *
44205
- * - `addon` — every cap that ships inside a given addon id. Niche;
44206
- * useful when an integration needs to interact with one specific
44207
- * addon's surface regardless of how many caps it exports.
44208
- *
44209
- * - `capability` — the most precise form. Single cap name. Use for
44210
- * integration tokens where you want to grant `addons.installPackage`
44211
- * and nothing else.
44212
- *
44213
- * `access` is REQUIRED with min 1 element. `admin` bypass is the
44214
- * "give me everything" escape; there is no wildcard scope.
44215
- */
44216
- var AllowedProviderSchema = union([literal("*"), array(string())]);
44217
- var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
44218
- var CapScopeSchema = _enum(["device", "system"]);
44219
- /**
44220
- * DeviceSelector (scope model v3 — 2026-08-12).
44221
- *
44222
- * A `device` grant no longer carries a frozen list of deviceIds. It carries
44223
- * a SELECTOR the matcher resolves against the live fleet, so the grant can be
44224
- * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
44225
- * AFTER the grant was minted — no re-grant, no re-login.
44226
- *
44227
- * - `all` — every device in the deployment. The broad viewer/operator
44228
- * lever without a `category` grant (a `category` grant also covers device
44229
- * caps that carry no deviceId; `all` is specifically the device set).
44230
- * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
44231
- * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
44232
- * is NOT covered until the grant is edited.
44233
- * - `types` — every device of a `DeviceType` (e.g. every `camera`).
44234
- * DYNAMIC. A device that changes type, or a new device of the type,
44235
- * re-resolves on the next request.
44236
- * - `locations` — every device whose operator-assigned `location` label is
44237
- * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
44238
- * null/unset location matches NO `locations` selector.
44239
- */
44240
- var DeviceSelectorSchema = discriminatedUnion("kind", [
44241
- object({ kind: literal("all") }),
44242
- object({
44243
- kind: literal("ids"),
44244
- ids: array(number().int()).min(1)
44245
- }),
44246
- object({
44247
- kind: literal("types"),
44248
- types: array(_enum(DeviceType)).min(1)
44249
- }),
44250
- object({
44251
- kind: literal("locations"),
44252
- locations: array(string().min(1)).min(1)
44253
- })
44254
- ]);
44255
- var DeviceTokenScopeSchema = object({
44256
- type: literal("device"),
44257
- /** The device SET this grant covers — resolved against the live fleet. */
44258
- selector: DeviceSelectorSchema,
44259
- access: array(MethodAccessSchema).min(1),
44260
- /**
44261
- * Whether a grant on a PARENT device transparently covers its accessory
44262
- * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
44263
- * Direction is parent → children ONLY.
44264
- *
44265
- * Absent → the matcher DERIVES it from the access flavour: `view`
44266
- * inherits (a camera viewer sees the camera's accessories), `create` /
44267
- * `delete` do NOT (actuating/removing a child is an explicit act the
44268
- * operator must grant on the child, not inherit from the parent). Set it
44269
- * explicitly to override that default per grant.
44270
- */
44271
- includeLinked: boolean().optional()
44272
- });
44273
- /**
44274
- * v2 → v3 lazy migration. A pre-v3 `device` grant carried
44275
- * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
44276
- * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
44277
- * EVERY parse path — stored records AND the JWT-carried scope arrays
44278
- * normalised at the request boundary ({@link normalizeTokenScopes} in
44279
- * `device-selector.ts`). Chosen over a one-time DB migration because a
44280
- * migration cannot reach a JWT already in a client's hands; parse-time
44281
- * migration covers both without a flag day. No cast — the raw object is read
44282
- * through `Reflect.get` (its static type is `unknown`).
44283
- */
44284
- function migrateLegacyTokenScope(raw) {
44285
- if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
44286
- if (Reflect.get(raw, "type") !== "device") return raw;
44287
- if (Reflect.get(raw, "selector") !== void 0) return raw;
44288
- const targets = Reflect.get(raw, "targets");
44289
- if (!Array.isArray(targets)) return raw;
44290
- return {
44291
- type: "device",
44292
- selector: {
44293
- kind: "ids",
44294
- ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
44295
- },
44296
- access: Reflect.get(raw, "access")
44297
- };
44298
- }
44299
- var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
44300
- object({
44301
- type: literal("category"),
44302
- target: CapScopeSchema,
44303
- access: array(MethodAccessSchema).min(1)
44304
- }),
44305
- object({
44306
- type: literal("capability"),
44307
- target: string(),
44308
- access: array(MethodAccessSchema).min(1)
44309
- }),
44310
- object({
44311
- type: literal("addon"),
44312
- target: string(),
44313
- access: array(MethodAccessSchema).min(1)
44314
- }),
44315
- DeviceTokenScopeSchema
44316
- ]));
44317
- object({
44318
- id: string(),
44319
- username: string(),
44320
- passwordHash: string(),
44321
- /**
44322
- * Admin bypass. When true, the middleware skips the scope-access
44323
- * check entirely. There is no other axis of privilege; the legacy
44324
- * role enum collapsed onto this boolean in v2.
44325
- */
44326
- isAdmin: boolean().default(false),
44327
- allowedProviders: AllowedProviderSchema,
44328
- allowedDevices: AllowedDevicesSchema,
44329
- /**
44330
- * Scopes granted to this user. Admins bypass; their `scopes` is
44331
- * ignored. Non-admins without scopes are locked out of every
44332
- * protected call.
44333
- */
44334
- scopes: array(TokenScopeSchema).default([]),
44335
- createdAt: number(),
44336
- updatedAt: number()
44337
- });
44338
- object({
44339
- id: string(),
44340
- label: string(),
44341
- isAdmin: boolean().default(false),
44342
- allowedProviders: AllowedProviderSchema,
44343
- allowedDevices: AllowedDevicesSchema,
44344
- tokenHash: string(),
44345
- tokenPrefix: string(),
44346
- createdAt: number(),
44347
- lastUsedAt: number().optional()
44348
- });
44349
- object({
44350
- id: string(),
44351
- userId: string(),
44352
- name: string(),
44353
- tokenHash: string(),
44354
- tokenPrefix: string(),
44355
- scopes: array(TokenScopeSchema),
44356
- expiresAt: number().nullish(),
44357
- lastUsedAt: number().nullish(),
44358
- createdAt: number()
44359
- });
44360
- /**
44361
44509
  * `oauth-integration` — a collection cap by which an addon declares
44362
44510
  * itself a linkable OAuth client of the hub's core `/oauth2/*` server.
44363
44511
  * Each provider returns a static descriptor; the core enumerates them
@@ -61351,26 +61499,6 @@ var ApiKeySummarySchema = object({
61351
61499
  createdAt: number(),
61352
61500
  lastUsedAt: number().optional()
61353
61501
  });
61354
- var ScopedTokenSummarySchema = object({
61355
- id: string(),
61356
- userId: string(),
61357
- name: string(),
61358
- tokenPrefix: string(),
61359
- scopes: array(TokenScopeSchema),
61360
- expiresAt: number().nullish(),
61361
- lastUsedAt: number().nullish(),
61362
- createdAt: number()
61363
- });
61364
- var CreateScopedTokenInputSchema = object({
61365
- userId: string(),
61366
- name: string(),
61367
- scopes: array(TokenScopeSchema),
61368
- expiresAt: number().optional()
61369
- });
61370
- var CreateScopedTokenResultSchema = object({
61371
- token: string(),
61372
- record: ScopedTokenSummarySchema
61373
- });
61374
61502
  var OauthSessionSummarySchema = object({
61375
61503
  id: string(),
61376
61504
  userId: string(),
@@ -61392,11 +61520,11 @@ var TotpStatusSchema = object({
61392
61520
  confirmedAt: number().nullable()
61393
61521
  });
61394
61522
  /**
61395
- * user-management — singleton capability for user accounts, API keys,
61396
- * and scoped tokens.
61523
+ * user-management — singleton capability for user accounts and the
61524
+ * legacy API-key rows.
61397
61525
  *
61398
61526
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
61399
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
61527
+ * — the subset check on `setUserScopes` is moot
61400
61528
  * because non-admins never reach these. If/when we open non-admin
61401
61529
  * delegation, structural caller-scope subset check goes inside the
61402
61530
  * provider.
@@ -61453,15 +61581,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
61453
61581
  kind: "mutation",
61454
61582
  auth: "admin",
61455
61583
  access: "delete"
61456
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
61457
- kind: "mutation",
61458
- auth: "admin",
61459
- access: "create"
61460
- }), method(object({ id: string() }), object({ success: literal(true) }), {
61461
- kind: "mutation",
61462
- auth: "admin",
61463
- access: "delete"
61464
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
61584
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
61465
61585
  kind: "mutation",
61466
61586
  auth: "admin",
61467
61587
  access: "create"
@@ -65933,7 +66053,7 @@ Object.freeze({
65933
66053
  capName: "llm",
65934
66054
  capScope: "system",
65935
66055
  addonId: null,
65936
- access: "view"
66056
+ access: "create"
65937
66057
  },
65938
66058
  "llm.listNodeModels": {
65939
66059
  capName: "llm",
@@ -70597,12 +70717,6 @@ Object.freeze({
70597
70717
  addonId: null,
70598
70718
  access: "create"
70599
70719
  },
70600
- "userManagement.createScopedToken": {
70601
- capName: "user-management",
70602
- capScope: "system",
70603
- addonId: null,
70604
- access: "create"
70605
- },
70606
70720
  "userManagement.createUser": {
70607
70721
  capName: "user-management",
70608
70722
  capScope: "system",
@@ -70651,12 +70765,6 @@ Object.freeze({
70651
70765
  addonId: null,
70652
70766
  access: "view"
70653
70767
  },
70654
- "userManagement.listScopedTokens": {
70655
- capName: "user-management",
70656
- capScope: "system",
70657
- addonId: null,
70658
- access: "view"
70659
- },
70660
70768
  "userManagement.listUsers": {
70661
70769
  capName: "user-management",
70662
70770
  capScope: "system",
@@ -70711,12 +70819,6 @@ Object.freeze({
70711
70819
  addonId: null,
70712
70820
  access: "delete"
70713
70821
  },
70714
- "userManagement.revokeScopedToken": {
70715
- capName: "user-management",
70716
- capScope: "system",
70717
- addonId: null,
70718
- access: "delete"
70719
- },
70720
70822
  "userManagement.setupTotp": {
70721
70823
  capName: "user-management",
70722
70824
  capScope: "system",
@@ -70747,12 +70849,6 @@ Object.freeze({
70747
70849
  addonId: null,
70748
70850
  access: "view"
70749
70851
  },
70750
- "userManagement.validateScopedToken": {
70751
- capName: "user-management",
70752
- capScope: "system",
70753
- addonId: null,
70754
- access: "view"
70755
- },
70756
70852
  "userManagement.verifyTotp": {
70757
70853
  capName: "user-management",
70758
70854
  capScope: "system",
@@ -75871,7 +75967,8 @@ Object.freeze({
75871
75967
  "enabled": false,
75872
75968
  "maxAttempts": 1
75873
75969
  },
75874
- "toolsEnabled": false
75970
+ "toolsEnabled": false,
75971
+ "providerConfig": {}
75875
75972
  } } } },
75876
75973
  "llm-runtime": {
75877
75974
  "complete": { "runtime": { "__nested__": {
@@ -76118,7 +76215,6 @@ Object.freeze({
76118
76215
  "getDefaults",
76119
76216
  "getUsage",
76120
76217
  "listModelCatalog",
76121
- "listModels",
76122
76218
  "listNodeModels",
76123
76219
  "listProfileKinds",
76124
76220
  "listProfiles",