@camstack/addon-training 0.1.59 → 0.1.61

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 (20) hide show
  1. package/dist/{MotionZonesSettings-D3MA168j.mjs → MotionZonesSettings-DSFRn3u7.mjs} +2 -2
  2. package/dist/{PrivacyMaskSettings-DlILfRb9.mjs → PrivacyMaskSettings-CJUs69K5.mjs} +2 -2
  3. package/dist/{SceneMonitorEditor-DgOpS2v_.mjs → SceneMonitorEditor-BjEBJhp2.mjs} +1 -1
  4. package/dist/_stub.js +14 -14
  5. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-BbkzYirO.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-B9bxvWW7.mjs} +4 -4
  6. package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BRYzagHC.mjs +26 -0
  7. package/dist/{dist-DM9y4CJe.mjs → dist-BrdzZGWE.mjs} +390 -294
  8. package/dist/{dist-DfNFNGnO.js → dist-Bw72X0Lw.js} +390 -294
  9. package/dist/{hostInit-SLlPYdLV.mjs → hostInit-Bi_brUZe.mjs} +3 -3
  10. package/dist/index.js +1 -1
  11. package/dist/orchestrator/training.addon.js +1 -1
  12. package/dist/orchestrator/training.addon.mjs +1 -1
  13. package/dist/{player-overlays-pM6iC4GI.mjs → player-overlays-DfEn3UiJ.mjs} +1 -1
  14. package/dist/providers/modal/training-modal.addon.js +1 -1
  15. package/dist/providers/modal/training-modal.addon.mjs +1 -1
  16. package/dist/remoteEntry.js +1 -1
  17. package/dist/{responsive-BAAHnmTT.mjs → responsive-KcnxmMOF.mjs} +1 -1
  18. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-D81A7IJp.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-764ClezD.mjs} +1 -1
  19. package/package.json +1 -1
  20. package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DlLXF7aF.mjs +0 -26
@@ -5547,7 +5547,7 @@ var ZodIssueCode = {
5547
5547
  var ZodFirstPartyTypeKind;
5548
5548
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5549
5549
  //#endregion
5550
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5550
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5551
5551
  /**
5552
5552
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5553
5553
  * window to float samples (D455).
@@ -7929,6 +7929,12 @@ function normalizeAddonInitResult(result) {
7929
7929
  if (Array.isArray(result)) return { providers: result };
7930
7930
  return result;
7931
7931
  }
7932
+ /**
7933
+ * The share-view scope kinds a share-link token can carry. The hub mints
7934
+ * and validates them (`ShareViewGrantSchema` builds its
7935
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7936
+ */
7937
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7932
7938
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
7933
7939
  var PeerBytesTicketSchema = object({
7934
7940
  /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
@@ -12790,6 +12796,280 @@ var ConvertResultSchema = object({
12790
12796
  files: array(string()).readonly()
12791
12797
  })).readonly()
12792
12798
  });
12799
+ /**
12800
+ * Zod schemas for persisted record types.
12801
+ *
12802
+ * These schemas serve as the single source of truth for types that are
12803
+ * stored in the settings-store backend and retrieved via tRPC. They
12804
+ * replace the manual TypeScript interfaces with schema-derived types,
12805
+ * enabling runtime validation when reading from the backend.
12806
+ *
12807
+ * Convention: each schema is named `<Type>Schema`, the inferred TS type
12808
+ * keeps the original name for backward compatibility.
12809
+ */
12810
+ /**
12811
+ * Auth model (v2 — 2026-05-12 caps-only):
12812
+ *
12813
+ * Two principals:
12814
+ * - `isAdmin: true` — full bypass. Admin scope set is ignored.
12815
+ * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
12816
+ *
12817
+ * No role enum. There used to be `viewer / agent / scoped` and earlier
12818
+ * `super_admin` — collapsed onto the single boolean because every
12819
+ * non-admin caller is governed by the same scope-check rules; the
12820
+ * distinction was only ever used to route role-specific procedures
12821
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12822
+ * with `isAdmin: false` + an explicit scope list.
12823
+ */
12824
+ /** Per-method access flavour. Materialised on every cap method via codegen. */
12825
+ var MethodAccessSchema = _enum([
12826
+ "view",
12827
+ "create",
12828
+ "delete"
12829
+ ]);
12830
+ /**
12831
+ * A single scope grant. Three forms — checked in matcher with OR
12832
+ * semantics; the first match decides whether the call passes:
12833
+ *
12834
+ * - `category` — broadest. `target: 'device' | 'system'` selects every
12835
+ * cap with the matching `scope` declaration. New caps inherit grants
12836
+ * automatically — adding a device cap to the codebase makes it
12837
+ * reachable to every user with `category:device [...]` without a
12838
+ * re-grant. Use this for "family viewer" / "operator" tiers.
12839
+ *
12840
+ * - `addon` — every cap that ships inside a given addon id. Niche;
12841
+ * useful when an integration needs to interact with one specific
12842
+ * addon's surface regardless of how many caps it exports.
12843
+ *
12844
+ * - `capability` — the most precise form. Single cap name. Use for
12845
+ * integration tokens where you want to grant `addons.installPackage`
12846
+ * and nothing else.
12847
+ *
12848
+ * `access` is REQUIRED with min 1 element. `admin` bypass is the
12849
+ * "give me everything" escape; there is no wildcard scope.
12850
+ */
12851
+ var AllowedProviderSchema = union([literal("*"), array(string())]);
12852
+ var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
12853
+ var CapScopeSchema = _enum(["device", "system"]);
12854
+ /**
12855
+ * DeviceSelector (scope model v3 — 2026-08-12).
12856
+ *
12857
+ * A `device` grant no longer carries a frozen list of deviceIds. It carries
12858
+ * a SELECTOR the matcher resolves against the live fleet, so the grant can be
12859
+ * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
12860
+ * AFTER the grant was minted — no re-grant, no re-login.
12861
+ *
12862
+ * - `all` — every device in the deployment. The broad viewer/operator
12863
+ * lever without a `category` grant (a `category` grant also covers device
12864
+ * caps that carry no deviceId; `all` is specifically the device set).
12865
+ * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
12866
+ * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
12867
+ * is NOT covered until the grant is edited.
12868
+ * - `types` — every device of a `DeviceType` (e.g. every `camera`).
12869
+ * DYNAMIC. A device that changes type, or a new device of the type,
12870
+ * re-resolves on the next request.
12871
+ * - `locations` — every device whose operator-assigned `location` label is
12872
+ * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
12873
+ * null/unset location matches NO `locations` selector.
12874
+ */
12875
+ var DeviceSelectorSchema = discriminatedUnion("kind", [
12876
+ object({ kind: literal("all") }),
12877
+ object({
12878
+ kind: literal("ids"),
12879
+ ids: array(number().int()).min(1)
12880
+ }),
12881
+ object({
12882
+ kind: literal("types"),
12883
+ types: array(_enum(DeviceType)).min(1)
12884
+ }),
12885
+ object({
12886
+ kind: literal("locations"),
12887
+ locations: array(string().min(1)).min(1)
12888
+ })
12889
+ ]);
12890
+ var DeviceTokenScopeSchema = object({
12891
+ type: literal("device"),
12892
+ /** The device SET this grant covers — resolved against the live fleet. */
12893
+ selector: DeviceSelectorSchema,
12894
+ access: array(MethodAccessSchema).min(1),
12895
+ /**
12896
+ * Whether a grant on a PARENT device transparently covers its accessory
12897
+ * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
12898
+ * Direction is parent → children ONLY.
12899
+ *
12900
+ * Absent → the matcher DERIVES it from the access flavour: `view`
12901
+ * inherits (a camera viewer sees the camera's accessories), `create` /
12902
+ * `delete` do NOT (actuating/removing a child is an explicit act the
12903
+ * operator must grant on the child, not inherit from the parent). Set it
12904
+ * explicitly to override that default per grant.
12905
+ */
12906
+ includeLinked: boolean().optional()
12907
+ });
12908
+ /**
12909
+ * v2 → v3 lazy migration. A pre-v3 `device` grant carried
12910
+ * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
12911
+ * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
12912
+ * EVERY parse path — stored records AND the JWT-carried scope arrays
12913
+ * normalised at the request boundary ({@link normalizeTokenScopes} in
12914
+ * `device-selector.ts`). Chosen over a one-time DB migration because a
12915
+ * migration cannot reach a JWT already in a client's hands; parse-time
12916
+ * migration covers both without a flag day. No cast — the raw object is read
12917
+ * through `Reflect.get` (its static type is `unknown`).
12918
+ */
12919
+ function migrateLegacyTokenScope(raw) {
12920
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
12921
+ if (Reflect.get(raw, "type") !== "device") return raw;
12922
+ if (Reflect.get(raw, "selector") !== void 0) return raw;
12923
+ const targets = Reflect.get(raw, "targets");
12924
+ if (!Array.isArray(targets)) return raw;
12925
+ return {
12926
+ type: "device",
12927
+ selector: {
12928
+ kind: "ids",
12929
+ ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
12930
+ },
12931
+ access: Reflect.get(raw, "access")
12932
+ };
12933
+ }
12934
+ var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
12935
+ object({
12936
+ type: literal("category"),
12937
+ target: CapScopeSchema,
12938
+ access: array(MethodAccessSchema).min(1)
12939
+ }),
12940
+ object({
12941
+ type: literal("capability"),
12942
+ target: string(),
12943
+ access: array(MethodAccessSchema).min(1)
12944
+ }),
12945
+ object({
12946
+ type: literal("addon"),
12947
+ target: string(),
12948
+ access: array(MethodAccessSchema).min(1)
12949
+ }),
12950
+ DeviceTokenScopeSchema
12951
+ ]));
12952
+ object({
12953
+ id: string(),
12954
+ username: string(),
12955
+ passwordHash: string(),
12956
+ /**
12957
+ * Admin bypass. When true, the middleware skips the scope-access
12958
+ * check entirely. There is no other axis of privilege; the legacy
12959
+ * role enum collapsed onto this boolean in v2.
12960
+ */
12961
+ isAdmin: boolean().default(false),
12962
+ allowedProviders: AllowedProviderSchema,
12963
+ allowedDevices: AllowedDevicesSchema,
12964
+ /**
12965
+ * Scopes granted to this user. Admins bypass; their `scopes` is
12966
+ * ignored. Non-admins without scopes are locked out of every
12967
+ * protected call.
12968
+ */
12969
+ scopes: array(TokenScopeSchema).default([]),
12970
+ createdAt: number(),
12971
+ updatedAt: number()
12972
+ });
12973
+ object({
12974
+ id: string(),
12975
+ label: string(),
12976
+ isAdmin: boolean().default(false),
12977
+ allowedProviders: AllowedProviderSchema,
12978
+ allowedDevices: AllowedDevicesSchema,
12979
+ tokenHash: string(),
12980
+ tokenPrefix: string(),
12981
+ createdAt: number(),
12982
+ lastUsedAt: number().optional()
12983
+ });
12984
+ object({
12985
+ id: string(),
12986
+ userId: string(),
12987
+ name: string(),
12988
+ tokenHash: string(),
12989
+ tokenPrefix: string(),
12990
+ scopes: array(TokenScopeSchema),
12991
+ expiresAt: number().nullish(),
12992
+ lastUsedAt: number().nullish(),
12993
+ createdAt: number()
12994
+ });
12995
+ /** What a share-view grant lets its holder see. */
12996
+ var ShareViewGrantSchema = object({
12997
+ kind: _enum(SHARE_VIEW_KINDS),
12998
+ deviceIds: array(number().int().nonnegative()).min(1).max(64),
12999
+ /** Talk-back, opt-in at mint time; absent means off. */
13000
+ talk: boolean().optional()
13001
+ });
13002
+ var ShareViewScopeSchema = object({
13003
+ type: literal("share-view"),
13004
+ grant: ShareViewGrantSchema
13005
+ });
13006
+ var AddonRoutesScopeSchema = object({
13007
+ type: literal("addon-routes"),
13008
+ access: array(MethodAccessSchema).min(1)
13009
+ });
13010
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13011
+ var CredentialScopeSchema = union([
13012
+ literal("*"),
13013
+ ShareViewScopeSchema,
13014
+ AddonRoutesScopeSchema,
13015
+ PreferencesSelfScopeSchema,
13016
+ TokenScopeSchema
13017
+ ]);
13018
+ object({
13019
+ kind: literal("credential"),
13020
+ sub: string().min(1),
13021
+ jti: string().min(16),
13022
+ scopes: array(CredentialScopeSchema).min(1)
13023
+ });
13024
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13025
+ /** A namespace's value: a JSON object, opaque to the hub. */
13026
+ var PreferenceValueSchema = record(string(), unknown());
13027
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
13028
+ /** A stored row, as the owner reads it. */
13029
+ var PreferenceRowSchema = object({
13030
+ namespace: PreferenceNamespaceSchema,
13031
+ value: PreferenceValueSchema,
13032
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13033
+ revision: number().int().positive(),
13034
+ updatedAt: number().int(),
13035
+ /** The client id the last writer sent; `null` when it sent none. */
13036
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13037
+ });
13038
+ object({
13039
+ /** Absent: every namespace the caller holds. */
13040
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13041
+ object({ rows: array(PreferenceRowSchema) });
13042
+ object({
13043
+ namespace: PreferenceNamespaceSchema,
13044
+ value: PreferenceValueSchema,
13045
+ /**
13046
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13047
+ * namespace must not exist yet. Any other value that is not the current
13048
+ * revision answers `conflict` and writes nothing.
13049
+ */
13050
+ baseRevision: number().int().nonnegative().optional(),
13051
+ deviceId: PreferenceDeviceIdSchema.optional()
13052
+ });
13053
+ discriminatedUnion("status", [object({
13054
+ status: literal("saved"),
13055
+ row: PreferenceRowSchema
13056
+ }), object({
13057
+ status: literal("conflict"),
13058
+ current: PreferenceRowSchema.nullable()
13059
+ })]);
13060
+ object({ namespace: PreferenceNamespaceSchema });
13061
+ object({
13062
+ /** `false` when the namespace did not exist. */
13063
+ deleted: boolean() });
13064
+ object({
13065
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13066
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13067
+ object({
13068
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13069
+ rows: array(PreferenceRowSchema),
13070
+ /** Namespaces the client listed that no longer exist. */
13071
+ deleted: array(PreferenceNamespaceSchema)
13072
+ });
12793
13073
  _enum(["new-session", "step-up"]);
12794
13074
  /** The languages the hub's app landing pages are written in (D858). */
12795
13075
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -39685,38 +39965,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
39685
39965
  auth: "admin",
39686
39966
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
39687
39967
  });
39968
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
39969
+ /** What a model (or, by default, every model of a kind) can do. */
39970
+ var LlmModelFeaturesSchema = object({
39971
+ vision: boolean(),
39972
+ tools: boolean(),
39973
+ streaming: boolean()
39974
+ });
39975
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
39976
+ var LlmModelInfoSchema = object({
39977
+ id: string(),
39978
+ label: string().optional(),
39979
+ contextLength: number().int().positive().optional(),
39980
+ features: LlmModelFeaturesSchema.partial().optional()
39981
+ });
39688
39982
  /**
39689
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
39690
- * methods concat-fan across providers; single-row methods route to ONE
39691
- * provider by the `addonId` in the call input (the notification-output
39692
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
39693
- * (hub-placed); the cap stays open for future providers.
39694
- *
39695
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
39696
- * `apiKey` is a password field — providers REDACT it on read and merge on
39697
- * write; a stored key NEVER round-trips to a client.
39983
+ * The provider-specific part of a profile, validated by the provider that owns
39984
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
39985
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
39986
+ * keychain, never in the row, and reads back as the redaction marker.
39698
39987
  */
39699
- var LlmProfileKindSchema = _enum([
39700
- "openai-compatible",
39701
- "openai",
39702
- "anthropic",
39703
- "google",
39704
- "managed-local",
39705
- "apple-foundation"
39706
- ]);
39988
+ var LlmProviderConfigSchema = record(string(), unknown());
39707
39989
  var LlmProfileSchema = object({
39708
39990
  id: string(),
39709
39991
  name: string(),
39992
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
39710
39993
  kind: LlmProfileKindSchema,
39711
39994
  /** Stamped by the provider — keeps the fanned catalog routable. */
39712
39995
  addonId: string(),
39713
39996
  enabled: boolean(),
39714
39997
  /** Vendor model id, or the managed runtime's loaded model. */
39715
39998
  model: string(),
39716
- /** Required for openai-compatible; override for cloud kinds. */
39717
- baseUrl: string().optional(),
39718
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
39719
- apiKey: string().optional(),
39720
39999
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
39721
40000
  * degraded to text — that shipped once and produced a confident answer to a
39722
40001
  * question about a picture nobody sent. */
@@ -39724,15 +40003,11 @@ var LlmProfileSchema = object({
39724
40003
  temperature: number().min(0).max(2).optional(),
39725
40004
  /** Nucleus sampling. Every wire we speak has it. */
39726
40005
  topP: number().min(0).max(1).optional(),
39727
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
39728
- * wire does, and the client drops it there (measured: the request body gets
39729
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
39730
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40006
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40007
+ * field in its editor only when its descriptor lists it in `profileFields`. */
39731
40008
  topK: number().int().positive().optional(),
39732
40009
  maxTokens: number().int().positive().optional(),
39733
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
39734
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
39735
- * the model with, so it is the one field that changes a PROCESS. */
40010
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
39736
40011
  contextLength: number().int().positive().optional(),
39737
40012
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
39738
40013
  * two system prompts fighting is worse than either alone). */
@@ -39758,16 +40033,37 @@ var LlmProfileSchema = object({
39758
40033
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
39759
40034
  * `true` here buys the wiring, not behaviour, until tools are registered. */
39760
40035
  toolsEnabled: boolean().default(false),
39761
- extraHeaders: record(string(), string()).optional(),
39762
- /** kind === 'managed-local' only (spec §4). */
39763
- runtime: ManagedRuntimeConfigSchema.optional(),
39764
- /**
39765
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
39766
- * to configure (no key, no URL, no download; `model` is `apple-system`).
39767
- * `supportsVision` on such a row is stamped by the provider from the node's
39768
- * reported `imageInput`, never taken from the operator (D62).
39769
- */
39770
- appleFoundation: object({ nodeId: string() }).optional()
40036
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40037
+ providerConfig: LlmProviderConfigSchema.default({})
40038
+ });
40039
+ /**
40040
+ * The common profile fields a kind's editor offers. The editor owns how each
40041
+ * one is drawn; the provider says which of them mean something on its wire.
40042
+ */
40043
+ var LlmProfileFieldSchema = _enum([
40044
+ "temperature",
40045
+ "topP",
40046
+ "topK",
40047
+ "maxTokens",
40048
+ "contextLength",
40049
+ "systemPrompt",
40050
+ "timeoutMs",
40051
+ "connectTimeoutMs",
40052
+ "firstTokenTimeoutMs",
40053
+ "idleTimeoutMs",
40054
+ "retry",
40055
+ "toolsEnabled"
40056
+ ]);
40057
+ /**
40058
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40059
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40060
+ * picker: that widget owns the model choice.
40061
+ */
40062
+ var LlmProviderWidgetSchema = object({
40063
+ id: string(),
40064
+ placement: _enum(["connection", "model"]),
40065
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40066
+ requires: array(string()).optional()
39771
40067
  });
39772
40068
  /** ConfigUISchema tree passed through untyped on the wire (the
39773
40069
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -39776,11 +40072,56 @@ var ConfigSchemaPassthrough$3 = unknown();
39776
40072
  var LlmProfileKindDescriptorSchema = object({
39777
40073
  kind: LlmProfileKindSchema,
39778
40074
  label: string(),
40075
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
39779
40076
  icon: string(),
39780
40077
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
39781
40078
  addonId: string(),
39782
- configSchema: ConfigSchemaPassthrough$3
40079
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40080
+ connectionSchema: ConfigSchemaPassthrough$3,
40081
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40082
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40083
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40084
+ features: LlmModelFeaturesSchema,
40085
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40086
+ visionEditable: boolean(),
40087
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40088
+ modelCatalog: _enum([
40089
+ "fetch",
40090
+ "static",
40091
+ "none"
40092
+ ]),
40093
+ staticModels: array(LlmModelInfoSchema).optional(),
40094
+ /** The common fields that mean something on this kind's wire. */
40095
+ profileFields: array(LlmProfileFieldSchema),
40096
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40097
+ });
40098
+ /**
40099
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40100
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40101
+ * untouched (absent or the redaction marker) is resolved server-side from the
40102
+ * stored profile — the browser never receives it.
40103
+ */
40104
+ var LlmListModelsInputSchema = object({
40105
+ addonId: string(),
40106
+ kind: LlmProfileKindSchema,
40107
+ profileId: string().optional(),
40108
+ connection: LlmProviderConfigSchema.optional()
39783
40109
  });
40110
+ var LlmListModelsErrorCodeSchema = _enum([
40111
+ "auth",
40112
+ "network",
40113
+ "unsupported",
40114
+ "invalid"
40115
+ ]);
40116
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40117
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40118
+ ok: literal(true),
40119
+ models: array(LlmModelInfoSchema)
40120
+ }), object({
40121
+ ok: literal(false),
40122
+ code: LlmListModelsErrorCodeSchema,
40123
+ message: string()
40124
+ })]);
39784
40125
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
39785
40126
  var LlmDefaultSchema = object({
39786
40127
  selector: LlmDefaultSelectorSchema,
@@ -39880,7 +40221,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39880
40221
  kind: "mutation",
39881
40222
  auth: "admin",
39882
40223
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
39883
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40224
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40225
+ kind: "mutation",
40226
+ auth: "admin"
40227
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
39884
40228
  selector: LlmDefaultSelectorSchema,
39885
40229
  profileId: string().nullable()
39886
40230
  }), _void(), {
@@ -43944,202 +44288,6 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
43944
44288
  auth: "admin"
43945
44289
  }), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
43946
44290
  /**
43947
- * Zod schemas for persisted record types.
43948
- *
43949
- * These schemas serve as the single source of truth for types that are
43950
- * stored in the settings-store backend and retrieved via tRPC. They
43951
- * replace the manual TypeScript interfaces with schema-derived types,
43952
- * enabling runtime validation when reading from the backend.
43953
- *
43954
- * Convention: each schema is named `<Type>Schema`, the inferred TS type
43955
- * keeps the original name for backward compatibility.
43956
- */
43957
- /**
43958
- * Auth model (v2 — 2026-05-12 caps-only):
43959
- *
43960
- * Two principals:
43961
- * - `isAdmin: true` — full bypass. Admin scope set is ignored.
43962
- * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
43963
- *
43964
- * No role enum. There used to be `viewer / agent / scoped` and earlier
43965
- * `super_admin` — collapsed onto the single boolean because every
43966
- * non-admin caller is governed by the same scope-check rules; the
43967
- * distinction was only ever used to route role-specific procedures
43968
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
43969
- * with `isAdmin: false` + an explicit scope list.
43970
- */
43971
- /** Per-method access flavour. Materialised on every cap method via codegen. */
43972
- var MethodAccessSchema = _enum([
43973
- "view",
43974
- "create",
43975
- "delete"
43976
- ]);
43977
- /**
43978
- * A single scope grant. Three forms — checked in matcher with OR
43979
- * semantics; the first match decides whether the call passes:
43980
- *
43981
- * - `category` — broadest. `target: 'device' | 'system'` selects every
43982
- * cap with the matching `scope` declaration. New caps inherit grants
43983
- * automatically — adding a device cap to the codebase makes it
43984
- * reachable to every user with `category:device [...]` without a
43985
- * re-grant. Use this for "family viewer" / "operator" tiers.
43986
- *
43987
- * - `addon` — every cap that ships inside a given addon id. Niche;
43988
- * useful when an integration needs to interact with one specific
43989
- * addon's surface regardless of how many caps it exports.
43990
- *
43991
- * - `capability` — the most precise form. Single cap name. Use for
43992
- * integration tokens where you want to grant `addons.installPackage`
43993
- * and nothing else.
43994
- *
43995
- * `access` is REQUIRED with min 1 element. `admin` bypass is the
43996
- * "give me everything" escape; there is no wildcard scope.
43997
- */
43998
- var AllowedProviderSchema = union([literal("*"), array(string())]);
43999
- var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
44000
- var CapScopeSchema = _enum(["device", "system"]);
44001
- /**
44002
- * DeviceSelector (scope model v3 — 2026-08-12).
44003
- *
44004
- * A `device` grant no longer carries a frozen list of deviceIds. It carries
44005
- * a SELECTOR the matcher resolves against the live fleet, so the grant can be
44006
- * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
44007
- * AFTER the grant was minted — no re-grant, no re-login.
44008
- *
44009
- * - `all` — every device in the deployment. The broad viewer/operator
44010
- * lever without a `category` grant (a `category` grant also covers device
44011
- * caps that carry no deviceId; `all` is specifically the device set).
44012
- * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
44013
- * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
44014
- * is NOT covered until the grant is edited.
44015
- * - `types` — every device of a `DeviceType` (e.g. every `camera`).
44016
- * DYNAMIC. A device that changes type, or a new device of the type,
44017
- * re-resolves on the next request.
44018
- * - `locations` — every device whose operator-assigned `location` label is
44019
- * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
44020
- * null/unset location matches NO `locations` selector.
44021
- */
44022
- var DeviceSelectorSchema = discriminatedUnion("kind", [
44023
- object({ kind: literal("all") }),
44024
- object({
44025
- kind: literal("ids"),
44026
- ids: array(number().int()).min(1)
44027
- }),
44028
- object({
44029
- kind: literal("types"),
44030
- types: array(_enum(DeviceType)).min(1)
44031
- }),
44032
- object({
44033
- kind: literal("locations"),
44034
- locations: array(string().min(1)).min(1)
44035
- })
44036
- ]);
44037
- var DeviceTokenScopeSchema = object({
44038
- type: literal("device"),
44039
- /** The device SET this grant covers — resolved against the live fleet. */
44040
- selector: DeviceSelectorSchema,
44041
- access: array(MethodAccessSchema).min(1),
44042
- /**
44043
- * Whether a grant on a PARENT device transparently covers its accessory
44044
- * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
44045
- * Direction is parent → children ONLY.
44046
- *
44047
- * Absent → the matcher DERIVES it from the access flavour: `view`
44048
- * inherits (a camera viewer sees the camera's accessories), `create` /
44049
- * `delete` do NOT (actuating/removing a child is an explicit act the
44050
- * operator must grant on the child, not inherit from the parent). Set it
44051
- * explicitly to override that default per grant.
44052
- */
44053
- includeLinked: boolean().optional()
44054
- });
44055
- /**
44056
- * v2 → v3 lazy migration. A pre-v3 `device` grant carried
44057
- * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
44058
- * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
44059
- * EVERY parse path — stored records AND the JWT-carried scope arrays
44060
- * normalised at the request boundary ({@link normalizeTokenScopes} in
44061
- * `device-selector.ts`). Chosen over a one-time DB migration because a
44062
- * migration cannot reach a JWT already in a client's hands; parse-time
44063
- * migration covers both without a flag day. No cast — the raw object is read
44064
- * through `Reflect.get` (its static type is `unknown`).
44065
- */
44066
- function migrateLegacyTokenScope(raw) {
44067
- if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
44068
- if (Reflect.get(raw, "type") !== "device") return raw;
44069
- if (Reflect.get(raw, "selector") !== void 0) return raw;
44070
- const targets = Reflect.get(raw, "targets");
44071
- if (!Array.isArray(targets)) return raw;
44072
- return {
44073
- type: "device",
44074
- selector: {
44075
- kind: "ids",
44076
- ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
44077
- },
44078
- access: Reflect.get(raw, "access")
44079
- };
44080
- }
44081
- var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
44082
- object({
44083
- type: literal("category"),
44084
- target: CapScopeSchema,
44085
- access: array(MethodAccessSchema).min(1)
44086
- }),
44087
- object({
44088
- type: literal("capability"),
44089
- target: string(),
44090
- access: array(MethodAccessSchema).min(1)
44091
- }),
44092
- object({
44093
- type: literal("addon"),
44094
- target: string(),
44095
- access: array(MethodAccessSchema).min(1)
44096
- }),
44097
- DeviceTokenScopeSchema
44098
- ]));
44099
- object({
44100
- id: string(),
44101
- username: string(),
44102
- passwordHash: string(),
44103
- /**
44104
- * Admin bypass. When true, the middleware skips the scope-access
44105
- * check entirely. There is no other axis of privilege; the legacy
44106
- * role enum collapsed onto this boolean in v2.
44107
- */
44108
- isAdmin: boolean().default(false),
44109
- allowedProviders: AllowedProviderSchema,
44110
- allowedDevices: AllowedDevicesSchema,
44111
- /**
44112
- * Scopes granted to this user. Admins bypass; their `scopes` is
44113
- * ignored. Non-admins without scopes are locked out of every
44114
- * protected call.
44115
- */
44116
- scopes: array(TokenScopeSchema).default([]),
44117
- createdAt: number(),
44118
- updatedAt: number()
44119
- });
44120
- object({
44121
- id: string(),
44122
- label: string(),
44123
- isAdmin: boolean().default(false),
44124
- allowedProviders: AllowedProviderSchema,
44125
- allowedDevices: AllowedDevicesSchema,
44126
- tokenHash: string(),
44127
- tokenPrefix: string(),
44128
- createdAt: number(),
44129
- lastUsedAt: number().optional()
44130
- });
44131
- object({
44132
- id: string(),
44133
- userId: string(),
44134
- name: string(),
44135
- tokenHash: string(),
44136
- tokenPrefix: string(),
44137
- scopes: array(TokenScopeSchema),
44138
- expiresAt: number().nullish(),
44139
- lastUsedAt: number().nullish(),
44140
- createdAt: number()
44141
- });
44142
- /**
44143
44291
  * `oauth-integration` — a collection cap by which an addon declares
44144
44292
  * itself a linkable OAuth client of the hub's core `/oauth2/*` server.
44145
44293
  * Each provider returns a static descriptor; the core enumerates them
@@ -61071,26 +61219,6 @@ var ApiKeySummarySchema = object({
61071
61219
  createdAt: number(),
61072
61220
  lastUsedAt: number().optional()
61073
61221
  });
61074
- var ScopedTokenSummarySchema = object({
61075
- id: string(),
61076
- userId: string(),
61077
- name: string(),
61078
- tokenPrefix: string(),
61079
- scopes: array(TokenScopeSchema),
61080
- expiresAt: number().nullish(),
61081
- lastUsedAt: number().nullish(),
61082
- createdAt: number()
61083
- });
61084
- var CreateScopedTokenInputSchema = object({
61085
- userId: string(),
61086
- name: string(),
61087
- scopes: array(TokenScopeSchema),
61088
- expiresAt: number().optional()
61089
- });
61090
- var CreateScopedTokenResultSchema = object({
61091
- token: string(),
61092
- record: ScopedTokenSummarySchema
61093
- });
61094
61222
  var OauthSessionSummarySchema = object({
61095
61223
  id: string(),
61096
61224
  userId: string(),
@@ -61112,11 +61240,11 @@ var TotpStatusSchema = object({
61112
61240
  confirmedAt: number().nullable()
61113
61241
  });
61114
61242
  /**
61115
- * user-management — singleton capability for user accounts, API keys,
61116
- * and scoped tokens.
61243
+ * user-management — singleton capability for user accounts and the
61244
+ * legacy API-key rows.
61117
61245
  *
61118
61246
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
61119
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
61247
+ * — the subset check on `setUserScopes` is moot
61120
61248
  * because non-admins never reach these. If/when we open non-admin
61121
61249
  * delegation, structural caller-scope subset check goes inside the
61122
61250
  * provider.
@@ -61173,15 +61301,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
61173
61301
  kind: "mutation",
61174
61302
  auth: "admin",
61175
61303
  access: "delete"
61176
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
61177
- kind: "mutation",
61178
- auth: "admin",
61179
- access: "create"
61180
- }), method(object({ id: string() }), object({ success: literal(true) }), {
61181
- kind: "mutation",
61182
- auth: "admin",
61183
- access: "delete"
61184
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
61304
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
61185
61305
  kind: "mutation",
61186
61306
  auth: "admin",
61187
61307
  access: "create"
@@ -65437,7 +65557,7 @@ Object.freeze({
65437
65557
  capName: "llm",
65438
65558
  capScope: "system",
65439
65559
  addonId: null,
65440
- access: "view"
65560
+ access: "create"
65441
65561
  },
65442
65562
  "llm.listNodeModels": {
65443
65563
  capName: "llm",
@@ -70101,12 +70221,6 @@ Object.freeze({
70101
70221
  addonId: null,
70102
70222
  access: "create"
70103
70223
  },
70104
- "userManagement.createScopedToken": {
70105
- capName: "user-management",
70106
- capScope: "system",
70107
- addonId: null,
70108
- access: "create"
70109
- },
70110
70224
  "userManagement.createUser": {
70111
70225
  capName: "user-management",
70112
70226
  capScope: "system",
@@ -70155,12 +70269,6 @@ Object.freeze({
70155
70269
  addonId: null,
70156
70270
  access: "view"
70157
70271
  },
70158
- "userManagement.listScopedTokens": {
70159
- capName: "user-management",
70160
- capScope: "system",
70161
- addonId: null,
70162
- access: "view"
70163
- },
70164
70272
  "userManagement.listUsers": {
70165
70273
  capName: "user-management",
70166
70274
  capScope: "system",
@@ -70215,12 +70323,6 @@ Object.freeze({
70215
70323
  addonId: null,
70216
70324
  access: "delete"
70217
70325
  },
70218
- "userManagement.revokeScopedToken": {
70219
- capName: "user-management",
70220
- capScope: "system",
70221
- addonId: null,
70222
- access: "delete"
70223
- },
70224
70326
  "userManagement.setupTotp": {
70225
70327
  capName: "user-management",
70226
70328
  capScope: "system",
@@ -70251,12 +70353,6 @@ Object.freeze({
70251
70353
  addonId: null,
70252
70354
  access: "view"
70253
70355
  },
70254
- "userManagement.validateScopedToken": {
70255
- capName: "user-management",
70256
- capScope: "system",
70257
- addonId: null,
70258
- access: "view"
70259
- },
70260
70356
  "userManagement.verifyTotp": {
70261
70357
  capName: "user-management",
70262
70358
  capScope: "system",