@camstack/addon-smtp-nodemailer 1.2.124 → 1.2.126

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.
@@ -5451,7 +5451,7 @@ var ZodIssueCode = {
5451
5451
  var ZodFirstPartyTypeKind;
5452
5452
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5453
5453
  //#endregion
5454
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5454
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5455
5455
  /**
5456
5456
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5457
5457
  * window to float samples (D455).
@@ -7833,6 +7833,12 @@ function normalizeAddonInitResult(result) {
7833
7833
  if (Array.isArray(result)) return { providers: result };
7834
7834
  return result;
7835
7835
  }
7836
+ /**
7837
+ * The share-view scope kinds a share-link token can carry. The hub mints
7838
+ * and validates them (`ShareViewGrantSchema` builds its
7839
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7840
+ */
7841
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7836
7842
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
7837
7843
  var PeerBytesTicketSchema = object({
7838
7844
  /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
@@ -12417,6 +12423,280 @@ var ConvertResultSchema = object({
12417
12423
  files: array(string()).readonly()
12418
12424
  })).readonly()
12419
12425
  });
12426
+ /**
12427
+ * Zod schemas for persisted record types.
12428
+ *
12429
+ * These schemas serve as the single source of truth for types that are
12430
+ * stored in the settings-store backend and retrieved via tRPC. They
12431
+ * replace the manual TypeScript interfaces with schema-derived types,
12432
+ * enabling runtime validation when reading from the backend.
12433
+ *
12434
+ * Convention: each schema is named `<Type>Schema`, the inferred TS type
12435
+ * keeps the original name for backward compatibility.
12436
+ */
12437
+ /**
12438
+ * Auth model (v2 — 2026-05-12 caps-only):
12439
+ *
12440
+ * Two principals:
12441
+ * - `isAdmin: true` — full bypass. Admin scope set is ignored.
12442
+ * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
12443
+ *
12444
+ * No role enum. There used to be `viewer / agent / scoped` and earlier
12445
+ * `super_admin` — collapsed onto the single boolean because every
12446
+ * non-admin caller is governed by the same scope-check rules; the
12447
+ * distinction was only ever used to route role-specific procedures
12448
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12449
+ * with `isAdmin: false` + an explicit scope list.
12450
+ */
12451
+ /** Per-method access flavour. Materialised on every cap method via codegen. */
12452
+ var MethodAccessSchema = _enum([
12453
+ "view",
12454
+ "create",
12455
+ "delete"
12456
+ ]);
12457
+ /**
12458
+ * A single scope grant. Three forms — checked in matcher with OR
12459
+ * semantics; the first match decides whether the call passes:
12460
+ *
12461
+ * - `category` — broadest. `target: 'device' | 'system'` selects every
12462
+ * cap with the matching `scope` declaration. New caps inherit grants
12463
+ * automatically — adding a device cap to the codebase makes it
12464
+ * reachable to every user with `category:device [...]` without a
12465
+ * re-grant. Use this for "family viewer" / "operator" tiers.
12466
+ *
12467
+ * - `addon` — every cap that ships inside a given addon id. Niche;
12468
+ * useful when an integration needs to interact with one specific
12469
+ * addon's surface regardless of how many caps it exports.
12470
+ *
12471
+ * - `capability` — the most precise form. Single cap name. Use for
12472
+ * integration tokens where you want to grant `addons.installPackage`
12473
+ * and nothing else.
12474
+ *
12475
+ * `access` is REQUIRED with min 1 element. `admin` bypass is the
12476
+ * "give me everything" escape; there is no wildcard scope.
12477
+ */
12478
+ var AllowedProviderSchema = union([literal("*"), array(string())]);
12479
+ var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
12480
+ var CapScopeSchema = _enum(["device", "system"]);
12481
+ /**
12482
+ * DeviceSelector (scope model v3 — 2026-08-12).
12483
+ *
12484
+ * A `device` grant no longer carries a frozen list of deviceIds. It carries
12485
+ * a SELECTOR the matcher resolves against the live fleet, so the grant can be
12486
+ * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
12487
+ * AFTER the grant was minted — no re-grant, no re-login.
12488
+ *
12489
+ * - `all` — every device in the deployment. The broad viewer/operator
12490
+ * lever without a `category` grant (a `category` grant also covers device
12491
+ * caps that carry no deviceId; `all` is specifically the device set).
12492
+ * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
12493
+ * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
12494
+ * is NOT covered until the grant is edited.
12495
+ * - `types` — every device of a `DeviceType` (e.g. every `camera`).
12496
+ * DYNAMIC. A device that changes type, or a new device of the type,
12497
+ * re-resolves on the next request.
12498
+ * - `locations` — every device whose operator-assigned `location` label is
12499
+ * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
12500
+ * null/unset location matches NO `locations` selector.
12501
+ */
12502
+ var DeviceSelectorSchema = discriminatedUnion("kind", [
12503
+ object({ kind: literal("all") }),
12504
+ object({
12505
+ kind: literal("ids"),
12506
+ ids: array(number().int()).min(1)
12507
+ }),
12508
+ object({
12509
+ kind: literal("types"),
12510
+ types: array(_enum(DeviceType)).min(1)
12511
+ }),
12512
+ object({
12513
+ kind: literal("locations"),
12514
+ locations: array(string().min(1)).min(1)
12515
+ })
12516
+ ]);
12517
+ var DeviceTokenScopeSchema = object({
12518
+ type: literal("device"),
12519
+ /** The device SET this grant covers — resolved against the live fleet. */
12520
+ selector: DeviceSelectorSchema,
12521
+ access: array(MethodAccessSchema).min(1),
12522
+ /**
12523
+ * Whether a grant on a PARENT device transparently covers its accessory
12524
+ * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
12525
+ * Direction is parent → children ONLY.
12526
+ *
12527
+ * Absent → the matcher DERIVES it from the access flavour: `view`
12528
+ * inherits (a camera viewer sees the camera's accessories), `create` /
12529
+ * `delete` do NOT (actuating/removing a child is an explicit act the
12530
+ * operator must grant on the child, not inherit from the parent). Set it
12531
+ * explicitly to override that default per grant.
12532
+ */
12533
+ includeLinked: boolean().optional()
12534
+ });
12535
+ /**
12536
+ * v2 → v3 lazy migration. A pre-v3 `device` grant carried
12537
+ * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
12538
+ * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
12539
+ * EVERY parse path — stored records AND the JWT-carried scope arrays
12540
+ * normalised at the request boundary ({@link normalizeTokenScopes} in
12541
+ * `device-selector.ts`). Chosen over a one-time DB migration because a
12542
+ * migration cannot reach a JWT already in a client's hands; parse-time
12543
+ * migration covers both without a flag day. No cast — the raw object is read
12544
+ * through `Reflect.get` (its static type is `unknown`).
12545
+ */
12546
+ function migrateLegacyTokenScope(raw) {
12547
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
12548
+ if (Reflect.get(raw, "type") !== "device") return raw;
12549
+ if (Reflect.get(raw, "selector") !== void 0) return raw;
12550
+ const targets = Reflect.get(raw, "targets");
12551
+ if (!Array.isArray(targets)) return raw;
12552
+ return {
12553
+ type: "device",
12554
+ selector: {
12555
+ kind: "ids",
12556
+ ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
12557
+ },
12558
+ access: Reflect.get(raw, "access")
12559
+ };
12560
+ }
12561
+ var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
12562
+ object({
12563
+ type: literal("category"),
12564
+ target: CapScopeSchema,
12565
+ access: array(MethodAccessSchema).min(1)
12566
+ }),
12567
+ object({
12568
+ type: literal("capability"),
12569
+ target: string(),
12570
+ access: array(MethodAccessSchema).min(1)
12571
+ }),
12572
+ object({
12573
+ type: literal("addon"),
12574
+ target: string(),
12575
+ access: array(MethodAccessSchema).min(1)
12576
+ }),
12577
+ DeviceTokenScopeSchema
12578
+ ]));
12579
+ object({
12580
+ id: string(),
12581
+ username: string(),
12582
+ passwordHash: string(),
12583
+ /**
12584
+ * Admin bypass. When true, the middleware skips the scope-access
12585
+ * check entirely. There is no other axis of privilege; the legacy
12586
+ * role enum collapsed onto this boolean in v2.
12587
+ */
12588
+ isAdmin: boolean().default(false),
12589
+ allowedProviders: AllowedProviderSchema,
12590
+ allowedDevices: AllowedDevicesSchema,
12591
+ /**
12592
+ * Scopes granted to this user. Admins bypass; their `scopes` is
12593
+ * ignored. Non-admins without scopes are locked out of every
12594
+ * protected call.
12595
+ */
12596
+ scopes: array(TokenScopeSchema).default([]),
12597
+ createdAt: number(),
12598
+ updatedAt: number()
12599
+ });
12600
+ object({
12601
+ id: string(),
12602
+ label: string(),
12603
+ isAdmin: boolean().default(false),
12604
+ allowedProviders: AllowedProviderSchema,
12605
+ allowedDevices: AllowedDevicesSchema,
12606
+ tokenHash: string(),
12607
+ tokenPrefix: string(),
12608
+ createdAt: number(),
12609
+ lastUsedAt: number().optional()
12610
+ });
12611
+ object({
12612
+ id: string(),
12613
+ userId: string(),
12614
+ name: string(),
12615
+ tokenHash: string(),
12616
+ tokenPrefix: string(),
12617
+ scopes: array(TokenScopeSchema),
12618
+ expiresAt: number().nullish(),
12619
+ lastUsedAt: number().nullish(),
12620
+ createdAt: number()
12621
+ });
12622
+ /** What a share-view grant lets its holder see. */
12623
+ var ShareViewGrantSchema = object({
12624
+ kind: _enum(SHARE_VIEW_KINDS),
12625
+ deviceIds: array(number().int().nonnegative()).min(1).max(64),
12626
+ /** Talk-back, opt-in at mint time; absent means off. */
12627
+ talk: boolean().optional()
12628
+ });
12629
+ var ShareViewScopeSchema = object({
12630
+ type: literal("share-view"),
12631
+ grant: ShareViewGrantSchema
12632
+ });
12633
+ var AddonRoutesScopeSchema = object({
12634
+ type: literal("addon-routes"),
12635
+ access: array(MethodAccessSchema).min(1)
12636
+ });
12637
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
12638
+ var CredentialScopeSchema = union([
12639
+ literal("*"),
12640
+ ShareViewScopeSchema,
12641
+ AddonRoutesScopeSchema,
12642
+ PreferencesSelfScopeSchema,
12643
+ TokenScopeSchema
12644
+ ]);
12645
+ object({
12646
+ kind: literal("credential"),
12647
+ sub: string().min(1),
12648
+ jti: string().min(16),
12649
+ scopes: array(CredentialScopeSchema).min(1)
12650
+ });
12651
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
12652
+ /** A namespace's value: a JSON object, opaque to the hub. */
12653
+ var PreferenceValueSchema = record(string(), unknown());
12654
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
12655
+ /** A stored row, as the owner reads it. */
12656
+ var PreferenceRowSchema = object({
12657
+ namespace: PreferenceNamespaceSchema,
12658
+ value: PreferenceValueSchema,
12659
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
12660
+ revision: number().int().positive(),
12661
+ updatedAt: number().int(),
12662
+ /** The client id the last writer sent; `null` when it sent none. */
12663
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
12664
+ });
12665
+ object({
12666
+ /** Absent: every namespace the caller holds. */
12667
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
12668
+ object({ rows: array(PreferenceRowSchema) });
12669
+ object({
12670
+ namespace: PreferenceNamespaceSchema,
12671
+ value: PreferenceValueSchema,
12672
+ /**
12673
+ * The revision the edit was based on. Absent: last write wins. `0`: the
12674
+ * namespace must not exist yet. Any other value that is not the current
12675
+ * revision answers `conflict` and writes nothing.
12676
+ */
12677
+ baseRevision: number().int().nonnegative().optional(),
12678
+ deviceId: PreferenceDeviceIdSchema.optional()
12679
+ });
12680
+ discriminatedUnion("status", [object({
12681
+ status: literal("saved"),
12682
+ row: PreferenceRowSchema
12683
+ }), object({
12684
+ status: literal("conflict"),
12685
+ current: PreferenceRowSchema.nullable()
12686
+ })]);
12687
+ object({ namespace: PreferenceNamespaceSchema });
12688
+ object({
12689
+ /** `false` when the namespace did not exist. */
12690
+ deleted: boolean() });
12691
+ object({
12692
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
12693
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
12694
+ object({
12695
+ /** Every row whose revision differs from the client's, and every row it did not list. */
12696
+ rows: array(PreferenceRowSchema),
12697
+ /** Namespaces the client listed that no longer exist. */
12698
+ deleted: array(PreferenceNamespaceSchema)
12699
+ });
12420
12700
  _enum(["new-session", "step-up"]);
12421
12701
  /** The languages the hub's app landing pages are written in (D858). */
12422
12702
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -39295,38 +39575,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
39295
39575
  auth: "admin",
39296
39576
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
39297
39577
  });
39578
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
39579
+ /** What a model (or, by default, every model of a kind) can do. */
39580
+ var LlmModelFeaturesSchema = object({
39581
+ vision: boolean(),
39582
+ tools: boolean(),
39583
+ streaming: boolean()
39584
+ });
39585
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
39586
+ var LlmModelInfoSchema = object({
39587
+ id: string(),
39588
+ label: string().optional(),
39589
+ contextLength: number().int().positive().optional(),
39590
+ features: LlmModelFeaturesSchema.partial().optional()
39591
+ });
39298
39592
  /**
39299
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
39300
- * methods concat-fan across providers; single-row methods route to ONE
39301
- * provider by the `addonId` in the call input (the notification-output
39302
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
39303
- * (hub-placed); the cap stays open for future providers.
39304
- *
39305
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
39306
- * `apiKey` is a password field — providers REDACT it on read and merge on
39307
- * write; a stored key NEVER round-trips to a client.
39593
+ * The provider-specific part of a profile, validated by the provider that owns
39594
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
39595
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
39596
+ * keychain, never in the row, and reads back as the redaction marker.
39308
39597
  */
39309
- var LlmProfileKindSchema = _enum([
39310
- "openai-compatible",
39311
- "openai",
39312
- "anthropic",
39313
- "google",
39314
- "managed-local",
39315
- "apple-foundation"
39316
- ]);
39598
+ var LlmProviderConfigSchema = record(string(), unknown());
39317
39599
  var LlmProfileSchema = object({
39318
39600
  id: string(),
39319
39601
  name: string(),
39602
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
39320
39603
  kind: LlmProfileKindSchema,
39321
39604
  /** Stamped by the provider — keeps the fanned catalog routable. */
39322
39605
  addonId: string(),
39323
39606
  enabled: boolean(),
39324
39607
  /** Vendor model id, or the managed runtime's loaded model. */
39325
39608
  model: string(),
39326
- /** Required for openai-compatible; override for cloud kinds. */
39327
- baseUrl: string().optional(),
39328
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
39329
- apiKey: string().optional(),
39330
39609
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
39331
39610
  * degraded to text — that shipped once and produced a confident answer to a
39332
39611
  * question about a picture nobody sent. */
@@ -39334,15 +39613,11 @@ var LlmProfileSchema = object({
39334
39613
  temperature: number().min(0).max(2).optional(),
39335
39614
  /** Nucleus sampling. Every wire we speak has it. */
39336
39615
  topP: number().min(0).max(1).optional(),
39337
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
39338
- * wire does, and the client drops it there (measured: the request body gets
39339
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
39340
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
39616
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
39617
+ * field in its editor only when its descriptor lists it in `profileFields`. */
39341
39618
  topK: number().int().positive().optional(),
39342
39619
  maxTokens: number().int().positive().optional(),
39343
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
39344
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
39345
- * the model with, so it is the one field that changes a PROCESS. */
39620
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
39346
39621
  contextLength: number().int().positive().optional(),
39347
39622
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
39348
39623
  * two system prompts fighting is worse than either alone). */
@@ -39368,16 +39643,37 @@ var LlmProfileSchema = object({
39368
39643
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
39369
39644
  * `true` here buys the wiring, not behaviour, until tools are registered. */
39370
39645
  toolsEnabled: boolean().default(false),
39371
- extraHeaders: record(string(), string()).optional(),
39372
- /** kind === 'managed-local' only (spec §4). */
39373
- runtime: ManagedRuntimeConfigSchema.optional(),
39374
- /**
39375
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
39376
- * to configure (no key, no URL, no download; `model` is `apple-system`).
39377
- * `supportsVision` on such a row is stamped by the provider from the node's
39378
- * reported `imageInput`, never taken from the operator (D62).
39379
- */
39380
- appleFoundation: object({ nodeId: string() }).optional()
39646
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
39647
+ providerConfig: LlmProviderConfigSchema.default({})
39648
+ });
39649
+ /**
39650
+ * The common profile fields a kind's editor offers. The editor owns how each
39651
+ * one is drawn; the provider says which of them mean something on its wire.
39652
+ */
39653
+ var LlmProfileFieldSchema = _enum([
39654
+ "temperature",
39655
+ "topP",
39656
+ "topK",
39657
+ "maxTokens",
39658
+ "contextLength",
39659
+ "systemPrompt",
39660
+ "timeoutMs",
39661
+ "connectTimeoutMs",
39662
+ "firstTokenTimeoutMs",
39663
+ "idleTimeoutMs",
39664
+ "retry",
39665
+ "toolsEnabled"
39666
+ ]);
39667
+ /**
39668
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
39669
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
39670
+ * picker: that widget owns the model choice.
39671
+ */
39672
+ var LlmProviderWidgetSchema = object({
39673
+ id: string(),
39674
+ placement: _enum(["connection", "model"]),
39675
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
39676
+ requires: array(string()).optional()
39381
39677
  });
39382
39678
  /** ConfigUISchema tree passed through untyped on the wire (the
39383
39679
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -39386,11 +39682,56 @@ var ConfigSchemaPassthrough$3 = unknown();
39386
39682
  var LlmProfileKindDescriptorSchema = object({
39387
39683
  kind: LlmProfileKindSchema,
39388
39684
  label: string(),
39685
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
39389
39686
  icon: string(),
39390
39687
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
39391
39688
  addonId: string(),
39392
- configSchema: ConfigSchemaPassthrough$3
39689
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
39690
+ connectionSchema: ConfigSchemaPassthrough$3,
39691
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
39692
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
39693
+ /** The kind's defaults; a model from `listModels` may override any of them. */
39694
+ features: LlmModelFeaturesSchema,
39695
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
39696
+ visionEditable: boolean(),
39697
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
39698
+ modelCatalog: _enum([
39699
+ "fetch",
39700
+ "static",
39701
+ "none"
39702
+ ]),
39703
+ staticModels: array(LlmModelInfoSchema).optional(),
39704
+ /** The common fields that mean something on this kind's wire. */
39705
+ profileFields: array(LlmProfileFieldSchema),
39706
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
39707
+ });
39708
+ /**
39709
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
39710
+ * (the editor's form); with `profileId` too, a secret the draft leaves
39711
+ * untouched (absent or the redaction marker) is resolved server-side from the
39712
+ * stored profile — the browser never receives it.
39713
+ */
39714
+ var LlmListModelsInputSchema = object({
39715
+ addonId: string(),
39716
+ kind: LlmProfileKindSchema,
39717
+ profileId: string().optional(),
39718
+ connection: LlmProviderConfigSchema.optional()
39393
39719
  });
39720
+ var LlmListModelsErrorCodeSchema = _enum([
39721
+ "auth",
39722
+ "network",
39723
+ "unsupported",
39724
+ "invalid"
39725
+ ]);
39726
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
39727
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
39728
+ ok: literal(true),
39729
+ models: array(LlmModelInfoSchema)
39730
+ }), object({
39731
+ ok: literal(false),
39732
+ code: LlmListModelsErrorCodeSchema,
39733
+ message: string()
39734
+ })]);
39394
39735
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
39395
39736
  var LlmDefaultSchema = object({
39396
39737
  selector: LlmDefaultSelectorSchema,
@@ -39490,7 +39831,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39490
39831
  kind: "mutation",
39491
39832
  auth: "admin",
39492
39833
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
39493
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
39834
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
39835
+ kind: "mutation",
39836
+ auth: "admin"
39837
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
39494
39838
  selector: LlmDefaultSelectorSchema,
39495
39839
  profileId: string().nullable()
39496
39840
  }), _void(), {
@@ -43554,202 +43898,6 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
43554
43898
  auth: "admin"
43555
43899
  }), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
43556
43900
  /**
43557
- * Zod schemas for persisted record types.
43558
- *
43559
- * These schemas serve as the single source of truth for types that are
43560
- * stored in the settings-store backend and retrieved via tRPC. They
43561
- * replace the manual TypeScript interfaces with schema-derived types,
43562
- * enabling runtime validation when reading from the backend.
43563
- *
43564
- * Convention: each schema is named `<Type>Schema`, the inferred TS type
43565
- * keeps the original name for backward compatibility.
43566
- */
43567
- /**
43568
- * Auth model (v2 — 2026-05-12 caps-only):
43569
- *
43570
- * Two principals:
43571
- * - `isAdmin: true` — full bypass. Admin scope set is ignored.
43572
- * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
43573
- *
43574
- * No role enum. There used to be `viewer / agent / scoped` and earlier
43575
- * `super_admin` — collapsed onto the single boolean because every
43576
- * non-admin caller is governed by the same scope-check rules; the
43577
- * distinction was only ever used to route role-specific procedures
43578
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
43579
- * with `isAdmin: false` + an explicit scope list.
43580
- */
43581
- /** Per-method access flavour. Materialised on every cap method via codegen. */
43582
- var MethodAccessSchema = _enum([
43583
- "view",
43584
- "create",
43585
- "delete"
43586
- ]);
43587
- /**
43588
- * A single scope grant. Three forms — checked in matcher with OR
43589
- * semantics; the first match decides whether the call passes:
43590
- *
43591
- * - `category` — broadest. `target: 'device' | 'system'` selects every
43592
- * cap with the matching `scope` declaration. New caps inherit grants
43593
- * automatically — adding a device cap to the codebase makes it
43594
- * reachable to every user with `category:device [...]` without a
43595
- * re-grant. Use this for "family viewer" / "operator" tiers.
43596
- *
43597
- * - `addon` — every cap that ships inside a given addon id. Niche;
43598
- * useful when an integration needs to interact with one specific
43599
- * addon's surface regardless of how many caps it exports.
43600
- *
43601
- * - `capability` — the most precise form. Single cap name. Use for
43602
- * integration tokens where you want to grant `addons.installPackage`
43603
- * and nothing else.
43604
- *
43605
- * `access` is REQUIRED with min 1 element. `admin` bypass is the
43606
- * "give me everything" escape; there is no wildcard scope.
43607
- */
43608
- var AllowedProviderSchema = union([literal("*"), array(string())]);
43609
- var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
43610
- var CapScopeSchema = _enum(["device", "system"]);
43611
- /**
43612
- * DeviceSelector (scope model v3 — 2026-08-12).
43613
- *
43614
- * A `device` grant no longer carries a frozen list of deviceIds. It carries
43615
- * a SELECTOR the matcher resolves against the live fleet, so the grant can be
43616
- * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
43617
- * AFTER the grant was minted — no re-grant, no re-login.
43618
- *
43619
- * - `all` — every device in the deployment. The broad viewer/operator
43620
- * lever without a `category` grant (a `category` grant also covers device
43621
- * caps that carry no deviceId; `all` is specifically the device set).
43622
- * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
43623
- * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
43624
- * is NOT covered until the grant is edited.
43625
- * - `types` — every device of a `DeviceType` (e.g. every `camera`).
43626
- * DYNAMIC. A device that changes type, or a new device of the type,
43627
- * re-resolves on the next request.
43628
- * - `locations` — every device whose operator-assigned `location` label is
43629
- * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
43630
- * null/unset location matches NO `locations` selector.
43631
- */
43632
- var DeviceSelectorSchema = discriminatedUnion("kind", [
43633
- object({ kind: literal("all") }),
43634
- object({
43635
- kind: literal("ids"),
43636
- ids: array(number().int()).min(1)
43637
- }),
43638
- object({
43639
- kind: literal("types"),
43640
- types: array(_enum(DeviceType)).min(1)
43641
- }),
43642
- object({
43643
- kind: literal("locations"),
43644
- locations: array(string().min(1)).min(1)
43645
- })
43646
- ]);
43647
- var DeviceTokenScopeSchema = object({
43648
- type: literal("device"),
43649
- /** The device SET this grant covers — resolved against the live fleet. */
43650
- selector: DeviceSelectorSchema,
43651
- access: array(MethodAccessSchema).min(1),
43652
- /**
43653
- * Whether a grant on a PARENT device transparently covers its accessory
43654
- * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
43655
- * Direction is parent → children ONLY.
43656
- *
43657
- * Absent → the matcher DERIVES it from the access flavour: `view`
43658
- * inherits (a camera viewer sees the camera's accessories), `create` /
43659
- * `delete` do NOT (actuating/removing a child is an explicit act the
43660
- * operator must grant on the child, not inherit from the parent). Set it
43661
- * explicitly to override that default per grant.
43662
- */
43663
- includeLinked: boolean().optional()
43664
- });
43665
- /**
43666
- * v2 → v3 lazy migration. A pre-v3 `device` grant carried
43667
- * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
43668
- * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
43669
- * EVERY parse path — stored records AND the JWT-carried scope arrays
43670
- * normalised at the request boundary ({@link normalizeTokenScopes} in
43671
- * `device-selector.ts`). Chosen over a one-time DB migration because a
43672
- * migration cannot reach a JWT already in a client's hands; parse-time
43673
- * migration covers both without a flag day. No cast — the raw object is read
43674
- * through `Reflect.get` (its static type is `unknown`).
43675
- */
43676
- function migrateLegacyTokenScope(raw) {
43677
- if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
43678
- if (Reflect.get(raw, "type") !== "device") return raw;
43679
- if (Reflect.get(raw, "selector") !== void 0) return raw;
43680
- const targets = Reflect.get(raw, "targets");
43681
- if (!Array.isArray(targets)) return raw;
43682
- return {
43683
- type: "device",
43684
- selector: {
43685
- kind: "ids",
43686
- ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
43687
- },
43688
- access: Reflect.get(raw, "access")
43689
- };
43690
- }
43691
- var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
43692
- object({
43693
- type: literal("category"),
43694
- target: CapScopeSchema,
43695
- access: array(MethodAccessSchema).min(1)
43696
- }),
43697
- object({
43698
- type: literal("capability"),
43699
- target: string(),
43700
- access: array(MethodAccessSchema).min(1)
43701
- }),
43702
- object({
43703
- type: literal("addon"),
43704
- target: string(),
43705
- access: array(MethodAccessSchema).min(1)
43706
- }),
43707
- DeviceTokenScopeSchema
43708
- ]));
43709
- object({
43710
- id: string(),
43711
- username: string(),
43712
- passwordHash: string(),
43713
- /**
43714
- * Admin bypass. When true, the middleware skips the scope-access
43715
- * check entirely. There is no other axis of privilege; the legacy
43716
- * role enum collapsed onto this boolean in v2.
43717
- */
43718
- isAdmin: boolean().default(false),
43719
- allowedProviders: AllowedProviderSchema,
43720
- allowedDevices: AllowedDevicesSchema,
43721
- /**
43722
- * Scopes granted to this user. Admins bypass; their `scopes` is
43723
- * ignored. Non-admins without scopes are locked out of every
43724
- * protected call.
43725
- */
43726
- scopes: array(TokenScopeSchema).default([]),
43727
- createdAt: number(),
43728
- updatedAt: number()
43729
- });
43730
- object({
43731
- id: string(),
43732
- label: string(),
43733
- isAdmin: boolean().default(false),
43734
- allowedProviders: AllowedProviderSchema,
43735
- allowedDevices: AllowedDevicesSchema,
43736
- tokenHash: string(),
43737
- tokenPrefix: string(),
43738
- createdAt: number(),
43739
- lastUsedAt: number().optional()
43740
- });
43741
- object({
43742
- id: string(),
43743
- userId: string(),
43744
- name: string(),
43745
- tokenHash: string(),
43746
- tokenPrefix: string(),
43747
- scopes: array(TokenScopeSchema),
43748
- expiresAt: number().nullish(),
43749
- lastUsedAt: number().nullish(),
43750
- createdAt: number()
43751
- });
43752
- /**
43753
43901
  * `oauth-integration` — a collection cap by which an addon declares
43754
43902
  * itself a linkable OAuth client of the hub's core `/oauth2/*` server.
43755
43903
  * Each provider returns a static descriptor; the core enumerates them
@@ -60694,26 +60842,6 @@ var ApiKeySummarySchema = object({
60694
60842
  createdAt: number(),
60695
60843
  lastUsedAt: number().optional()
60696
60844
  });
60697
- var ScopedTokenSummarySchema = object({
60698
- id: string(),
60699
- userId: string(),
60700
- name: string(),
60701
- tokenPrefix: string(),
60702
- scopes: array(TokenScopeSchema),
60703
- expiresAt: number().nullish(),
60704
- lastUsedAt: number().nullish(),
60705
- createdAt: number()
60706
- });
60707
- var CreateScopedTokenInputSchema = object({
60708
- userId: string(),
60709
- name: string(),
60710
- scopes: array(TokenScopeSchema),
60711
- expiresAt: number().optional()
60712
- });
60713
- var CreateScopedTokenResultSchema = object({
60714
- token: string(),
60715
- record: ScopedTokenSummarySchema
60716
- });
60717
60845
  var OauthSessionSummarySchema = object({
60718
60846
  id: string(),
60719
60847
  userId: string(),
@@ -60735,11 +60863,11 @@ var TotpStatusSchema = object({
60735
60863
  confirmedAt: number().nullable()
60736
60864
  });
60737
60865
  /**
60738
- * user-management — singleton capability for user accounts, API keys,
60739
- * and scoped tokens.
60866
+ * user-management — singleton capability for user accounts and the
60867
+ * legacy API-key rows.
60740
60868
  *
60741
60869
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
60742
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
60870
+ * — the subset check on `setUserScopes` is moot
60743
60871
  * because non-admins never reach these. If/when we open non-admin
60744
60872
  * delegation, structural caller-scope subset check goes inside the
60745
60873
  * provider.
@@ -60796,15 +60924,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
60796
60924
  kind: "mutation",
60797
60925
  auth: "admin",
60798
60926
  access: "delete"
60799
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
60800
- kind: "mutation",
60801
- auth: "admin",
60802
- access: "create"
60803
- }), method(object({ id: string() }), object({ success: literal(true) }), {
60804
- kind: "mutation",
60805
- auth: "admin",
60806
- access: "delete"
60807
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
60927
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
60808
60928
  kind: "mutation",
60809
60929
  auth: "admin",
60810
60930
  access: "create"
@@ -64960,7 +65080,7 @@ Object.freeze({
64960
65080
  capName: "llm",
64961
65081
  capScope: "system",
64962
65082
  addonId: null,
64963
- access: "view"
65083
+ access: "create"
64964
65084
  },
64965
65085
  "llm.listNodeModels": {
64966
65086
  capName: "llm",
@@ -69624,12 +69744,6 @@ Object.freeze({
69624
69744
  addonId: null,
69625
69745
  access: "create"
69626
69746
  },
69627
- "userManagement.createScopedToken": {
69628
- capName: "user-management",
69629
- capScope: "system",
69630
- addonId: null,
69631
- access: "create"
69632
- },
69633
69747
  "userManagement.createUser": {
69634
69748
  capName: "user-management",
69635
69749
  capScope: "system",
@@ -69678,12 +69792,6 @@ Object.freeze({
69678
69792
  addonId: null,
69679
69793
  access: "view"
69680
69794
  },
69681
- "userManagement.listScopedTokens": {
69682
- capName: "user-management",
69683
- capScope: "system",
69684
- addonId: null,
69685
- access: "view"
69686
- },
69687
69795
  "userManagement.listUsers": {
69688
69796
  capName: "user-management",
69689
69797
  capScope: "system",
@@ -69738,12 +69846,6 @@ Object.freeze({
69738
69846
  addonId: null,
69739
69847
  access: "delete"
69740
69848
  },
69741
- "userManagement.revokeScopedToken": {
69742
- capName: "user-management",
69743
- capScope: "system",
69744
- addonId: null,
69745
- access: "delete"
69746
- },
69747
69849
  "userManagement.setupTotp": {
69748
69850
  capName: "user-management",
69749
69851
  capScope: "system",
@@ -69774,12 +69876,6 @@ Object.freeze({
69774
69876
  addonId: null,
69775
69877
  access: "view"
69776
69878
  },
69777
- "userManagement.validateScopedToken": {
69778
- capName: "user-management",
69779
- capScope: "system",
69780
- addonId: null,
69781
- access: "view"
69782
- },
69783
69879
  "userManagement.verifyTotp": {
69784
69880
  capName: "user-management",
69785
69881
  capScope: "system",