@camstack/addon-provider-amcrest 0.2.141 → 0.2.142

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
@@ -5450,7 +5450,7 @@ var ZodIssueCode = {
5450
5450
  var ZodFirstPartyTypeKind;
5451
5451
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5452
5452
  //#endregion
5453
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5453
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5454
5454
  /**
5455
5455
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5456
5456
  * window to float samples (D455).
@@ -7833,9 +7833,9 @@ function normalizeAddonInitResult(result) {
7833
7833
  return result;
7834
7834
  }
7835
7835
  /**
7836
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7837
- * and validates them (`share-token.service.ts` builds its enum from this
7838
- * list); a data plane names the kinds it ACCEPTS in `share`.
7836
+ * The share-view scope kinds a share-link token can carry. The hub mints
7837
+ * and validates them (`ShareViewGrantSchema` builds its
7838
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7839
7839
  */
7840
7840
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7841
7841
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12549,7 +12549,7 @@ var ConvertResultSchema = object({
12549
12549
  * `super_admin` — collapsed onto the single boolean because every
12550
12550
  * non-admin caller is governed by the same scope-check rules; the
12551
12551
  * distinction was only ever used to route role-specific procedures
12552
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12552
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12553
12553
  * with `isAdmin: false` + an explicit scope list.
12554
12554
  */
12555
12555
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -12738,10 +12738,12 @@ var AddonRoutesScopeSchema = object({
12738
12738
  type: literal("addon-routes"),
12739
12739
  access: array(MethodAccessSchema).min(1)
12740
12740
  });
12741
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
12741
12742
  var CredentialScopeSchema = union([
12742
12743
  literal("*"),
12743
12744
  ShareViewScopeSchema,
12744
12745
  AddonRoutesScopeSchema,
12746
+ PreferencesSelfScopeSchema,
12745
12747
  TokenScopeSchema
12746
12748
  ]);
12747
12749
  object({
@@ -12750,6 +12752,55 @@ object({
12750
12752
  jti: string().min(16),
12751
12753
  scopes: array(CredentialScopeSchema).min(1)
12752
12754
  });
12755
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
12756
+ /** A namespace's value: a JSON object, opaque to the hub. */
12757
+ var PreferenceValueSchema = record(string(), unknown());
12758
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
12759
+ /** A stored row, as the owner reads it. */
12760
+ var PreferenceRowSchema = object({
12761
+ namespace: PreferenceNamespaceSchema,
12762
+ value: PreferenceValueSchema,
12763
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
12764
+ revision: number().int().positive(),
12765
+ updatedAt: number().int(),
12766
+ /** The client id the last writer sent; `null` when it sent none. */
12767
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
12768
+ });
12769
+ object({
12770
+ /** Absent: every namespace the caller holds. */
12771
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
12772
+ object({ rows: array(PreferenceRowSchema) });
12773
+ object({
12774
+ namespace: PreferenceNamespaceSchema,
12775
+ value: PreferenceValueSchema,
12776
+ /**
12777
+ * The revision the edit was based on. Absent: last write wins. `0`: the
12778
+ * namespace must not exist yet. Any other value that is not the current
12779
+ * revision answers `conflict` and writes nothing.
12780
+ */
12781
+ baseRevision: number().int().nonnegative().optional(),
12782
+ deviceId: PreferenceDeviceIdSchema.optional()
12783
+ });
12784
+ discriminatedUnion("status", [object({
12785
+ status: literal("saved"),
12786
+ row: PreferenceRowSchema
12787
+ }), object({
12788
+ status: literal("conflict"),
12789
+ current: PreferenceRowSchema.nullable()
12790
+ })]);
12791
+ object({ namespace: PreferenceNamespaceSchema });
12792
+ object({
12793
+ /** `false` when the namespace did not exist. */
12794
+ deleted: boolean() });
12795
+ object({
12796
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
12797
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
12798
+ object({
12799
+ /** Every row whose revision differs from the client's, and every row it did not list. */
12800
+ rows: array(PreferenceRowSchema),
12801
+ /** Namespaces the client listed that no longer exist. */
12802
+ deleted: array(PreferenceNamespaceSchema)
12803
+ });
12753
12804
  _enum(["new-session", "step-up"]);
12754
12805
  /** The languages the hub's app landing pages are written in (D858). */
12755
12806
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -40039,38 +40090,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40039
40090
  auth: "admin",
40040
40091
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40041
40092
  });
40093
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
40094
+ /** What a model (or, by default, every model of a kind) can do. */
40095
+ var LlmModelFeaturesSchema = object({
40096
+ vision: boolean(),
40097
+ tools: boolean(),
40098
+ streaming: boolean()
40099
+ });
40100
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40101
+ var LlmModelInfoSchema = object({
40102
+ id: string(),
40103
+ label: string().optional(),
40104
+ contextLength: number().int().positive().optional(),
40105
+ features: LlmModelFeaturesSchema.partial().optional()
40106
+ });
40042
40107
  /**
40043
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40044
- * methods concat-fan across providers; single-row methods route to ONE
40045
- * provider by the `addonId` in the call input (the notification-output
40046
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40047
- * (hub-placed); the cap stays open for future providers.
40048
- *
40049
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40050
- * `apiKey` is a password field — providers REDACT it on read and merge on
40051
- * write; a stored key NEVER round-trips to a client.
40108
+ * The provider-specific part of a profile, validated by the provider that owns
40109
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40110
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40111
+ * keychain, never in the row, and reads back as the redaction marker.
40052
40112
  */
40053
- var LlmProfileKindSchema = _enum([
40054
- "openai-compatible",
40055
- "openai",
40056
- "anthropic",
40057
- "google",
40058
- "managed-local",
40059
- "apple-foundation"
40060
- ]);
40113
+ var LlmProviderConfigSchema = record(string(), unknown());
40061
40114
  var LlmProfileSchema = object({
40062
40115
  id: string(),
40063
40116
  name: string(),
40117
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40064
40118
  kind: LlmProfileKindSchema,
40065
40119
  /** Stamped by the provider — keeps the fanned catalog routable. */
40066
40120
  addonId: string(),
40067
40121
  enabled: boolean(),
40068
40122
  /** Vendor model id, or the managed runtime's loaded model. */
40069
40123
  model: string(),
40070
- /** Required for openai-compatible; override for cloud kinds. */
40071
- baseUrl: string().optional(),
40072
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40073
- apiKey: string().optional(),
40074
40124
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
40075
40125
  * degraded to text — that shipped once and produced a confident answer to a
40076
40126
  * question about a picture nobody sent. */
@@ -40078,15 +40128,11 @@ var LlmProfileSchema = object({
40078
40128
  temperature: number().min(0).max(2).optional(),
40079
40129
  /** Nucleus sampling. Every wire we speak has it. */
40080
40130
  topP: number().min(0).max(1).optional(),
40081
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
40082
- * wire does, and the client drops it there (measured: the request body gets
40083
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
40084
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40131
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40132
+ * field in its editor only when its descriptor lists it in `profileFields`. */
40085
40133
  topK: number().int().positive().optional(),
40086
40134
  maxTokens: number().int().positive().optional(),
40087
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40088
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40089
- * the model with, so it is the one field that changes a PROCESS. */
40135
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40090
40136
  contextLength: number().int().positive().optional(),
40091
40137
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40092
40138
  * two system prompts fighting is worse than either alone). */
@@ -40112,16 +40158,37 @@ var LlmProfileSchema = object({
40112
40158
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40113
40159
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40114
40160
  toolsEnabled: boolean().default(false),
40115
- extraHeaders: record(string(), string()).optional(),
40116
- /** kind === 'managed-local' only (spec §4). */
40117
- runtime: ManagedRuntimeConfigSchema.optional(),
40118
- /**
40119
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40120
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40121
- * `supportsVision` on such a row is stamped by the provider from the node's
40122
- * reported `imageInput`, never taken from the operator (D62).
40123
- */
40124
- appleFoundation: object({ nodeId: string() }).optional()
40161
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40162
+ providerConfig: LlmProviderConfigSchema.default({})
40163
+ });
40164
+ /**
40165
+ * The common profile fields a kind's editor offers. The editor owns how each
40166
+ * one is drawn; the provider says which of them mean something on its wire.
40167
+ */
40168
+ var LlmProfileFieldSchema = _enum([
40169
+ "temperature",
40170
+ "topP",
40171
+ "topK",
40172
+ "maxTokens",
40173
+ "contextLength",
40174
+ "systemPrompt",
40175
+ "timeoutMs",
40176
+ "connectTimeoutMs",
40177
+ "firstTokenTimeoutMs",
40178
+ "idleTimeoutMs",
40179
+ "retry",
40180
+ "toolsEnabled"
40181
+ ]);
40182
+ /**
40183
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40184
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40185
+ * picker: that widget owns the model choice.
40186
+ */
40187
+ var LlmProviderWidgetSchema = object({
40188
+ id: string(),
40189
+ placement: _enum(["connection", "model"]),
40190
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40191
+ requires: array(string()).optional()
40125
40192
  });
40126
40193
  /** ConfigUISchema tree passed through untyped on the wire (the
40127
40194
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40130,11 +40197,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40130
40197
  var LlmProfileKindDescriptorSchema = object({
40131
40198
  kind: LlmProfileKindSchema,
40132
40199
  label: string(),
40200
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40133
40201
  icon: string(),
40134
40202
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40135
40203
  addonId: string(),
40136
- configSchema: ConfigSchemaPassthrough$3
40204
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40205
+ connectionSchema: ConfigSchemaPassthrough$3,
40206
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40207
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40208
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40209
+ features: LlmModelFeaturesSchema,
40210
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40211
+ visionEditable: boolean(),
40212
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40213
+ modelCatalog: _enum([
40214
+ "fetch",
40215
+ "static",
40216
+ "none"
40217
+ ]),
40218
+ staticModels: array(LlmModelInfoSchema).optional(),
40219
+ /** The common fields that mean something on this kind's wire. */
40220
+ profileFields: array(LlmProfileFieldSchema),
40221
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40137
40222
  });
40223
+ /**
40224
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40225
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40226
+ * untouched (absent or the redaction marker) is resolved server-side from the
40227
+ * stored profile — the browser never receives it.
40228
+ */
40229
+ var LlmListModelsInputSchema = object({
40230
+ addonId: string(),
40231
+ kind: LlmProfileKindSchema,
40232
+ profileId: string().optional(),
40233
+ connection: LlmProviderConfigSchema.optional()
40234
+ });
40235
+ var LlmListModelsErrorCodeSchema = _enum([
40236
+ "auth",
40237
+ "network",
40238
+ "unsupported",
40239
+ "invalid"
40240
+ ]);
40241
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40242
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40243
+ ok: literal(true),
40244
+ models: array(LlmModelInfoSchema)
40245
+ }), object({
40246
+ ok: literal(false),
40247
+ code: LlmListModelsErrorCodeSchema,
40248
+ message: string()
40249
+ })]);
40138
40250
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40139
40251
  var LlmDefaultSchema = object({
40140
40252
  selector: LlmDefaultSelectorSchema,
@@ -40234,7 +40346,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40234
40346
  kind: "mutation",
40235
40347
  auth: "admin",
40236
40348
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40237
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40349
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40350
+ kind: "mutation",
40351
+ auth: "admin"
40352
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40238
40353
  selector: LlmDefaultSelectorSchema,
40239
40354
  profileId: string().nullable()
40240
40355
  }), _void(), {
@@ -65097,26 +65212,6 @@ var ApiKeySummarySchema = object({
65097
65212
  createdAt: number(),
65098
65213
  lastUsedAt: number().optional()
65099
65214
  });
65100
- var ScopedTokenSummarySchema = object({
65101
- id: string(),
65102
- userId: string(),
65103
- name: string(),
65104
- tokenPrefix: string(),
65105
- scopes: array(TokenScopeSchema),
65106
- expiresAt: number().nullish(),
65107
- lastUsedAt: number().nullish(),
65108
- createdAt: number()
65109
- });
65110
- var CreateScopedTokenInputSchema = object({
65111
- userId: string(),
65112
- name: string(),
65113
- scopes: array(TokenScopeSchema),
65114
- expiresAt: number().optional()
65115
- });
65116
- var CreateScopedTokenResultSchema = object({
65117
- token: string(),
65118
- record: ScopedTokenSummarySchema
65119
- });
65120
65215
  var OauthSessionSummarySchema = object({
65121
65216
  id: string(),
65122
65217
  userId: string(),
@@ -65138,11 +65233,11 @@ var TotpStatusSchema = object({
65138
65233
  confirmedAt: number().nullable()
65139
65234
  });
65140
65235
  /**
65141
- * user-management — singleton capability for user accounts, API keys,
65142
- * and scoped tokens.
65236
+ * user-management — singleton capability for user accounts and the
65237
+ * legacy API-key rows.
65143
65238
  *
65144
65239
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
65145
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
65240
+ * — the subset check on `setUserScopes` is moot
65146
65241
  * because non-admins never reach these. If/when we open non-admin
65147
65242
  * delegation, structural caller-scope subset check goes inside the
65148
65243
  * provider.
@@ -65199,15 +65294,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
65199
65294
  kind: "mutation",
65200
65295
  auth: "admin",
65201
65296
  access: "delete"
65202
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
65203
- kind: "mutation",
65204
- auth: "admin",
65205
- access: "create"
65206
- }), method(object({ id: string() }), object({ success: literal(true) }), {
65207
- kind: "mutation",
65208
- auth: "admin",
65209
- access: "delete"
65210
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
65297
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
65211
65298
  kind: "mutation",
65212
65299
  auth: "admin",
65213
65300
  access: "create"
@@ -71301,7 +71388,7 @@ Object.freeze({
71301
71388
  capName: "llm",
71302
71389
  capScope: "system",
71303
71390
  addonId: null,
71304
- access: "view"
71391
+ access: "create"
71305
71392
  },
71306
71393
  "llm.listNodeModels": {
71307
71394
  capName: "llm",
@@ -75965,12 +76052,6 @@ Object.freeze({
75965
76052
  addonId: null,
75966
76053
  access: "create"
75967
76054
  },
75968
- "userManagement.createScopedToken": {
75969
- capName: "user-management",
75970
- capScope: "system",
75971
- addonId: null,
75972
- access: "create"
75973
- },
75974
76055
  "userManagement.createUser": {
75975
76056
  capName: "user-management",
75976
76057
  capScope: "system",
@@ -76019,12 +76100,6 @@ Object.freeze({
76019
76100
  addonId: null,
76020
76101
  access: "view"
76021
76102
  },
76022
- "userManagement.listScopedTokens": {
76023
- capName: "user-management",
76024
- capScope: "system",
76025
- addonId: null,
76026
- access: "view"
76027
- },
76028
76103
  "userManagement.listUsers": {
76029
76104
  capName: "user-management",
76030
76105
  capScope: "system",
@@ -76079,12 +76154,6 @@ Object.freeze({
76079
76154
  addonId: null,
76080
76155
  access: "delete"
76081
76156
  },
76082
- "userManagement.revokeScopedToken": {
76083
- capName: "user-management",
76084
- capScope: "system",
76085
- addonId: null,
76086
- access: "delete"
76087
- },
76088
76157
  "userManagement.setupTotp": {
76089
76158
  capName: "user-management",
76090
76159
  capScope: "system",
@@ -76115,12 +76184,6 @@ Object.freeze({
76115
76184
  addonId: null,
76116
76185
  access: "view"
76117
76186
  },
76118
- "userManagement.validateScopedToken": {
76119
- capName: "user-management",
76120
- capScope: "system",
76121
- addonId: null,
76122
- access: "view"
76123
- },
76124
76187
  "userManagement.verifyTotp": {
76125
76188
  capName: "user-management",
76126
76189
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -5429,7 +5429,7 @@ var ZodIssueCode = {
5429
5429
  var ZodFirstPartyTypeKind;
5430
5430
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5431
5431
  //#endregion
5432
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5432
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5433
5433
  /**
5434
5434
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5435
5435
  * window to float samples (D455).
@@ -7812,9 +7812,9 @@ function normalizeAddonInitResult(result) {
7812
7812
  return result;
7813
7813
  }
7814
7814
  /**
7815
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7816
- * and validates them (`share-token.service.ts` builds its enum from this
7817
- * list); a data plane names the kinds it ACCEPTS in `share`.
7815
+ * The share-view scope kinds a share-link token can carry. The hub mints
7816
+ * and validates them (`ShareViewGrantSchema` builds its
7817
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7818
7818
  */
7819
7819
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7820
7820
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12528,7 +12528,7 @@ var ConvertResultSchema = object({
12528
12528
  * `super_admin` — collapsed onto the single boolean because every
12529
12529
  * non-admin caller is governed by the same scope-check rules; the
12530
12530
  * distinction was only ever used to route role-specific procedures
12531
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12531
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12532
12532
  * with `isAdmin: false` + an explicit scope list.
12533
12533
  */
12534
12534
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -12717,10 +12717,12 @@ var AddonRoutesScopeSchema = object({
12717
12717
  type: literal("addon-routes"),
12718
12718
  access: array(MethodAccessSchema).min(1)
12719
12719
  });
12720
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
12720
12721
  var CredentialScopeSchema = union([
12721
12722
  literal("*"),
12722
12723
  ShareViewScopeSchema,
12723
12724
  AddonRoutesScopeSchema,
12725
+ PreferencesSelfScopeSchema,
12724
12726
  TokenScopeSchema
12725
12727
  ]);
12726
12728
  object({
@@ -12729,6 +12731,55 @@ object({
12729
12731
  jti: string().min(16),
12730
12732
  scopes: array(CredentialScopeSchema).min(1)
12731
12733
  });
12734
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
12735
+ /** A namespace's value: a JSON object, opaque to the hub. */
12736
+ var PreferenceValueSchema = record(string(), unknown());
12737
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
12738
+ /** A stored row, as the owner reads it. */
12739
+ var PreferenceRowSchema = object({
12740
+ namespace: PreferenceNamespaceSchema,
12741
+ value: PreferenceValueSchema,
12742
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
12743
+ revision: number().int().positive(),
12744
+ updatedAt: number().int(),
12745
+ /** The client id the last writer sent; `null` when it sent none. */
12746
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
12747
+ });
12748
+ object({
12749
+ /** Absent: every namespace the caller holds. */
12750
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
12751
+ object({ rows: array(PreferenceRowSchema) });
12752
+ object({
12753
+ namespace: PreferenceNamespaceSchema,
12754
+ value: PreferenceValueSchema,
12755
+ /**
12756
+ * The revision the edit was based on. Absent: last write wins. `0`: the
12757
+ * namespace must not exist yet. Any other value that is not the current
12758
+ * revision answers `conflict` and writes nothing.
12759
+ */
12760
+ baseRevision: number().int().nonnegative().optional(),
12761
+ deviceId: PreferenceDeviceIdSchema.optional()
12762
+ });
12763
+ discriminatedUnion("status", [object({
12764
+ status: literal("saved"),
12765
+ row: PreferenceRowSchema
12766
+ }), object({
12767
+ status: literal("conflict"),
12768
+ current: PreferenceRowSchema.nullable()
12769
+ })]);
12770
+ object({ namespace: PreferenceNamespaceSchema });
12771
+ object({
12772
+ /** `false` when the namespace did not exist. */
12773
+ deleted: boolean() });
12774
+ object({
12775
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
12776
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
12777
+ object({
12778
+ /** Every row whose revision differs from the client's, and every row it did not list. */
12779
+ rows: array(PreferenceRowSchema),
12780
+ /** Namespaces the client listed that no longer exist. */
12781
+ deleted: array(PreferenceNamespaceSchema)
12782
+ });
12732
12783
  _enum(["new-session", "step-up"]);
12733
12784
  /** The languages the hub's app landing pages are written in (D858). */
12734
12785
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -40018,38 +40069,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
40018
40069
  auth: "admin",
40019
40070
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40020
40071
  });
40072
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
40073
+ /** What a model (or, by default, every model of a kind) can do. */
40074
+ var LlmModelFeaturesSchema = object({
40075
+ vision: boolean(),
40076
+ tools: boolean(),
40077
+ streaming: boolean()
40078
+ });
40079
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
40080
+ var LlmModelInfoSchema = object({
40081
+ id: string(),
40082
+ label: string().optional(),
40083
+ contextLength: number().int().positive().optional(),
40084
+ features: LlmModelFeaturesSchema.partial().optional()
40085
+ });
40021
40086
  /**
40022
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
40023
- * methods concat-fan across providers; single-row methods route to ONE
40024
- * provider by the `addonId` in the call input (the notification-output
40025
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
40026
- * (hub-placed); the cap stays open for future providers.
40027
- *
40028
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
40029
- * `apiKey` is a password field — providers REDACT it on read and merge on
40030
- * write; a stored key NEVER round-trips to a client.
40087
+ * The provider-specific part of a profile, validated by the provider that owns
40088
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
40089
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
40090
+ * keychain, never in the row, and reads back as the redaction marker.
40031
40091
  */
40032
- var LlmProfileKindSchema = _enum([
40033
- "openai-compatible",
40034
- "openai",
40035
- "anthropic",
40036
- "google",
40037
- "managed-local",
40038
- "apple-foundation"
40039
- ]);
40092
+ var LlmProviderConfigSchema = record(string(), unknown());
40040
40093
  var LlmProfileSchema = object({
40041
40094
  id: string(),
40042
40095
  name: string(),
40096
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
40043
40097
  kind: LlmProfileKindSchema,
40044
40098
  /** Stamped by the provider — keeps the fanned catalog routable. */
40045
40099
  addonId: string(),
40046
40100
  enabled: boolean(),
40047
40101
  /** Vendor model id, or the managed runtime's loaded model. */
40048
40102
  model: string(),
40049
- /** Required for openai-compatible; override for cloud kinds. */
40050
- baseUrl: string().optional(),
40051
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
40052
- apiKey: string().optional(),
40053
40103
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
40054
40104
  * degraded to text — that shipped once and produced a confident answer to a
40055
40105
  * question about a picture nobody sent. */
@@ -40057,15 +40107,11 @@ var LlmProfileSchema = object({
40057
40107
  temperature: number().min(0).max(2).optional(),
40058
40108
  /** Nucleus sampling. Every wire we speak has it. */
40059
40109
  topP: number().min(0).max(1).optional(),
40060
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
40061
- * wire does, and the client drops it there (measured: the request body gets
40062
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
40063
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40110
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40111
+ * field in its editor only when its descriptor lists it in `profileFields`. */
40064
40112
  topK: number().int().positive().optional(),
40065
40113
  maxTokens: number().int().positive().optional(),
40066
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
40067
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
40068
- * the model with, so it is the one field that changes a PROCESS. */
40114
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
40069
40115
  contextLength: number().int().positive().optional(),
40070
40116
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
40071
40117
  * two system prompts fighting is worse than either alone). */
@@ -40091,16 +40137,37 @@ var LlmProfileSchema = object({
40091
40137
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
40092
40138
  * `true` here buys the wiring, not behaviour, until tools are registered. */
40093
40139
  toolsEnabled: boolean().default(false),
40094
- extraHeaders: record(string(), string()).optional(),
40095
- /** kind === 'managed-local' only (spec §4). */
40096
- runtime: ManagedRuntimeConfigSchema.optional(),
40097
- /**
40098
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
40099
- * to configure (no key, no URL, no download; `model` is `apple-system`).
40100
- * `supportsVision` on such a row is stamped by the provider from the node's
40101
- * reported `imageInput`, never taken from the operator (D62).
40102
- */
40103
- appleFoundation: object({ nodeId: string() }).optional()
40140
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40141
+ providerConfig: LlmProviderConfigSchema.default({})
40142
+ });
40143
+ /**
40144
+ * The common profile fields a kind's editor offers. The editor owns how each
40145
+ * one is drawn; the provider says which of them mean something on its wire.
40146
+ */
40147
+ var LlmProfileFieldSchema = _enum([
40148
+ "temperature",
40149
+ "topP",
40150
+ "topK",
40151
+ "maxTokens",
40152
+ "contextLength",
40153
+ "systemPrompt",
40154
+ "timeoutMs",
40155
+ "connectTimeoutMs",
40156
+ "firstTokenTimeoutMs",
40157
+ "idleTimeoutMs",
40158
+ "retry",
40159
+ "toolsEnabled"
40160
+ ]);
40161
+ /**
40162
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40163
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40164
+ * picker: that widget owns the model choice.
40165
+ */
40166
+ var LlmProviderWidgetSchema = object({
40167
+ id: string(),
40168
+ placement: _enum(["connection", "model"]),
40169
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40170
+ requires: array(string()).optional()
40104
40171
  });
40105
40172
  /** ConfigUISchema tree passed through untyped on the wire (the
40106
40173
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -40109,11 +40176,56 @@ var ConfigSchemaPassthrough$3 = unknown();
40109
40176
  var LlmProfileKindDescriptorSchema = object({
40110
40177
  kind: LlmProfileKindSchema,
40111
40178
  label: string(),
40179
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40112
40180
  icon: string(),
40113
40181
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40114
40182
  addonId: string(),
40115
- configSchema: ConfigSchemaPassthrough$3
40183
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40184
+ connectionSchema: ConfigSchemaPassthrough$3,
40185
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40186
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40187
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40188
+ features: LlmModelFeaturesSchema,
40189
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40190
+ visionEditable: boolean(),
40191
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40192
+ modelCatalog: _enum([
40193
+ "fetch",
40194
+ "static",
40195
+ "none"
40196
+ ]),
40197
+ staticModels: array(LlmModelInfoSchema).optional(),
40198
+ /** The common fields that mean something on this kind's wire. */
40199
+ profileFields: array(LlmProfileFieldSchema),
40200
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40116
40201
  });
40202
+ /**
40203
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40204
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40205
+ * untouched (absent or the redaction marker) is resolved server-side from the
40206
+ * stored profile — the browser never receives it.
40207
+ */
40208
+ var LlmListModelsInputSchema = object({
40209
+ addonId: string(),
40210
+ kind: LlmProfileKindSchema,
40211
+ profileId: string().optional(),
40212
+ connection: LlmProviderConfigSchema.optional()
40213
+ });
40214
+ var LlmListModelsErrorCodeSchema = _enum([
40215
+ "auth",
40216
+ "network",
40217
+ "unsupported",
40218
+ "invalid"
40219
+ ]);
40220
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40221
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40222
+ ok: literal(true),
40223
+ models: array(LlmModelInfoSchema)
40224
+ }), object({
40225
+ ok: literal(false),
40226
+ code: LlmListModelsErrorCodeSchema,
40227
+ message: string()
40228
+ })]);
40117
40229
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40118
40230
  var LlmDefaultSchema = object({
40119
40231
  selector: LlmDefaultSelectorSchema,
@@ -40213,7 +40325,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40213
40325
  kind: "mutation",
40214
40326
  auth: "admin",
40215
40327
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40216
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40328
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40329
+ kind: "mutation",
40330
+ auth: "admin"
40331
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40217
40332
  selector: LlmDefaultSelectorSchema,
40218
40333
  profileId: string().nullable()
40219
40334
  }), _void(), {
@@ -65076,26 +65191,6 @@ var ApiKeySummarySchema = object({
65076
65191
  createdAt: number(),
65077
65192
  lastUsedAt: number().optional()
65078
65193
  });
65079
- var ScopedTokenSummarySchema = object({
65080
- id: string(),
65081
- userId: string(),
65082
- name: string(),
65083
- tokenPrefix: string(),
65084
- scopes: array(TokenScopeSchema),
65085
- expiresAt: number().nullish(),
65086
- lastUsedAt: number().nullish(),
65087
- createdAt: number()
65088
- });
65089
- var CreateScopedTokenInputSchema = object({
65090
- userId: string(),
65091
- name: string(),
65092
- scopes: array(TokenScopeSchema),
65093
- expiresAt: number().optional()
65094
- });
65095
- var CreateScopedTokenResultSchema = object({
65096
- token: string(),
65097
- record: ScopedTokenSummarySchema
65098
- });
65099
65194
  var OauthSessionSummarySchema = object({
65100
65195
  id: string(),
65101
65196
  userId: string(),
@@ -65117,11 +65212,11 @@ var TotpStatusSchema = object({
65117
65212
  confirmedAt: number().nullable()
65118
65213
  });
65119
65214
  /**
65120
- * user-management — singleton capability for user accounts, API keys,
65121
- * and scoped tokens.
65215
+ * user-management — singleton capability for user accounts and the
65216
+ * legacy API-key rows.
65122
65217
  *
65123
65218
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
65124
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
65219
+ * — the subset check on `setUserScopes` is moot
65125
65220
  * because non-admins never reach these. If/when we open non-admin
65126
65221
  * delegation, structural caller-scope subset check goes inside the
65127
65222
  * provider.
@@ -65178,15 +65273,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
65178
65273
  kind: "mutation",
65179
65274
  auth: "admin",
65180
65275
  access: "delete"
65181
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
65182
- kind: "mutation",
65183
- auth: "admin",
65184
- access: "create"
65185
- }), method(object({ id: string() }), object({ success: literal(true) }), {
65186
- kind: "mutation",
65187
- auth: "admin",
65188
- access: "delete"
65189
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
65276
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
65190
65277
  kind: "mutation",
65191
65278
  auth: "admin",
65192
65279
  access: "create"
@@ -71280,7 +71367,7 @@ Object.freeze({
71280
71367
  capName: "llm",
71281
71368
  capScope: "system",
71282
71369
  addonId: null,
71283
- access: "view"
71370
+ access: "create"
71284
71371
  },
71285
71372
  "llm.listNodeModels": {
71286
71373
  capName: "llm",
@@ -75944,12 +76031,6 @@ Object.freeze({
75944
76031
  addonId: null,
75945
76032
  access: "create"
75946
76033
  },
75947
- "userManagement.createScopedToken": {
75948
- capName: "user-management",
75949
- capScope: "system",
75950
- addonId: null,
75951
- access: "create"
75952
- },
75953
76034
  "userManagement.createUser": {
75954
76035
  capName: "user-management",
75955
76036
  capScope: "system",
@@ -75998,12 +76079,6 @@ Object.freeze({
75998
76079
  addonId: null,
75999
76080
  access: "view"
76000
76081
  },
76001
- "userManagement.listScopedTokens": {
76002
- capName: "user-management",
76003
- capScope: "system",
76004
- addonId: null,
76005
- access: "view"
76006
- },
76007
76082
  "userManagement.listUsers": {
76008
76083
  capName: "user-management",
76009
76084
  capScope: "system",
@@ -76058,12 +76133,6 @@ Object.freeze({
76058
76133
  addonId: null,
76059
76134
  access: "delete"
76060
76135
  },
76061
- "userManagement.revokeScopedToken": {
76062
- capName: "user-management",
76063
- capScope: "system",
76064
- addonId: null,
76065
- access: "delete"
76066
- },
76067
76136
  "userManagement.setupTotp": {
76068
76137
  capName: "user-management",
76069
76138
  capScope: "system",
@@ -76094,12 +76163,6 @@ Object.freeze({
76094
76163
  addonId: null,
76095
76164
  access: "view"
76096
76165
  },
76097
- "userManagement.validateScopedToken": {
76098
- capName: "user-management",
76099
- capScope: "system",
76100
- addonId: null,
76101
- access: "view"
76102
- },
76103
76166
  "userManagement.verifyTotp": {
76104
76167
  capName: "user-management",
76105
76168
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-amcrest",
3
- "version": "0.2.141",
3
+ "version": "0.2.142",
4
4
  "description": "Amcrest/Dahua camera device provider addon for CamStack — Dahua CGI over HTTP(S) with digest auth (snapshot, RTSP catalog, PTZ, image/day-night config)",
5
5
  "keywords": [
6
6
  "camstack",