@qilin-agent/client-ui-settings-models 3.1.6 → 3.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,6 +1,26 @@
1
+ import z from "@qilin-agent/schemastery";
2
+ //#region lib/types/onboarding-config.js
3
+ /** Public page-bootstrap options shared by the Host and Client halves. */
4
+ /** Validate Host configuration and its public page-bootstrap payload. */
5
+ const Config = z.object({ credentialOnboarding: z.boolean().default(true) });
6
+ /** Page-global key carrying only the public onboarding options. */
7
+ const ONBOARDING_CONFIG_GLOBAL = "__QILIN_MODELS_ONBOARDING__";
8
+ //#endregion
1
9
  //#region lib/types/index.js
2
- /** Host loader entry for the browser implementation exported from `./client`. */
3
- /** Host plugin body — no host-side behavior for the models settings plugin. */
4
- function apply() {}
10
+ /** Host configuration and page bootstrap for Models credential onboarding. */
11
+ /**
12
+ * Publish the credential-onboarding choice before browser plugins activate.
13
+ * @param ctx - Host context collecting the page's initialization data.
14
+ * @param config - plugin options with schema defaults applied by the Loader.
15
+ */
16
+ function apply(ctx, config) {
17
+ ctx.on("webserver/index-inject", (table) => {
18
+ table.push({
19
+ kind: "global",
20
+ name: ONBOARDING_CONFIG_GLOBAL,
21
+ value: { credentialOnboarding: config.credentialOnboarding }
22
+ });
23
+ });
24
+ }
5
25
  //#endregion
6
- export { apply };
26
+ export { Config, apply };
@@ -46,6 +46,11 @@ export interface CustomProviderCardProps {
46
46
  readOnly: boolean;
47
47
  /** Close the card; `changed` reports whether a provider was created. */
48
48
  onClose: (changed: boolean) => void;
49
+ /**
50
+ * Called once per change with whether the create or the list's endpoint
51
+ * interrogation is in flight, so the owner can hold its surface still.
52
+ */
53
+ onBusyChange?: (busy: boolean) => void;
49
54
  }
50
55
  /**
51
56
  * Render the custom-provider creation card.
@@ -74,6 +74,13 @@ export interface ModelListEditorProps {
74
74
  t: (key: keyof typeof en) => string;
75
75
  /** Disable every control (read-only deployment or a pending write). */
76
76
  disabled: boolean;
77
+ /**
78
+ * Called once per change with whether an endpoint interrogation is in
79
+ * flight. The owning card folds it into its own busy state so the surface
80
+ * around the card — a mode switch, say — can refuse to move while the
81
+ * answer, and the picker it opens, is still bound for this list.
82
+ */
83
+ onBusyChange: (busy: boolean) => void;
77
84
  }
78
85
  /**
79
86
  * Render the model list with its fetch action.
@@ -2,6 +2,7 @@
2
2
  import type { ReactNode } from 'react';
3
3
  import type { DeepSeekModelDraft } from './DeepSeekModelsEditor.tsx';
4
4
  import type { ModelsKey } from './locales.ts';
5
+ import type { ModelRowOrder } from './useModelRows.ts';
5
6
  /** A capacity's editable text and adapter-specific inherited hint. */
6
7
  interface CapacityInput {
7
8
  value: string;
@@ -12,7 +13,9 @@ interface CapacityInput {
12
13
  /** Adapter-owned data and actions for one model row. */
13
14
  interface ModelRowProps {
14
15
  model: DeepSeekModelDraft;
16
+ rowKey: number;
15
17
  position: number;
18
+ order: ModelRowOrder;
16
19
  inputField: 'inputModalities' | 'input';
17
20
  inputFallback?: readonly string[] | undefined;
18
21
  inputLoading?: boolean;
@@ -46,10 +46,14 @@ export interface ProviderEditorProps {
46
46
  namespace: SettingsNamespaceView;
47
47
  /** Settings-owned synchronous schema and immutable path operations. */
48
48
  schema: SettingsSchemaOperations;
49
+ /** Endpoint the route uses when its profile sets no `baseURL`; absent when the adapter reports none. */
50
+ defaultBaseURL?: string;
49
51
  /** Environment variables used by the provider to construct its endpoint. */
50
52
  baseURLEnv?: readonly string[];
51
53
  /** Authentication the route performs when its profile names no credential reference; absent when the adapter reports none. */
52
54
  nativeAuth?: LlmNativeAuth;
55
+ /** Redacted state of the profile's named credential reference, from the page snapshot. */
56
+ credential?: CredentialInfo;
53
57
  /** Redacted checks for the profile's named reference or the provider's native variables. */
54
58
  credentialChecks?: Readonly<Record<string, CredentialInfo>>;
55
59
  /** Path from the section root to this provider's profile. */
@@ -74,6 +78,14 @@ export interface ProviderEditorProps {
74
78
  submitBusyLabelKey?: keyof typeof en;
75
79
  /** Close the editor; `changed` reports whether an Apply committed. */
76
80
  onClose: (changed: boolean) => void;
81
+ /** Called on a credential form submission before the save starts. */
82
+ onSubmitCredential?: () => void;
83
+ /**
84
+ * Called once per change with whether the apply or the model list's
85
+ * endpoint interrogation is in flight, so the owner can hold its surface
86
+ * still.
87
+ */
88
+ onBusyChange?: (busy: boolean) => void;
77
89
  }
78
90
  /**
79
91
  * The minimal path ops carrying `after` over `before`, both as the card sees
@@ -1,8 +1,10 @@
1
1
  /**
2
2
  * Models settings and product-onboarding plugin, browser half. It registers
3
3
  * the Models page plus the official-DeepSeek onboarding dialog, whose UI is
4
- * this package's modal wrapper. The Host settings and credential contracts
5
- * stay behind their existing wire APIs. Export discipline:
4
+ * this package's modal wrapper; the dialog registers only when the Host's
5
+ * published credentialOnboarding choice leaves the API-key step to the
6
+ * browser. The Host settings and credential contracts stay behind their
7
+ * existing wire APIs. Export discipline:
6
8
  * packages/client/AGENTS.md.
7
9
  */
8
10
  import type { Context as ClientContext } from '@qilin-agent/kylin';
@@ -30,19 +30,20 @@ export declare const en: {
30
30
  keyReveal: string;
31
31
  keyHide: string;
32
32
  keyPlaceholder: string;
33
- keyPlaceholderNative: string;
34
- keyStored: string;
35
- keyEnvLocked: string;
33
+ keyPlaceholderFallback: string;
36
34
  keyPlaceholderSaved: string;
37
35
  keyFallbackMissing: string;
38
36
  keyFallbackDetected: string;
39
37
  keyFallbackDetectedHidden: string;
40
38
  keyFallbackUnchecked: string;
39
+ keyHelp: string;
40
+ authHelp: string;
41
41
  customized: string;
42
42
  baseUrl: string;
43
43
  baseUrlDefault: string;
44
44
  baseUrlEnvironment: string;
45
45
  baseUrlConfigured: string;
46
+ baseUrlPlaceholder: string;
46
47
  deepSeekBaseUrl: string;
47
48
  deepSeekEndpointHint: string;
48
49
  models: string;
@@ -73,6 +74,8 @@ export declare const en: {
73
74
  modelReasoningOffValuePlaceholder: string;
74
75
  addModel: string;
75
76
  removeModel: string;
77
+ reorderModel: string;
78
+ reorderModelHelp: string;
76
79
  modelsEmpty: string;
77
80
  keyBlank: string;
78
81
  keyBlankNew: string;
@@ -113,6 +116,7 @@ export declare const en: {
113
116
  customBaseUrlInvalid: string;
114
117
  customNeedsModels: string;
115
118
  customBaseUrlPlaceholder: string;
119
+ customAnthropicBaseUrlPlaceholder: string;
116
120
  settingsPathUnresolvable: string;
117
121
  create: string;
118
122
  creating: string;
@@ -5,7 +5,7 @@
5
5
  * failure codes and Remote namespaces stay in the apply world.
6
6
  */
7
7
  import type { Context as ClientContext } from '@qilin-agent/kylin';
8
- import type { CredentialInfo, LlmDiscoveredModel, LlmModelDiscoveryRequest, SettingsNamespaceView, SettingsPathOpView } from '@qilin-agent/api-remotes/client';
8
+ import type { LlmDiscoveredModel, LlmModelDiscoveryRequest, SettingsNamespaceView, SettingsPathOpView } from '@qilin-agent/api-remotes/client';
9
9
  /** What one namespace write answered. */
10
10
  export type SettingsWriteOutcome =
11
11
  /** Committed; the view carries the stored user subtree and the new revision. */
@@ -40,12 +40,6 @@ export type ModelDiscoveryOutcome =
40
40
  };
41
41
  /** The Host operations the Models page and its cards invoke. */
42
42
  export interface ModelsOperations {
43
- /**
44
- * Read one credential reference's state.
45
- * @param ref - credential reference name.
46
- * @returns the state, or undefined when the reference is unknown or the read was refused.
47
- */
48
- describeCredential(ref: string): Promise<CredentialInfo | undefined>;
49
43
  /**
50
44
  * Store one credential literal under its reference.
51
45
  * @param ref - credential reference name.
@@ -0,0 +1,41 @@
1
+ /** Local model-row identities, disclosures, capacity text, and draft ordering. */
2
+ import type { DeepSeekModelDraft } from './DeepSeekModelsEditor.tsx';
3
+ /** Text fields whose unfinished spelling belongs to one draft row. */
4
+ export type CapacityField = 'contextWindow' | 'maxTokens';
5
+ interface RowState {
6
+ key: number;
7
+ expanded: boolean;
8
+ editing: Map<CapacityField, string>;
9
+ }
10
+ /** Drag state and actions for one model row within its editor. */
11
+ export interface ModelRowOrder {
12
+ dragging: boolean;
13
+ target: 'before' | 'after' | undefined;
14
+ canDrop: boolean;
15
+ onStart: () => void;
16
+ onEnd: () => void;
17
+ onOver: (half: 'before' | 'after') => void;
18
+ onLeave: () => void;
19
+ onDrop: (half: 'before' | 'after') => void;
20
+ onMove: (offset: -1 | 1) => void;
21
+ }
22
+ interface ModelRows {
23
+ rows: (RowState & {
24
+ model: DeepSeekModelDraft;
25
+ order: ModelRowOrder;
26
+ })[];
27
+ toggle: (index: number) => void;
28
+ edit: (index: number, field: CapacityField, text: string | undefined) => void;
29
+ forget: (removed: ReadonlySet<number>) => void;
30
+ reset: () => void;
31
+ }
32
+ /**
33
+ * Keep row state with its model through draft moves and removals.
34
+ * @param models - current draft array, owned by the provider card.
35
+ * @param onChange - replaces only that card's draft array.
36
+ * @param disabled - prevents reordering while the card cannot be edited.
37
+ * @returns row state and local editing and ordering actions.
38
+ */
39
+ export declare function useModelRows(models: readonly DeepSeekModelDraft[], onChange: (models: DeepSeekModelDraft[]) => void, disabled: boolean): ModelRows;
40
+ export {};
41
+ //# sourceMappingURL=useModelRows.d.ts.map
@@ -1,4 +1,11 @@
1
- /** Host loader entry for the browser implementation exported from `./client`. */
2
- /** Host plugin body — no host-side behavior for the models settings plugin. */
3
- export declare function apply(): void;
1
+ /** Host configuration and page bootstrap for Models credential onboarding. */
2
+ import type { Context } from '@qilin-agent/kylin';
3
+ import { type Config } from './onboarding-config.ts';
4
+ export { Config } from './onboarding-config.ts';
5
+ /**
6
+ * Publish the credential-onboarding choice before browser plugins activate.
7
+ * @param ctx - Host context collecting the page's initialization data.
8
+ * @param config - plugin options with schema defaults applied by the Loader.
9
+ */
10
+ export declare function apply(ctx: Context, config: Config): void;
4
11
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,16 @@
1
+ /** Public page-bootstrap options shared by the Host and Client halves. */
2
+ import z from '@qilin-agent/schemastery';
3
+ /** Onboarding options after schema defaults are applied. */
4
+ export interface Config {
5
+ /** Offer the browser API-key step when no native shell owns credential onboarding. */
6
+ credentialOnboarding: boolean;
7
+ }
8
+ /** Validate Host configuration and its public page-bootstrap payload. */
9
+ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
10
+ credentialOnboarding: z<boolean, boolean, "defined">;
11
+ }>>, Schemastery.ObjectT<NoInfer<{
12
+ credentialOnboarding: z<boolean, boolean, "defined">;
13
+ }>>, "plain">;
14
+ /** Page-global key carrying only the public onboarding options. */
15
+ export declare const ONBOARDING_CONFIG_GLOBAL = "__QILIN_MODELS_ONBOARDING__";
16
+ //# sourceMappingURL=onboarding-config.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qilin-agent/client-ui-settings-models",
3
3
  "description": "Models settings and shared product-onboarding dialogs over existing settings and credential joins",
4
- "version": "3.1.6",
4
+ "version": "3.1.8",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -40,22 +40,27 @@
40
40
  },
41
41
  "license": "MIT",
42
42
  "peerDependencies": {
43
- "@qilin-agent/kylin": "~4.0.5"
43
+ "@qilin-agent/kylin": "~4.0.6-alpha.2"
44
44
  },
45
45
  "devDependencies": {
46
+ "@qilin-agent/remote-mock": "3.1.8",
47
+ "@qilin-agent/api-remotes": "3.1.8",
48
+ "@qilin-agent/client-locale": "3.1.8",
49
+ "@qilin-agent/client-store": "3.1.8",
50
+ "@qilin-agent/client-test-runtime": "3.1.8",
51
+ "@qilin-agent/client-ui-primitives": "3.1.8",
52
+ "@qilin-agent/client-ui-settings": "3.1.8",
53
+ "@qilin-agent/client-ui-slots": "3.1.8",
54
+ "@qilin-agent/host-webserver": "3.1.8",
46
55
  "@types/react": "~18.3.1",
56
+ "@testing-library/react": "^16.3.2",
57
+ "@qilin-agent/kylin": "~4.0.6-alpha.2",
47
58
  "react": "^18.2.0",
48
- "@qilin-agent/remote-mock": "3.1.6",
49
- "@qilin-agent/api-remotes": "3.1.6",
50
- "@qilin-agent/client-locale": "3.1.6",
51
- "@qilin-agent/client-test-runtime": "3.1.6",
52
- "@qilin-agent/client-store": "3.1.6",
53
- "@qilin-agent/client-ui-primitives": "3.1.6",
54
- "@qilin-agent/client-ui-settings": "3.1.6",
55
- "@qilin-agent/kylin": "~4.0.5",
56
- "@qilin-agent/client-ui-slots": "3.1.6",
57
- "@qilin-agent/util-values": "3.1.6",
58
- "@qilin-agent/client-ui-renderer": "3.1.6"
59
+ "@qilin-agent/client-ui-renderer": "3.1.8",
60
+ "@qilin-agent/util-values": "3.1.8"
61
+ },
62
+ "dependencies": {
63
+ "@qilin-agent/schemastery": "~3.18.6-alpha.2"
59
64
  },
60
65
  "files": [
61
66
  "lib/index.js",