@camstack/addon-provider-hikvision 1.2.156 → 1.2.157

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 (3) hide show
  1. package/dist/addon.js +165 -102
  2. package/dist/addon.mjs +165 -102
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -5449,7 +5449,7 @@ var ZodIssueCode = {
5449
5449
  var ZodFirstPartyTypeKind;
5450
5450
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5451
5451
  //#endregion
5452
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5452
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5453
5453
  /**
5454
5454
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5455
5455
  * window to float samples (D455).
@@ -7832,9 +7832,9 @@ function normalizeAddonInitResult(result) {
7832
7832
  return result;
7833
7833
  }
7834
7834
  /**
7835
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7836
- * and validates them (`share-token.service.ts` builds its enum from this
7837
- * list); a data plane names the kinds it ACCEPTS in `share`.
7835
+ * The share-view scope kinds a share-link token can carry. The hub mints
7836
+ * and validates them (`ShareViewGrantSchema` builds its
7837
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7838
7838
  */
7839
7839
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7840
7840
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12841,7 +12841,7 @@ var ConvertResultSchema = object({
12841
12841
  * `super_admin` — collapsed onto the single boolean because every
12842
12842
  * non-admin caller is governed by the same scope-check rules; the
12843
12843
  * distinction was only ever used to route role-specific procedures
12844
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12844
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12845
12845
  * with `isAdmin: false` + an explicit scope list.
12846
12846
  */
12847
12847
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -13030,10 +13030,12 @@ var AddonRoutesScopeSchema = object({
13030
13030
  type: literal("addon-routes"),
13031
13031
  access: array(MethodAccessSchema).min(1)
13032
13032
  });
13033
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13033
13034
  var CredentialScopeSchema = union([
13034
13035
  literal("*"),
13035
13036
  ShareViewScopeSchema,
13036
13037
  AddonRoutesScopeSchema,
13038
+ PreferencesSelfScopeSchema,
13037
13039
  TokenScopeSchema
13038
13040
  ]);
13039
13041
  object({
@@ -13042,6 +13044,55 @@ object({
13042
13044
  jti: string().min(16),
13043
13045
  scopes: array(CredentialScopeSchema).min(1)
13044
13046
  });
13047
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13048
+ /** A namespace's value: a JSON object, opaque to the hub. */
13049
+ var PreferenceValueSchema = record(string(), unknown());
13050
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
13051
+ /** A stored row, as the owner reads it. */
13052
+ var PreferenceRowSchema = object({
13053
+ namespace: PreferenceNamespaceSchema,
13054
+ value: PreferenceValueSchema,
13055
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13056
+ revision: number().int().positive(),
13057
+ updatedAt: number().int(),
13058
+ /** The client id the last writer sent; `null` when it sent none. */
13059
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13060
+ });
13061
+ object({
13062
+ /** Absent: every namespace the caller holds. */
13063
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13064
+ object({ rows: array(PreferenceRowSchema) });
13065
+ object({
13066
+ namespace: PreferenceNamespaceSchema,
13067
+ value: PreferenceValueSchema,
13068
+ /**
13069
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13070
+ * namespace must not exist yet. Any other value that is not the current
13071
+ * revision answers `conflict` and writes nothing.
13072
+ */
13073
+ baseRevision: number().int().nonnegative().optional(),
13074
+ deviceId: PreferenceDeviceIdSchema.optional()
13075
+ });
13076
+ discriminatedUnion("status", [object({
13077
+ status: literal("saved"),
13078
+ row: PreferenceRowSchema
13079
+ }), object({
13080
+ status: literal("conflict"),
13081
+ current: PreferenceRowSchema.nullable()
13082
+ })]);
13083
+ object({ namespace: PreferenceNamespaceSchema });
13084
+ object({
13085
+ /** `false` when the namespace did not exist. */
13086
+ deleted: boolean() });
13087
+ object({
13088
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13089
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13090
+ object({
13091
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13092
+ rows: array(PreferenceRowSchema),
13093
+ /** Namespaces the client listed that no longer exist. */
13094
+ deleted: array(PreferenceNamespaceSchema)
13095
+ });
13045
13096
  _enum(["new-session", "step-up"]);
13046
13097
  /** The languages the hub's app landing pages are written in (D858). */
13047
13098
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -40350,38 +40401,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40350
40401
  auth: "admin",
40351
40402
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40352
40403
  });
40404
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
40405
+ /** What a model (or, by default, every model of a kind) can do. */
40406
+ var LlmModelFeaturesSchema = object({
40407
+ vision: boolean(),
40408
+ tools: boolean(),
40409
+ streaming: boolean()
40410
+ });
40411
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40412
+ var LlmModelInfoSchema = object({
40413
+ id: string(),
40414
+ label: string().optional(),
40415
+ contextLength: number().int().positive().optional(),
40416
+ features: LlmModelFeaturesSchema.partial().optional()
40417
+ });
40353
40418
  /**
40354
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40355
- * methods concat-fan across providers; single-row methods route to ONE
40356
- * provider by the `addonId` in the call input (the notification-output
40357
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40358
- * (hub-placed); the cap stays open for future providers.
40359
- *
40360
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40361
- * `apiKey` is a password field — providers REDACT it on read and merge on
40362
- * write; a stored key NEVER round-trips to a client.
40419
+ * The provider-specific part of a profile, validated by the provider that owns
40420
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40421
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40422
+ * keychain, never in the row, and reads back as the redaction marker.
40363
40423
  */
40364
- var LlmProfileKindSchema = _enum([
40365
- "openai-compatible",
40366
- "openai",
40367
- "anthropic",
40368
- "google",
40369
- "managed-local",
40370
- "apple-foundation"
40371
- ]);
40424
+ var LlmProviderConfigSchema = record(string(), unknown());
40372
40425
  var LlmProfileSchema = object({
40373
40426
  id: string(),
40374
40427
  name: string(),
40428
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40375
40429
  kind: LlmProfileKindSchema,
40376
40430
  /** Stamped by the provider — keeps the fanned catalog routable. */
40377
40431
  addonId: string(),
40378
40432
  enabled: boolean(),
40379
40433
  /** Vendor model id, or the managed runtime's loaded model. */
40380
40434
  model: string(),
40381
- /** Required for openai-compatible; override for cloud kinds. */
40382
- baseUrl: string().optional(),
40383
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40384
- apiKey: string().optional(),
40385
40435
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
40386
40436
  * degraded to text — that shipped once and produced a confident answer to a
40387
40437
  * question about a picture nobody sent. */
@@ -40389,15 +40439,11 @@ var LlmProfileSchema = object({
40389
40439
  temperature: number().min(0).max(2).optional(),
40390
40440
  /** Nucleus sampling. Every wire we speak has it. */
40391
40441
  topP: number().min(0).max(1).optional(),
40392
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
40393
- * wire does, and the client drops it there (measured: the request body gets
40394
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
40395
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40442
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40443
+ * field in its editor only when its descriptor lists it in `profileFields`. */
40396
40444
  topK: number().int().positive().optional(),
40397
40445
  maxTokens: number().int().positive().optional(),
40398
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40399
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40400
- * the model with, so it is the one field that changes a PROCESS. */
40446
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40401
40447
  contextLength: number().int().positive().optional(),
40402
40448
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40403
40449
  * two system prompts fighting is worse than either alone). */
@@ -40423,16 +40469,37 @@ var LlmProfileSchema = object({
40423
40469
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40424
40470
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40425
40471
  toolsEnabled: boolean().default(false),
40426
- extraHeaders: record(string(), string()).optional(),
40427
- /** kind === 'managed-local' only (spec §4). */
40428
- runtime: ManagedRuntimeConfigSchema.optional(),
40429
- /**
40430
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40431
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40432
- * `supportsVision` on such a row is stamped by the provider from the node's
40433
- * reported `imageInput`, never taken from the operator (D62).
40434
- */
40435
- appleFoundation: object({ nodeId: string() }).optional()
40472
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40473
+ providerConfig: LlmProviderConfigSchema.default({})
40474
+ });
40475
+ /**
40476
+ * The common profile fields a kind's editor offers. The editor owns how each
40477
+ * one is drawn; the provider says which of them mean something on its wire.
40478
+ */
40479
+ var LlmProfileFieldSchema = _enum([
40480
+ "temperature",
40481
+ "topP",
40482
+ "topK",
40483
+ "maxTokens",
40484
+ "contextLength",
40485
+ "systemPrompt",
40486
+ "timeoutMs",
40487
+ "connectTimeoutMs",
40488
+ "firstTokenTimeoutMs",
40489
+ "idleTimeoutMs",
40490
+ "retry",
40491
+ "toolsEnabled"
40492
+ ]);
40493
+ /**
40494
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40495
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40496
+ * picker: that widget owns the model choice.
40497
+ */
40498
+ var LlmProviderWidgetSchema = object({
40499
+ id: string(),
40500
+ placement: _enum(["connection", "model"]),
40501
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40502
+ requires: array(string()).optional()
40436
40503
  });
40437
40504
  /** ConfigUISchema tree passed through untyped on the wire (the
40438
40505
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40441,11 +40508,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40441
40508
  var LlmProfileKindDescriptorSchema = object({
40442
40509
  kind: LlmProfileKindSchema,
40443
40510
  label: string(),
40511
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40444
40512
  icon: string(),
40445
40513
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40446
40514
  addonId: string(),
40447
- configSchema: ConfigSchemaPassthrough$3
40515
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40516
+ connectionSchema: ConfigSchemaPassthrough$3,
40517
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40518
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40519
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40520
+ features: LlmModelFeaturesSchema,
40521
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40522
+ visionEditable: boolean(),
40523
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40524
+ modelCatalog: _enum([
40525
+ "fetch",
40526
+ "static",
40527
+ "none"
40528
+ ]),
40529
+ staticModels: array(LlmModelInfoSchema).optional(),
40530
+ /** The common fields that mean something on this kind's wire. */
40531
+ profileFields: array(LlmProfileFieldSchema),
40532
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40448
40533
  });
40534
+ /**
40535
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40536
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40537
+ * untouched (absent or the redaction marker) is resolved server-side from the
40538
+ * stored profile — the browser never receives it.
40539
+ */
40540
+ var LlmListModelsInputSchema = object({
40541
+ addonId: string(),
40542
+ kind: LlmProfileKindSchema,
40543
+ profileId: string().optional(),
40544
+ connection: LlmProviderConfigSchema.optional()
40545
+ });
40546
+ var LlmListModelsErrorCodeSchema = _enum([
40547
+ "auth",
40548
+ "network",
40549
+ "unsupported",
40550
+ "invalid"
40551
+ ]);
40552
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40553
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40554
+ ok: literal(true),
40555
+ models: array(LlmModelInfoSchema)
40556
+ }), object({
40557
+ ok: literal(false),
40558
+ code: LlmListModelsErrorCodeSchema,
40559
+ message: string()
40560
+ })]);
40449
40561
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40450
40562
  var LlmDefaultSchema = object({
40451
40563
  selector: LlmDefaultSelectorSchema,
@@ -40545,7 +40657,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40545
40657
  kind: "mutation",
40546
40658
  auth: "admin",
40547
40659
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40548
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40660
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40661
+ kind: "mutation",
40662
+ auth: "admin"
40663
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40549
40664
  selector: LlmDefaultSelectorSchema,
40550
40665
  profileId: string().nullable()
40551
40666
  }), _void(), {
@@ -65516,26 +65631,6 @@ var ApiKeySummarySchema = object({
65516
65631
  createdAt: number(),
65517
65632
  lastUsedAt: number().optional()
65518
65633
  });
65519
- var ScopedTokenSummarySchema = object({
65520
- id: string(),
65521
- userId: string(),
65522
- name: string(),
65523
- tokenPrefix: string(),
65524
- scopes: array(TokenScopeSchema),
65525
- expiresAt: number().nullish(),
65526
- lastUsedAt: number().nullish(),
65527
- createdAt: number()
65528
- });
65529
- var CreateScopedTokenInputSchema = object({
65530
- userId: string(),
65531
- name: string(),
65532
- scopes: array(TokenScopeSchema),
65533
- expiresAt: number().optional()
65534
- });
65535
- var CreateScopedTokenResultSchema = object({
65536
- token: string(),
65537
- record: ScopedTokenSummarySchema
65538
- });
65539
65634
  var OauthSessionSummarySchema = object({
65540
65635
  id: string(),
65541
65636
  userId: string(),
@@ -65557,11 +65652,11 @@ var TotpStatusSchema = object({
65557
65652
  confirmedAt: number().nullable()
65558
65653
  });
65559
65654
  /**
65560
- * user-management — singleton capability for user accounts, API keys,
65561
- * and scoped tokens.
65655
+ * user-management — singleton capability for user accounts and the
65656
+ * legacy API-key rows.
65562
65657
  *
65563
65658
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
65564
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
65659
+ * — the subset check on `setUserScopes` is moot
65565
65660
  * because non-admins never reach these. If/when we open non-admin
65566
65661
  * delegation, structural caller-scope subset check goes inside the
65567
65662
  * provider.
@@ -65618,15 +65713,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
65618
65713
  kind: "mutation",
65619
65714
  auth: "admin",
65620
65715
  access: "delete"
65621
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
65622
- kind: "mutation",
65623
- auth: "admin",
65624
- access: "create"
65625
- }), method(object({ id: string() }), object({ success: literal(true) }), {
65626
- kind: "mutation",
65627
- auth: "admin",
65628
- access: "delete"
65629
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
65716
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
65630
65717
  kind: "mutation",
65631
65718
  auth: "admin",
65632
65719
  access: "create"
@@ -71735,7 +71822,7 @@ Object.freeze({
71735
71822
  capName: "llm",
71736
71823
  capScope: "system",
71737
71824
  addonId: null,
71738
- access: "view"
71825
+ access: "create"
71739
71826
  },
71740
71827
  "llm.listNodeModels": {
71741
71828
  capName: "llm",
@@ -76399,12 +76486,6 @@ Object.freeze({
76399
76486
  addonId: null,
76400
76487
  access: "create"
76401
76488
  },
76402
- "userManagement.createScopedToken": {
76403
- capName: "user-management",
76404
- capScope: "system",
76405
- addonId: null,
76406
- access: "create"
76407
- },
76408
76489
  "userManagement.createUser": {
76409
76490
  capName: "user-management",
76410
76491
  capScope: "system",
@@ -76453,12 +76534,6 @@ Object.freeze({
76453
76534
  addonId: null,
76454
76535
  access: "view"
76455
76536
  },
76456
- "userManagement.listScopedTokens": {
76457
- capName: "user-management",
76458
- capScope: "system",
76459
- addonId: null,
76460
- access: "view"
76461
- },
76462
76537
  "userManagement.listUsers": {
76463
76538
  capName: "user-management",
76464
76539
  capScope: "system",
@@ -76513,12 +76588,6 @@ Object.freeze({
76513
76588
  addonId: null,
76514
76589
  access: "delete"
76515
76590
  },
76516
- "userManagement.revokeScopedToken": {
76517
- capName: "user-management",
76518
- capScope: "system",
76519
- addonId: null,
76520
- access: "delete"
76521
- },
76522
76591
  "userManagement.setupTotp": {
76523
76592
  capName: "user-management",
76524
76593
  capScope: "system",
@@ -76549,12 +76618,6 @@ Object.freeze({
76549
76618
  addonId: null,
76550
76619
  access: "view"
76551
76620
  },
76552
- "userManagement.validateScopedToken": {
76553
- capName: "user-management",
76554
- capScope: "system",
76555
- addonId: null,
76556
- access: "view"
76557
- },
76558
76621
  "userManagement.verifyTotp": {
76559
76622
  capName: "user-management",
76560
76623
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -5428,7 +5428,7 @@ var ZodIssueCode = {
5428
5428
  var ZodFirstPartyTypeKind;
5429
5429
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5430
5430
  //#endregion
5431
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5431
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5432
5432
  /**
5433
5433
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5434
5434
  * window to float samples (D455).
@@ -7811,9 +7811,9 @@ function normalizeAddonInitResult(result) {
7811
7811
  return result;
7812
7812
  }
7813
7813
  /**
7814
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7815
- * and validates them (`share-token.service.ts` builds its enum from this
7816
- * list); a data plane names the kinds it ACCEPTS in `share`.
7814
+ * The share-view scope kinds a share-link token can carry. The hub mints
7815
+ * and validates them (`ShareViewGrantSchema` builds its
7816
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7817
7817
  */
7818
7818
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7819
7819
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12820,7 +12820,7 @@ var ConvertResultSchema = object({
12820
12820
  * `super_admin` — collapsed onto the single boolean because every
12821
12821
  * non-admin caller is governed by the same scope-check rules; the
12822
12822
  * distinction was only ever used to route role-specific procedures
12823
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12823
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12824
12824
  * with `isAdmin: false` + an explicit scope list.
12825
12825
  */
12826
12826
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -13009,10 +13009,12 @@ var AddonRoutesScopeSchema = object({
13009
13009
  type: literal("addon-routes"),
13010
13010
  access: array(MethodAccessSchema).min(1)
13011
13011
  });
13012
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
13012
13013
  var CredentialScopeSchema = union([
13013
13014
  literal("*"),
13014
13015
  ShareViewScopeSchema,
13015
13016
  AddonRoutesScopeSchema,
13017
+ PreferencesSelfScopeSchema,
13016
13018
  TokenScopeSchema
13017
13019
  ]);
13018
13020
  object({
@@ -13021,6 +13023,55 @@ object({
13021
13023
  jti: string().min(16),
13022
13024
  scopes: array(CredentialScopeSchema).min(1)
13023
13025
  });
13026
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
13027
+ /** A namespace's value: a JSON object, opaque to the hub. */
13028
+ var PreferenceValueSchema = record(string(), unknown());
13029
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
13030
+ /** A stored row, as the owner reads it. */
13031
+ var PreferenceRowSchema = object({
13032
+ namespace: PreferenceNamespaceSchema,
13033
+ value: PreferenceValueSchema,
13034
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
13035
+ revision: number().int().positive(),
13036
+ updatedAt: number().int(),
13037
+ /** The client id the last writer sent; `null` when it sent none. */
13038
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
13039
+ });
13040
+ object({
13041
+ /** Absent: every namespace the caller holds. */
13042
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
13043
+ object({ rows: array(PreferenceRowSchema) });
13044
+ object({
13045
+ namespace: PreferenceNamespaceSchema,
13046
+ value: PreferenceValueSchema,
13047
+ /**
13048
+ * The revision the edit was based on. Absent: last write wins. `0`: the
13049
+ * namespace must not exist yet. Any other value that is not the current
13050
+ * revision answers `conflict` and writes nothing.
13051
+ */
13052
+ baseRevision: number().int().nonnegative().optional(),
13053
+ deviceId: PreferenceDeviceIdSchema.optional()
13054
+ });
13055
+ discriminatedUnion("status", [object({
13056
+ status: literal("saved"),
13057
+ row: PreferenceRowSchema
13058
+ }), object({
13059
+ status: literal("conflict"),
13060
+ current: PreferenceRowSchema.nullable()
13061
+ })]);
13062
+ object({ namespace: PreferenceNamespaceSchema });
13063
+ object({
13064
+ /** `false` when the namespace did not exist. */
13065
+ deleted: boolean() });
13066
+ object({
13067
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
13068
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
13069
+ object({
13070
+ /** Every row whose revision differs from the client's, and every row it did not list. */
13071
+ rows: array(PreferenceRowSchema),
13072
+ /** Namespaces the client listed that no longer exist. */
13073
+ deleted: array(PreferenceNamespaceSchema)
13074
+ });
13024
13075
  _enum(["new-session", "step-up"]);
13025
13076
  /** The languages the hub's app landing pages are written in (D858). */
13026
13077
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -40329,38 +40380,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40329
40380
  auth: "admin",
40330
40381
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40331
40382
  });
40383
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
40384
+ /** What a model (or, by default, every model of a kind) can do. */
40385
+ var LlmModelFeaturesSchema = object({
40386
+ vision: boolean(),
40387
+ tools: boolean(),
40388
+ streaming: boolean()
40389
+ });
40390
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40391
+ var LlmModelInfoSchema = object({
40392
+ id: string(),
40393
+ label: string().optional(),
40394
+ contextLength: number().int().positive().optional(),
40395
+ features: LlmModelFeaturesSchema.partial().optional()
40396
+ });
40332
40397
  /**
40333
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40334
- * methods concat-fan across providers; single-row methods route to ONE
40335
- * provider by the `addonId` in the call input (the notification-output
40336
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40337
- * (hub-placed); the cap stays open for future providers.
40338
- *
40339
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40340
- * `apiKey` is a password field — providers REDACT it on read and merge on
40341
- * write; a stored key NEVER round-trips to a client.
40398
+ * The provider-specific part of a profile, validated by the provider that owns
40399
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40400
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40401
+ * keychain, never in the row, and reads back as the redaction marker.
40342
40402
  */
40343
- var LlmProfileKindSchema = _enum([
40344
- "openai-compatible",
40345
- "openai",
40346
- "anthropic",
40347
- "google",
40348
- "managed-local",
40349
- "apple-foundation"
40350
- ]);
40403
+ var LlmProviderConfigSchema = record(string(), unknown());
40351
40404
  var LlmProfileSchema = object({
40352
40405
  id: string(),
40353
40406
  name: string(),
40407
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40354
40408
  kind: LlmProfileKindSchema,
40355
40409
  /** Stamped by the provider — keeps the fanned catalog routable. */
40356
40410
  addonId: string(),
40357
40411
  enabled: boolean(),
40358
40412
  /** Vendor model id, or the managed runtime's loaded model. */
40359
40413
  model: string(),
40360
- /** Required for openai-compatible; override for cloud kinds. */
40361
- baseUrl: string().optional(),
40362
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40363
- apiKey: string().optional(),
40364
40414
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
40365
40415
  * degraded to text — that shipped once and produced a confident answer to a
40366
40416
  * question about a picture nobody sent. */
@@ -40368,15 +40418,11 @@ var LlmProfileSchema = object({
40368
40418
  temperature: number().min(0).max(2).optional(),
40369
40419
  /** Nucleus sampling. Every wire we speak has it. */
40370
40420
  topP: number().min(0).max(1).optional(),
40371
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
40372
- * wire does, and the client drops it there (measured: the request body gets
40373
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
40374
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40421
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40422
+ * field in its editor only when its descriptor lists it in `profileFields`. */
40375
40423
  topK: number().int().positive().optional(),
40376
40424
  maxTokens: number().int().positive().optional(),
40377
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40378
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40379
- * the model with, so it is the one field that changes a PROCESS. */
40425
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40380
40426
  contextLength: number().int().positive().optional(),
40381
40427
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40382
40428
  * two system prompts fighting is worse than either alone). */
@@ -40402,16 +40448,37 @@ var LlmProfileSchema = object({
40402
40448
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40403
40449
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40404
40450
  toolsEnabled: boolean().default(false),
40405
- extraHeaders: record(string(), string()).optional(),
40406
- /** kind === 'managed-local' only (spec §4). */
40407
- runtime: ManagedRuntimeConfigSchema.optional(),
40408
- /**
40409
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40410
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40411
- * `supportsVision` on such a row is stamped by the provider from the node's
40412
- * reported `imageInput`, never taken from the operator (D62).
40413
- */
40414
- appleFoundation: object({ nodeId: string() }).optional()
40451
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40452
+ providerConfig: LlmProviderConfigSchema.default({})
40453
+ });
40454
+ /**
40455
+ * The common profile fields a kind's editor offers. The editor owns how each
40456
+ * one is drawn; the provider says which of them mean something on its wire.
40457
+ */
40458
+ var LlmProfileFieldSchema = _enum([
40459
+ "temperature",
40460
+ "topP",
40461
+ "topK",
40462
+ "maxTokens",
40463
+ "contextLength",
40464
+ "systemPrompt",
40465
+ "timeoutMs",
40466
+ "connectTimeoutMs",
40467
+ "firstTokenTimeoutMs",
40468
+ "idleTimeoutMs",
40469
+ "retry",
40470
+ "toolsEnabled"
40471
+ ]);
40472
+ /**
40473
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40474
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40475
+ * picker: that widget owns the model choice.
40476
+ */
40477
+ var LlmProviderWidgetSchema = object({
40478
+ id: string(),
40479
+ placement: _enum(["connection", "model"]),
40480
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40481
+ requires: array(string()).optional()
40415
40482
  });
40416
40483
  /** ConfigUISchema tree passed through untyped on the wire (the
40417
40484
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40420,11 +40487,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40420
40487
  var LlmProfileKindDescriptorSchema = object({
40421
40488
  kind: LlmProfileKindSchema,
40422
40489
  label: string(),
40490
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40423
40491
  icon: string(),
40424
40492
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40425
40493
  addonId: string(),
40426
- configSchema: ConfigSchemaPassthrough$3
40494
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40495
+ connectionSchema: ConfigSchemaPassthrough$3,
40496
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40497
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40498
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40499
+ features: LlmModelFeaturesSchema,
40500
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40501
+ visionEditable: boolean(),
40502
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40503
+ modelCatalog: _enum([
40504
+ "fetch",
40505
+ "static",
40506
+ "none"
40507
+ ]),
40508
+ staticModels: array(LlmModelInfoSchema).optional(),
40509
+ /** The common fields that mean something on this kind's wire. */
40510
+ profileFields: array(LlmProfileFieldSchema),
40511
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40427
40512
  });
40513
+ /**
40514
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40515
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40516
+ * untouched (absent or the redaction marker) is resolved server-side from the
40517
+ * stored profile — the browser never receives it.
40518
+ */
40519
+ var LlmListModelsInputSchema = object({
40520
+ addonId: string(),
40521
+ kind: LlmProfileKindSchema,
40522
+ profileId: string().optional(),
40523
+ connection: LlmProviderConfigSchema.optional()
40524
+ });
40525
+ var LlmListModelsErrorCodeSchema = _enum([
40526
+ "auth",
40527
+ "network",
40528
+ "unsupported",
40529
+ "invalid"
40530
+ ]);
40531
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40532
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40533
+ ok: literal(true),
40534
+ models: array(LlmModelInfoSchema)
40535
+ }), object({
40536
+ ok: literal(false),
40537
+ code: LlmListModelsErrorCodeSchema,
40538
+ message: string()
40539
+ })]);
40428
40540
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40429
40541
  var LlmDefaultSchema = object({
40430
40542
  selector: LlmDefaultSelectorSchema,
@@ -40524,7 +40636,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40524
40636
  kind: "mutation",
40525
40637
  auth: "admin",
40526
40638
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40527
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40639
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40640
+ kind: "mutation",
40641
+ auth: "admin"
40642
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40528
40643
  selector: LlmDefaultSelectorSchema,
40529
40644
  profileId: string().nullable()
40530
40645
  }), _void(), {
@@ -65495,26 +65610,6 @@ var ApiKeySummarySchema = object({
65495
65610
  createdAt: number(),
65496
65611
  lastUsedAt: number().optional()
65497
65612
  });
65498
- var ScopedTokenSummarySchema = object({
65499
- id: string(),
65500
- userId: string(),
65501
- name: string(),
65502
- tokenPrefix: string(),
65503
- scopes: array(TokenScopeSchema),
65504
- expiresAt: number().nullish(),
65505
- lastUsedAt: number().nullish(),
65506
- createdAt: number()
65507
- });
65508
- var CreateScopedTokenInputSchema = object({
65509
- userId: string(),
65510
- name: string(),
65511
- scopes: array(TokenScopeSchema),
65512
- expiresAt: number().optional()
65513
- });
65514
- var CreateScopedTokenResultSchema = object({
65515
- token: string(),
65516
- record: ScopedTokenSummarySchema
65517
- });
65518
65613
  var OauthSessionSummarySchema = object({
65519
65614
  id: string(),
65520
65615
  userId: string(),
@@ -65536,11 +65631,11 @@ var TotpStatusSchema = object({
65536
65631
  confirmedAt: number().nullable()
65537
65632
  });
65538
65633
  /**
65539
- * user-management — singleton capability for user accounts, API keys,
65540
- * and scoped tokens.
65634
+ * user-management — singleton capability for user accounts and the
65635
+ * legacy API-key rows.
65541
65636
  *
65542
65637
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
65543
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
65638
+ * — the subset check on `setUserScopes` is moot
65544
65639
  * because non-admins never reach these. If/when we open non-admin
65545
65640
  * delegation, structural caller-scope subset check goes inside the
65546
65641
  * provider.
@@ -65597,15 +65692,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
65597
65692
  kind: "mutation",
65598
65693
  auth: "admin",
65599
65694
  access: "delete"
65600
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
65601
- kind: "mutation",
65602
- auth: "admin",
65603
- access: "create"
65604
- }), method(object({ id: string() }), object({ success: literal(true) }), {
65605
- kind: "mutation",
65606
- auth: "admin",
65607
- access: "delete"
65608
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
65695
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
65609
65696
  kind: "mutation",
65610
65697
  auth: "admin",
65611
65698
  access: "create"
@@ -71714,7 +71801,7 @@ Object.freeze({
71714
71801
  capName: "llm",
71715
71802
  capScope: "system",
71716
71803
  addonId: null,
71717
- access: "view"
71804
+ access: "create"
71718
71805
  },
71719
71806
  "llm.listNodeModels": {
71720
71807
  capName: "llm",
@@ -76378,12 +76465,6 @@ Object.freeze({
76378
76465
  addonId: null,
76379
76466
  access: "create"
76380
76467
  },
76381
- "userManagement.createScopedToken": {
76382
- capName: "user-management",
76383
- capScope: "system",
76384
- addonId: null,
76385
- access: "create"
76386
- },
76387
76468
  "userManagement.createUser": {
76388
76469
  capName: "user-management",
76389
76470
  capScope: "system",
@@ -76432,12 +76513,6 @@ Object.freeze({
76432
76513
  addonId: null,
76433
76514
  access: "view"
76434
76515
  },
76435
- "userManagement.listScopedTokens": {
76436
- capName: "user-management",
76437
- capScope: "system",
76438
- addonId: null,
76439
- access: "view"
76440
- },
76441
76516
  "userManagement.listUsers": {
76442
76517
  capName: "user-management",
76443
76518
  capScope: "system",
@@ -76492,12 +76567,6 @@ Object.freeze({
76492
76567
  addonId: null,
76493
76568
  access: "delete"
76494
76569
  },
76495
- "userManagement.revokeScopedToken": {
76496
- capName: "user-management",
76497
- capScope: "system",
76498
- addonId: null,
76499
- access: "delete"
76500
- },
76501
76570
  "userManagement.setupTotp": {
76502
76571
  capName: "user-management",
76503
76572
  capScope: "system",
@@ -76528,12 +76597,6 @@ Object.freeze({
76528
76597
  addonId: null,
76529
76598
  access: "view"
76530
76599
  },
76531
- "userManagement.validateScopedToken": {
76532
- capName: "user-management",
76533
- capScope: "system",
76534
- addonId: null,
76535
- access: "view"
76536
- },
76537
76600
  "userManagement.verifyTotp": {
76538
76601
  capName: "user-management",
76539
76602
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-hikvision",
3
- "version": "1.2.156",
3
+ "version": "1.2.157",
4
4
  "description": "Hikvision camera device provider addon for CamStack — ISAPI over HTTP(S) with digest auth (snapshot, alarm stream, RTSP discovery)",
5
5
  "keywords": [
6
6
  "camstack",