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