@camstack/addon-post-analysis 1.2.609 → 1.2.611

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 (15) hide show
  1. package/dist/{clip-model-registry-BItfTZEx.mjs → clip-model-registry-3TQUwS_R.mjs} +391 -295
  2. package/dist/{clip-model-registry-B11yS32V.js → clip-model-registry-D1PS6-db.js} +396 -294
  3. package/dist/embedding-encoder/index.js +1 -1
  4. package/dist/embedding-encoder/index.mjs +1 -1
  5. package/dist/pipeline-analytics/_stub.js +2 -2
  6. package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-LGLlz5Sk.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-D_6mbip_.mjs} +3 -3
  7. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BX7AfZj6.mjs +26 -0
  8. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DZcBAOjR.mjs +26 -0
  9. package/dist/pipeline-analytics/{hostInit-Cko0y33G.mjs → hostInit-Tp2cEslm.mjs} +3 -3
  10. package/dist/pipeline-analytics/index.js +72961 -72978
  11. package/dist/pipeline-analytics/index.mjs +85493 -85509
  12. package/dist/pipeline-analytics/remoteEntry.js +1 -1
  13. package/package.json +1 -1
  14. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-iXmJsQ9Y.mjs +0 -26
  15. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-Cm7pZeMH.mjs +0 -26
@@ -5643,7 +5643,7 @@ var ZodIssueCode = {
5643
5643
  var ZodFirstPartyTypeKind;
5644
5644
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5645
5645
  //#endregion
5646
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5646
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5647
5647
  /**
5648
5648
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5649
5649
  * window to float samples (D455).
@@ -8025,6 +8025,12 @@ function normalizeAddonInitResult(result) {
8025
8025
  if (Array.isArray(result)) return { providers: result };
8026
8026
  return result;
8027
8027
  }
8028
+ /**
8029
+ * The share-view scope kinds a share-link token can carry. The hub mints
8030
+ * and validates them (`ShareViewGrantSchema` builds its
8031
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
8032
+ */
8033
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
8028
8034
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
8029
8035
  var PeerBytesTicketSchema = object({
8030
8036
  /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
@@ -13978,6 +13984,280 @@ var ConvertResultSchema = object({
13978
13984
  files: array(string()).readonly()
13979
13985
  })).readonly()
13980
13986
  });
13987
+ /**
13988
+ * Zod schemas for persisted record types.
13989
+ *
13990
+ * These schemas serve as the single source of truth for types that are
13991
+ * stored in the settings-store backend and retrieved via tRPC. They
13992
+ * replace the manual TypeScript interfaces with schema-derived types,
13993
+ * enabling runtime validation when reading from the backend.
13994
+ *
13995
+ * Convention: each schema is named `<Type>Schema`, the inferred TS type
13996
+ * keeps the original name for backward compatibility.
13997
+ */
13998
+ /**
13999
+ * Auth model (v2 — 2026-05-12 caps-only):
14000
+ *
14001
+ * Two principals:
14002
+ * - `isAdmin: true` — full bypass. Admin scope set is ignored.
14003
+ * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
14004
+ *
14005
+ * No role enum. There used to be `viewer / agent / scoped` and earlier
14006
+ * `super_admin` — collapsed onto the single boolean because every
14007
+ * non-admin caller is governed by the same scope-check rules; the
14008
+ * distinction was only ever used to route role-specific procedures
14009
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
14010
+ * with `isAdmin: false` + an explicit scope list.
14011
+ */
14012
+ /** Per-method access flavour. Materialised on every cap method via codegen. */
14013
+ var MethodAccessSchema = _enum([
14014
+ "view",
14015
+ "create",
14016
+ "delete"
14017
+ ]);
14018
+ /**
14019
+ * A single scope grant. Three forms — checked in matcher with OR
14020
+ * semantics; the first match decides whether the call passes:
14021
+ *
14022
+ * - `category` — broadest. `target: 'device' | 'system'` selects every
14023
+ * cap with the matching `scope` declaration. New caps inherit grants
14024
+ * automatically — adding a device cap to the codebase makes it
14025
+ * reachable to every user with `category:device [...]` without a
14026
+ * re-grant. Use this for "family viewer" / "operator" tiers.
14027
+ *
14028
+ * - `addon` — every cap that ships inside a given addon id. Niche;
14029
+ * useful when an integration needs to interact with one specific
14030
+ * addon's surface regardless of how many caps it exports.
14031
+ *
14032
+ * - `capability` — the most precise form. Single cap name. Use for
14033
+ * integration tokens where you want to grant `addons.installPackage`
14034
+ * and nothing else.
14035
+ *
14036
+ * `access` is REQUIRED with min 1 element. `admin` bypass is the
14037
+ * "give me everything" escape; there is no wildcard scope.
14038
+ */
14039
+ var AllowedProviderSchema = union([literal("*"), array(string())]);
14040
+ var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
14041
+ var CapScopeSchema = _enum(["device", "system"]);
14042
+ /**
14043
+ * DeviceSelector (scope model v3 — 2026-08-12).
14044
+ *
14045
+ * A `device` grant no longer carries a frozen list of deviceIds. It carries
14046
+ * a SELECTOR the matcher resolves against the live fleet, so the grant can be
14047
+ * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
14048
+ * AFTER the grant was minted — no re-grant, no re-login.
14049
+ *
14050
+ * - `all` — every device in the deployment. The broad viewer/operator
14051
+ * lever without a `category` grant (a `category` grant also covers device
14052
+ * caps that carry no deviceId; `all` is specifically the device set).
14053
+ * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
14054
+ * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
14055
+ * is NOT covered until the grant is edited.
14056
+ * - `types` — every device of a `DeviceType` (e.g. every `camera`).
14057
+ * DYNAMIC. A device that changes type, or a new device of the type,
14058
+ * re-resolves on the next request.
14059
+ * - `locations` — every device whose operator-assigned `location` label is
14060
+ * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
14061
+ * null/unset location matches NO `locations` selector.
14062
+ */
14063
+ var DeviceSelectorSchema = discriminatedUnion("kind", [
14064
+ object({ kind: literal("all") }),
14065
+ object({
14066
+ kind: literal("ids"),
14067
+ ids: array(number().int()).min(1)
14068
+ }),
14069
+ object({
14070
+ kind: literal("types"),
14071
+ types: array(_enum(DeviceType)).min(1)
14072
+ }),
14073
+ object({
14074
+ kind: literal("locations"),
14075
+ locations: array(string().min(1)).min(1)
14076
+ })
14077
+ ]);
14078
+ var DeviceTokenScopeSchema = object({
14079
+ type: literal("device"),
14080
+ /** The device SET this grant covers — resolved against the live fleet. */
14081
+ selector: DeviceSelectorSchema,
14082
+ access: array(MethodAccessSchema).min(1),
14083
+ /**
14084
+ * Whether a grant on a PARENT device transparently covers its accessory
14085
+ * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
14086
+ * Direction is parent → children ONLY.
14087
+ *
14088
+ * Absent → the matcher DERIVES it from the access flavour: `view`
14089
+ * inherits (a camera viewer sees the camera's accessories), `create` /
14090
+ * `delete` do NOT (actuating/removing a child is an explicit act the
14091
+ * operator must grant on the child, not inherit from the parent). Set it
14092
+ * explicitly to override that default per grant.
14093
+ */
14094
+ includeLinked: boolean().optional()
14095
+ });
14096
+ /**
14097
+ * v2 → v3 lazy migration. A pre-v3 `device` grant carried
14098
+ * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
14099
+ * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
14100
+ * EVERY parse path — stored records AND the JWT-carried scope arrays
14101
+ * normalised at the request boundary ({@link normalizeTokenScopes} in
14102
+ * `device-selector.ts`). Chosen over a one-time DB migration because a
14103
+ * migration cannot reach a JWT already in a client's hands; parse-time
14104
+ * migration covers both without a flag day. No cast — the raw object is read
14105
+ * through `Reflect.get` (its static type is `unknown`).
14106
+ */
14107
+ function migrateLegacyTokenScope(raw) {
14108
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
14109
+ if (Reflect.get(raw, "type") !== "device") return raw;
14110
+ if (Reflect.get(raw, "selector") !== void 0) return raw;
14111
+ const targets = Reflect.get(raw, "targets");
14112
+ if (!Array.isArray(targets)) return raw;
14113
+ return {
14114
+ type: "device",
14115
+ selector: {
14116
+ kind: "ids",
14117
+ ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
14118
+ },
14119
+ access: Reflect.get(raw, "access")
14120
+ };
14121
+ }
14122
+ var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
14123
+ object({
14124
+ type: literal("category"),
14125
+ target: CapScopeSchema,
14126
+ access: array(MethodAccessSchema).min(1)
14127
+ }),
14128
+ object({
14129
+ type: literal("capability"),
14130
+ target: string(),
14131
+ access: array(MethodAccessSchema).min(1)
14132
+ }),
14133
+ object({
14134
+ type: literal("addon"),
14135
+ target: string(),
14136
+ access: array(MethodAccessSchema).min(1)
14137
+ }),
14138
+ DeviceTokenScopeSchema
14139
+ ]));
14140
+ object({
14141
+ id: string(),
14142
+ username: string(),
14143
+ passwordHash: string(),
14144
+ /**
14145
+ * Admin bypass. When true, the middleware skips the scope-access
14146
+ * check entirely. There is no other axis of privilege; the legacy
14147
+ * role enum collapsed onto this boolean in v2.
14148
+ */
14149
+ isAdmin: boolean().default(false),
14150
+ allowedProviders: AllowedProviderSchema,
14151
+ allowedDevices: AllowedDevicesSchema,
14152
+ /**
14153
+ * Scopes granted to this user. Admins bypass; their `scopes` is
14154
+ * ignored. Non-admins without scopes are locked out of every
14155
+ * protected call.
14156
+ */
14157
+ scopes: array(TokenScopeSchema).default([]),
14158
+ createdAt: number(),
14159
+ updatedAt: number()
14160
+ });
14161
+ object({
14162
+ id: string(),
14163
+ label: string(),
14164
+ isAdmin: boolean().default(false),
14165
+ allowedProviders: AllowedProviderSchema,
14166
+ allowedDevices: AllowedDevicesSchema,
14167
+ tokenHash: string(),
14168
+ tokenPrefix: string(),
14169
+ createdAt: number(),
14170
+ lastUsedAt: number().optional()
14171
+ });
14172
+ object({
14173
+ id: string(),
14174
+ userId: string(),
14175
+ name: string(),
14176
+ tokenHash: string(),
14177
+ tokenPrefix: string(),
14178
+ scopes: array(TokenScopeSchema),
14179
+ expiresAt: number().nullish(),
14180
+ lastUsedAt: number().nullish(),
14181
+ createdAt: number()
14182
+ });
14183
+ /** What a share-view grant lets its holder see. */
14184
+ var ShareViewGrantSchema = object({
14185
+ kind: _enum(SHARE_VIEW_KINDS),
14186
+ deviceIds: array(number().int().nonnegative()).min(1).max(64),
14187
+ /** Talk-back, opt-in at mint time; absent means off. */
14188
+ talk: boolean().optional()
14189
+ });
14190
+ var ShareViewScopeSchema = object({
14191
+ type: literal("share-view"),
14192
+ grant: ShareViewGrantSchema
14193
+ });
14194
+ var AddonRoutesScopeSchema = object({
14195
+ type: literal("addon-routes"),
14196
+ access: array(MethodAccessSchema).min(1)
14197
+ });
14198
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
14199
+ var CredentialScopeSchema = union([
14200
+ literal("*"),
14201
+ ShareViewScopeSchema,
14202
+ AddonRoutesScopeSchema,
14203
+ PreferencesSelfScopeSchema,
14204
+ TokenScopeSchema
14205
+ ]);
14206
+ object({
14207
+ kind: literal("credential"),
14208
+ sub: string().min(1),
14209
+ jti: string().min(16),
14210
+ scopes: array(CredentialScopeSchema).min(1)
14211
+ });
14212
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
14213
+ /** A namespace's value: a JSON object, opaque to the hub. */
14214
+ var PreferenceValueSchema = record(string(), unknown());
14215
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
14216
+ /** A stored row, as the owner reads it. */
14217
+ var PreferenceRowSchema = object({
14218
+ namespace: PreferenceNamespaceSchema,
14219
+ value: PreferenceValueSchema,
14220
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
14221
+ revision: number().int().positive(),
14222
+ updatedAt: number().int(),
14223
+ /** The client id the last writer sent; `null` when it sent none. */
14224
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
14225
+ });
14226
+ object({
14227
+ /** Absent: every namespace the caller holds. */
14228
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
14229
+ object({ rows: array(PreferenceRowSchema) });
14230
+ object({
14231
+ namespace: PreferenceNamespaceSchema,
14232
+ value: PreferenceValueSchema,
14233
+ /**
14234
+ * The revision the edit was based on. Absent: last write wins. `0`: the
14235
+ * namespace must not exist yet. Any other value that is not the current
14236
+ * revision answers `conflict` and writes nothing.
14237
+ */
14238
+ baseRevision: number().int().nonnegative().optional(),
14239
+ deviceId: PreferenceDeviceIdSchema.optional()
14240
+ });
14241
+ discriminatedUnion("status", [object({
14242
+ status: literal("saved"),
14243
+ row: PreferenceRowSchema
14244
+ }), object({
14245
+ status: literal("conflict"),
14246
+ current: PreferenceRowSchema.nullable()
14247
+ })]);
14248
+ object({ namespace: PreferenceNamespaceSchema });
14249
+ object({
14250
+ /** `false` when the namespace did not exist. */
14251
+ deleted: boolean() });
14252
+ object({
14253
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
14254
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
14255
+ object({
14256
+ /** Every row whose revision differs from the client's, and every row it did not list. */
14257
+ rows: array(PreferenceRowSchema),
14258
+ /** Namespaces the client listed that no longer exist. */
14259
+ deleted: array(PreferenceNamespaceSchema)
14260
+ });
13981
14261
  _enum(["new-session", "step-up"]);
13982
14262
  /** The languages the hub's app landing pages are written in (D858). */
13983
14263
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -41300,38 +41580,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
41300
41580
  auth: "admin",
41301
41581
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
41302
41582
  });
41583
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
41584
+ /** What a model (or, by default, every model of a kind) can do. */
41585
+ var LlmModelFeaturesSchema = object({
41586
+ vision: boolean(),
41587
+ tools: boolean(),
41588
+ streaming: boolean()
41589
+ });
41590
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
41591
+ var LlmModelInfoSchema = object({
41592
+ id: string(),
41593
+ label: string().optional(),
41594
+ contextLength: number().int().positive().optional(),
41595
+ features: LlmModelFeaturesSchema.partial().optional()
41596
+ });
41303
41597
  /**
41304
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
41305
- * methods concat-fan across providers; single-row methods route to ONE
41306
- * provider by the `addonId` in the call input (the notification-output
41307
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
41308
- * (hub-placed); the cap stays open for future providers.
41309
- *
41310
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
41311
- * `apiKey` is a password field — providers REDACT it on read and merge on
41312
- * write; a stored key NEVER round-trips to a client.
41598
+ * The provider-specific part of a profile, validated by the provider that owns
41599
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
41600
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
41601
+ * keychain, never in the row, and reads back as the redaction marker.
41313
41602
  */
41314
- var LlmProfileKindSchema = _enum([
41315
- "openai-compatible",
41316
- "openai",
41317
- "anthropic",
41318
- "google",
41319
- "managed-local",
41320
- "apple-foundation"
41321
- ]);
41603
+ var LlmProviderConfigSchema = record(string(), unknown());
41322
41604
  var LlmProfileSchema = object({
41323
41605
  id: string(),
41324
41606
  name: string(),
41607
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
41325
41608
  kind: LlmProfileKindSchema,
41326
41609
  /** Stamped by the provider — keeps the fanned catalog routable. */
41327
41610
  addonId: string(),
41328
41611
  enabled: boolean(),
41329
41612
  /** Vendor model id, or the managed runtime's loaded model. */
41330
41613
  model: string(),
41331
- /** Required for openai-compatible; override for cloud kinds. */
41332
- baseUrl: string().optional(),
41333
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
41334
- apiKey: string().optional(),
41335
41614
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
41336
41615
  * degraded to text — that shipped once and produced a confident answer to a
41337
41616
  * question about a picture nobody sent. */
@@ -41339,15 +41618,11 @@ var LlmProfileSchema = object({
41339
41618
  temperature: number().min(0).max(2).optional(),
41340
41619
  /** Nucleus sampling. Every wire we speak has it. */
41341
41620
  topP: number().min(0).max(1).optional(),
41342
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
41343
- * wire does, and the client drops it there (measured: the request body gets
41344
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
41345
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
41621
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
41622
+ * field in its editor only when its descriptor lists it in `profileFields`. */
41346
41623
  topK: number().int().positive().optional(),
41347
41624
  maxTokens: number().int().positive().optional(),
41348
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
41349
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
41350
- * the model with, so it is the one field that changes a PROCESS. */
41625
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
41351
41626
  contextLength: number().int().positive().optional(),
41352
41627
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
41353
41628
  * two system prompts fighting is worse than either alone). */
@@ -41373,16 +41648,37 @@ var LlmProfileSchema = object({
41373
41648
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
41374
41649
  * `true` here buys the wiring, not behaviour, until tools are registered. */
41375
41650
  toolsEnabled: boolean().default(false),
41376
- extraHeaders: record(string(), string()).optional(),
41377
- /** kind === 'managed-local' only (spec §4). */
41378
- runtime: ManagedRuntimeConfigSchema.optional(),
41379
- /**
41380
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
41381
- * to configure (no key, no URL, no download; `model` is `apple-system`).
41382
- * `supportsVision` on such a row is stamped by the provider from the node's
41383
- * reported `imageInput`, never taken from the operator (D62).
41384
- */
41385
- appleFoundation: object({ nodeId: string() }).optional()
41651
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
41652
+ providerConfig: LlmProviderConfigSchema.default({})
41653
+ });
41654
+ /**
41655
+ * The common profile fields a kind's editor offers. The editor owns how each
41656
+ * one is drawn; the provider says which of them mean something on its wire.
41657
+ */
41658
+ var LlmProfileFieldSchema = _enum([
41659
+ "temperature",
41660
+ "topP",
41661
+ "topK",
41662
+ "maxTokens",
41663
+ "contextLength",
41664
+ "systemPrompt",
41665
+ "timeoutMs",
41666
+ "connectTimeoutMs",
41667
+ "firstTokenTimeoutMs",
41668
+ "idleTimeoutMs",
41669
+ "retry",
41670
+ "toolsEnabled"
41671
+ ]);
41672
+ /**
41673
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
41674
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
41675
+ * picker: that widget owns the model choice.
41676
+ */
41677
+ var LlmProviderWidgetSchema = object({
41678
+ id: string(),
41679
+ placement: _enum(["connection", "model"]),
41680
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
41681
+ requires: array(string()).optional()
41386
41682
  });
41387
41683
  /** ConfigUISchema tree passed through untyped on the wire (the
41388
41684
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -41391,11 +41687,56 @@ var ConfigSchemaPassthrough$3 = unknown();
41391
41687
  var LlmProfileKindDescriptorSchema = object({
41392
41688
  kind: LlmProfileKindSchema,
41393
41689
  label: string(),
41690
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
41394
41691
  icon: string(),
41395
41692
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
41396
41693
  addonId: string(),
41397
- configSchema: ConfigSchemaPassthrough$3
41694
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
41695
+ connectionSchema: ConfigSchemaPassthrough$3,
41696
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
41697
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
41698
+ /** The kind's defaults; a model from `listModels` may override any of them. */
41699
+ features: LlmModelFeaturesSchema,
41700
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
41701
+ visionEditable: boolean(),
41702
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
41703
+ modelCatalog: _enum([
41704
+ "fetch",
41705
+ "static",
41706
+ "none"
41707
+ ]),
41708
+ staticModels: array(LlmModelInfoSchema).optional(),
41709
+ /** The common fields that mean something on this kind's wire. */
41710
+ profileFields: array(LlmProfileFieldSchema),
41711
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
41712
+ });
41713
+ /**
41714
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
41715
+ * (the editor's form); with `profileId` too, a secret the draft leaves
41716
+ * untouched (absent or the redaction marker) is resolved server-side from the
41717
+ * stored profile — the browser never receives it.
41718
+ */
41719
+ var LlmListModelsInputSchema = object({
41720
+ addonId: string(),
41721
+ kind: LlmProfileKindSchema,
41722
+ profileId: string().optional(),
41723
+ connection: LlmProviderConfigSchema.optional()
41398
41724
  });
41725
+ var LlmListModelsErrorCodeSchema = _enum([
41726
+ "auth",
41727
+ "network",
41728
+ "unsupported",
41729
+ "invalid"
41730
+ ]);
41731
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
41732
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
41733
+ ok: literal(true),
41734
+ models: array(LlmModelInfoSchema)
41735
+ }), object({
41736
+ ok: literal(false),
41737
+ code: LlmListModelsErrorCodeSchema,
41738
+ message: string()
41739
+ })]);
41399
41740
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
41400
41741
  var LlmDefaultSchema = object({
41401
41742
  selector: LlmDefaultSelectorSchema,
@@ -41495,7 +41836,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
41495
41836
  kind: "mutation",
41496
41837
  auth: "admin",
41497
41838
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
41498
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
41839
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
41840
+ kind: "mutation",
41841
+ auth: "admin"
41842
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
41499
41843
  selector: LlmDefaultSelectorSchema,
41500
41844
  profileId: string().nullable()
41501
41845
  }), _void(), {
@@ -46524,202 +46868,6 @@ var notificationRulesCapability = {
46524
46868
  }
46525
46869
  };
46526
46870
  /**
46527
- * Zod schemas for persisted record types.
46528
- *
46529
- * These schemas serve as the single source of truth for types that are
46530
- * stored in the settings-store backend and retrieved via tRPC. They
46531
- * replace the manual TypeScript interfaces with schema-derived types,
46532
- * enabling runtime validation when reading from the backend.
46533
- *
46534
- * Convention: each schema is named `<Type>Schema`, the inferred TS type
46535
- * keeps the original name for backward compatibility.
46536
- */
46537
- /**
46538
- * Auth model (v2 — 2026-05-12 caps-only):
46539
- *
46540
- * Two principals:
46541
- * - `isAdmin: true` — full bypass. Admin scope set is ignored.
46542
- * - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
46543
- *
46544
- * No role enum. There used to be `viewer / agent / scoped` and earlier
46545
- * `super_admin` — collapsed onto the single boolean because every
46546
- * non-admin caller is governed by the same scope-check rules; the
46547
- * distinction was only ever used to route role-specific procedures
46548
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
46549
- * with `isAdmin: false` + an explicit scope list.
46550
- */
46551
- /** Per-method access flavour. Materialised on every cap method via codegen. */
46552
- var MethodAccessSchema = _enum([
46553
- "view",
46554
- "create",
46555
- "delete"
46556
- ]);
46557
- /**
46558
- * A single scope grant. Three forms — checked in matcher with OR
46559
- * semantics; the first match decides whether the call passes:
46560
- *
46561
- * - `category` — broadest. `target: 'device' | 'system'` selects every
46562
- * cap with the matching `scope` declaration. New caps inherit grants
46563
- * automatically — adding a device cap to the codebase makes it
46564
- * reachable to every user with `category:device [...]` without a
46565
- * re-grant. Use this for "family viewer" / "operator" tiers.
46566
- *
46567
- * - `addon` — every cap that ships inside a given addon id. Niche;
46568
- * useful when an integration needs to interact with one specific
46569
- * addon's surface regardless of how many caps it exports.
46570
- *
46571
- * - `capability` — the most precise form. Single cap name. Use for
46572
- * integration tokens where you want to grant `addons.installPackage`
46573
- * and nothing else.
46574
- *
46575
- * `access` is REQUIRED with min 1 element. `admin` bypass is the
46576
- * "give me everything" escape; there is no wildcard scope.
46577
- */
46578
- var AllowedProviderSchema = union([literal("*"), array(string())]);
46579
- var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
46580
- var CapScopeSchema = _enum(["device", "system"]);
46581
- /**
46582
- * DeviceSelector (scope model v3 — 2026-08-12).
46583
- *
46584
- * A `device` grant no longer carries a frozen list of deviceIds. It carries
46585
- * a SELECTOR the matcher resolves against the live fleet, so the grant can be
46586
- * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
46587
- * AFTER the grant was minted — no re-grant, no re-login.
46588
- *
46589
- * - `all` — every device in the deployment. The broad viewer/operator
46590
- * lever without a `category` grant (a `category` grant also covers device
46591
- * caps that carry no deviceId; `all` is specifically the device set).
46592
- * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
46593
- * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
46594
- * is NOT covered until the grant is edited.
46595
- * - `types` — every device of a `DeviceType` (e.g. every `camera`).
46596
- * DYNAMIC. A device that changes type, or a new device of the type,
46597
- * re-resolves on the next request.
46598
- * - `locations` — every device whose operator-assigned `location` label is
46599
- * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
46600
- * null/unset location matches NO `locations` selector.
46601
- */
46602
- var DeviceSelectorSchema = discriminatedUnion("kind", [
46603
- object({ kind: literal("all") }),
46604
- object({
46605
- kind: literal("ids"),
46606
- ids: array(number().int()).min(1)
46607
- }),
46608
- object({
46609
- kind: literal("types"),
46610
- types: array(_enum(DeviceType)).min(1)
46611
- }),
46612
- object({
46613
- kind: literal("locations"),
46614
- locations: array(string().min(1)).min(1)
46615
- })
46616
- ]);
46617
- var DeviceTokenScopeSchema = object({
46618
- type: literal("device"),
46619
- /** The device SET this grant covers — resolved against the live fleet. */
46620
- selector: DeviceSelectorSchema,
46621
- access: array(MethodAccessSchema).min(1),
46622
- /**
46623
- * Whether a grant on a PARENT device transparently covers its accessory
46624
- * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
46625
- * Direction is parent → children ONLY.
46626
- *
46627
- * Absent → the matcher DERIVES it from the access flavour: `view`
46628
- * inherits (a camera viewer sees the camera's accessories), `create` /
46629
- * `delete` do NOT (actuating/removing a child is an explicit act the
46630
- * operator must grant on the child, not inherit from the parent). Set it
46631
- * explicitly to override that default per grant.
46632
- */
46633
- includeLinked: boolean().optional()
46634
- });
46635
- /**
46636
- * v2 → v3 lazy migration. A pre-v3 `device` grant carried
46637
- * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
46638
- * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
46639
- * EVERY parse path — stored records AND the JWT-carried scope arrays
46640
- * normalised at the request boundary ({@link normalizeTokenScopes} in
46641
- * `device-selector.ts`). Chosen over a one-time DB migration because a
46642
- * migration cannot reach a JWT already in a client's hands; parse-time
46643
- * migration covers both without a flag day. No cast — the raw object is read
46644
- * through `Reflect.get` (its static type is `unknown`).
46645
- */
46646
- function migrateLegacyTokenScope(raw) {
46647
- if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
46648
- if (Reflect.get(raw, "type") !== "device") return raw;
46649
- if (Reflect.get(raw, "selector") !== void 0) return raw;
46650
- const targets = Reflect.get(raw, "targets");
46651
- if (!Array.isArray(targets)) return raw;
46652
- return {
46653
- type: "device",
46654
- selector: {
46655
- kind: "ids",
46656
- ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
46657
- },
46658
- access: Reflect.get(raw, "access")
46659
- };
46660
- }
46661
- var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
46662
- object({
46663
- type: literal("category"),
46664
- target: CapScopeSchema,
46665
- access: array(MethodAccessSchema).min(1)
46666
- }),
46667
- object({
46668
- type: literal("capability"),
46669
- target: string(),
46670
- access: array(MethodAccessSchema).min(1)
46671
- }),
46672
- object({
46673
- type: literal("addon"),
46674
- target: string(),
46675
- access: array(MethodAccessSchema).min(1)
46676
- }),
46677
- DeviceTokenScopeSchema
46678
- ]));
46679
- object({
46680
- id: string(),
46681
- username: string(),
46682
- passwordHash: string(),
46683
- /**
46684
- * Admin bypass. When true, the middleware skips the scope-access
46685
- * check entirely. There is no other axis of privilege; the legacy
46686
- * role enum collapsed onto this boolean in v2.
46687
- */
46688
- isAdmin: boolean().default(false),
46689
- allowedProviders: AllowedProviderSchema,
46690
- allowedDevices: AllowedDevicesSchema,
46691
- /**
46692
- * Scopes granted to this user. Admins bypass; their `scopes` is
46693
- * ignored. Non-admins without scopes are locked out of every
46694
- * protected call.
46695
- */
46696
- scopes: array(TokenScopeSchema).default([]),
46697
- createdAt: number(),
46698
- updatedAt: number()
46699
- });
46700
- object({
46701
- id: string(),
46702
- label: string(),
46703
- isAdmin: boolean().default(false),
46704
- allowedProviders: AllowedProviderSchema,
46705
- allowedDevices: AllowedDevicesSchema,
46706
- tokenHash: string(),
46707
- tokenPrefix: string(),
46708
- createdAt: number(),
46709
- lastUsedAt: number().optional()
46710
- });
46711
- object({
46712
- id: string(),
46713
- userId: string(),
46714
- name: string(),
46715
- tokenHash: string(),
46716
- tokenPrefix: string(),
46717
- scopes: array(TokenScopeSchema),
46718
- expiresAt: number().nullish(),
46719
- lastUsedAt: number().nullish(),
46720
- createdAt: number()
46721
- });
46722
- /**
46723
46871
  * `oauth-integration` — a collection cap by which an addon declares
46724
46872
  * itself a linkable OAuth client of the hub's core `/oauth2/*` server.
46725
46873
  * Each provider returns a static descriptor; the core enumerates them
@@ -67666,26 +67814,6 @@ var ApiKeySummarySchema = object({
67666
67814
  createdAt: number(),
67667
67815
  lastUsedAt: number().optional()
67668
67816
  });
67669
- var ScopedTokenSummarySchema = object({
67670
- id: string(),
67671
- userId: string(),
67672
- name: string(),
67673
- tokenPrefix: string(),
67674
- scopes: array(TokenScopeSchema),
67675
- expiresAt: number().nullish(),
67676
- lastUsedAt: number().nullish(),
67677
- createdAt: number()
67678
- });
67679
- var CreateScopedTokenInputSchema = object({
67680
- userId: string(),
67681
- name: string(),
67682
- scopes: array(TokenScopeSchema),
67683
- expiresAt: number().optional()
67684
- });
67685
- var CreateScopedTokenResultSchema = object({
67686
- token: string(),
67687
- record: ScopedTokenSummarySchema
67688
- });
67689
67817
  var OauthSessionSummarySchema = object({
67690
67818
  id: string(),
67691
67819
  userId: string(),
@@ -67707,11 +67835,11 @@ var TotpStatusSchema = object({
67707
67835
  confirmedAt: number().nullable()
67708
67836
  });
67709
67837
  /**
67710
- * user-management — singleton capability for user accounts, API keys,
67711
- * and scoped tokens.
67838
+ * user-management — singleton capability for user accounts and the
67839
+ * legacy API-key rows.
67712
67840
  *
67713
67841
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
67714
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
67842
+ * — the subset check on `setUserScopes` is moot
67715
67843
  * because non-admins never reach these. If/when we open non-admin
67716
67844
  * delegation, structural caller-scope subset check goes inside the
67717
67845
  * provider.
@@ -67768,15 +67896,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
67768
67896
  kind: "mutation",
67769
67897
  auth: "admin",
67770
67898
  access: "delete"
67771
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
67772
- kind: "mutation",
67773
- auth: "admin",
67774
- access: "create"
67775
- }), method(object({ id: string() }), object({ success: literal(true) }), {
67776
- kind: "mutation",
67777
- auth: "admin",
67778
- access: "delete"
67779
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
67899
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
67780
67900
  kind: "mutation",
67781
67901
  auth: "admin",
67782
67902
  access: "create"
@@ -73436,7 +73556,7 @@ Object.freeze({
73436
73556
  capName: "llm",
73437
73557
  capScope: "system",
73438
73558
  addonId: null,
73439
- access: "view"
73559
+ access: "create"
73440
73560
  },
73441
73561
  "llm.listNodeModels": {
73442
73562
  capName: "llm",
@@ -78100,12 +78220,6 @@ Object.freeze({
78100
78220
  addonId: null,
78101
78221
  access: "create"
78102
78222
  },
78103
- "userManagement.createScopedToken": {
78104
- capName: "user-management",
78105
- capScope: "system",
78106
- addonId: null,
78107
- access: "create"
78108
- },
78109
78223
  "userManagement.createUser": {
78110
78224
  capName: "user-management",
78111
78225
  capScope: "system",
@@ -78154,12 +78268,6 @@ Object.freeze({
78154
78268
  addonId: null,
78155
78269
  access: "view"
78156
78270
  },
78157
- "userManagement.listScopedTokens": {
78158
- capName: "user-management",
78159
- capScope: "system",
78160
- addonId: null,
78161
- access: "view"
78162
- },
78163
78271
  "userManagement.listUsers": {
78164
78272
  capName: "user-management",
78165
78273
  capScope: "system",
@@ -78214,12 +78322,6 @@ Object.freeze({
78214
78322
  addonId: null,
78215
78323
  access: "delete"
78216
78324
  },
78217
- "userManagement.revokeScopedToken": {
78218
- capName: "user-management",
78219
- capScope: "system",
78220
- addonId: null,
78221
- access: "delete"
78222
- },
78223
78325
  "userManagement.setupTotp": {
78224
78326
  capName: "user-management",
78225
78327
  capScope: "system",
@@ -78250,12 +78352,6 @@ Object.freeze({
78250
78352
  addonId: null,
78251
78353
  access: "view"
78252
78354
  },
78253
- "userManagement.validateScopedToken": {
78254
- capName: "user-management",
78255
- capScope: "system",
78256
- addonId: null,
78257
- access: "view"
78258
- },
78259
78355
  "userManagement.verifyTotp": {
78260
78356
  capName: "user-management",
78261
78357
  capScope: "system",
@@ -86504,6 +86600,12 @@ Object.defineProperty(exports, "RECORD_MAX_DATA_BYTES", {
86504
86600
  return RECORD_MAX_DATA_BYTES;
86505
86601
  }
86506
86602
  });
86603
+ Object.defineProperty(exports, "RECORD_QUERY_MAX", {
86604
+ enumerable: true,
86605
+ get: function() {
86606
+ return RECORD_QUERY_MAX;
86607
+ }
86608
+ });
86507
86609
  Object.defineProperty(exports, "RebuildObjectEmbeddingsRefusalSchema", {
86508
86610
  enumerable: true,
86509
86611
  get: function() {