@deepseek-ai/dsh-client-ui-settings-models 0.0.1-rc.3

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.
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Models settings page store: one snapshot joining the configurable-provider
3
+ * directory (`llm.providers`), the settings namespaces (`settings.describe`),
4
+ * and the referenced credentials (`credentials.describe`). The host stays the
5
+ * single fact source — every mutation writes through the wire and the page
6
+ * re-renders from the next describe, pushed or refetched.
7
+ */
8
+ import type { ConfigurableProviderView, CredentialView, IApiClient, SettingsNamespaceView } from '@deepseek-ai/dsh-api-remotes/client';
9
+ import type { SnapshotStore } from '@deepseek-ai/dsh-client-runtime/client';
10
+ /** One provider row the page renders. */
11
+ export interface ProviderRow {
12
+ /** The directory entry (route id, display name, settings address, live state). */
13
+ entry: ConfigurableProviderView;
14
+ /** Whether any layer configures this provider (its profile resolves). */
15
+ configured: boolean;
16
+ /** Whether the user layer alone carries the profile (removal restores the base). */
17
+ removable: boolean;
18
+ /** The credential reference the resolved profile names, when one does. */
19
+ apiKeyEnv: string | undefined;
20
+ /** Credential state for {@link apiKeyEnv}, once described. */
21
+ credential: CredentialView | undefined;
22
+ }
23
+ /** Page snapshot. */
24
+ export interface ModelsSettingsState {
25
+ status: 'idle' | 'loading' | 'ready' | 'error';
26
+ /** Whole-load failure text; row-level write failures stay in the editor. */
27
+ error: string | null;
28
+ /** Credential enrichment failure; provider/settings rows remain usable. */
29
+ credentialError: string | null;
30
+ /** Whether the settings provider accepts writes. */
31
+ writable: boolean;
32
+ /** Every configurable provider joined with its configured/credential state. */
33
+ rows: readonly ProviderRow[];
34
+ /** Namespace views by ns, for the editor's schema/layers/secrets. */
35
+ namespaces: ReadonlyMap<string, SettingsNamespaceView>;
36
+ }
37
+ /**
38
+ * Human text for a rejected wire call. A transport failure rejects with an
39
+ * Error; a host or a runtime can reject with anything, and the page still has
40
+ * to say something.
41
+ * @param error - the rejection value.
42
+ * @returns the message to show.
43
+ */
44
+ export declare function messageOf(error: unknown): string;
45
+ /**
46
+ * Derive the conventional credential reference for a provider route: the v1
47
+ * page never asks for an environment-variable name, so a typed key stores
48
+ * under this derived reference and the profile records it as `apiKeyEnv`.
49
+ * @param provider - provider route id (e.g. `anthropic`, `minimax-cn`).
50
+ * @returns the derived reference name (e.g. `MINIMAX_CN_API_KEY`).
51
+ */
52
+ export declare function deriveKeyRef(provider: string): string;
53
+ /**
54
+ * The wire protocols a hand-declared route may name, read out of the owning
55
+ * namespace's own schema. This stays a schema read rather than a wire field so
56
+ * the choices the page offers cannot drift from the ones the adapter accepts:
57
+ * both come from the same `Config`.
58
+ * @param namespace - the namespace view whose schema declares the profile shape.
59
+ * @returns the protocol identifiers, or an empty list when the schema has none.
60
+ */
61
+ export declare function protocolChoices(namespace: SettingsNamespaceView | undefined): string[];
62
+ /** The models settings page controller (one per settings surface). */
63
+ export declare class ModelsSettingsStore {
64
+ private readonly api;
65
+ /** The snapshot the section renders from (uSES-safe store). */
66
+ readonly store: SnapshotStore<ModelsSettingsState>;
67
+ /** Latest load wins; an older response never overwrites a newer one. */
68
+ private generation;
69
+ /**
70
+ * @param api - the wire face (settings/credentials/llm domains).
71
+ */
72
+ constructor(api: Pick<IApiClient, 'settings' | 'credentials' | 'llm'>);
73
+ /**
74
+ * Refresh the whole page snapshot: directory and namespaces in parallel,
75
+ * then one batched credential describe over every referenced ref. A
76
+ * failure keeps the last good rows and surfaces the error.
77
+ * @returns nothing; the snapshot carries the outcome.
78
+ */
79
+ load(): Promise<void>;
80
+ }
81
+ /**
82
+ * Whether a joined row can serve model requests as it stands: the route is
83
+ * registered with the adapter registry, and whatever credential its resolved
84
+ * profile names is stored. A profile naming no reference authenticates through
85
+ * the provider's own path (the Bedrock chain, Vertex ADC, a gateway that needs
86
+ * nothing), as does a live route with no settings address at all, so neither
87
+ * owes this page a key.
88
+ * @param row - one joined provider row.
89
+ * @returns whether the user already has this provider to talk to.
90
+ */
91
+ export declare function providerUsable(row: ProviderRow): boolean;
92
+ /** First-run onboarding readiness derived only from the shared Models join. */
93
+ export type OnboardingReadiness = {
94
+ kind: 'loading';
95
+ } | {
96
+ kind: 'adapter-absent';
97
+ } | {
98
+ kind: 'provider-ready';
99
+ } | {
100
+ kind: 'credential-missing';
101
+ } | {
102
+ kind: 'unavailable';
103
+ reason: 'load-failed' | 'provider-inactive' | 'credentials-unavailable' | 'settings-read-only' | 'credential-read-only';
104
+ };
105
+ /**
106
+ * Project first-run readiness from the provider/settings/credential join used
107
+ * by the Models page. The step exists to leave the user with a model to talk
108
+ * to, so ANY usable provider ends it; only when none exists does the official
109
+ * DeepSeek route — the one route the prompt can offer a key field for — decide
110
+ * whether prompting can help. A missing official configurable-provider
111
+ * declaration means the adapter is not repairable by navigating to Models.
112
+ * @param state - current shared Models join snapshot.
113
+ * @returns the onboarding state without reading a parallel fact source.
114
+ */
115
+ export declare function onboardingReadiness(state: ModelsSettingsState): OnboardingReadiness;
116
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1,4 @@
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;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Package-owned invariant companion for `@deepseek-ai/dsh-client-ui-settings-models`.
3
+ * @module @deepseek-ai/dsh-client-ui-settings-models/invariant
4
+ */
5
+ import type { Context } from '@deepseek-ai/cordis';
6
+ /** Cordis companion plugin name. */
7
+ export declare const name = "client-ui-settings-models-invariant";
8
+ /** Service required before the companion can reserve package ownership. */
9
+ export declare const inject: string[];
10
+ /**
11
+ * Register this package's invariant companion.
12
+ * @param ctx - Cordis context carrying the invariant service.
13
+ * @returns the installed registration's disposer after setup succeeds.
14
+ */
15
+ export declare const apply: (ctx: Context) => Promise<() => void>;
16
+ //# sourceMappingURL=invariant.d.ts.map
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@deepseek-ai/dsh-client-ui-settings-models",
3
+ "description": "Models settings and official-DeepSeek first-run routing over one live provider/settings/credential join",
4
+ "version": "0.0.1-rc.3",
5
+ "publishConfig": {
6
+ "access": "restricted"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
11
+ "directory": "packages/client/ui-settings-models"
12
+ },
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "types": "lib/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/types/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./invariant": {
22
+ "types": "./lib/types/invariant.d.ts",
23
+ "default": "./lib/invariant.js"
24
+ },
25
+ "./client": {
26
+ "types": "./lib/types/client/index.d.ts",
27
+ "default": "./lib/client.js"
28
+ },
29
+ "./src/*": "./src/*",
30
+ "./package.json": "./package.json"
31
+ },
32
+ "dsh": {
33
+ "client": {
34
+ "inject": [
35
+ "@deepseek-ai/dsh-client-runtime",
36
+ "@deepseek-ai/dsh-client-ui-settings",
37
+ "@deepseek-ai/dsh-client-locale",
38
+ "@deepseek-ai/dsh-api-remotes"
39
+ ],
40
+ "platform": "web"
41
+ }
42
+ },
43
+ "license": "BSD-3-Clause",
44
+ "peerDependencies": {
45
+ "react": "^18.2.0",
46
+ "@deepseek-ai/cordis": "^4.0.1-rc.1",
47
+ "@deepseek-ai/dsh-api-remotes": "^0.0.1-rc.3",
48
+ "@deepseek-ai/dsh-client-connection": "^0.0.1-rc.3",
49
+ "@deepseek-ai/dsh-client-runtime": "^0.0.1-rc.3",
50
+ "@deepseek-ai/dsh-client-ui-slots": "^0.0.1-rc.3",
51
+ "@deepseek-ai/dsh-client-web-react": "^0.0.1-rc.3",
52
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.0.1-rc.3",
53
+ "@deepseek-ai/dsh-invariants": "^0.0.1-rc.3",
54
+ "@deepseek-ai/dsh-client-schema-form": "^0.0.1-rc.3"
55
+ },
56
+ "devDependencies": {
57
+ "@types/react": "~18.3.1",
58
+ "react": "^18.2.0",
59
+ "@deepseek-ai/dsh-client-connection": "^0.0.1-rc.3",
60
+ "@deepseek-ai/dsh-client-runtime": "^0.0.1-rc.3",
61
+ "@deepseek-ai/dsh-client-schema-form": "^0.0.1-rc.3",
62
+ "@deepseek-ai/dsh-client-locale": "^0.0.1-rc.3",
63
+ "@deepseek-ai/dsh-client-test-runtime": "^0.0.1-rc.3",
64
+ "@deepseek-ai/dsh-api-remotes": "^0.0.1-rc.3",
65
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.0.1-rc.3",
66
+ "@deepseek-ai/dsh-client-ui-settings": "^0.0.1-rc.3",
67
+ "@deepseek-ai/dsh-client-ui-slots": "^0.0.1-rc.3",
68
+ "@deepseek-ai/dsh-client-web-react": "^0.0.1-rc.3",
69
+ "@deepseek-ai/cordis": "^4.0.1-rc.1",
70
+ "@deepseek-ai/dsh-invariants": "^0.0.1-rc.3"
71
+ },
72
+ "files": [
73
+ "lib/index.js",
74
+ "lib/invariant.js",
75
+ "lib/client.js",
76
+ "lib/types/**/*.d.ts"
77
+ ],
78
+ "scripts": {
79
+ "bundle": "tsdown",
80
+ "watch": "tsdown --watch"
81
+ }
82
+ }