@camstack/types 1.2.386 → 1.2.387

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.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-BE7_6UnC.js");
2
+ const require_sleep = require("./sleep-6sOPE0EV.js");
3
3
  const require_event_category = require("./event-category-eSqkye-K.js");
4
4
  const require_composition = require("./composition-eoYYVfOp.js");
5
5
  const require_node_color = require("./node-color.js");
@@ -6616,7 +6616,7 @@ function classifyBearerPrincipal(payload) {
6616
6616
  * would lock every non-admin viewer out of recorder playback, snapshot media
6617
6617
  * and the stream-broker embed, which is a worse outcome than the hole.
6618
6618
  * - **integration** — must hold `addon:<addonId>` at the verb's access. This is
6619
- * the same rule the `cst_` scoped-token branch has always applied; the JWT
6619
+ * the same rule the scoped-token branch has always applied; the JWT
6620
6620
  * branch simply never applied it, and closing that divergence IS the fix.
6621
6621
  * `isAdmin` is ignored: an integration token is minted `isAdmin: false` and a
6622
6622
  * token claiming otherwise must not talk its way past the grant.
@@ -6660,7 +6660,7 @@ function principalMayReachAddon(input) {
6660
6660
  * `super_admin` — collapsed onto the single boolean because every
6661
6661
  * non-admin caller is governed by the same scope-check rules; the
6662
6662
  * distinction was only ever used to route role-specific procedures
6663
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
6663
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
6664
6664
  * with `isAdmin: false` + an explicit scope list.
6665
6665
  */
6666
6666
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -6839,13 +6839,13 @@ var ScopedTokenSchema = zod.z.object({
6839
6839
  /**
6840
6840
  * The ONE permission vocabulary every credential is reduced to (D892).
6841
6841
  *
6842
- * A credential — a login session, an account-link token, a legacy `csa_` /
6843
- * `cst_` / `csv_` token, or the unified token `auth.mintToken` issues — is
6842
+ * A credential — a login session, an account-link token, or a token
6843
+ * `auth.mintToken` issues (there is no other format, D895) — is
6844
6844
  * verified into a principal whose permissions are a `CredentialScope[]`, and
6845
6845
  * nothing else. What KIND of credential it was never decides what it may do:
6846
6846
  *
6847
- * - `'*'` — everything (the admin bypass). Held by an admin's session, a
6848
- * legacy admin token, and a unified token minted with it.
6847
+ * - `'*'` — everything (the admin bypass). Held by an admin's session and
6848
+ * a token minted with it.
6849
6849
  * - a {@link TokenScope} — the v3 capability grants (`category`,
6850
6850
  * `capability`, `addon`, `device`) the tRPC matcher has always applied.
6851
6851
  * - `share-view` — one fail-closed embed perimeter (`grid-view` /
@@ -6854,7 +6854,12 @@ var ScopedTokenSchema = zod.z.object({
6854
6854
  * - `addon-routes` — may reach any addon's own `authenticated` HTTP routes
6855
6855
  * and data planes (never an `admin` one). A person's session has always
6856
6856
  * had this; an integration token never had it and must hold
6857
- * `addon:<id>` instead.
6857
+ * `addon:<id>` instead. Only an admin may mint it into a token.
6858
+ * - `preferences-self` — may read and write the SUBJECT's own account
6859
+ * preferences (D894), never another user's. Every person's session holds
6860
+ * it; a unified token holds it only when minted with it. `'*'` does NOT
6861
+ * imply it: the hub's own mesh principal holds `'*'` and is nobody's
6862
+ * account.
6858
6863
  *
6859
6864
  * Pure: no I/O. It lives in `@camstack/types` so the hub, the kernel and any
6860
6865
  * addon read the same vocabulary.
@@ -6878,10 +6883,14 @@ var AddonRoutesScopeSchema = zod.z.object({
6878
6883
  type: zod.z.literal("addon-routes"),
6879
6884
  access: zod.z.array(MethodAccessSchema).min(1)
6880
6885
  });
6886
+ var PreferencesSelfScopeSchema = zod.z.object({ type: zod.z.literal("preferences-self") });
6887
+ /** The grant every person's session carries for its own account preferences. */
6888
+ var PREFERENCES_SELF_SCOPE = { type: "preferences-self" };
6881
6889
  var CredentialScopeSchema = zod.z.union([
6882
6890
  zod.z.literal("*"),
6883
6891
  ShareViewScopeSchema,
6884
6892
  AddonRoutesScopeSchema,
6893
+ PreferencesSelfScopeSchema,
6885
6894
  TokenScopeSchema
6886
6895
  ]);
6887
6896
  /** Every access flavour — what a person's session holds on addon routes. */
@@ -6891,7 +6900,7 @@ var ALL_METHOD_ACCESS = [
6891
6900
  "delete"
6892
6901
  ];
6893
6902
  function isTokenScope(scope) {
6894
- return scope !== "*" && scope.type !== "share-view" && scope.type !== "addon-routes";
6903
+ return scope !== "*" && scope.type !== "share-view" && scope.type !== "addon-routes" && scope.type !== "preferences-self";
6895
6904
  }
6896
6905
  /** True iff the scope set holds `'*'`. */
6897
6906
  function scopesGrantAdmin(scopes) {
@@ -6915,6 +6924,15 @@ function scopesAllowAddonRoutes(scopes, access) {
6915
6924
  return scopes.some((s) => s !== "*" && s.type === "addon-routes" && s.access.includes(access));
6916
6925
  }
6917
6926
  /**
6927
+ * True iff the set may touch its subject's own account preferences: it holds
6928
+ * `preferences-self` and no share-view grant restricts it. `'*'` alone is not
6929
+ * enough (see the vocabulary above).
6930
+ */
6931
+ function scopesAllowOwnPreferences(scopes) {
6932
+ if (shareViewGrantOf(scopes) !== null) return false;
6933
+ return scopes.some((s) => s !== "*" && s.type === "preferences-self");
6934
+ }
6935
+ /**
6918
6936
  * Parse a scope array from an untrusted source (a JWT claim, a stored row).
6919
6937
  * Any element that does not parse makes the WHOLE set unusable — `null` — so
6920
6938
  * a corrupt grant can never degrade into a partial one.
@@ -6931,6 +6949,22 @@ function parseCredentialScopes(raw) {
6931
6949
  */
6932
6950
  var CREDENTIAL_TOKEN_KIND = "credential";
6933
6951
  /**
6952
+ * The `aud` claim every minted token is signed with (D895). The hub's raw JWT
6953
+ * verify (`AuthManager.verifyToken`, used by every surface that wants a LOGIN
6954
+ * session — the OAuth consent page, the session cookie, health, backups)
6955
+ * refuses a token carrying it, so a minted token — a share link above all —
6956
+ * can never be replayed as a person's session. Only the credential verifier's
6957
+ * own door (`verifyCredentialToken`) accepts it.
6958
+ */
6959
+ var CREDENTIAL_TOKEN_AUDIENCE = "camstack:credential";
6960
+ /** Does a verified JWT payload belong to the minted-token family? */
6961
+ function isCredentialTokenPayload(payload) {
6962
+ if (payload === null || typeof payload !== "object") return false;
6963
+ const kind = Reflect.get(payload, "kind");
6964
+ const aud = Reflect.get(payload, "aud");
6965
+ return kind === "credential" || aud === "camstack:credential" || Array.isArray(aud) && aud.includes("camstack:credential");
6966
+ }
6967
+ /**
6934
6968
  * The claims of a unified token (`auth.mintToken`). It carries no `exp`: its
6935
6969
  * row (looked up by `jti` on every verify, for revocation) holds the ONE
6936
6970
  * expiry, so a share link can be extended and a JWT clock can never disagree
@@ -6943,6 +6977,80 @@ var CredentialTokenClaimsSchema = zod.z.object({
6943
6977
  scopes: zod.z.array(CredentialScopeSchema).min(1)
6944
6978
  });
6945
6979
  //#endregion
6980
+ //#region src/schemas/user-preferences.ts
6981
+ /**
6982
+ * Per-user ACCOUNT preferences (D894): the hub-side half of the viewer's two
6983
+ * settings levels.
6984
+ *
6985
+ * - DEVICE settings never leave the phone.
6986
+ * - ACCOUNT settings live here: one row per `(user, namespace)`, private to
6987
+ * that user, synced across every device signed in as them, last write wins
6988
+ * unless the writer sends the revision it based its edit on.
6989
+ *
6990
+ * A setting lives in exactly ONE level; there are no overrides. The caller
6991
+ * never names a user: the hub stamps the principal's own id, admin included.
6992
+ *
6993
+ * The contract the client codes against is the `preferences.*` tRPC router
6994
+ * (`server/backend/src/api/core/preferences.router.ts`).
6995
+ */
6996
+ /** `viewer.app`, `viewer.cameras`, `viewer.grids` … — lowercase, dot/dash separated. */
6997
+ var PREFERENCES_NAMESPACE_PATTERN = /^[a-z][a-z0-9.-]{0,63}$/;
6998
+ /** One row's value, measured as UTF-8 JSON. */
6999
+ var PREFERENCES_MAX_VALUE_BYTES = 256 * 1024;
7000
+ /** Namespaces one user may hold. */
7001
+ var PREFERENCES_MAX_NAMESPACES = 32;
7002
+ /** The opaque client id a writer stamps (`updatedByDevice`). */
7003
+ var PREFERENCES_MAX_DEVICE_ID_LENGTH = 64;
7004
+ var PreferenceNamespaceSchema = zod.z.string().regex(PREFERENCES_NAMESPACE_PATTERN);
7005
+ /** A namespace's value: a JSON object, opaque to the hub. */
7006
+ var PreferenceValueSchema = zod.z.record(zod.z.string(), zod.z.unknown());
7007
+ var PreferenceDeviceIdSchema = zod.z.string().min(1).max(64);
7008
+ /** A stored row, as the owner reads it. */
7009
+ var PreferenceRowSchema = zod.z.object({
7010
+ namespace: PreferenceNamespaceSchema,
7011
+ value: PreferenceValueSchema,
7012
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
7013
+ revision: zod.z.number().int().positive(),
7014
+ updatedAt: zod.z.number().int(),
7015
+ /** The client id the last writer sent; `null` when it sent none. */
7016
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
7017
+ });
7018
+ var PreferencesGetInputSchema = zod.z.object({
7019
+ /** Absent: every namespace the caller holds. */
7020
+ namespaces: zod.z.array(PreferenceNamespaceSchema).max(32).optional() });
7021
+ var PreferencesGetOutputSchema = zod.z.object({ rows: zod.z.array(PreferenceRowSchema) });
7022
+ var PreferencesPutInputSchema = zod.z.object({
7023
+ namespace: PreferenceNamespaceSchema,
7024
+ value: PreferenceValueSchema,
7025
+ /**
7026
+ * The revision the edit was based on. Absent: last write wins. `0`: the
7027
+ * namespace must not exist yet. Any other value that is not the current
7028
+ * revision answers `conflict` and writes nothing.
7029
+ */
7030
+ baseRevision: zod.z.number().int().nonnegative().optional(),
7031
+ deviceId: PreferenceDeviceIdSchema.optional()
7032
+ });
7033
+ var PreferencesPutOutputSchema = zod.z.discriminatedUnion("status", [zod.z.object({
7034
+ status: zod.z.literal("saved"),
7035
+ row: PreferenceRowSchema
7036
+ }), zod.z.object({
7037
+ status: zod.z.literal("conflict"),
7038
+ current: PreferenceRowSchema.nullable()
7039
+ })]);
7040
+ var PreferencesDeleteInputSchema = zod.z.object({ namespace: PreferenceNamespaceSchema });
7041
+ var PreferencesDeleteOutputSchema = zod.z.object({
7042
+ /** `false` when the namespace did not exist. */
7043
+ deleted: zod.z.boolean() });
7044
+ var PreferencesChangedSinceInputSchema = zod.z.object({
7045
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
7046
+ revisionByNamespace: zod.z.record(PreferenceNamespaceSchema, zod.z.number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
7047
+ var PreferencesChangedSinceOutputSchema = zod.z.object({
7048
+ /** Every row whose revision differs from the client's, and every row it did not list. */
7049
+ rows: zod.z.array(PreferenceRowSchema),
7050
+ /** Namespaces the client listed that no longer exist. */
7051
+ deleted: zod.z.array(PreferenceNamespaceSchema)
7052
+ });
7053
+ //#endregion
6946
7054
  //#region src/auth/app-callback.ts
6947
7055
  /**
6948
7056
  * The viewer app's custom-scheme callback — the ONE list of URLs a hub flow
@@ -40118,30 +40226,50 @@ var llmRuntimeCapability = {
40118
40226
  * (hub-placed); the cap stays open for future providers.
40119
40227
  *
40120
40228
  * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40121
- * `apiKey` is a password field — providers REDACT it on read and merge on
40122
- * write; a stored key NEVER round-trips to a client.
40123
- */
40124
- var LlmProfileKindSchema = zod.z.enum([
40125
- "openai-compatible",
40126
- "openai",
40127
- "anthropic",
40128
- "google",
40129
- "managed-local",
40130
- "apple-foundation"
40131
- ]);
40229
+ * A row is common fields plus `providerConfig`, which the provider owning the
40230
+ * row's kind declares (`connectionSchema`) and validates. The kind is an open
40231
+ * id declared by that provider (D893). A `password` field of the provider's
40232
+ * schema is a secret — providers REDACT it on read and merge on write; a
40233
+ * stored key NEVER round-trips to a client.
40234
+ */
40235
+ /**
40236
+ * A profile kind is an OPEN id, declared by the provider that serves it
40237
+ * (`listProfileKinds`). The cap names no kind: a new provider ships a new kind
40238
+ * without a framework change. Lower-case, digits and dashes, so it stays safe
40239
+ * as a URL segment, a record field and a CSS hook.
40240
+ */
40241
+ var LLM_PROFILE_KIND_PATTERN = /^[a-z0-9][a-z0-9-]{0,63}$/;
40242
+ var LlmProfileKindSchema = zod.z.string().regex(LLM_PROFILE_KIND_PATTERN, "a kind id is lower-case letters, digits and dashes");
40243
+ /** What a model (or, by default, every model of a kind) can do. */
40244
+ var LlmModelFeaturesSchema = zod.z.object({
40245
+ vision: zod.z.boolean(),
40246
+ tools: zod.z.boolean(),
40247
+ streaming: zod.z.boolean()
40248
+ });
40249
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40250
+ var LlmModelInfoSchema = zod.z.object({
40251
+ id: zod.z.string(),
40252
+ label: zod.z.string().optional(),
40253
+ contextLength: zod.z.number().int().positive().optional(),
40254
+ features: LlmModelFeaturesSchema.partial().optional()
40255
+ });
40256
+ /**
40257
+ * The provider-specific part of a profile, validated by the provider that owns
40258
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40259
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40260
+ * keychain, never in the row, and reads back as the redaction marker.
40261
+ */
40262
+ var LlmProviderConfigSchema = zod.z.record(zod.z.string(), zod.z.unknown());
40132
40263
  var LlmProfileSchema = zod.z.object({
40133
40264
  id: zod.z.string(),
40134
40265
  name: zod.z.string(),
40266
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40135
40267
  kind: LlmProfileKindSchema,
40136
40268
  /** Stamped by the provider — keeps the fanned catalog routable. */
40137
40269
  addonId: zod.z.string(),
40138
40270
  enabled: zod.z.boolean(),
40139
40271
  /** Vendor model id, or the managed runtime's loaded model. */
40140
40272
  model: zod.z.string(),
40141
- /** Required for openai-compatible; override for cloud kinds. */
40142
- baseUrl: zod.z.string().optional(),
40143
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40144
- apiKey: zod.z.string().optional(),
40145
40273
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
40146
40274
  * degraded to text — that shipped once and produced a confident answer to a
40147
40275
  * question about a picture nobody sent. */
@@ -40149,15 +40277,11 @@ var LlmProfileSchema = zod.z.object({
40149
40277
  temperature: zod.z.number().min(0).max(2).optional(),
40150
40278
  /** Nucleus sampling. Every wire we speak has it. */
40151
40279
  topP: zod.z.number().min(0).max(1).optional(),
40152
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
40153
- * wire does, and the client drops it there (measured: the request body gets
40154
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
40155
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40280
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40281
+ * field in its editor only when its descriptor lists it in `profileFields`. */
40156
40282
  topK: zod.z.number().int().positive().optional(),
40157
40283
  maxTokens: zod.z.number().int().positive().optional(),
40158
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40159
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40160
- * the model with, so it is the one field that changes a PROCESS. */
40284
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40161
40285
  contextLength: zod.z.number().int().positive().optional(),
40162
40286
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40163
40287
  * two system prompts fighting is worse than either alone). */
@@ -40183,16 +40307,37 @@ var LlmProfileSchema = zod.z.object({
40183
40307
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40184
40308
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40185
40309
  toolsEnabled: zod.z.boolean().default(false),
40186
- extraHeaders: zod.z.record(zod.z.string(), zod.z.string()).optional(),
40187
- /** kind === 'managed-local' only (spec §4). */
40188
- runtime: ManagedRuntimeConfigSchema.optional(),
40189
- /**
40190
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40191
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40192
- * `supportsVision` on such a row is stamped by the provider from the node's
40193
- * reported `imageInput`, never taken from the operator (D62).
40194
- */
40195
- appleFoundation: zod.z.object({ nodeId: zod.z.string() }).optional()
40310
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40311
+ providerConfig: LlmProviderConfigSchema.default({})
40312
+ });
40313
+ /**
40314
+ * The common profile fields a kind's editor offers. The editor owns how each
40315
+ * one is drawn; the provider says which of them mean something on its wire.
40316
+ */
40317
+ var LlmProfileFieldSchema = zod.z.enum([
40318
+ "temperature",
40319
+ "topP",
40320
+ "topK",
40321
+ "maxTokens",
40322
+ "contextLength",
40323
+ "systemPrompt",
40324
+ "timeoutMs",
40325
+ "connectTimeoutMs",
40326
+ "firstTokenTimeoutMs",
40327
+ "idleTimeoutMs",
40328
+ "retry",
40329
+ "toolsEnabled"
40330
+ ]);
40331
+ /**
40332
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40333
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40334
+ * picker: that widget owns the model choice.
40335
+ */
40336
+ var LlmProviderWidgetSchema = zod.z.object({
40337
+ id: zod.z.string(),
40338
+ placement: zod.z.enum(["connection", "model"]),
40339
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40340
+ requires: zod.z.array(zod.z.string()).optional()
40196
40341
  });
40197
40342
  /** ConfigUISchema tree passed through untyped on the wire (the
40198
40343
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40201,11 +40346,56 @@ var ConfigSchemaPassthrough$3 = zod.z.unknown();
40201
40346
  var LlmProfileKindDescriptorSchema = zod.z.object({
40202
40347
  kind: LlmProfileKindSchema,
40203
40348
  label: zod.z.string(),
40349
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40204
40350
  icon: zod.z.string(),
40205
40351
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40206
40352
  addonId: zod.z.string(),
40207
- configSchema: ConfigSchemaPassthrough$3
40353
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40354
+ connectionSchema: ConfigSchemaPassthrough$3,
40355
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40356
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40357
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40358
+ features: LlmModelFeaturesSchema,
40359
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40360
+ visionEditable: zod.z.boolean(),
40361
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40362
+ modelCatalog: zod.z.enum([
40363
+ "fetch",
40364
+ "static",
40365
+ "none"
40366
+ ]),
40367
+ staticModels: zod.z.array(LlmModelInfoSchema).optional(),
40368
+ /** The common fields that mean something on this kind's wire. */
40369
+ profileFields: zod.z.array(LlmProfileFieldSchema),
40370
+ providerWidgets: zod.z.array(LlmProviderWidgetSchema).optional()
40208
40371
  });
40372
+ /**
40373
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40374
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40375
+ * untouched (absent or the redaction marker) is resolved server-side from the
40376
+ * stored profile — the browser never receives it.
40377
+ */
40378
+ var LlmListModelsInputSchema = zod.z.object({
40379
+ addonId: zod.z.string(),
40380
+ kind: LlmProfileKindSchema,
40381
+ profileId: zod.z.string().optional(),
40382
+ connection: LlmProviderConfigSchema.optional()
40383
+ });
40384
+ var LlmListModelsErrorCodeSchema = zod.z.enum([
40385
+ "auth",
40386
+ "network",
40387
+ "unsupported",
40388
+ "invalid"
40389
+ ]);
40390
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40391
+ var LlmListModelsResultSchema = zod.z.discriminatedUnion("ok", [zod.z.object({
40392
+ ok: zod.z.literal(true),
40393
+ models: zod.z.array(LlmModelInfoSchema)
40394
+ }), zod.z.object({
40395
+ ok: zod.z.literal(false),
40396
+ code: LlmListModelsErrorCodeSchema,
40397
+ message: zod.z.string()
40398
+ })]);
40209
40399
  var LlmDefaultSelectorSchema = zod.z.union([zod.z.object({ consumer: zod.z.string() }), zod.z.object({ purpose: zod.z.enum(["text", "vision"]) })]);
40210
40400
  var LlmDefaultSchema = zod.z.object({
40211
40401
  selector: LlmDefaultSelectorSchema,
@@ -40336,8 +40526,17 @@ var llmCapability = {
40336
40526
  auth: "admin",
40337
40527
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40338
40528
  }),
40339
- /** Live vendor enumeration (GET /models etc.). */
40340
- listModels: require_sleep.method(ProfileRefInputSchema, zod.z.array(zod.z.string())),
40529
+ /**
40530
+ * The models a kind offers, for a SAVED profile or an unsaved draft
40531
+ * (`connection`). A mutation, not a query: a draft may carry a key, and a
40532
+ * query's input travels in the URL. Admin: it dials whatever endpoint the
40533
+ * draft names and may resolve a stored key to do it. The answer never
40534
+ * carries a secret — failures are a typed result, never a throw.
40535
+ */
40536
+ listModels: require_sleep.method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40537
+ kind: "mutation",
40538
+ auth: "admin"
40539
+ }),
40341
40540
  getDefaults: require_sleep.method(zod.z.object({}), zod.z.array(LlmDefaultSchema)),
40342
40541
  setDefault: require_sleep.method(zod.z.object({
40343
40542
  selector: LlmDefaultSelectorSchema,
@@ -72461,26 +72660,6 @@ var ApiKeySummarySchema = zod.z.object({
72461
72660
  createdAt: zod.z.number(),
72462
72661
  lastUsedAt: zod.z.number().optional()
72463
72662
  });
72464
- var ScopedTokenSummarySchema = zod.z.object({
72465
- id: zod.z.string(),
72466
- userId: zod.z.string(),
72467
- name: zod.z.string(),
72468
- tokenPrefix: zod.z.string(),
72469
- scopes: zod.z.array(TokenScopeSchema),
72470
- expiresAt: zod.z.number().nullish(),
72471
- lastUsedAt: zod.z.number().nullish(),
72472
- createdAt: zod.z.number()
72473
- });
72474
- var CreateScopedTokenInputSchema = zod.z.object({
72475
- userId: zod.z.string(),
72476
- name: zod.z.string(),
72477
- scopes: zod.z.array(TokenScopeSchema),
72478
- expiresAt: zod.z.number().optional()
72479
- });
72480
- var CreateScopedTokenResultSchema = zod.z.object({
72481
- token: zod.z.string(),
72482
- record: ScopedTokenSummarySchema
72483
- });
72484
72663
  var OauthSessionSummarySchema = zod.z.object({
72485
72664
  id: zod.z.string(),
72486
72665
  userId: zod.z.string(),
@@ -72502,11 +72681,11 @@ var TotpStatusSchema = zod.z.object({
72502
72681
  confirmedAt: zod.z.number().nullable()
72503
72682
  });
72504
72683
  /**
72505
- * user-management — singleton capability for user accounts, API keys,
72506
- * and scoped tokens.
72684
+ * user-management — singleton capability for user accounts and the
72685
+ * legacy API-key rows.
72507
72686
  *
72508
72687
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
72509
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
72688
+ * — the subset check on `setUserScopes` is moot
72510
72689
  * because non-admins never reach these. If/when we open non-admin
72511
72690
  * delegation, structural caller-scope subset check goes inside the
72512
72691
  * provider.
@@ -72577,18 +72756,6 @@ var userManagementCapability = {
72577
72756
  auth: "admin",
72578
72757
  access: "delete"
72579
72758
  }),
72580
- createScopedToken: require_sleep.method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
72581
- kind: "mutation",
72582
- auth: "admin",
72583
- access: "create"
72584
- }),
72585
- revokeScopedToken: require_sleep.method(zod.z.object({ id: zod.z.string() }), zod.z.object({ success: zod.z.literal(true) }), {
72586
- kind: "mutation",
72587
- auth: "admin",
72588
- access: "delete"
72589
- }),
72590
- validateScopedToken: require_sleep.method(zod.z.object({ token: zod.z.string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }),
72591
- listScopedTokens: require_sleep.method(zod.z.object({ userId: zod.z.string() }), zod.z.array(ScopedTokenSummarySchema), { auth: "admin" }),
72592
72759
  setupTotp: require_sleep.method(zod.z.object({ userId: zod.z.string() }), TotpSetupResultSchema, {
72593
72760
  kind: "mutation",
72594
72761
  auth: "admin",
@@ -80812,7 +80979,7 @@ var METHOD_ACCESS_MAP = Object.freeze({
80812
80979
  capName: "llm",
80813
80980
  capScope: "system",
80814
80981
  addonId: null,
80815
- access: "view"
80982
+ access: "create"
80816
80983
  },
80817
80984
  "llm.listNodeModels": {
80818
80985
  capName: "llm",
@@ -85476,12 +85643,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
85476
85643
  addonId: null,
85477
85644
  access: "create"
85478
85645
  },
85479
- "userManagement.createScopedToken": {
85480
- capName: "user-management",
85481
- capScope: "system",
85482
- addonId: null,
85483
- access: "create"
85484
- },
85485
85646
  "userManagement.createUser": {
85486
85647
  capName: "user-management",
85487
85648
  capScope: "system",
@@ -85530,12 +85691,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
85530
85691
  addonId: null,
85531
85692
  access: "view"
85532
85693
  },
85533
- "userManagement.listScopedTokens": {
85534
- capName: "user-management",
85535
- capScope: "system",
85536
- addonId: null,
85537
- access: "view"
85538
- },
85539
85694
  "userManagement.listUsers": {
85540
85695
  capName: "user-management",
85541
85696
  capScope: "system",
@@ -85590,12 +85745,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
85590
85745
  addonId: null,
85591
85746
  access: "delete"
85592
85747
  },
85593
- "userManagement.revokeScopedToken": {
85594
- capName: "user-management",
85595
- capScope: "system",
85596
- addonId: null,
85597
- access: "delete"
85598
- },
85599
85748
  "userManagement.setupTotp": {
85600
85749
  capName: "user-management",
85601
85750
  capScope: "system",
@@ -85626,12 +85775,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
85626
85775
  addonId: null,
85627
85776
  access: "view"
85628
85777
  },
85629
- "userManagement.validateScopedToken": {
85630
- capName: "user-management",
85631
- capScope: "system",
85632
- addonId: null,
85633
- access: "view"
85634
- },
85635
85778
  "userManagement.verifyTotp": {
85636
85779
  capName: "user-management",
85637
85780
  capScope: "system",
@@ -93639,7 +93782,7 @@ function createSystemProxy(api) {
93639
93782
  migrateRawSecrets: (input) => dispatch("llm", "migrateRawSecrets", "mutation", input),
93640
93783
  deleteProfile: (input) => dispatch("llm", "deleteProfile", "mutation", input),
93641
93784
  testProfile: (input) => dispatch("llm", "testProfile", "mutation", input),
93642
- listModels: (input) => dispatch("llm", "listModels", "query", input),
93785
+ listModels: (input) => dispatch("llm", "listModels", "mutation", input),
93643
93786
  getDefaults: (input) => dispatch("llm", "getDefaults", "query", input),
93644
93787
  setDefault: (input) => dispatch("llm", "setDefault", "mutation", input),
93645
93788
  getUsage: (input) => dispatch("llm", "getUsage", "query", input),
@@ -94083,10 +94226,6 @@ function createSystemProxy(api) {
94083
94226
  validateCredentials: (input) => dispatch("userManagement", "validateCredentials", "mutation", input),
94084
94227
  listApiKeys: (input) => dispatch("userManagement", "listApiKeys", "query", input),
94085
94228
  revokeApiKey: (input) => dispatch("userManagement", "revokeApiKey", "mutation", input),
94086
- createScopedToken: (input) => dispatch("userManagement", "createScopedToken", "mutation", input),
94087
- revokeScopedToken: (input) => dispatch("userManagement", "revokeScopedToken", "mutation", input),
94088
- validateScopedToken: (input) => dispatch("userManagement", "validateScopedToken", "query", input),
94089
- listScopedTokens: (input) => dispatch("userManagement", "listScopedTokens", "query", input),
94090
94229
  setupTotp: (input) => dispatch("userManagement", "setupTotp", "mutation", input),
94091
94230
  confirmTotp: (input) => dispatch("userManagement", "confirmTotp", "mutation", input),
94092
94231
  disableTotp: (input) => dispatch("userManagement", "disableTotp", "mutation", input),
@@ -103201,6 +103340,7 @@ exports.CONNECTION_TEST_TIMEOUT_MS = CONNECTION_TEST_TIMEOUT_MS;
103201
103340
  exports.CONTAINER_CHILD_PRIORITY = CONTAINER_CHILD_PRIORITY;
103202
103341
  exports.CORE_BLOCKS_ADDON_ID = CORE_BLOCKS_ADDON_ID;
103203
103342
  exports.CORE_BLOCK_ADDON_PREFIX = CORE_BLOCK_ADDON_PREFIX;
103343
+ exports.CREDENTIAL_TOKEN_AUDIENCE = CREDENTIAL_TOKEN_AUDIENCE;
103204
103344
  exports.CREDENTIAL_TOKEN_KIND = CREDENTIAL_TOKEN_KIND;
103205
103345
  exports.CROP_SUPPLY_SOURCES = CROP_SUPPLY_SOURCES;
103206
103346
  exports.CROP_SUPPLY_STEP_IDS = CROP_SUPPLY_STEP_IDS;
@@ -103379,8 +103519,6 @@ exports.CoreBlockStatusSchema = CoreBlockStatusSchema;
103379
103519
  exports.CoverStateSchema = CoverStateSchema;
103380
103520
  exports.CoverStatusSchema = CoverStatusSchema;
103381
103521
  exports.CreateIntegrationInputSchema = CreateIntegrationInputSchema;
103382
- exports.CreateScopedTokenInputSchema = CreateScopedTokenInputSchema;
103383
- exports.CreateScopedTokenResultSchema = CreateScopedTokenResultSchema;
103384
103522
  exports.CreateUserInputSchema = CreateUserInputSchema;
103385
103523
  exports.CredentialScopeSchema = CredentialScopeSchema;
103386
103524
  exports.CredentialTokenClaimsSchema = CredentialTokenClaimsSchema;
@@ -103763,6 +103901,7 @@ exports.LABEL_SUPPLY_VOCABULARIES = LABEL_SUPPLY_VOCABULARIES;
103763
103901
  exports.LEGACY_READ_ONLY_CONFIG_KEY = LEGACY_READ_ONLY_CONFIG_KEY;
103764
103902
  exports.LINKED_DEVICES_SLOT = LINKED_DEVICES_SLOT;
103765
103903
  exports.LINKED_LABEL_STEP_PREFIX = LINKED_LABEL_STEP_PREFIX;
103904
+ exports.LLM_PROFILE_KIND_PATTERN = LLM_PROFILE_KIND_PATTERN;
103766
103905
  exports.LOAD_CONTRIBUTION_ATTRIBUTIONS = LOAD_CONTRIBUTION_ATTRIBUTIONS;
103767
103906
  exports.LOAD_CONTRIBUTION_ROLES = LOAD_CONTRIBUTION_ROLES;
103768
103907
  exports.LOCATION_DESCRIPTION_MAX = LOCATION_DESCRIPTION_MAX;
@@ -103799,10 +103938,18 @@ exports.LlmGenerateErrSchema = LlmGenerateErrSchema;
103799
103938
  exports.LlmGenerateOkSchema = LlmGenerateOkSchema;
103800
103939
  exports.LlmGenerateResultSchema = LlmGenerateResultSchema;
103801
103940
  exports.LlmImageSchema = LlmImageSchema;
103941
+ exports.LlmListModelsErrorCodeSchema = LlmListModelsErrorCodeSchema;
103942
+ exports.LlmListModelsInputSchema = LlmListModelsInputSchema;
103943
+ exports.LlmListModelsResultSchema = LlmListModelsResultSchema;
103944
+ exports.LlmModelFeaturesSchema = LlmModelFeaturesSchema;
103945
+ exports.LlmModelInfoSchema = LlmModelInfoSchema;
103802
103946
  exports.LlmNodeModelSchema = LlmNodeModelSchema;
103947
+ exports.LlmProfileFieldSchema = LlmProfileFieldSchema;
103803
103948
  exports.LlmProfileKindDescriptorSchema = LlmProfileKindDescriptorSchema;
103804
103949
  exports.LlmProfileKindSchema = LlmProfileKindSchema;
103805
103950
  exports.LlmProfileSchema = LlmProfileSchema;
103951
+ exports.LlmProviderConfigSchema = LlmProviderConfigSchema;
103952
+ exports.LlmProviderWidgetSchema = LlmProviderWidgetSchema;
103806
103953
  exports.LlmRefusalSourceSchema = LlmRefusalSourceSchema;
103807
103954
  exports.LlmRetryPolicySchema = LlmRetryPolicySchema;
103808
103955
  exports.LlmRuntimeAppleCompleteInputSchema = LlmRuntimeAppleCompleteInputSchema;
@@ -104261,6 +104408,11 @@ exports.PIPELINE_ANALYTICS_CAP_NAME = PIPELINE_ANALYTICS_CAP_NAME;
104261
104408
  exports.PIPELINE_FLOW_CAPABILITY_NAMES = PIPELINE_FLOW_CAPABILITY_NAMES;
104262
104409
  exports.PIPELINE_OWNER_CAPABILITY_NAMES = PIPELINE_OWNER_CAPABILITY_NAMES;
104263
104410
  exports.PIPELINE_RAMP = PIPELINE_RAMP;
104411
+ exports.PREFERENCES_MAX_DEVICE_ID_LENGTH = PREFERENCES_MAX_DEVICE_ID_LENGTH;
104412
+ exports.PREFERENCES_MAX_NAMESPACES = PREFERENCES_MAX_NAMESPACES;
104413
+ exports.PREFERENCES_MAX_VALUE_BYTES = PREFERENCES_MAX_VALUE_BYTES;
104414
+ exports.PREFERENCES_NAMESPACE_PATTERN = PREFERENCES_NAMESPACE_PATTERN;
104415
+ exports.PREFERENCES_SELF_SCOPE = PREFERENCES_SELF_SCOPE;
104264
104416
  exports.PRIVACY_MASK_CAP_NAME = PRIVACY_MASK_CAP_NAME;
104265
104417
  exports.PROVIDER_KIND_CAP_NAMES = PROVIDER_KIND_CAP_NAMES;
104266
104418
  exports.PROVIDER_PIN_FIELD = require_sleep.PROVIDER_PIN_FIELD;
@@ -104300,6 +104452,19 @@ exports.PlaintextSecretError = require_sleep.PlaintextSecretError;
104300
104452
  exports.PolygonPointSchema = PolygonPointSchema;
104301
104453
  exports.PoolMemoryWatchdog = PoolMemoryWatchdog;
104302
104454
  exports.PowerMeterStatusSchema = PowerMeterStatusSchema;
104455
+ exports.PreferenceDeviceIdSchema = PreferenceDeviceIdSchema;
104456
+ exports.PreferenceNamespaceSchema = PreferenceNamespaceSchema;
104457
+ exports.PreferenceRowSchema = PreferenceRowSchema;
104458
+ exports.PreferenceValueSchema = PreferenceValueSchema;
104459
+ exports.PreferencesChangedSinceInputSchema = PreferencesChangedSinceInputSchema;
104460
+ exports.PreferencesChangedSinceOutputSchema = PreferencesChangedSinceOutputSchema;
104461
+ exports.PreferencesDeleteInputSchema = PreferencesDeleteInputSchema;
104462
+ exports.PreferencesDeleteOutputSchema = PreferencesDeleteOutputSchema;
104463
+ exports.PreferencesGetInputSchema = PreferencesGetInputSchema;
104464
+ exports.PreferencesGetOutputSchema = PreferencesGetOutputSchema;
104465
+ exports.PreferencesPutInputSchema = PreferencesPutInputSchema;
104466
+ exports.PreferencesPutOutputSchema = PreferencesPutOutputSchema;
104467
+ exports.PreferencesSelfScopeSchema = PreferencesSelfScopeSchema;
104303
104468
  exports.PresenceStatusSchema = PresenceStatusSchema;
104304
104469
  exports.PressureSensorStatusSchema = PressureSensorStatusSchema;
104305
104470
  exports.PrivacyMaskOptionsSchema = PrivacyMaskOptionsSchema;
@@ -104582,7 +104747,6 @@ exports.SceneUnavailableSchema = SceneUnavailableSchema;
104582
104747
  exports.SceneUncoveredPolicySchema = SceneUncoveredPolicySchema;
104583
104748
  exports.SceneVerdictSchema = SceneVerdictSchema;
104584
104749
  exports.ScopedTokenSchema = ScopedTokenSchema;
104585
- exports.ScopedTokenSummarySchema = ScopedTokenSummarySchema;
104586
104750
  exports.ScoredObjectEventSchema = ScoredObjectEventSchema;
104587
104751
  exports.ScriptRunnerStatusSchema = ScriptRunnerStatusSchema;
104588
104752
  exports.SearchResultSchema = SearchResultSchema;
@@ -105265,6 +105429,7 @@ exports.isBaseConditionKey = isBaseConditionKey;
105265
105429
  exports.isBatteryPresenceFault = isBatteryPresenceFault;
105266
105430
  exports.isClusterScopedStep = isClusterScopedStep;
105267
105431
  exports.isCollectionArrayMethod = isCollectionArrayMethod;
105432
+ exports.isCredentialTokenPayload = isCredentialTokenPayload;
105268
105433
  exports.isDefaultAlarmProfileId = isDefaultAlarmProfileId;
105269
105434
  exports.isDefaultAppConnectionEndpoint = isDefaultAppConnectionEndpoint;
105270
105435
  exports.isDefinitiveDeviceRefusal = isDefinitiveDeviceRefusal;
@@ -105604,6 +105769,7 @@ exports.scopeKey = require_sleep.scopeKey;
105604
105769
  exports.scopesAllowAddon = scopesAllowAddon;
105605
105770
  exports.scopesAllowAddonRoutes = scopesAllowAddonRoutes;
105606
105771
  exports.scopesAllowDeviceCap = scopesAllowDeviceCap;
105772
+ exports.scopesAllowOwnPreferences = scopesAllowOwnPreferences;
105607
105773
  exports.scopesGrantAdmin = scopesGrantAdmin;
105608
105774
  exports.scoreRuntimes = scoreRuntimes;
105609
105775
  exports.scriptRunnerCapability = scriptRunnerCapability;