@camstack/addon-pipeline 1.2.603 → 1.2.605

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 (35) hide show
  1. package/dist/audio-analyzer/index.js +3 -3
  2. package/dist/audio-analyzer/index.mjs +3 -3
  3. package/dist/{custom-model-catalog-BAnOZBOf.js → custom-model-catalog-CEwbRUr7.js} +2 -2
  4. package/dist/{custom-model-catalog-Dv09Pvq_.mjs → custom-model-catalog-G0HvRpSn.mjs} +2 -2
  5. package/dist/detection-pipeline/index.js +4 -4
  6. package/dist/detection-pipeline/index.mjs +4 -4
  7. package/dist/{dist-DvXRw_dM.js → dist-7LlEAfx1.js} +390 -294
  8. package/dist/{dist-CsCflIM1.mjs → dist-C_81FQSz.mjs} +390 -294
  9. package/dist/{model-catalogs-aTwF92Re.mjs → model-catalogs-CWnvAqRN.mjs} +1 -1
  10. package/dist/{model-catalogs-B95QZeYt.js → model-catalogs-PZwyhy-6.js} +1 -1
  11. package/dist/motion-wasm/index.js +1 -1
  12. package/dist/motion-wasm/index.mjs +1 -1
  13. package/dist/{node-DxAtLKEn.js → node-B8vaXwjz.js} +1 -1
  14. package/dist/{node-DAp5MmRJ.mjs → node-Du8pLNm0.mjs} +1 -1
  15. package/dist/pipeline-runner/index.js +3 -3
  16. package/dist/pipeline-runner/index.mjs +3 -3
  17. package/dist/{process-memory-CmWDOMmE.js → process-memory-BekNMmIb.js} +1 -1
  18. package/dist/{process-memory-1_2L6U3Q.mjs → process-memory-BpmFzpGK.mjs} +1 -1
  19. package/dist/recorder/index.js +4 -4
  20. package/dist/recorder/index.mjs +4 -4
  21. package/dist/{segment-demux-js-HagdockZ.js → segment-demux-js-CAVgSBfN.js} +1 -1
  22. package/dist/{segment-demux-js-DQo9qSHm.mjs → segment-demux-js-DgTOmmSE.mjs} +1 -1
  23. package/dist/stream-broker/_stub.js +2 -2
  24. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-DoBB8xYv.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-Bcv9Iadt.mjs} +3 -3
  25. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-UQheneKm.mjs +26 -0
  26. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CSyOD5De.mjs +26 -0
  27. package/dist/stream-broker/demux-worker-child.js +1 -1
  28. package/dist/stream-broker/demux-worker-child.mjs +1 -1
  29. package/dist/stream-broker/{hostInit-DaZYQhX4.mjs → hostInit-BPTm2pJj.mjs} +3 -3
  30. package/dist/stream-broker/index.js +3 -3
  31. package/dist/stream-broker/index.mjs +3 -3
  32. package/dist/stream-broker/remoteEntry.js +1 -1
  33. package/package.json +1 -1
  34. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DkA9R3eo.mjs +0 -26
  35. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-RrTYeVaZ.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).
@@ -7977,6 +7977,12 @@ function normalizeAddonInitResult(result) {
7977
7977
  if (Array.isArray(result)) return { providers: result };
7978
7978
  return result;
7979
7979
  }
7980
+ /**
7981
+ * The share-view scope kinds a share-link token can carry. The hub mints
7982
+ * and validates them (`ShareViewGrantSchema` builds its
7983
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7984
+ */
7985
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7980
7986
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
7981
7987
  var PeerBytesTicketSchema = object({
7982
7988
  /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
@@ -15278,6 +15284,280 @@ var ConvertResultSchema = object({
15278
15284
  files: array(string()).readonly()
15279
15285
  })).readonly()
15280
15286
  });
15287
+ /**
15288
+ * Zod schemas for persisted record types.
15289
+ *
15290
+ * These schemas serve as the single source of truth for types that are
15291
+ * stored in the settings-store backend and retrieved via tRPC. They
15292
+ * replace the manual TypeScript interfaces with schema-derived types,
15293
+ * enabling runtime validation when reading from the backend.
15294
+ *
15295
+ * Convention: each schema is named `<Type>Schema`, the inferred TS type
15296
+ * keeps the original name for backward compatibility.
15297
+ */
15298
+ /**
15299
+ * Auth model (v2 — 2026-05-12 caps-only):
15300
+ *
15301
+ * Two principals:
15302
+ * - `isAdmin: true` — full bypass. Admin scope set is ignored.
15303
+ * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
15304
+ *
15305
+ * No role enum. There used to be `viewer / agent / scoped` and earlier
15306
+ * `super_admin` — collapsed onto the single boolean because every
15307
+ * non-admin caller is governed by the same scope-check rules; the
15308
+ * distinction was only ever used to route role-specific procedures
15309
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
15310
+ * with `isAdmin: false` + an explicit scope list.
15311
+ */
15312
+ /** Per-method access flavour. Materialised on every cap method via codegen. */
15313
+ var MethodAccessSchema = _enum([
15314
+ "view",
15315
+ "create",
15316
+ "delete"
15317
+ ]);
15318
+ /**
15319
+ * A single scope grant. Three forms — checked in matcher with OR
15320
+ * semantics; the first match decides whether the call passes:
15321
+ *
15322
+ * - `category` — broadest. `target: 'device' | 'system'` selects every
15323
+ * cap with the matching `scope` declaration. New caps inherit grants
15324
+ * automatically — adding a device cap to the codebase makes it
15325
+ * reachable to every user with `category:device [...]` without a
15326
+ * re-grant. Use this for "family viewer" / "operator" tiers.
15327
+ *
15328
+ * - `addon` — every cap that ships inside a given addon id. Niche;
15329
+ * useful when an integration needs to interact with one specific
15330
+ * addon's surface regardless of how many caps it exports.
15331
+ *
15332
+ * - `capability` — the most precise form. Single cap name. Use for
15333
+ * integration tokens where you want to grant `addons.installPackage`
15334
+ * and nothing else.
15335
+ *
15336
+ * `access` is REQUIRED with min 1 element. `admin` bypass is the
15337
+ * "give me everything" escape; there is no wildcard scope.
15338
+ */
15339
+ var AllowedProviderSchema = union([literal("*"), array(string())]);
15340
+ var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
15341
+ var CapScopeSchema = _enum(["device", "system"]);
15342
+ /**
15343
+ * DeviceSelector (scope model v3 — 2026-08-12).
15344
+ *
15345
+ * A `device` grant no longer carries a frozen list of deviceIds. It carries
15346
+ * a SELECTOR the matcher resolves against the live fleet, so the grant can be
15347
+ * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
15348
+ * AFTER the grant was minted — no re-grant, no re-login.
15349
+ *
15350
+ * - `all` — every device in the deployment. The broad viewer/operator
15351
+ * lever without a `category` grant (a `category` grant also covers device
15352
+ * caps that carry no deviceId; `all` is specifically the device set).
15353
+ * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
15354
+ * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
15355
+ * is NOT covered until the grant is edited.
15356
+ * - `types` — every device of a `DeviceType` (e.g. every `camera`).
15357
+ * DYNAMIC. A device that changes type, or a new device of the type,
15358
+ * re-resolves on the next request.
15359
+ * - `locations` — every device whose operator-assigned `location` label is
15360
+ * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
15361
+ * null/unset location matches NO `locations` selector.
15362
+ */
15363
+ var DeviceSelectorSchema = discriminatedUnion("kind", [
15364
+ object({ kind: literal("all") }),
15365
+ object({
15366
+ kind: literal("ids"),
15367
+ ids: array(number().int()).min(1)
15368
+ }),
15369
+ object({
15370
+ kind: literal("types"),
15371
+ types: array(_enum(DeviceType)).min(1)
15372
+ }),
15373
+ object({
15374
+ kind: literal("locations"),
15375
+ locations: array(string().min(1)).min(1)
15376
+ })
15377
+ ]);
15378
+ var DeviceTokenScopeSchema = object({
15379
+ type: literal("device"),
15380
+ /** The device SET this grant covers — resolved against the live fleet. */
15381
+ selector: DeviceSelectorSchema,
15382
+ access: array(MethodAccessSchema).min(1),
15383
+ /**
15384
+ * Whether a grant on a PARENT device transparently covers its accessory
15385
+ * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
15386
+ * Direction is parent → children ONLY.
15387
+ *
15388
+ * Absent → the matcher DERIVES it from the access flavour: `view`
15389
+ * inherits (a camera viewer sees the camera's accessories), `create` /
15390
+ * `delete` do NOT (actuating/removing a child is an explicit act the
15391
+ * operator must grant on the child, not inherit from the parent). Set it
15392
+ * explicitly to override that default per grant.
15393
+ */
15394
+ includeLinked: boolean().optional()
15395
+ });
15396
+ /**
15397
+ * v2 → v3 lazy migration. A pre-v3 `device` grant carried
15398
+ * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
15399
+ * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
15400
+ * EVERY parse path — stored records AND the JWT-carried scope arrays
15401
+ * normalised at the request boundary ({@link normalizeTokenScopes} in
15402
+ * `device-selector.ts`). Chosen over a one-time DB migration because a
15403
+ * migration cannot reach a JWT already in a client's hands; parse-time
15404
+ * migration covers both without a flag day. No cast — the raw object is read
15405
+ * through `Reflect.get` (its static type is `unknown`).
15406
+ */
15407
+ function migrateLegacyTokenScope(raw) {
15408
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
15409
+ if (Reflect.get(raw, "type") !== "device") return raw;
15410
+ if (Reflect.get(raw, "selector") !== void 0) return raw;
15411
+ const targets = Reflect.get(raw, "targets");
15412
+ if (!Array.isArray(targets)) return raw;
15413
+ return {
15414
+ type: "device",
15415
+ selector: {
15416
+ kind: "ids",
15417
+ ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
15418
+ },
15419
+ access: Reflect.get(raw, "access")
15420
+ };
15421
+ }
15422
+ var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
15423
+ object({
15424
+ type: literal("category"),
15425
+ target: CapScopeSchema,
15426
+ access: array(MethodAccessSchema).min(1)
15427
+ }),
15428
+ object({
15429
+ type: literal("capability"),
15430
+ target: string(),
15431
+ access: array(MethodAccessSchema).min(1)
15432
+ }),
15433
+ object({
15434
+ type: literal("addon"),
15435
+ target: string(),
15436
+ access: array(MethodAccessSchema).min(1)
15437
+ }),
15438
+ DeviceTokenScopeSchema
15439
+ ]));
15440
+ object({
15441
+ id: string(),
15442
+ username: string(),
15443
+ passwordHash: string(),
15444
+ /**
15445
+ * Admin bypass. When true, the middleware skips the scope-access
15446
+ * check entirely. There is no other axis of privilege; the legacy
15447
+ * role enum collapsed onto this boolean in v2.
15448
+ */
15449
+ isAdmin: boolean().default(false),
15450
+ allowedProviders: AllowedProviderSchema,
15451
+ allowedDevices: AllowedDevicesSchema,
15452
+ /**
15453
+ * Scopes granted to this user. Admins bypass; their `scopes` is
15454
+ * ignored. Non-admins without scopes are locked out of every
15455
+ * protected call.
15456
+ */
15457
+ scopes: array(TokenScopeSchema).default([]),
15458
+ createdAt: number(),
15459
+ updatedAt: number()
15460
+ });
15461
+ object({
15462
+ id: string(),
15463
+ label: string(),
15464
+ isAdmin: boolean().default(false),
15465
+ allowedProviders: AllowedProviderSchema,
15466
+ allowedDevices: AllowedDevicesSchema,
15467
+ tokenHash: string(),
15468
+ tokenPrefix: string(),
15469
+ createdAt: number(),
15470
+ lastUsedAt: number().optional()
15471
+ });
15472
+ object({
15473
+ id: string(),
15474
+ userId: string(),
15475
+ name: string(),
15476
+ tokenHash: string(),
15477
+ tokenPrefix: string(),
15478
+ scopes: array(TokenScopeSchema),
15479
+ expiresAt: number().nullish(),
15480
+ lastUsedAt: number().nullish(),
15481
+ createdAt: number()
15482
+ });
15483
+ /** What a share-view grant lets its holder see. */
15484
+ var ShareViewGrantSchema = object({
15485
+ kind: _enum(SHARE_VIEW_KINDS),
15486
+ deviceIds: array(number().int().nonnegative()).min(1).max(64),
15487
+ /** Talk-back, opt-in at mint time; absent means off. */
15488
+ talk: boolean().optional()
15489
+ });
15490
+ var ShareViewScopeSchema = object({
15491
+ type: literal("share-view"),
15492
+ grant: ShareViewGrantSchema
15493
+ });
15494
+ var AddonRoutesScopeSchema = object({
15495
+ type: literal("addon-routes"),
15496
+ access: array(MethodAccessSchema).min(1)
15497
+ });
15498
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
15499
+ var CredentialScopeSchema = union([
15500
+ literal("*"),
15501
+ ShareViewScopeSchema,
15502
+ AddonRoutesScopeSchema,
15503
+ PreferencesSelfScopeSchema,
15504
+ TokenScopeSchema
15505
+ ]);
15506
+ object({
15507
+ kind: literal("credential"),
15508
+ sub: string().min(1),
15509
+ jti: string().min(16),
15510
+ scopes: array(CredentialScopeSchema).min(1)
15511
+ });
15512
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
15513
+ /** A namespace's value: a JSON object, opaque to the hub. */
15514
+ var PreferenceValueSchema = record(string(), unknown());
15515
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
15516
+ /** A stored row, as the owner reads it. */
15517
+ var PreferenceRowSchema = object({
15518
+ namespace: PreferenceNamespaceSchema,
15519
+ value: PreferenceValueSchema,
15520
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
15521
+ revision: number().int().positive(),
15522
+ updatedAt: number().int(),
15523
+ /** The client id the last writer sent; `null` when it sent none. */
15524
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
15525
+ });
15526
+ object({
15527
+ /** Absent: every namespace the caller holds. */
15528
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
15529
+ object({ rows: array(PreferenceRowSchema) });
15530
+ object({
15531
+ namespace: PreferenceNamespaceSchema,
15532
+ value: PreferenceValueSchema,
15533
+ /**
15534
+ * The revision the edit was based on. Absent: last write wins. `0`: the
15535
+ * namespace must not exist yet. Any other value that is not the current
15536
+ * revision answers `conflict` and writes nothing.
15537
+ */
15538
+ baseRevision: number().int().nonnegative().optional(),
15539
+ deviceId: PreferenceDeviceIdSchema.optional()
15540
+ });
15541
+ discriminatedUnion("status", [object({
15542
+ status: literal("saved"),
15543
+ row: PreferenceRowSchema
15544
+ }), object({
15545
+ status: literal("conflict"),
15546
+ current: PreferenceRowSchema.nullable()
15547
+ })]);
15548
+ object({ namespace: PreferenceNamespaceSchema });
15549
+ object({
15550
+ /** `false` when the namespace did not exist. */
15551
+ deleted: boolean() });
15552
+ object({
15553
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
15554
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
15555
+ object({
15556
+ /** Every row whose revision differs from the client's, and every row it did not list. */
15557
+ rows: array(PreferenceRowSchema),
15558
+ /** Namespaces the client listed that no longer exist. */
15559
+ deleted: array(PreferenceNamespaceSchema)
15560
+ });
15281
15561
  _enum(["new-session", "step-up"]);
15282
15562
  /** The languages the hub's app landing pages are written in (D858). */
15283
15563
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -42695,38 +42975,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
42695
42975
  auth: "admin",
42696
42976
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
42697
42977
  });
42978
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
42979
+ /** What a model (or, by default, every model of a kind) can do. */
42980
+ var LlmModelFeaturesSchema = object({
42981
+ vision: boolean(),
42982
+ tools: boolean(),
42983
+ streaming: boolean()
42984
+ });
42985
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
42986
+ var LlmModelInfoSchema = object({
42987
+ id: string(),
42988
+ label: string().optional(),
42989
+ contextLength: number().int().positive().optional(),
42990
+ features: LlmModelFeaturesSchema.partial().optional()
42991
+ });
42698
42992
  /**
42699
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
42700
- * methods concat-fan across providers; single-row methods route to ONE
42701
- * provider by the `addonId` in the call input (the notification-output
42702
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
42703
- * (hub-placed); the cap stays open for future providers.
42704
- *
42705
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
42706
- * `apiKey` is a password field — providers REDACT it on read and merge on
42707
- * write; a stored key NEVER round-trips to a client.
42993
+ * The provider-specific part of a profile, validated by the provider that owns
42994
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
42995
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
42996
+ * keychain, never in the row, and reads back as the redaction marker.
42708
42997
  */
42709
- var LlmProfileKindSchema = _enum([
42710
- "openai-compatible",
42711
- "openai",
42712
- "anthropic",
42713
- "google",
42714
- "managed-local",
42715
- "apple-foundation"
42716
- ]);
42998
+ var LlmProviderConfigSchema = record(string(), unknown());
42717
42999
  var LlmProfileSchema = object({
42718
43000
  id: string(),
42719
43001
  name: string(),
43002
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
42720
43003
  kind: LlmProfileKindSchema,
42721
43004
  /** Stamped by the provider — keeps the fanned catalog routable. */
42722
43005
  addonId: string(),
42723
43006
  enabled: boolean(),
42724
43007
  /** Vendor model id, or the managed runtime's loaded model. */
42725
43008
  model: string(),
42726
- /** Required for openai-compatible; override for cloud kinds. */
42727
- baseUrl: string().optional(),
42728
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
42729
- apiKey: string().optional(),
42730
43009
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
42731
43010
  * degraded to text — that shipped once and produced a confident answer to a
42732
43011
  * question about a picture nobody sent. */
@@ -42734,15 +43013,11 @@ var LlmProfileSchema = object({
42734
43013
  temperature: number().min(0).max(2).optional(),
42735
43014
  /** Nucleus sampling. Every wire we speak has it. */
42736
43015
  topP: number().min(0).max(1).optional(),
42737
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
42738
- * wire does, and the client drops it there (measured: the request body gets
42739
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
42740
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
43016
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
43017
+ * field in its editor only when its descriptor lists it in `profileFields`. */
42741
43018
  topK: number().int().positive().optional(),
42742
43019
  maxTokens: number().int().positive().optional(),
42743
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
42744
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
42745
- * the model with, so it is the one field that changes a PROCESS. */
43020
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
42746
43021
  contextLength: number().int().positive().optional(),
42747
43022
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
42748
43023
  * two system prompts fighting is worse than either alone). */
@@ -42768,16 +43043,37 @@ var LlmProfileSchema = object({
42768
43043
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
42769
43044
  * `true` here buys the wiring, not behaviour, until tools are registered. */
42770
43045
  toolsEnabled: boolean().default(false),
42771
- extraHeaders: record(string(), string()).optional(),
42772
- /** kind === 'managed-local' only (spec §4). */
42773
- runtime: ManagedRuntimeConfigSchema.optional(),
42774
- /**
42775
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
42776
- * to configure (no key, no URL, no download; `model` is `apple-system`).
42777
- * `supportsVision` on such a row is stamped by the provider from the node's
42778
- * reported `imageInput`, never taken from the operator (D62).
42779
- */
42780
- appleFoundation: object({ nodeId: string() }).optional()
43046
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
43047
+ providerConfig: LlmProviderConfigSchema.default({})
43048
+ });
43049
+ /**
43050
+ * The common profile fields a kind's editor offers. The editor owns how each
43051
+ * one is drawn; the provider says which of them mean something on its wire.
43052
+ */
43053
+ var LlmProfileFieldSchema = _enum([
43054
+ "temperature",
43055
+ "topP",
43056
+ "topK",
43057
+ "maxTokens",
43058
+ "contextLength",
43059
+ "systemPrompt",
43060
+ "timeoutMs",
43061
+ "connectTimeoutMs",
43062
+ "firstTokenTimeoutMs",
43063
+ "idleTimeoutMs",
43064
+ "retry",
43065
+ "toolsEnabled"
43066
+ ]);
43067
+ /**
43068
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
43069
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
43070
+ * picker: that widget owns the model choice.
43071
+ */
43072
+ var LlmProviderWidgetSchema = object({
43073
+ id: string(),
43074
+ placement: _enum(["connection", "model"]),
43075
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
43076
+ requires: array(string()).optional()
42781
43077
  });
42782
43078
  /** ConfigUISchema tree passed through untyped on the wire (the
42783
43079
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -42786,11 +43082,56 @@ var ConfigSchemaPassthrough$3 = unknown();
42786
43082
  var LlmProfileKindDescriptorSchema = object({
42787
43083
  kind: LlmProfileKindSchema,
42788
43084
  label: string(),
43085
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
42789
43086
  icon: string(),
42790
43087
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
42791
43088
  addonId: string(),
42792
- configSchema: ConfigSchemaPassthrough$3
43089
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
43090
+ connectionSchema: ConfigSchemaPassthrough$3,
43091
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
43092
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
43093
+ /** The kind's defaults; a model from `listModels` may override any of them. */
43094
+ features: LlmModelFeaturesSchema,
43095
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
43096
+ visionEditable: boolean(),
43097
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
43098
+ modelCatalog: _enum([
43099
+ "fetch",
43100
+ "static",
43101
+ "none"
43102
+ ]),
43103
+ staticModels: array(LlmModelInfoSchema).optional(),
43104
+ /** The common fields that mean something on this kind's wire. */
43105
+ profileFields: array(LlmProfileFieldSchema),
43106
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
43107
+ });
43108
+ /**
43109
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
43110
+ * (the editor's form); with `profileId` too, a secret the draft leaves
43111
+ * untouched (absent or the redaction marker) is resolved server-side from the
43112
+ * stored profile — the browser never receives it.
43113
+ */
43114
+ var LlmListModelsInputSchema = object({
43115
+ addonId: string(),
43116
+ kind: LlmProfileKindSchema,
43117
+ profileId: string().optional(),
43118
+ connection: LlmProviderConfigSchema.optional()
42793
43119
  });
43120
+ var LlmListModelsErrorCodeSchema = _enum([
43121
+ "auth",
43122
+ "network",
43123
+ "unsupported",
43124
+ "invalid"
43125
+ ]);
43126
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
43127
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
43128
+ ok: literal(true),
43129
+ models: array(LlmModelInfoSchema)
43130
+ }), object({
43131
+ ok: literal(false),
43132
+ code: LlmListModelsErrorCodeSchema,
43133
+ message: string()
43134
+ })]);
42794
43135
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
42795
43136
  var LlmDefaultSchema = object({
42796
43137
  selector: LlmDefaultSelectorSchema,
@@ -42890,7 +43231,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
42890
43231
  kind: "mutation",
42891
43232
  auth: "admin",
42892
43233
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
42893
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
43234
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
43235
+ kind: "mutation",
43236
+ auth: "admin"
43237
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
42894
43238
  selector: LlmDefaultSelectorSchema,
42895
43239
  profileId: string().nullable()
42896
43240
  }), _void(), {
@@ -47332,202 +47676,6 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
47332
47676
  auth: "admin"
47333
47677
  }), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
47334
47678
  /**
47335
- * Zod schemas for persisted record types.
47336
- *
47337
- * These schemas serve as the single source of truth for types that are
47338
- * stored in the settings-store backend and retrieved via tRPC. They
47339
- * replace the manual TypeScript interfaces with schema-derived types,
47340
- * enabling runtime validation when reading from the backend.
47341
- *
47342
- * Convention: each schema is named `<Type>Schema`, the inferred TS type
47343
- * keeps the original name for backward compatibility.
47344
- */
47345
- /**
47346
- * Auth model (v2 — 2026-05-12 caps-only):
47347
- *
47348
- * Two principals:
47349
- * - `isAdmin: true` — full bypass. Admin scope set is ignored.
47350
- * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
47351
- *
47352
- * No role enum. There used to be `viewer / agent / scoped` and earlier
47353
- * `super_admin` — collapsed onto the single boolean because every
47354
- * non-admin caller is governed by the same scope-check rules; the
47355
- * distinction was only ever used to route role-specific procedures
47356
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
47357
- * with `isAdmin: false` + an explicit scope list.
47358
- */
47359
- /** Per-method access flavour. Materialised on every cap method via codegen. */
47360
- var MethodAccessSchema = _enum([
47361
- "view",
47362
- "create",
47363
- "delete"
47364
- ]);
47365
- /**
47366
- * A single scope grant. Three forms — checked in matcher with OR
47367
- * semantics; the first match decides whether the call passes:
47368
- *
47369
- * - `category` — broadest. `target: 'device' | 'system'` selects every
47370
- * cap with the matching `scope` declaration. New caps inherit grants
47371
- * automatically — adding a device cap to the codebase makes it
47372
- * reachable to every user with `category:device [...]` without a
47373
- * re-grant. Use this for "family viewer" / "operator" tiers.
47374
- *
47375
- * - `addon` — every cap that ships inside a given addon id. Niche;
47376
- * useful when an integration needs to interact with one specific
47377
- * addon's surface regardless of how many caps it exports.
47378
- *
47379
- * - `capability` — the most precise form. Single cap name. Use for
47380
- * integration tokens where you want to grant `addons.installPackage`
47381
- * and nothing else.
47382
- *
47383
- * `access` is REQUIRED with min 1 element. `admin` bypass is the
47384
- * "give me everything" escape; there is no wildcard scope.
47385
- */
47386
- var AllowedProviderSchema = union([literal("*"), array(string())]);
47387
- var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
47388
- var CapScopeSchema = _enum(["device", "system"]);
47389
- /**
47390
- * DeviceSelector (scope model v3 — 2026-08-12).
47391
- *
47392
- * A `device` grant no longer carries a frozen list of deviceIds. It carries
47393
- * a SELECTOR the matcher resolves against the live fleet, so the grant can be
47394
- * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
47395
- * AFTER the grant was minted — no re-grant, no re-login.
47396
- *
47397
- * - `all` — every device in the deployment. The broad viewer/operator
47398
- * lever without a `category` grant (a `category` grant also covers device
47399
- * caps that carry no deviceId; `all` is specifically the device set).
47400
- * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
47401
- * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
47402
- * is NOT covered until the grant is edited.
47403
- * - `types` — every device of a `DeviceType` (e.g. every `camera`).
47404
- * DYNAMIC. A device that changes type, or a new device of the type,
47405
- * re-resolves on the next request.
47406
- * - `locations` — every device whose operator-assigned `location` label is
47407
- * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
47408
- * null/unset location matches NO `locations` selector.
47409
- */
47410
- var DeviceSelectorSchema = discriminatedUnion("kind", [
47411
- object({ kind: literal("all") }),
47412
- object({
47413
- kind: literal("ids"),
47414
- ids: array(number().int()).min(1)
47415
- }),
47416
- object({
47417
- kind: literal("types"),
47418
- types: array(_enum(DeviceType)).min(1)
47419
- }),
47420
- object({
47421
- kind: literal("locations"),
47422
- locations: array(string().min(1)).min(1)
47423
- })
47424
- ]);
47425
- var DeviceTokenScopeSchema = object({
47426
- type: literal("device"),
47427
- /** The device SET this grant covers — resolved against the live fleet. */
47428
- selector: DeviceSelectorSchema,
47429
- access: array(MethodAccessSchema).min(1),
47430
- /**
47431
- * Whether a grant on a PARENT device transparently covers its accessory
47432
- * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
47433
- * Direction is parent → children ONLY.
47434
- *
47435
- * Absent → the matcher DERIVES it from the access flavour: `view`
47436
- * inherits (a camera viewer sees the camera's accessories), `create` /
47437
- * `delete` do NOT (actuating/removing a child is an explicit act the
47438
- * operator must grant on the child, not inherit from the parent). Set it
47439
- * explicitly to override that default per grant.
47440
- */
47441
- includeLinked: boolean().optional()
47442
- });
47443
- /**
47444
- * v2 → v3 lazy migration. A pre-v3 `device` grant carried
47445
- * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
47446
- * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
47447
- * EVERY parse path — stored records AND the JWT-carried scope arrays
47448
- * normalised at the request boundary ({@link normalizeTokenScopes} in
47449
- * `device-selector.ts`). Chosen over a one-time DB migration because a
47450
- * migration cannot reach a JWT already in a client's hands; parse-time
47451
- * migration covers both without a flag day. No cast — the raw object is read
47452
- * through `Reflect.get` (its static type is `unknown`).
47453
- */
47454
- function migrateLegacyTokenScope(raw) {
47455
- if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
47456
- if (Reflect.get(raw, "type") !== "device") return raw;
47457
- if (Reflect.get(raw, "selector") !== void 0) return raw;
47458
- const targets = Reflect.get(raw, "targets");
47459
- if (!Array.isArray(targets)) return raw;
47460
- return {
47461
- type: "device",
47462
- selector: {
47463
- kind: "ids",
47464
- ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
47465
- },
47466
- access: Reflect.get(raw, "access")
47467
- };
47468
- }
47469
- var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
47470
- object({
47471
- type: literal("category"),
47472
- target: CapScopeSchema,
47473
- access: array(MethodAccessSchema).min(1)
47474
- }),
47475
- object({
47476
- type: literal("capability"),
47477
- target: string(),
47478
- access: array(MethodAccessSchema).min(1)
47479
- }),
47480
- object({
47481
- type: literal("addon"),
47482
- target: string(),
47483
- access: array(MethodAccessSchema).min(1)
47484
- }),
47485
- DeviceTokenScopeSchema
47486
- ]));
47487
- object({
47488
- id: string(),
47489
- username: string(),
47490
- passwordHash: string(),
47491
- /**
47492
- * Admin bypass. When true, the middleware skips the scope-access
47493
- * check entirely. There is no other axis of privilege; the legacy
47494
- * role enum collapsed onto this boolean in v2.
47495
- */
47496
- isAdmin: boolean().default(false),
47497
- allowedProviders: AllowedProviderSchema,
47498
- allowedDevices: AllowedDevicesSchema,
47499
- /**
47500
- * Scopes granted to this user. Admins bypass; their `scopes` is
47501
- * ignored. Non-admins without scopes are locked out of every
47502
- * protected call.
47503
- */
47504
- scopes: array(TokenScopeSchema).default([]),
47505
- createdAt: number(),
47506
- updatedAt: number()
47507
- });
47508
- object({
47509
- id: string(),
47510
- label: string(),
47511
- isAdmin: boolean().default(false),
47512
- allowedProviders: AllowedProviderSchema,
47513
- allowedDevices: AllowedDevicesSchema,
47514
- tokenHash: string(),
47515
- tokenPrefix: string(),
47516
- createdAt: number(),
47517
- lastUsedAt: number().optional()
47518
- });
47519
- object({
47520
- id: string(),
47521
- userId: string(),
47522
- name: string(),
47523
- tokenHash: string(),
47524
- tokenPrefix: string(),
47525
- scopes: array(TokenScopeSchema),
47526
- expiresAt: number().nullish(),
47527
- lastUsedAt: number().nullish(),
47528
- createdAt: number()
47529
- });
47530
- /**
47531
47679
  * `oauth-integration` — a collection cap by which an addon declares
47532
47680
  * itself a linkable OAuth client of the hub's core `/oauth2/*` server.
47533
47681
  * Each provider returns a static descriptor; the core enumerates them
@@ -65942,26 +66090,6 @@ var ApiKeySummarySchema = object({
65942
66090
  createdAt: number(),
65943
66091
  lastUsedAt: number().optional()
65944
66092
  });
65945
- var ScopedTokenSummarySchema = object({
65946
- id: string(),
65947
- userId: string(),
65948
- name: string(),
65949
- tokenPrefix: string(),
65950
- scopes: array(TokenScopeSchema),
65951
- expiresAt: number().nullish(),
65952
- lastUsedAt: number().nullish(),
65953
- createdAt: number()
65954
- });
65955
- var CreateScopedTokenInputSchema = object({
65956
- userId: string(),
65957
- name: string(),
65958
- scopes: array(TokenScopeSchema),
65959
- expiresAt: number().optional()
65960
- });
65961
- var CreateScopedTokenResultSchema = object({
65962
- token: string(),
65963
- record: ScopedTokenSummarySchema
65964
- });
65965
66093
  var OauthSessionSummarySchema = object({
65966
66094
  id: string(),
65967
66095
  userId: string(),
@@ -65983,11 +66111,11 @@ var TotpStatusSchema = object({
65983
66111
  confirmedAt: number().nullable()
65984
66112
  });
65985
66113
  /**
65986
- * user-management — singleton capability for user accounts, API keys,
65987
- * and scoped tokens.
66114
+ * user-management — singleton capability for user accounts and the
66115
+ * legacy API-key rows.
65988
66116
  *
65989
66117
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
65990
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
66118
+ * — the subset check on `setUserScopes` is moot
65991
66119
  * because non-admins never reach these. If/when we open non-admin
65992
66120
  * delegation, structural caller-scope subset check goes inside the
65993
66121
  * provider.
@@ -66044,15 +66172,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
66044
66172
  kind: "mutation",
66045
66173
  auth: "admin",
66046
66174
  access: "delete"
66047
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
66048
- kind: "mutation",
66049
- auth: "admin",
66050
- access: "create"
66051
- }), method(object({ id: string() }), object({ success: literal(true) }), {
66052
- kind: "mutation",
66053
- auth: "admin",
66054
- access: "delete"
66055
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
66175
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
66056
66176
  kind: "mutation",
66057
66177
  auth: "admin",
66058
66178
  access: "create"
@@ -70226,7 +70346,7 @@ Object.freeze({
70226
70346
  capName: "llm",
70227
70347
  capScope: "system",
70228
70348
  addonId: null,
70229
- access: "view"
70349
+ access: "create"
70230
70350
  },
70231
70351
  "llm.listNodeModels": {
70232
70352
  capName: "llm",
@@ -74890,12 +75010,6 @@ Object.freeze({
74890
75010
  addonId: null,
74891
75011
  access: "create"
74892
75012
  },
74893
- "userManagement.createScopedToken": {
74894
- capName: "user-management",
74895
- capScope: "system",
74896
- addonId: null,
74897
- access: "create"
74898
- },
74899
75013
  "userManagement.createUser": {
74900
75014
  capName: "user-management",
74901
75015
  capScope: "system",
@@ -74944,12 +75058,6 @@ Object.freeze({
74944
75058
  addonId: null,
74945
75059
  access: "view"
74946
75060
  },
74947
- "userManagement.listScopedTokens": {
74948
- capName: "user-management",
74949
- capScope: "system",
74950
- addonId: null,
74951
- access: "view"
74952
- },
74953
75061
  "userManagement.listUsers": {
74954
75062
  capName: "user-management",
74955
75063
  capScope: "system",
@@ -75004,12 +75112,6 @@ Object.freeze({
75004
75112
  addonId: null,
75005
75113
  access: "delete"
75006
75114
  },
75007
- "userManagement.revokeScopedToken": {
75008
- capName: "user-management",
75009
- capScope: "system",
75010
- addonId: null,
75011
- access: "delete"
75012
- },
75013
75115
  "userManagement.setupTotp": {
75014
75116
  capName: "user-management",
75015
75117
  capScope: "system",
@@ -75040,12 +75142,6 @@ Object.freeze({
75040
75142
  addonId: null,
75041
75143
  access: "view"
75042
75144
  },
75043
- "userManagement.validateScopedToken": {
75044
- capName: "user-management",
75045
- capScope: "system",
75046
- addonId: null,
75047
- access: "view"
75048
- },
75049
75145
  "userManagement.verifyTotp": {
75050
75146
  capName: "user-management",
75051
75147
  capScope: "system",