@camstack/addon-terminal 0.1.136 → 0.1.137

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
@@ -5446,7 +5446,7 @@ var ZodIssueCode = {
5446
5446
  var ZodFirstPartyTypeKind;
5447
5447
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5448
5448
  //#endregion
5449
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5449
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5450
5450
  /**
5451
5451
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5452
5452
  * window to float samples (D455).
@@ -7829,9 +7829,9 @@ function normalizeAddonInitResult(result) {
7829
7829
  return result;
7830
7830
  }
7831
7831
  /**
7832
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7833
- * and validates them (`share-token.service.ts` builds its enum from this
7834
- * list); a data plane names the kinds it ACCEPTS in `share`.
7832
+ * The share-view scope kinds a share-link token can carry. The hub mints
7833
+ * and validates them (`ShareViewGrantSchema` builds its
7834
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7835
7835
  */
7836
7836
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7837
7837
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12612,7 +12612,7 @@ var ConvertResultSchema = object({
12612
12612
  * `super_admin` — collapsed onto the single boolean because every
12613
12613
  * non-admin caller is governed by the same scope-check rules; the
12614
12614
  * distinction was only ever used to route role-specific procedures
12615
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12615
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12616
12616
  * with `isAdmin: false` + an explicit scope list.
12617
12617
  */
12618
12618
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -12801,10 +12801,12 @@ var AddonRoutesScopeSchema = object({
12801
12801
  type: literal("addon-routes"),
12802
12802
  access: array(MethodAccessSchema).min(1)
12803
12803
  });
12804
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
12804
12805
  var CredentialScopeSchema = union([
12805
12806
  literal("*"),
12806
12807
  ShareViewScopeSchema,
12807
12808
  AddonRoutesScopeSchema,
12809
+ PreferencesSelfScopeSchema,
12808
12810
  TokenScopeSchema
12809
12811
  ]);
12810
12812
  object({
@@ -12813,6 +12815,55 @@ object({
12813
12815
  jti: string().min(16),
12814
12816
  scopes: array(CredentialScopeSchema).min(1)
12815
12817
  });
12818
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
12819
+ /** A namespace's value: a JSON object, opaque to the hub. */
12820
+ var PreferenceValueSchema = record(string(), unknown());
12821
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
12822
+ /** A stored row, as the owner reads it. */
12823
+ var PreferenceRowSchema = object({
12824
+ namespace: PreferenceNamespaceSchema,
12825
+ value: PreferenceValueSchema,
12826
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
12827
+ revision: number().int().positive(),
12828
+ updatedAt: number().int(),
12829
+ /** The client id the last writer sent; `null` when it sent none. */
12830
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
12831
+ });
12832
+ object({
12833
+ /** Absent: every namespace the caller holds. */
12834
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
12835
+ object({ rows: array(PreferenceRowSchema) });
12836
+ object({
12837
+ namespace: PreferenceNamespaceSchema,
12838
+ value: PreferenceValueSchema,
12839
+ /**
12840
+ * The revision the edit was based on. Absent: last write wins. `0`: the
12841
+ * namespace must not exist yet. Any other value that is not the current
12842
+ * revision answers `conflict` and writes nothing.
12843
+ */
12844
+ baseRevision: number().int().nonnegative().optional(),
12845
+ deviceId: PreferenceDeviceIdSchema.optional()
12846
+ });
12847
+ discriminatedUnion("status", [object({
12848
+ status: literal("saved"),
12849
+ row: PreferenceRowSchema
12850
+ }), object({
12851
+ status: literal("conflict"),
12852
+ current: PreferenceRowSchema.nullable()
12853
+ })]);
12854
+ object({ namespace: PreferenceNamespaceSchema });
12855
+ object({
12856
+ /** `false` when the namespace did not exist. */
12857
+ deleted: boolean() });
12858
+ object({
12859
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
12860
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
12861
+ object({
12862
+ /** Every row whose revision differs from the client's, and every row it did not list. */
12863
+ rows: array(PreferenceRowSchema),
12864
+ /** Namespaces the client listed that no longer exist. */
12865
+ deleted: array(PreferenceNamespaceSchema)
12866
+ });
12816
12867
  _enum(["new-session", "step-up"]);
12817
12868
  /** The languages the hub's app landing pages are written in (D858). */
12818
12869
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -39908,38 +39959,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
39908
39959
  auth: "admin",
39909
39960
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
39910
39961
  });
39962
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
39963
+ /** What a model (or, by default, every model of a kind) can do. */
39964
+ var LlmModelFeaturesSchema = object({
39965
+ vision: boolean(),
39966
+ tools: boolean(),
39967
+ streaming: boolean()
39968
+ });
39969
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
39970
+ var LlmModelInfoSchema = object({
39971
+ id: string(),
39972
+ label: string().optional(),
39973
+ contextLength: number().int().positive().optional(),
39974
+ features: LlmModelFeaturesSchema.partial().optional()
39975
+ });
39911
39976
  /**
39912
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
39913
- * methods concat-fan across providers; single-row methods route to ONE
39914
- * provider by the `addonId` in the call input (the notification-output
39915
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
39916
- * (hub-placed); the cap stays open for future providers.
39917
- *
39918
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
39919
- * `apiKey` is a password field — providers REDACT it on read and merge on
39920
- * write; a stored key NEVER round-trips to a client.
39977
+ * The provider-specific part of a profile, validated by the provider that owns
39978
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
39979
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
39980
+ * keychain, never in the row, and reads back as the redaction marker.
39921
39981
  */
39922
- var LlmProfileKindSchema = _enum([
39923
- "openai-compatible",
39924
- "openai",
39925
- "anthropic",
39926
- "google",
39927
- "managed-local",
39928
- "apple-foundation"
39929
- ]);
39982
+ var LlmProviderConfigSchema = record(string(), unknown());
39930
39983
  var LlmProfileSchema = object({
39931
39984
  id: string(),
39932
39985
  name: string(),
39986
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
39933
39987
  kind: LlmProfileKindSchema,
39934
39988
  /** Stamped by the provider — keeps the fanned catalog routable. */
39935
39989
  addonId: string(),
39936
39990
  enabled: boolean(),
39937
39991
  /** Vendor model id, or the managed runtime's loaded model. */
39938
39992
  model: string(),
39939
- /** Required for openai-compatible; override for cloud kinds. */
39940
- baseUrl: string().optional(),
39941
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
39942
- apiKey: string().optional(),
39943
39993
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
39944
39994
  * degraded to text — that shipped once and produced a confident answer to a
39945
39995
  * question about a picture nobody sent. */
@@ -39947,15 +39997,11 @@ var LlmProfileSchema = object({
39947
39997
  temperature: number().min(0).max(2).optional(),
39948
39998
  /** Nucleus sampling. Every wire we speak has it. */
39949
39999
  topP: number().min(0).max(1).optional(),
39950
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
39951
- * wire does, and the client drops it there (measured: the request body gets
39952
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
39953
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
40000
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
40001
+ * field in its editor only when its descriptor lists it in `profileFields`. */
39954
40002
  topK: number().int().positive().optional(),
39955
40003
  maxTokens: number().int().positive().optional(),
39956
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
39957
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
39958
- * the model with, so it is the one field that changes a PROCESS. */
40004
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
39959
40005
  contextLength: number().int().positive().optional(),
39960
40006
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
39961
40007
  * two system prompts fighting is worse than either alone). */
@@ -39981,16 +40027,37 @@ var LlmProfileSchema = object({
39981
40027
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
39982
40028
  * `true` here buys the wiring, not behaviour, until tools are registered. */
39983
40029
  toolsEnabled: boolean().default(false),
39984
- extraHeaders: record(string(), string()).optional(),
39985
- /** kind === 'managed-local' only (spec §4). */
39986
- runtime: ManagedRuntimeConfigSchema.optional(),
39987
- /**
39988
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
39989
- * to configure (no key, no URL, no download; `model` is `apple-system`).
39990
- * `supportsVision` on such a row is stamped by the provider from the node's
39991
- * reported `imageInput`, never taken from the operator (D62).
39992
- */
39993
- appleFoundation: object({ nodeId: string() }).optional()
40030
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40031
+ providerConfig: LlmProviderConfigSchema.default({})
40032
+ });
40033
+ /**
40034
+ * The common profile fields a kind's editor offers. The editor owns how each
40035
+ * one is drawn; the provider says which of them mean something on its wire.
40036
+ */
40037
+ var LlmProfileFieldSchema = _enum([
40038
+ "temperature",
40039
+ "topP",
40040
+ "topK",
40041
+ "maxTokens",
40042
+ "contextLength",
40043
+ "systemPrompt",
40044
+ "timeoutMs",
40045
+ "connectTimeoutMs",
40046
+ "firstTokenTimeoutMs",
40047
+ "idleTimeoutMs",
40048
+ "retry",
40049
+ "toolsEnabled"
40050
+ ]);
40051
+ /**
40052
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40053
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40054
+ * picker: that widget owns the model choice.
40055
+ */
40056
+ var LlmProviderWidgetSchema = object({
40057
+ id: string(),
40058
+ placement: _enum(["connection", "model"]),
40059
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40060
+ requires: array(string()).optional()
39994
40061
  });
39995
40062
  /** ConfigUISchema tree passed through untyped on the wire (the
39996
40063
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -39999,11 +40066,56 @@ var ConfigSchemaPassthrough$3 = unknown();
39999
40066
  var LlmProfileKindDescriptorSchema = object({
40000
40067
  kind: LlmProfileKindSchema,
40001
40068
  label: string(),
40069
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
40002
40070
  icon: string(),
40003
40071
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
40004
40072
  addonId: string(),
40005
- configSchema: ConfigSchemaPassthrough$3
40073
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40074
+ connectionSchema: ConfigSchemaPassthrough$3,
40075
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40076
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40077
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40078
+ features: LlmModelFeaturesSchema,
40079
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40080
+ visionEditable: boolean(),
40081
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40082
+ modelCatalog: _enum([
40083
+ "fetch",
40084
+ "static",
40085
+ "none"
40086
+ ]),
40087
+ staticModels: array(LlmModelInfoSchema).optional(),
40088
+ /** The common fields that mean something on this kind's wire. */
40089
+ profileFields: array(LlmProfileFieldSchema),
40090
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
40006
40091
  });
40092
+ /**
40093
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40094
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40095
+ * untouched (absent or the redaction marker) is resolved server-side from the
40096
+ * stored profile — the browser never receives it.
40097
+ */
40098
+ var LlmListModelsInputSchema = object({
40099
+ addonId: string(),
40100
+ kind: LlmProfileKindSchema,
40101
+ profileId: string().optional(),
40102
+ connection: LlmProviderConfigSchema.optional()
40103
+ });
40104
+ var LlmListModelsErrorCodeSchema = _enum([
40105
+ "auth",
40106
+ "network",
40107
+ "unsupported",
40108
+ "invalid"
40109
+ ]);
40110
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40111
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40112
+ ok: literal(true),
40113
+ models: array(LlmModelInfoSchema)
40114
+ }), object({
40115
+ ok: literal(false),
40116
+ code: LlmListModelsErrorCodeSchema,
40117
+ message: string()
40118
+ })]);
40007
40119
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
40008
40120
  var LlmDefaultSchema = object({
40009
40121
  selector: LlmDefaultSelectorSchema,
@@ -40103,7 +40215,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40103
40215
  kind: "mutation",
40104
40216
  auth: "admin",
40105
40217
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40106
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40218
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40219
+ kind: "mutation",
40220
+ auth: "admin"
40221
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40107
40222
  selector: LlmDefaultSelectorSchema,
40108
40223
  profileId: string().nullable()
40109
40224
  }), _void(), {
@@ -64139,26 +64254,6 @@ var ApiKeySummarySchema = object({
64139
64254
  createdAt: number(),
64140
64255
  lastUsedAt: number().optional()
64141
64256
  });
64142
- var ScopedTokenSummarySchema = object({
64143
- id: string(),
64144
- userId: string(),
64145
- name: string(),
64146
- tokenPrefix: string(),
64147
- scopes: array(TokenScopeSchema),
64148
- expiresAt: number().nullish(),
64149
- lastUsedAt: number().nullish(),
64150
- createdAt: number()
64151
- });
64152
- var CreateScopedTokenInputSchema = object({
64153
- userId: string(),
64154
- name: string(),
64155
- scopes: array(TokenScopeSchema),
64156
- expiresAt: number().optional()
64157
- });
64158
- var CreateScopedTokenResultSchema = object({
64159
- token: string(),
64160
- record: ScopedTokenSummarySchema
64161
- });
64162
64257
  var OauthSessionSummarySchema = object({
64163
64258
  id: string(),
64164
64259
  userId: string(),
@@ -64180,11 +64275,11 @@ var TotpStatusSchema = object({
64180
64275
  confirmedAt: number().nullable()
64181
64276
  });
64182
64277
  /**
64183
- * user-management — singleton capability for user accounts, API keys,
64184
- * and scoped tokens.
64278
+ * user-management — singleton capability for user accounts and the
64279
+ * legacy API-key rows.
64185
64280
  *
64186
64281
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
64187
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
64282
+ * — the subset check on `setUserScopes` is moot
64188
64283
  * because non-admins never reach these. If/when we open non-admin
64189
64284
  * delegation, structural caller-scope subset check goes inside the
64190
64285
  * provider.
@@ -64241,15 +64336,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64241
64336
  kind: "mutation",
64242
64337
  auth: "admin",
64243
64338
  access: "delete"
64244
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
64245
- kind: "mutation",
64246
- auth: "admin",
64247
- access: "create"
64248
- }), method(object({ id: string() }), object({ success: literal(true) }), {
64249
- kind: "mutation",
64250
- auth: "admin",
64251
- access: "delete"
64252
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
64339
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
64253
64340
  kind: "mutation",
64254
64341
  auth: "admin",
64255
64342
  access: "create"
@@ -69856,7 +69943,7 @@ Object.freeze({
69856
69943
  capName: "llm",
69857
69944
  capScope: "system",
69858
69945
  addonId: null,
69859
- access: "view"
69946
+ access: "create"
69860
69947
  },
69861
69948
  "llm.listNodeModels": {
69862
69949
  capName: "llm",
@@ -74520,12 +74607,6 @@ Object.freeze({
74520
74607
  addonId: null,
74521
74608
  access: "create"
74522
74609
  },
74523
- "userManagement.createScopedToken": {
74524
- capName: "user-management",
74525
- capScope: "system",
74526
- addonId: null,
74527
- access: "create"
74528
- },
74529
74610
  "userManagement.createUser": {
74530
74611
  capName: "user-management",
74531
74612
  capScope: "system",
@@ -74574,12 +74655,6 @@ Object.freeze({
74574
74655
  addonId: null,
74575
74656
  access: "view"
74576
74657
  },
74577
- "userManagement.listScopedTokens": {
74578
- capName: "user-management",
74579
- capScope: "system",
74580
- addonId: null,
74581
- access: "view"
74582
- },
74583
74658
  "userManagement.listUsers": {
74584
74659
  capName: "user-management",
74585
74660
  capScope: "system",
@@ -74634,12 +74709,6 @@ Object.freeze({
74634
74709
  addonId: null,
74635
74710
  access: "delete"
74636
74711
  },
74637
- "userManagement.revokeScopedToken": {
74638
- capName: "user-management",
74639
- capScope: "system",
74640
- addonId: null,
74641
- access: "delete"
74642
- },
74643
74712
  "userManagement.setupTotp": {
74644
74713
  capName: "user-management",
74645
74714
  capScope: "system",
@@ -74670,12 +74739,6 @@ Object.freeze({
74670
74739
  addonId: null,
74671
74740
  access: "view"
74672
74741
  },
74673
- "userManagement.validateScopedToken": {
74674
- capName: "user-management",
74675
- capScope: "system",
74676
- addonId: null,
74677
- access: "view"
74678
- },
74679
74742
  "userManagement.verifyTotp": {
74680
74743
  capName: "user-management",
74681
74744
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -5423,7 +5423,7 @@ var ZodIssueCode = {
5423
5423
  var ZodFirstPartyTypeKind;
5424
5424
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5425
5425
  //#endregion
5426
- //#region ../types/dist/sleep-BxjU_fJM.mjs
5426
+ //#region ../types/dist/sleep-yKL5gfrH.mjs
5427
5427
  /**
5428
5428
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5429
5429
  * window to float samples (D455).
@@ -7806,9 +7806,9 @@ function normalizeAddonInitResult(result) {
7806
7806
  return result;
7807
7807
  }
7808
7808
  /**
7809
- * The share-view scope kinds a `csv_*` share token can carry. The hub mints
7810
- * and validates them (`share-token.service.ts` builds its enum from this
7811
- * list); a data plane names the kinds it ACCEPTS in `share`.
7809
+ * The share-view scope kinds a share-link token can carry. The hub mints
7810
+ * and validates them (`ShareViewGrantSchema` builds its
7811
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
7812
7812
  */
7813
7813
  var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
7814
7814
  /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
@@ -12589,7 +12589,7 @@ var ConvertResultSchema = object({
12589
12589
  * `super_admin` — collapsed onto the single boolean because every
12590
12590
  * non-admin caller is governed by the same scope-check rules; the
12591
12591
  * distinction was only ever used to route role-specific procedures
12592
- * which we no longer have. CLI / webhook integrations are `cst_*` tokens
12592
+ * which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
12593
12593
  * with `isAdmin: false` + an explicit scope list.
12594
12594
  */
12595
12595
  /** Per-method access flavour. Materialised on every cap method via codegen. */
@@ -12778,10 +12778,12 @@ var AddonRoutesScopeSchema = object({
12778
12778
  type: literal("addon-routes"),
12779
12779
  access: array(MethodAccessSchema).min(1)
12780
12780
  });
12781
+ var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
12781
12782
  var CredentialScopeSchema = union([
12782
12783
  literal("*"),
12783
12784
  ShareViewScopeSchema,
12784
12785
  AddonRoutesScopeSchema,
12786
+ PreferencesSelfScopeSchema,
12785
12787
  TokenScopeSchema
12786
12788
  ]);
12787
12789
  object({
@@ -12790,6 +12792,55 @@ object({
12790
12792
  jti: string().min(16),
12791
12793
  scopes: array(CredentialScopeSchema).min(1)
12792
12794
  });
12795
+ var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
12796
+ /** A namespace's value: a JSON object, opaque to the hub. */
12797
+ var PreferenceValueSchema = record(string(), unknown());
12798
+ var PreferenceDeviceIdSchema = string().min(1).max(64);
12799
+ /** A stored row, as the owner reads it. */
12800
+ var PreferenceRowSchema = object({
12801
+ namespace: PreferenceNamespaceSchema,
12802
+ value: PreferenceValueSchema,
12803
+ /** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
12804
+ revision: number().int().positive(),
12805
+ updatedAt: number().int(),
12806
+ /** The client id the last writer sent; `null` when it sent none. */
12807
+ updatedByDevice: PreferenceDeviceIdSchema.nullable()
12808
+ });
12809
+ object({
12810
+ /** Absent: every namespace the caller holds. */
12811
+ namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
12812
+ object({ rows: array(PreferenceRowSchema) });
12813
+ object({
12814
+ namespace: PreferenceNamespaceSchema,
12815
+ value: PreferenceValueSchema,
12816
+ /**
12817
+ * The revision the edit was based on. Absent: last write wins. `0`: the
12818
+ * namespace must not exist yet. Any other value that is not the current
12819
+ * revision answers `conflict` and writes nothing.
12820
+ */
12821
+ baseRevision: number().int().nonnegative().optional(),
12822
+ deviceId: PreferenceDeviceIdSchema.optional()
12823
+ });
12824
+ discriminatedUnion("status", [object({
12825
+ status: literal("saved"),
12826
+ row: PreferenceRowSchema
12827
+ }), object({
12828
+ status: literal("conflict"),
12829
+ current: PreferenceRowSchema.nullable()
12830
+ })]);
12831
+ object({ namespace: PreferenceNamespaceSchema });
12832
+ object({
12833
+ /** `false` when the namespace did not exist. */
12834
+ deleted: boolean() });
12835
+ object({
12836
+ /** The revision the client holds per namespace; a namespace it does not list is new to it. */
12837
+ revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
12838
+ object({
12839
+ /** Every row whose revision differs from the client's, and every row it did not list. */
12840
+ rows: array(PreferenceRowSchema),
12841
+ /** Namespaces the client listed that no longer exist. */
12842
+ deleted: array(PreferenceNamespaceSchema)
12843
+ });
12793
12844
  _enum(["new-session", "step-up"]);
12794
12845
  /** The languages the hub's app landing pages are written in (D858). */
12795
12846
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -39885,38 +39936,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
39885
39936
  auth: "admin",
39886
39937
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
39887
39938
  });
39939
+ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
39940
+ /** What a model (or, by default, every model of a kind) can do. */
39941
+ var LlmModelFeaturesSchema = object({
39942
+ vision: boolean(),
39943
+ tools: boolean(),
39944
+ streaming: boolean()
39945
+ });
39946
+ /** One model a provider offers. `features` overrides the kind's defaults, per field. */
39947
+ var LlmModelInfoSchema = object({
39948
+ id: string(),
39949
+ label: string().optional(),
39950
+ contextLength: number().int().positive().optional(),
39951
+ features: LlmModelFeaturesSchema.partial().optional()
39952
+ });
39888
39953
  /**
39889
- * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
39890
- * methods concat-fan across providers; single-row methods route to ONE
39891
- * provider by the `addonId` in the call input (the notification-output
39892
- * posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
39893
- * (hub-placed); the cap stays open for future providers.
39894
- *
39895
- * Profiles are ROWS (data), not addons: one row = one usable model endpoint.
39896
- * `apiKey` is a password field — providers REDACT it on read and merge on
39897
- * write; a stored key NEVER round-trips to a client.
39954
+ * The provider-specific part of a profile, validated by the provider that owns
39955
+ * the kind (`upsertProfile` refuses what it does not accept). A field its
39956
+ * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
39957
+ * keychain, never in the row, and reads back as the redaction marker.
39898
39958
  */
39899
- var LlmProfileKindSchema = _enum([
39900
- "openai-compatible",
39901
- "openai",
39902
- "anthropic",
39903
- "google",
39904
- "managed-local",
39905
- "apple-foundation"
39906
- ]);
39959
+ var LlmProviderConfigSchema = record(string(), unknown());
39907
39960
  var LlmProfileSchema = object({
39908
39961
  id: string(),
39909
39962
  name: string(),
39963
+ /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
39910
39964
  kind: LlmProfileKindSchema,
39911
39965
  /** Stamped by the provider — keeps the fanned catalog routable. */
39912
39966
  addonId: string(),
39913
39967
  enabled: boolean(),
39914
39968
  /** Vendor model id, or the managed runtime's loaded model. */
39915
39969
  model: string(),
39916
- /** Required for openai-compatible; override for cloud kinds. */
39917
- baseUrl: string().optional(),
39918
- /** ConfigUISchema type:'password' — never round-trips (spec §5). */
39919
- apiKey: string().optional(),
39920
39970
  /** Vision on/off. A vision call against a `false` profile is REFUSED, never
39921
39971
  * degraded to text — that shipped once and produced a confident answer to a
39922
39972
  * question about a picture nobody sent. */
@@ -39924,15 +39974,11 @@ var LlmProfileSchema = object({
39924
39974
  temperature: number().min(0).max(2).optional(),
39925
39975
  /** Nucleus sampling. Every wire we speak has it. */
39926
39976
  topP: number().min(0).max(1).optional(),
39927
- /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
39928
- * wire does, and the client drops it there (measured: the request body gets
39929
- * `top_p` and no `top_k`). The profile editor hides the field wherever it
39930
- * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
39977
+ /** Top-k sampling. Carried only by the wires that have it — a kind offers the
39978
+ * field in its editor only when its descriptor lists it in `profileFields`. */
39931
39979
  topK: number().int().positive().optional(),
39932
39980
  maxTokens: number().int().positive().optional(),
39933
- /** Prompt context window. Advisory for cloud kinds (they enforce their own);
39934
- * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
39935
- * the model with, so it is the one field that changes a PROCESS. */
39981
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
39936
39982
  contextLength: number().int().positive().optional(),
39937
39983
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
39938
39984
  * two system prompts fighting is worse than either alone). */
@@ -39958,16 +40004,37 @@ var LlmProfileSchema = object({
39958
40004
  * library; the REGISTRY of callable tools is ours and is empty in v1, so a
39959
40005
  * `true` here buys the wiring, not behaviour, until tools are registered. */
39960
40006
  toolsEnabled: boolean().default(false),
39961
- extraHeaders: record(string(), string()).optional(),
39962
- /** kind === 'managed-local' only (spec §4). */
39963
- runtime: ManagedRuntimeConfigSchema.optional(),
39964
- /**
39965
- * kind === 'apple-foundation' only: WHERE it runs — the only thing there is
39966
- * to configure (no key, no URL, no download; `model` is `apple-system`).
39967
- * `supportsVision` on such a row is stamped by the provider from the node's
39968
- * reported `imageInput`, never taken from the operator (D62).
39969
- */
39970
- appleFoundation: object({ nodeId: string() }).optional()
40007
+ /** Everything the kind's provider owns (endpoint, key, node, runtime…). */
40008
+ providerConfig: LlmProviderConfigSchema.default({})
40009
+ });
40010
+ /**
40011
+ * The common profile fields a kind's editor offers. The editor owns how each
40012
+ * one is drawn; the provider says which of them mean something on its wire.
40013
+ */
40014
+ var LlmProfileFieldSchema = _enum([
40015
+ "temperature",
40016
+ "topP",
40017
+ "topK",
40018
+ "maxTokens",
40019
+ "contextLength",
40020
+ "systemPrompt",
40021
+ "timeoutMs",
40022
+ "connectTimeoutMs",
40023
+ "firstTokenTimeoutMs",
40024
+ "idleTimeoutMs",
40025
+ "retry",
40026
+ "toolsEnabled"
40027
+ ]);
40028
+ /**
40029
+ * A provider-drawn part of the editor, by a generic widget id the admin UI
40030
+ * registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
40031
+ * picker: that widget owns the model choice.
40032
+ */
40033
+ var LlmProviderWidgetSchema = object({
40034
+ id: string(),
40035
+ placement: _enum(["connection", "model"]),
40036
+ /** `providerConfig` keys this widget must fill before the profile can be saved. */
40037
+ requires: array(string()).optional()
39971
40038
  });
39972
40039
  /** ConfigUISchema tree passed through untyped on the wire (the
39973
40040
  * notification-output `ConfigSchemaPassthrough` precedent at
@@ -39976,11 +40043,56 @@ var ConfigSchemaPassthrough$3 = unknown();
39976
40043
  var LlmProfileKindDescriptorSchema = object({
39977
40044
  kind: LlmProfileKindSchema,
39978
40045
  label: string(),
40046
+ /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
39979
40047
  icon: string(),
39980
40048
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
39981
40049
  addonId: string(),
39982
- configSchema: ConfigSchemaPassthrough$3
40050
+ /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
40051
+ connectionSchema: ConfigSchemaPassthrough$3,
40052
+ /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
40053
+ advancedSchema: ConfigSchemaPassthrough$3.optional(),
40054
+ /** The kind's defaults; a model from `listModels` may override any of them. */
40055
+ features: LlmModelFeaturesSchema,
40056
+ /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
40057
+ visionEditable: boolean(),
40058
+ /** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
40059
+ modelCatalog: _enum([
40060
+ "fetch",
40061
+ "static",
40062
+ "none"
40063
+ ]),
40064
+ staticModels: array(LlmModelInfoSchema).optional(),
40065
+ /** The common fields that mean something on this kind's wire. */
40066
+ profileFields: array(LlmProfileFieldSchema),
40067
+ providerWidgets: array(LlmProviderWidgetSchema).optional()
39983
40068
  });
40069
+ /**
40070
+ * `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
40071
+ * (the editor's form); with `profileId` too, a secret the draft leaves
40072
+ * untouched (absent or the redaction marker) is resolved server-side from the
40073
+ * stored profile — the browser never receives it.
40074
+ */
40075
+ var LlmListModelsInputSchema = object({
40076
+ addonId: string(),
40077
+ kind: LlmProfileKindSchema,
40078
+ profileId: string().optional(),
40079
+ connection: LlmProviderConfigSchema.optional()
40080
+ });
40081
+ var LlmListModelsErrorCodeSchema = _enum([
40082
+ "auth",
40083
+ "network",
40084
+ "unsupported",
40085
+ "invalid"
40086
+ ]);
40087
+ /** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
40088
+ var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
40089
+ ok: literal(true),
40090
+ models: array(LlmModelInfoSchema)
40091
+ }), object({
40092
+ ok: literal(false),
40093
+ code: LlmListModelsErrorCodeSchema,
40094
+ message: string()
40095
+ })]);
39984
40096
  var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
39985
40097
  var LlmDefaultSchema = object({
39986
40098
  selector: LlmDefaultSelectorSchema,
@@ -40080,7 +40192,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
40080
40192
  kind: "mutation",
40081
40193
  auth: "admin",
40082
40194
  timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
40083
- }), method(ProfileRefInputSchema, array(string())), method(object({}), array(LlmDefaultSchema)), method(object({
40195
+ }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
40196
+ kind: "mutation",
40197
+ auth: "admin"
40198
+ }), method(object({}), array(LlmDefaultSchema)), method(object({
40084
40199
  selector: LlmDefaultSelectorSchema,
40085
40200
  profileId: string().nullable()
40086
40201
  }), _void(), {
@@ -64116,26 +64231,6 @@ var ApiKeySummarySchema = object({
64116
64231
  createdAt: number(),
64117
64232
  lastUsedAt: number().optional()
64118
64233
  });
64119
- var ScopedTokenSummarySchema = object({
64120
- id: string(),
64121
- userId: string(),
64122
- name: string(),
64123
- tokenPrefix: string(),
64124
- scopes: array(TokenScopeSchema),
64125
- expiresAt: number().nullish(),
64126
- lastUsedAt: number().nullish(),
64127
- createdAt: number()
64128
- });
64129
- var CreateScopedTokenInputSchema = object({
64130
- userId: string(),
64131
- name: string(),
64132
- scopes: array(TokenScopeSchema),
64133
- expiresAt: number().optional()
64134
- });
64135
- var CreateScopedTokenResultSchema = object({
64136
- token: string(),
64137
- record: ScopedTokenSummarySchema
64138
- });
64139
64234
  var OauthSessionSummarySchema = object({
64140
64235
  id: string(),
64141
64236
  userId: string(),
@@ -64157,11 +64252,11 @@ var TotpStatusSchema = object({
64157
64252
  confirmedAt: number().nullable()
64158
64253
  });
64159
64254
  /**
64160
- * user-management — singleton capability for user accounts, API keys,
64161
- * and scoped tokens.
64255
+ * user-management — singleton capability for user accounts and the
64256
+ * legacy API-key rows.
64162
64257
  *
64163
64258
  * v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
64164
- * — the subset check on `setUserScopes` / `createScopedToken` is moot
64259
+ * — the subset check on `setUserScopes` is moot
64165
64260
  * because non-admins never reach these. If/when we open non-admin
64166
64261
  * delegation, structural caller-scope subset check goes inside the
64167
64262
  * provider.
@@ -64218,15 +64313,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
64218
64313
  kind: "mutation",
64219
64314
  auth: "admin",
64220
64315
  access: "delete"
64221
- }), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
64222
- kind: "mutation",
64223
- auth: "admin",
64224
- access: "create"
64225
- }), method(object({ id: string() }), object({ success: literal(true) }), {
64226
- kind: "mutation",
64227
- auth: "admin",
64228
- access: "delete"
64229
- }), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
64316
+ }), method(object({ userId: string() }), TotpSetupResultSchema, {
64230
64317
  kind: "mutation",
64231
64318
  auth: "admin",
64232
64319
  access: "create"
@@ -69833,7 +69920,7 @@ Object.freeze({
69833
69920
  capName: "llm",
69834
69921
  capScope: "system",
69835
69922
  addonId: null,
69836
- access: "view"
69923
+ access: "create"
69837
69924
  },
69838
69925
  "llm.listNodeModels": {
69839
69926
  capName: "llm",
@@ -74497,12 +74584,6 @@ Object.freeze({
74497
74584
  addonId: null,
74498
74585
  access: "create"
74499
74586
  },
74500
- "userManagement.createScopedToken": {
74501
- capName: "user-management",
74502
- capScope: "system",
74503
- addonId: null,
74504
- access: "create"
74505
- },
74506
74587
  "userManagement.createUser": {
74507
74588
  capName: "user-management",
74508
74589
  capScope: "system",
@@ -74551,12 +74632,6 @@ Object.freeze({
74551
74632
  addonId: null,
74552
74633
  access: "view"
74553
74634
  },
74554
- "userManagement.listScopedTokens": {
74555
- capName: "user-management",
74556
- capScope: "system",
74557
- addonId: null,
74558
- access: "view"
74559
- },
74560
74635
  "userManagement.listUsers": {
74561
74636
  capName: "user-management",
74562
74637
  capScope: "system",
@@ -74611,12 +74686,6 @@ Object.freeze({
74611
74686
  addonId: null,
74612
74687
  access: "delete"
74613
74688
  },
74614
- "userManagement.revokeScopedToken": {
74615
- capName: "user-management",
74616
- capScope: "system",
74617
- addonId: null,
74618
- access: "delete"
74619
- },
74620
74689
  "userManagement.setupTotp": {
74621
74690
  capName: "user-management",
74622
74691
  capScope: "system",
@@ -74647,12 +74716,6 @@ Object.freeze({
74647
74716
  addonId: null,
74648
74717
  access: "view"
74649
74718
  },
74650
- "userManagement.validateScopedToken": {
74651
- capName: "user-management",
74652
- capScope: "system",
74653
- addonId: null,
74654
- access: "view"
74655
- },
74656
74719
  "userManagement.verifyTotp": {
74657
74720
  capName: "user-management",
74658
74721
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-terminal",
3
- "version": "0.1.136",
3
+ "version": "0.1.137",
4
4
  "description": "Interactive terminal sessions (pty + xterm) as a CamStack addon",
5
5
  "keywords": [
6
6
  "camstack",