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