dsh-advisor 0.1.0
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/LICENSE +21 -0
- package/README.i18n.yaml +7 -0
- package/README.md +303 -0
- package/README.zh.md +166 -0
- package/cordis.patch.yml +6 -0
- package/lib/advisor-runtime.d.ts +242 -0
- package/lib/advisor-runtime.js +662 -0
- package/lib/advisor-runtime.js.map +1 -0
- package/lib/client/advisor-card.d.ts +90 -0
- package/lib/client/advisor-store.d.ts +310 -0
- package/lib/client/index.d.ts +39 -0
- package/lib/client/locales.d.ts +40 -0
- package/lib/client.d.ts +1 -0
- package/lib/client.js +840 -0
- package/lib/commands.d.ts +136 -0
- package/lib/commands.js +185 -0
- package/lib/commands.js.map +1 -0
- package/lib/config.d.ts +74 -0
- package/lib/config.js +93 -0
- package/lib/config.js.map +1 -0
- package/lib/delivery.d.ts +129 -0
- package/lib/delivery.js +169 -0
- package/lib/delivery.js.map +1 -0
- package/lib/emission-guard.d.ts +99 -0
- package/lib/emission-guard.js +155 -0
- package/lib/emission-guard.js.map +1 -0
- package/lib/gateway.d.ts +116 -0
- package/lib/gateway.js +214 -0
- package/lib/gateway.js.map +1 -0
- package/lib/index.d.ts +48 -0
- package/lib/index.js +485 -0
- package/lib/index.js.map +1 -0
- package/lib/kinds.d.ts +38 -0
- package/lib/kinds.js +24 -0
- package/lib/kinds.js.map +1 -0
- package/lib/prompts.d.ts +22 -0
- package/lib/prompts.js +38 -0
- package/lib/prompts.js.map +1 -0
- package/lib/settings.d.ts +96 -0
- package/lib/settings.js +141 -0
- package/lib/settings.js.map +1 -0
- package/lib/transcript.d.ts +257 -0
- package/lib/transcript.js +530 -0
- package/lib/transcript.js.map +1 -0
- package/package.json +90 -0
- package/scripts/build-client.mjs +268 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advisor-runtime.js","sourceRoot":"","sources":["../src/advisor-runtime.ts"],"names":[],"mappings":"AAAA;;;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IAAI,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACjF,IAAI,MAAqC,CAAA;QACzC,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;YACjF,MAAM,GAAG,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,iBAAiB,CAAC,KAAK,CAAC,CAAC;gBACtF,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC;gBAC1B,CAAC,CAAC,SAAS,CAAA;QACf,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,GAAG,SAAS,CAAA;QACpB,CAAC;QACD,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;QAC1C,OAAO,MAAM,CAAA;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Advisor settings card (plan dsh-advisor-plugin-config-card-ux, task 1): the
|
|
3
|
+
* card registered into the "插件配置" settings page's `settings.plugin.item`
|
|
4
|
+
* slot (id `advisor`, order 30). It keeps the n5 gateway channel — the store
|
|
5
|
+
* reads/writes the advisor config through `/api/advisor/get` +
|
|
6
|
+
* `/api/advisor/set` (KD-G3) — while the card chrome is rebuilt to replicate
|
|
7
|
+
* the upstream `PluginCard` contract (self-drawn: the upstream client value
|
|
8
|
+
* face exports no reusable card). The chrome: a collapsible box whose header
|
|
9
|
+
* is a button stacking the plugin name over its description, with a dirty
|
|
10
|
+
* "unsaved" pill and a rotating chevron (`IconChevronDownOutline14` from
|
|
11
|
+
* ui-primitives), `aria-expanded`/`aria-label` like the upstream header; a
|
|
12
|
+
* divider under the header; then the form content; then a footer with the
|
|
13
|
+
* failed message + Discard/Save carrying the upstream disabled semantics —
|
|
14
|
+
* save = `!dirty || invalid || saving`, discard = `!dirty || saving` (KD-U1,
|
|
15
|
+
* Global Constraints). Save additionally carries `!writable` and the store
|
|
16
|
+
* refuses writes outright in read-only environments (W-1, qc2 fix wave) —
|
|
17
|
+
* see the disabled-term comment in the ready branch. Disclosure is
|
|
18
|
+
* card-local state: which card a user has open is a reading gesture, and
|
|
19
|
+
* staged edits outlive collapsing — the pill rides the header (upstream
|
|
20
|
+
* rationale).
|
|
21
|
+
*
|
|
22
|
+
* The full form is unchanged from the card-form plan: `enabled` switch
|
|
23
|
+
* (default off), `provider`/`model` select boxes limited to the
|
|
24
|
+
* system-configured providers and their models (KD-S2), the
|
|
25
|
+
* required-when-enabled gate (KD-S4, also enforced in the store), the
|
|
26
|
+
* `systemPrompt` textarea, the `immuneTurns`/`maxDeltaMessages` number
|
|
27
|
+
* inputs, and Save writing the advisor config through the gateway channel
|
|
28
|
+
* (store → `connection.rpc.call('/api', 'advisor/set', { patch })`). Discard
|
|
29
|
+
* rewinds the draft to the last-known host config (client-side only — no
|
|
30
|
+
* gateway write).
|
|
31
|
+
*
|
|
32
|
+
* Presentation follows `PluginCard.module.css` shape via
|
|
33
|
+
* `advisor-card.module.css` — every color resolves through a `--dsw-alias-*`
|
|
34
|
+
* token so the card adapts to the light/dark theme.
|
|
35
|
+
*
|
|
36
|
+
* A stored provider/model that is no longer among the current options
|
|
37
|
+
* surfaces warning copy (`staleProvider`/`staleModel`) instead of blocking
|
|
38
|
+
* Save: the user keeps the stored value (it still applies as stored) or
|
|
39
|
+
* reselects — the host gate rejects truly invalid configurations on write.
|
|
40
|
+
* Clearing a number input leaves the field empty; the store then omits that
|
|
41
|
+
* key from the apply patch (the stored value stays unchanged).
|
|
42
|
+
*
|
|
43
|
+
* Degraded/error/loading states keep the same card chrome (KD-U3): the
|
|
44
|
+
* header always renders title+description+chevron, and the body carries the
|
|
45
|
+
* config-channel notice or the load error + retry (AC-3 — the documented
|
|
46
|
+
* divergence from upstream, whose unavailable card renders nothing). A card
|
|
47
|
+
* that cannot render its form keeps the notice/error body ALWAYS visible
|
|
48
|
+
* (derived open — the header cannot collapse it away), while a healthy card
|
|
49
|
+
* is collapsed until the user expands it (AC-1). The notice also stays
|
|
50
|
+
* visible through a background refresh of a degraded card: while
|
|
51
|
+
* `status === 'loading'` the open derivation falls back to the store's
|
|
52
|
+
* latched `degraded` (qc1 S-2 fix wave), so the refresh window never
|
|
53
|
+
* collapses the AC-3 notice.
|
|
54
|
+
* When the last load could not reach the `advisor.get` gateway endpoint (the
|
|
55
|
+
* gateway channel is down or not ready on this host), the form is replaced
|
|
56
|
+
* by the `namespaceUnavailable` notice and Save is never offered, so the
|
|
57
|
+
* page never presents a writable-looking editor whose writes the host would
|
|
58
|
+
* refuse (KD-G5). Note: without a settings service the gateway's `get` still
|
|
59
|
+
* succeeds (entry fallback — the form renders), while `set` fails with a
|
|
60
|
+
* clear "settings service is unavailable" error; the notice covers channel
|
|
61
|
+
* unreachability, not the no-settings-service case.
|
|
62
|
+
*/
|
|
63
|
+
import { type ReactNode } from 'react';
|
|
64
|
+
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
65
|
+
import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-web-react';
|
|
66
|
+
import type { AdvisorSettingsState, AdvisorSettingsStore } from './advisor-store.ts';
|
|
67
|
+
/** Injected dependencies of {@link AdvisorCard} (slot `inject`). */
|
|
68
|
+
export interface AdvisorCardInjected {
|
|
69
|
+
/** The card store (loaded on mount, refreshed on pushed invalidations). */
|
|
70
|
+
controller: AdvisorSettingsStore;
|
|
71
|
+
/** uSES subscription hook bound to the store. */
|
|
72
|
+
useSnapshot: SnapshotSelectorHook<AdvisorSettingsState>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Props the renderer binds for the card: the `settings.plugin.item` runtime
|
|
76
|
+
* share (empty owner props), the framework-synthesized `t` seat for the
|
|
77
|
+
* declared `settings.advisor` namespace (KD-1 — `t` is NOT part of the inject
|
|
78
|
+
* face), and the registrant's business face.
|
|
79
|
+
*/
|
|
80
|
+
export type AdvisorCardProps = PropsRuntime<'settings.plugin.item'> & PropsLocale<'settings.advisor'> & InjectFace<AdvisorCardInjected>;
|
|
81
|
+
/**
|
|
82
|
+
* Render the advisor card inside the plugin-config section, replicating the
|
|
83
|
+
* upstream PluginCard chrome (KD-U1): a collapsible `<li>` with a header
|
|
84
|
+
* button (name over description, dirty pill, rotating chevron, aria) and,
|
|
85
|
+
* when open, a divided body holding the readOnly notice, the form, and the
|
|
86
|
+
* footer (failed message + Discard/Save).
|
|
87
|
+
* @param props - slot-delivered injected dependencies and the synthesized t seat.
|
|
88
|
+
* @returns the card.
|
|
89
|
+
*/
|
|
90
|
+
export declare function AdvisorCard(props: AdvisorCardProps): ReactNode;
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Advisor settings card store (plan dsh-advisor-settings-gateway-n5, task 2).
|
|
3
|
+
* One snapshot over the wire faces the card renders from; the host stays the
|
|
4
|
+
* single fact source — every mutation writes through the host `advisor` config
|
|
5
|
+
* gateway (`connection.rpc.call('/api', 'advisor/get' | 'advisor/set', …)`),
|
|
6
|
+
* and the page re-renders from the next get, pushed or refetched.
|
|
7
|
+
*
|
|
8
|
+
* Data-source split (KD-G3):
|
|
9
|
+
* - the **advisor config** reads/writes ride the gateway RPC channel
|
|
10
|
+
* (`/api/advisor/get` returns `{ config }`, `/api/advisor/set` accepts
|
|
11
|
+
* `{ patch }` and returns the new composed config) — the `advisor` settings
|
|
12
|
+
* namespace is NOT on the apiproxy exposed-namespaces whitelist, so the
|
|
13
|
+
* old `api.settings.describe`/`mutate` path is dead for it and the gateway
|
|
14
|
+
* is the only web-visible channel (host side: `src/gateway.ts`, `@Remote`
|
|
15
|
+
* get/set against the live `AdvisorSettingsBridge` source);
|
|
16
|
+
* - the **provider/model directory** stays on `api.settings.describe` /
|
|
17
|
+
* `api.llm.*` (the `llm-deepseek` namespaces ARE in the exposed set).
|
|
18
|
+
*
|
|
19
|
+
* The returned config is the RESOLVED config (through the host hard gate):
|
|
20
|
+
* absent keys (provider/model/disabledReason) are omitted by the wire
|
|
21
|
+
* normalization, never present-as-undefined — the draft seeds treat them as
|
|
22
|
+
* missing. Apply diffs the draft against the last-read config (the seed) and
|
|
23
|
+
* sends only the changed keys as the `{ patch }`; clearing a provider/model
|
|
24
|
+
* the seed pins stores an explicit `''` override (the gateway merge cannot
|
|
25
|
+
* express an unset, and the resolver treats `''` as absent). Clearing a number
|
|
26
|
+
* input leaves the field empty and omits the key from the patch.
|
|
27
|
+
*
|
|
28
|
+
* The join mirrors the ui-models Models page (store.ts):
|
|
29
|
+
* - **configured** provider = its settings namespace resolves AND its profile
|
|
30
|
+
* resolves (`settingsPath` empty → whole section, else `getPath` on the
|
|
31
|
+
* namespace value);
|
|
32
|
+
* - **model options** = the provider profile's declared `models` first
|
|
33
|
+
* (KD-S2), else the `llm.models` catalog group for that provider, else
|
|
34
|
+
* empty options + a reason (guidance copy lives in the card);
|
|
35
|
+
* - the **draft** is seeded from the RESOLVED advisor config so the form
|
|
36
|
+
* always shows the effective configuration (KD-G5: `advisor.get` failure →
|
|
37
|
+
* the card shows the config-channel notice instead of a writable-looking
|
|
38
|
+
* form — never a hard load error, and never Apply).
|
|
39
|
+
*/
|
|
40
|
+
import type { ClientConnectionRpc, IApiClient, SettingsNamespaceView } from '@deepseek-ai/dsh-client-connection/client';
|
|
41
|
+
import type { SnapshotStore } from '@deepseek-ai/dsh-client-runtime/client';
|
|
42
|
+
/**
|
|
43
|
+
* The wire `config` value the host gateway returns — mirror of the node-side
|
|
44
|
+
* `ResolvedAdvisorConfig` (src/config.ts). Kept as a local structural type
|
|
45
|
+
* because the client bundle may not value-import the node-side module: the
|
|
46
|
+
* wire normalization omits absent keys (provider/model/disabledReason are
|
|
47
|
+
* simply missing from the JSON), so every optional key reads as undefined.
|
|
48
|
+
*/
|
|
49
|
+
export interface AdvisorConfigView {
|
|
50
|
+
/** Master switch; the resolved value (false while the gate blocks). */
|
|
51
|
+
enabled: boolean;
|
|
52
|
+
/** Provider route; absent when unset. */
|
|
53
|
+
provider?: string;
|
|
54
|
+
/** Model id; absent when unset. */
|
|
55
|
+
model?: string;
|
|
56
|
+
/** System prompt override ('' = built-in reviewer prompt). */
|
|
57
|
+
systemPrompt: string;
|
|
58
|
+
/** Cooldown after a delivered interrupt; integer ≥ 0. */
|
|
59
|
+
immuneTurns: number;
|
|
60
|
+
/** Delta window; integer ≥ 0, 0 = unbounded. */
|
|
61
|
+
maxDeltaMessages: number;
|
|
62
|
+
/** Present iff the advisor is disabled by the explicit model gate. */
|
|
63
|
+
disabledReason?: string;
|
|
64
|
+
}
|
|
65
|
+
/** One provider row the card offers (configured providers only, KD-S2). */
|
|
66
|
+
export interface ProviderOption {
|
|
67
|
+
/** Provider route id. */
|
|
68
|
+
provider: string;
|
|
69
|
+
/** Human-readable provider name. */
|
|
70
|
+
displayName: string;
|
|
71
|
+
/** Settings namespace whose section configures this provider. */
|
|
72
|
+
settingsNs: string;
|
|
73
|
+
/** Path from that section's root to the provider's profile object. */
|
|
74
|
+
settingsPath: readonly string[];
|
|
75
|
+
/** Whether the profile resolves (always true inside the option list). */
|
|
76
|
+
configured: boolean;
|
|
77
|
+
}
|
|
78
|
+
/** One model option offered for a provider. */
|
|
79
|
+
export interface ModelOption {
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
description?: string;
|
|
83
|
+
}
|
|
84
|
+
/** Why a provider offers no model options (KD-S2 empty case → guidance copy). */
|
|
85
|
+
export type ModelsEmptyReason =
|
|
86
|
+
/** The resolved profile declares an (empty) `models` list — profile wins. */
|
|
87
|
+
'profile-empty'
|
|
88
|
+
/** No profile models; the catalog group exists but is empty. */
|
|
89
|
+
| 'catalog-empty'
|
|
90
|
+
/** No profile models; the catalog has no group for this provider. */
|
|
91
|
+
| 'unavailable';
|
|
92
|
+
/** The user-layer draft the form edits (all six config keys). */
|
|
93
|
+
export interface AdvisorDraft {
|
|
94
|
+
/** Master switch; default false. */
|
|
95
|
+
enabled: boolean;
|
|
96
|
+
/** Provider route; required (non-empty) when enabled. */
|
|
97
|
+
provider?: string;
|
|
98
|
+
/** Model id; required (non-empty) when enabled. */
|
|
99
|
+
model?: string;
|
|
100
|
+
/** Optional system prompt override; '' = built-in reviewer prompt. */
|
|
101
|
+
systemPrompt: string;
|
|
102
|
+
/** Cooldown after a delivered interrupt; integer ≥ 0, default 3. Cleared input → undefined (left unchanged on apply). */
|
|
103
|
+
immuneTurns?: number;
|
|
104
|
+
/** Delta window; integer ≥ 0, default 60, 0 = unbounded. Cleared input → undefined (left unchanged on apply). */
|
|
105
|
+
maxDeltaMessages?: number;
|
|
106
|
+
}
|
|
107
|
+
/** Why an Apply failed (copy keys resolve in the card; raw text passes through). */
|
|
108
|
+
export type ApplyFailure = {
|
|
109
|
+
kind: 'gate';
|
|
110
|
+
reason: 'provider' | 'model';
|
|
111
|
+
} | {
|
|
112
|
+
kind: 'message';
|
|
113
|
+
message: string;
|
|
114
|
+
};
|
|
115
|
+
/** Apply lifecycle feedback the form renders. */
|
|
116
|
+
export type ApplyState = {
|
|
117
|
+
kind: 'idle';
|
|
118
|
+
} | {
|
|
119
|
+
kind: 'saving';
|
|
120
|
+
} | {
|
|
121
|
+
kind: 'saved';
|
|
122
|
+
} | {
|
|
123
|
+
kind: 'error';
|
|
124
|
+
failure: ApplyFailure;
|
|
125
|
+
};
|
|
126
|
+
/** Page snapshot. */
|
|
127
|
+
export interface AdvisorSettingsState {
|
|
128
|
+
status: 'idle' | 'loading' | 'ready' | 'error';
|
|
129
|
+
/** Whole-load failure text; write failures stay in the apply state. */
|
|
130
|
+
error: string | null;
|
|
131
|
+
/** Whether the settings provider accepts writes. */
|
|
132
|
+
writable: boolean;
|
|
133
|
+
/** Configured provider options (KD-S2: configured providers only). */
|
|
134
|
+
providers: readonly ProviderOption[];
|
|
135
|
+
/** Model options per provider route, once resolved. */
|
|
136
|
+
modelsByProvider: Readonly<Record<string, readonly ModelOption[]>>;
|
|
137
|
+
/** Empty-options reason per provider route (KD-S2 guidance). */
|
|
138
|
+
modelsEmptyReason: Readonly<Record<string, ModelsEmptyReason>>;
|
|
139
|
+
/** Namespace views by ns, for the provider join. */
|
|
140
|
+
namespaces: Readonly<Record<string, SettingsNamespaceView>>;
|
|
141
|
+
/**
|
|
142
|
+
* Whether the `advisor.get` gateway endpoint was reachable on the last load
|
|
143
|
+
* (KD-G3/G5): success = a writable form; failure (gateway not ready, no
|
|
144
|
+
* settings service on the host) = the card shows the config-channel
|
|
145
|
+
* notice instead of a writable-looking form and never offers Save.
|
|
146
|
+
*/
|
|
147
|
+
advisorPresent: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Latch of the last SETTLED readiness: true iff the last ready update
|
|
150
|
+
* resolved `config === undefined` (qc1 S-2 fix wave). The snapshot cannot
|
|
151
|
+
* tell a "refresh of a degraded card" from a "first mount not yet settled"
|
|
152
|
+
* while `status === 'loading'` (both read loading + advisorPresent=false),
|
|
153
|
+
* so the card derives its degraded disclosure from this latch during
|
|
154
|
+
* loading — keeping the AC-3 notice visible through a background refresh
|
|
155
|
+
* of a degraded card. Set ONLY in the ready update (the load-error path
|
|
156
|
+
* leaves it alone — the error state has its own always-open branch).
|
|
157
|
+
*/
|
|
158
|
+
degraded: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Whether the draft holds edits a save would write — the "unsaved" pill
|
|
161
|
+
* and the save/discard disabled semantics (upstream CardShell.dirty).
|
|
162
|
+
* Derived as `patchFor(draft)` non-empty (KD-U2, plan
|
|
163
|
+
* dsh-advisor-plugin-config-card-ux task 2), recomputed on load (seed
|
|
164
|
+
* settled, real config resolved only), every draft mutation, discard and a
|
|
165
|
+
* successful apply — always inside the same `store.update` callback that
|
|
166
|
+
* mutates the draft/seed, never via a snapshot read + second write.
|
|
167
|
+
*/
|
|
168
|
+
dirty: boolean;
|
|
169
|
+
/** The form draft (seeded from the resolved config; never re-seeded by refreshes). */
|
|
170
|
+
draft: AdvisorDraft;
|
|
171
|
+
/** Apply lifecycle feedback. */
|
|
172
|
+
applyState: ApplyState;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The advisor settings card controller (one per settings surface).
|
|
176
|
+
*/
|
|
177
|
+
export declare class AdvisorSettingsStore {
|
|
178
|
+
private readonly api;
|
|
179
|
+
private readonly rpc;
|
|
180
|
+
/** The snapshot the card renders from (uSES-safe store). */
|
|
181
|
+
readonly store: SnapshotStore<AdvisorSettingsState>;
|
|
182
|
+
/** Latest load wins; an older response never overwrites a newer one. */
|
|
183
|
+
private generation;
|
|
184
|
+
/** Host-scoped model catalog; cached only on success (a transient failure stays uncached and is refetched). */
|
|
185
|
+
private catalog;
|
|
186
|
+
/** In-flight host-scoped catalog fetch; one promise shared across providers. */
|
|
187
|
+
private catalogPromise;
|
|
188
|
+
/**
|
|
189
|
+
* Bumped by every successful load(): an in-flight catalog fetch started
|
|
190
|
+
* before a bump is stale (the models/changed invalidation that triggered
|
|
191
|
+
* the reload happened mid-fetch) and caches nothing (qc1 W-1 / qc3 S-1).
|
|
192
|
+
*/
|
|
193
|
+
private catalogGeneration;
|
|
194
|
+
/** In-flight model resolutions (one per provider). */
|
|
195
|
+
private inflightModels;
|
|
196
|
+
/** The draft is seeded once (first load); refreshes never clobber edits. */
|
|
197
|
+
private draftSeeded;
|
|
198
|
+
/** The resolved advisor config at the last get/apply (patch diff baseline). */
|
|
199
|
+
private seed;
|
|
200
|
+
/**
|
|
201
|
+
* @param api - the wire face (settings/llm domains) for the provider/model
|
|
202
|
+
* directory (the advisor namespace is NOT on that wire).
|
|
203
|
+
* @param rpc - the connection's generic RPC caller for the host gateway
|
|
204
|
+
* channel (`/api`), injected from the connection handle.
|
|
205
|
+
*/
|
|
206
|
+
constructor(api: Pick<IApiClient, 'settings' | 'llm'>, rpc: ClientConnectionRpc);
|
|
207
|
+
/**
|
|
208
|
+
* Refresh the whole page snapshot: the provider directory and the settings
|
|
209
|
+
* namespaces in parallel, then the advisor config over the gateway channel,
|
|
210
|
+
* then the provider join and the draft seed. A provider-directory failure
|
|
211
|
+
* keeps the last good rows and surfaces the error; an `advisor.get` failure
|
|
212
|
+
* is NOT a page error (KD-G5 — the card shows the config-channel notice,
|
|
213
|
+
* the provider directory stays usable). The draft is seeded only on the
|
|
214
|
+
* first load — pushed refreshes never discard in-progress edits (mirror the
|
|
215
|
+
* ProviderEditor draft lifetime).
|
|
216
|
+
* @returns nothing; the snapshot carries the outcome.
|
|
217
|
+
*/
|
|
218
|
+
load(): Promise<void>;
|
|
219
|
+
/**
|
|
220
|
+
* Resolve the model options for one provider (KD-S2): profile-declared
|
|
221
|
+
* `models` win; otherwise the `llm.models` catalog group for that provider;
|
|
222
|
+
* neither → empty options + a reason. The host-scoped catalog is fetched at
|
|
223
|
+
* most once (concurrent first resolutions share one in-flight fetch) and
|
|
224
|
+
* cached only on success. No-op for unconfigured providers.
|
|
225
|
+
* @param provider - provider route id.
|
|
226
|
+
* @returns nothing; the snapshot carries the outcome.
|
|
227
|
+
*/
|
|
228
|
+
ensureModels(provider: string): Promise<void>;
|
|
229
|
+
/**
|
|
230
|
+
* Fetch the host-scoped model catalog. A failure (wire rejection or throw)
|
|
231
|
+
* leaves the cache empty so the next resolution refetches — a transient
|
|
232
|
+
* failure is never sticky for the store lifetime. A fetch started before a
|
|
233
|
+
* load() bumped `catalogGeneration` is stale (the invalidation that caused
|
|
234
|
+
* the reload happened mid-fetch) and caches nothing.
|
|
235
|
+
*/
|
|
236
|
+
private fetchCatalog;
|
|
237
|
+
/** Set the enabled switch (gate fields become required while on). */
|
|
238
|
+
setEnabled(enabled: boolean): void;
|
|
239
|
+
/** Set or clear the provider ('' clears); switches invalidate the chosen model. */
|
|
240
|
+
setProvider(provider: string): void;
|
|
241
|
+
/** Set or clear the model ('' clears). */
|
|
242
|
+
setModel(model: string): void;
|
|
243
|
+
/** Set the system prompt override. */
|
|
244
|
+
setSystemPrompt(prompt: string): void;
|
|
245
|
+
/** Set the immune-turns cooldown (int ≥ 0; non-numeric input keeps the current value; undefined clears → omitted from patch). */
|
|
246
|
+
setImmuneTurns(value: number | undefined): void;
|
|
247
|
+
/** Set the delta-message window (int ≥ 0; non-numeric input keeps the current value; undefined clears → omitted from patch). */
|
|
248
|
+
setMaxDeltaMessages(value: number | undefined): void;
|
|
249
|
+
/**
|
|
250
|
+
* Refuse in a read-only environment (store-side defense-in-depth for the
|
|
251
|
+
* W-1 invariant — a write must never be issued when the UI declares the
|
|
252
|
+
* settings service read-only), then validate the draft (KD-S4 gate) and
|
|
253
|
+
* write the changed keys as a config patch through the gateway channel
|
|
254
|
+
* (`/api/advisor/set`). Any failure (business rejection or transport)
|
|
255
|
+
* surfaces the message failure and keeps the form for retry — the gateway
|
|
256
|
+
* merge has no revision guard, so the old settings-conflict branch is
|
|
257
|
+
* replaced by plain error handling (KD-G3). Nothing to write → the apply
|
|
258
|
+
* reports saved without a call.
|
|
259
|
+
* @returns nothing; the apply state carries the outcome.
|
|
260
|
+
*/
|
|
261
|
+
apply(): Promise<void>;
|
|
262
|
+
/**
|
|
263
|
+
* Drop the current draft edits and rewind the form to the last-known host
|
|
264
|
+
* config (the seed from the last get/apply). The card chrome mirrors the
|
|
265
|
+
* upstream plugin cards' Save/Discard pair (KD-4): unlike the upstream
|
|
266
|
+
* staged CardForm, this store's edits mutate the draft in place, so discard
|
|
267
|
+
* rewinds the draft instead of dropping a staging layer. Pure client-side
|
|
268
|
+
* revert — no gateway write (the host stays the single fact source; a
|
|
269
|
+
* follow-up apply diffs against the restored seed and sends nothing).
|
|
270
|
+
*
|
|
271
|
+
* Invariant (qc3 N-2): a mid-apply discard is UNGUARDED at the store level
|
|
272
|
+
* BY DESIGN — the UI disables Discard while a save is in flight
|
|
273
|
+
* (`disabled={busy}` on the card, `busy = !writable || saving`), so the
|
|
274
|
+
* interleaving cannot occur from the UI and no behavior guard is added
|
|
275
|
+
* here. A programmatic mid-apply discard would only rewind the draft before
|
|
276
|
+
* the in-flight apply adopts the returned config as the new seed — the
|
|
277
|
+
* host write is unaffected.
|
|
278
|
+
*/
|
|
279
|
+
discard(): void;
|
|
280
|
+
/**
|
|
281
|
+
* The minimal config patch making the effective config match the draft —
|
|
282
|
+
* only keys whose value differs from the last-read seed are sent, so a
|
|
283
|
+
* stale read never clobbers concurrent changes to untouched keys and base
|
|
284
|
+
* (plugin-row) values stay in place. A cleared provider/model the seed pins
|
|
285
|
+
* becomes an explicit `''` override (the gateway merge cannot express an
|
|
286
|
+
* unset, and the resolver treats '' as absent); a cleared number field is
|
|
287
|
+
* omitted (the stored value stays unchanged).
|
|
288
|
+
*/
|
|
289
|
+
private patchFor;
|
|
290
|
+
/**
|
|
291
|
+
* The dirty derivation (KD-U2, plan dsh-advisor-plugin-config-card-ux task
|
|
292
|
+
* 2): the draft holds edits a save would write iff the minimal patch
|
|
293
|
+
* against the current seed is non-empty. Takes the DRAFT being mutated and
|
|
294
|
+
* reads `this.seed` — it must be called INSIDE the same `store.update`
|
|
295
|
+
* callback that mutates the draft/seed, never via a snapshot read + second
|
|
296
|
+
* write (the frozen-snapshot write would be dropped by the snapshot store).
|
|
297
|
+
*/
|
|
298
|
+
private recomputeDirty;
|
|
299
|
+
/** Edit one always-present draft field via the schema-form path writer. */
|
|
300
|
+
private setField;
|
|
301
|
+
/** Remove one optional draft field via the schema-form path writer. */
|
|
302
|
+
private clearField;
|
|
303
|
+
private clampInt;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Refetch the card snapshot only after its first load: an unopened Advisor
|
|
307
|
+
* card must not fetch on background invalidations.
|
|
308
|
+
* @param controller - the card store.
|
|
309
|
+
*/
|
|
310
|
+
export declare function refreshIfLoaded(controller: AdvisorSettingsStore): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Advisor settings plugin, browser half. Registers the `advisor` card into
|
|
3
|
+
* the shell-declared `settings.plugin.item` slot (the "插件配置" settings
|
|
4
|
+
* page — id `advisor`, order 30, after the upstream bash / agent-loop /
|
|
5
|
+
* web-search cards). The card's store joins the settings namespaces and the
|
|
6
|
+
* provider directory through the connection wire, and keeps fresh on pushed
|
|
7
|
+
* invalidations. Export discipline: the client half value-imports ONLY the
|
|
8
|
+
* frozen platform module table (CLIENT_EXTERNALS: react /
|
|
9
|
+
* @deepseek-ai/cordis / ui-slots / web-react / ui-primitives /
|
|
10
|
+
* schema-form / the documented `@deepseek-ai/dsh-client-runtime/client`
|
|
11
|
+
* exemption); every other `@deepseek-ai/*` import is type-only (erased at
|
|
12
|
+
* build) — values arrive via cordis injection (`ctx.get('connection')`, slot
|
|
13
|
+
* inject faces). Mirrors the ui-models reference entry.
|
|
14
|
+
*/
|
|
15
|
+
import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client';
|
|
16
|
+
import { type AdvisorKey } from './locales.ts';
|
|
17
|
+
export type { AdvisorCardInjected, AdvisorCardProps } from './advisor-card.tsx';
|
|
18
|
+
export type { AdvisorKey } from './locales.ts';
|
|
19
|
+
export type { AdvisorDraft, AdvisorSettingsState, AdvisorSettingsStore, ApplyFailure, ApplyState, ModelOption, ModelsEmptyReason, ProviderOption, } from './advisor-store.ts';
|
|
20
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
21
|
+
interface LocaleNamespaceMap {
|
|
22
|
+
/** The Advisor settings card copy. */
|
|
23
|
+
'settings.advisor': AdvisorKey;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export { refreshIfLoaded } from './advisor-store.ts';
|
|
27
|
+
/**
|
|
28
|
+
* Required services (cordis fiber inject). The target slot is declared by
|
|
29
|
+
* ui-plugin-config's apply, whose activation order relative to this one is
|
|
30
|
+
* NOT constrained; registration depends on the slot through `slots.inject()`.
|
|
31
|
+
*/
|
|
32
|
+
export declare const inject: string[];
|
|
33
|
+
/**
|
|
34
|
+
* Register the Advisor card once the `settings.plugin.item` declaration is on
|
|
35
|
+
* the ledger, wire its store to the connection, and keep it fresh on every
|
|
36
|
+
* pushed invalidation (settings or provider topology).
|
|
37
|
+
* @param ctx - client root context.
|
|
38
|
+
*/
|
|
39
|
+
export declare function apply(ctx: ClientContext): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copy dictionaries for the Advisor settings card (namespace
|
|
3
|
+
* `settings.advisor`). The English dictionary is the key-set source of truth
|
|
4
|
+
* for the pair; the Chinese dictionary mirrors it exactly.
|
|
5
|
+
*/
|
|
6
|
+
/** English strings (the key-set source of truth for this pair). */
|
|
7
|
+
export declare const en: {
|
|
8
|
+
title: string;
|
|
9
|
+
intro: string;
|
|
10
|
+
collapse: string;
|
|
11
|
+
expand: string;
|
|
12
|
+
unsaved: string;
|
|
13
|
+
loadFailed: string;
|
|
14
|
+
retry: string;
|
|
15
|
+
enabled: string;
|
|
16
|
+
provider: string;
|
|
17
|
+
providerPlaceholder: string;
|
|
18
|
+
providerRequired: string;
|
|
19
|
+
model: string;
|
|
20
|
+
modelPlaceholder: string;
|
|
21
|
+
modelRequired: string;
|
|
22
|
+
noProviders: string;
|
|
23
|
+
noModels: string;
|
|
24
|
+
staleProvider: string;
|
|
25
|
+
staleModel: string;
|
|
26
|
+
systemPrompt: string;
|
|
27
|
+
systemPromptPlaceholder: string;
|
|
28
|
+
immuneTurns: string;
|
|
29
|
+
maxDeltaMessages: string;
|
|
30
|
+
save: string;
|
|
31
|
+
saving: string;
|
|
32
|
+
discard: string;
|
|
33
|
+
saved: string;
|
|
34
|
+
readOnly: string;
|
|
35
|
+
namespaceUnavailable: string;
|
|
36
|
+
};
|
|
37
|
+
/** The settings.advisor namespace key union. */
|
|
38
|
+
export type AdvisorKey = keyof typeof en;
|
|
39
|
+
/** Chinese strings (same keys as {@link en}). */
|
|
40
|
+
export declare const zh: typeof en;
|
package/lib/client.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './client/index.js'
|