dsh-plugin-effort-declare 0.1.4 → 0.1.5
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/CONTRIBUTING.en.md +2 -1
- package/CONTRIBUTING.md +1 -0
- package/INSTALL.en.md +2 -2
- package/INSTALL.md +2 -2
- package/README.en.md +4 -2
- package/README.md +3 -1
- package/lib/client.js +30 -32
- package/lib/client.js.map +1 -1
- package/lib/types/client/EffortDeclareSection.d.ts +3 -2
- package/lib/types/client/EffortDeclareSection.d.ts.map +1 -1
- package/lib/types/client/index.d.ts +23 -2
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/load-drafts.d.ts +3 -3
- package/lib/types/client/load-drafts.d.ts.map +1 -1
- package/lib/types/client/remotes.d.ts +40 -0
- package/lib/types/client/remotes.d.ts.map +1 -0
- package/lib/types/core/catalog.d.ts +3 -3
- package/lib/types/core/catalog.d.ts.map +1 -1
- package/lib/types/core/drafts.d.ts +1 -1
- package/lib/types/core/drafts.d.ts.map +1 -1
- package/lib/types/core/filter.d.ts +1 -1
- package/lib/types/core/filter.d.ts.map +1 -1
- package/lib/types/core/path-ops.d.ts +1 -1
- package/lib/types/core/path-ops.d.ts.map +1 -1
- package/package.json +9 -12
- package/src/client/EffortDeclareSection.tsx +18 -20
- package/src/client/README.en.md +5 -4
- package/src/client/README.md +5 -4
- package/src/client/index.ts +35 -6
- package/src/client/load-drafts.ts +10 -10
- package/src/client/locales.ts +2 -2
- package/src/client/remotes.ts +39 -0
- package/src/core/README.en.md +2 -2
- package/src/core/README.md +2 -2
- package/src/core/catalog.ts +3 -2
- package/src/core/drafts.ts +1 -1
- package/src/core/filter.ts +1 -1
- package/src/core/path-ops.ts +1 -1
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* dsh-plugin-effort-declare — browser half: settings.section for per-model
|
|
3
3
|
* reasoning effort declarations.
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
6
|
+
import type { SlotCore } from '@deepseek-ai/dsh-client-ui-slots';
|
|
6
7
|
import { type EffortDeclareKey } from './locales.ts';
|
|
7
8
|
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
8
9
|
interface LocaleNamespaceMap {
|
|
@@ -10,6 +11,26 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
10
11
|
'plugin-effort-declare': EffortDeclareKey;
|
|
11
12
|
}
|
|
12
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* `slots` and `connection/reset` are provided by the unpublished
|
|
16
|
+
* dsh-client-runtime wrapper. 0.1.2-alpha.2 did not publish that package;
|
|
17
|
+
* the shapes match the official models page and SlotCore.
|
|
18
|
+
*/
|
|
19
|
+
declare module '@deepseek-ai/cordis' {
|
|
20
|
+
interface Events {
|
|
21
|
+
/**
|
|
22
|
+
* A connection generation was (re-)established. Wire-derived caches must
|
|
23
|
+
* treat their state as stale and repull.
|
|
24
|
+
* @mode emit
|
|
25
|
+
*/
|
|
26
|
+
'connection/reset'(): void;
|
|
27
|
+
}
|
|
28
|
+
interface Context {
|
|
29
|
+
slots: SlotCore & {
|
|
30
|
+
inject(name: string, factory: () => unknown): unknown;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
13
34
|
export declare const inject: string[];
|
|
14
|
-
export declare function apply(ctx:
|
|
35
|
+
export declare function apply(ctx: Context): void;
|
|
15
36
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAIlD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAA;AAKhE,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAGhE,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,kBAAkB;QAC1B,4CAA4C;QAC5C,uBAAuB,EAAE,gBAAgB,CAAA;KAC1C;CACF;AAED;;;;GAIG;AACH,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,MAAM;QACd;;;;WAIG;QACH,kBAAkB,IAAI,IAAI,CAAA;KAC3B;IACD,UAAU,OAAO;QACf,KAAK,EAAE,QAAQ,GAAG;YAChB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,GAAG,OAAO,CAAA;SACtD,CAAA;KACF;CACF;AAED,eAAO,MAAM,MAAM,UAQlB,CAAA;AAkBD,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAgExC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Load editable route drafts from llm.
|
|
2
|
+
* Load editable route drafts from llm.listConfigurableProviders + the llm-pi-ai namespace.
|
|
3
3
|
* Drafts come from the user layer; route protocol classification may use effective value.
|
|
4
4
|
*
|
|
5
5
|
* First paint uses `ensure()` (idle-only). Refresh never calls `ensure()`:
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* by revision (including older delayed echoes), not ignored as a generic
|
|
9
9
|
* document-updated.
|
|
10
10
|
*/
|
|
11
|
-
import type { IApiClient } from '@deepseek-ai/dsh-api-remotes/client';
|
|
12
11
|
import type { SettingsDescribeFace } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
12
|
+
import type { LlmDirectoryRemote } from './remotes.ts';
|
|
13
13
|
import { type RouteDraft } from '../core/drafts.ts';
|
|
14
14
|
import type { SchemaOps } from './schema-ops.ts';
|
|
15
15
|
export interface LoadDraftsResult {
|
|
@@ -48,6 +48,6 @@ export declare function waitForNamespaceRevisionChange(describe: MirrorDescribe,
|
|
|
48
48
|
* `ensure`: first paint / idle recovery (official ensure only reads from idle).
|
|
49
49
|
* `snapshot`: refresh after the mirror revision already moved — do not ensure.
|
|
50
50
|
*/
|
|
51
|
-
export declare function loadDrafts(
|
|
51
|
+
export declare function loadDrafts(llm: LlmDirectoryRemote, describe: Pick<SettingsDescribeFace, 'ensure' | 'getSnapshot'>, schema: SchemaOps, mode?: LoadDraftsMode): Promise<LoadDraftsResult>;
|
|
52
52
|
export {};
|
|
53
53
|
//# sourceMappingURL=load-drafts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-drafts.d.ts","sourceRoot":"","sources":["../../../src/client/load-drafts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"load-drafts.d.ts","sourceRoot":"","sources":["../../../src/client/load-drafts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAA;AACtF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAKtD,OAAO,EAA6B,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAG9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAOhD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,EAAE,UAAU,EAAE,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,UAAU,CAAA;AAElD,KAAK,cAAc,GAAG,UAAU,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC,CAAA;AACrE,KAAK,cAAc,GAAG,IAAI,CAAC,oBAAoB,EAAE,aAAa,GAAG,WAAW,CAAC,CAAA;AAE7E,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ote faces this page actually calls (DSH 0.1.2).
|
|
3
|
+
* Shapes match the generated Host descriptors, not the removed IApiClient.
|
|
4
|
+
*/
|
|
5
|
+
import type { SettingsDescribeFace } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
6
|
+
import type { ProviderDirectoryEntry } from '../core/filter.ts';
|
|
7
|
+
import type { PathOp } from '../core/path-ops.ts';
|
|
8
|
+
/** Gateway envelope for a successful Remote call. */
|
|
9
|
+
export type RemoteOk<T> = {
|
|
10
|
+
ok: true;
|
|
11
|
+
value: T;
|
|
12
|
+
};
|
|
13
|
+
/** Gateway envelope for a failed Remote call. */
|
|
14
|
+
export type RemoteErr = {
|
|
15
|
+
ok: false;
|
|
16
|
+
error: {
|
|
17
|
+
code: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type RemoteResult<T> = RemoteOk<T> | RemoteErr;
|
|
22
|
+
/**
|
|
23
|
+
* `llm.listConfigurableProviders` — generated
|
|
24
|
+
* `@deepseek-ai/dsh-llm#llm/listConfigurableProviders`.
|
|
25
|
+
* `value` is the directory array (no `{ providers }` wrapper).
|
|
26
|
+
*/
|
|
27
|
+
export interface LlmDirectoryRemote {
|
|
28
|
+
listConfigurableProviders(): Promise<RemoteResult<readonly ProviderDirectoryEntry[]>>;
|
|
29
|
+
}
|
|
30
|
+
type NamespaceView = Parameters<SettingsDescribeFace['acceptView']>[0];
|
|
31
|
+
/**
|
|
32
|
+
* `settings.mutate` — generated
|
|
33
|
+
* `@deepseek-ai/dsh-api-settings-controller#settings/mutate`.
|
|
34
|
+
* Conflict code is `settings/conflict`.
|
|
35
|
+
*/
|
|
36
|
+
export interface SettingsWriteRemote {
|
|
37
|
+
mutate(ns: string, ops: readonly PathOp[], expectedRevision: number | undefined): Promise<RemoteResult<NamespaceView>>;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=remotes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remotes.d.ts","sourceRoot":"","sources":["../../../src/client/remotes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAA;AACtF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEjD,qDAAqD;AACrD,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAA;AAEhD,iDAAiD;AACjD,MAAM,MAAM,SAAS,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAA;AAE/E,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;AAErD;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,yBAAyB,IAAI,OAAO,CAAC,YAAY,CAAC,SAAS,sBAAsB,EAAE,CAAC,CAAC,CAAA;CACtF;AAED,KAAK,aAAa,GAAG,UAAU,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAEtE;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,SAAS,MAAM,EAAE,EACtB,gBAAgB,EAAE,MAAM,GAAG,SAAS,GACnC,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAA;CACxC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Canonical thinking levels and openai-completions thinkingFormat names.
|
|
3
3
|
*
|
|
4
4
|
* Levels match `@deepseek-ai/dsh-llm-pi-ai` catalog.ts `THINKING_LEVELS`.
|
|
5
|
-
* Formats match `SUPPORTED_THINKING_FORMATS` in the same file (
|
|
5
|
+
* Formats match `SUPPORTED_THINKING_FORMATS` in the same file (0.1.2-alpha.2).
|
|
6
6
|
* Tests pin these lists against a checked-in schema fixture
|
|
7
7
|
* (`tests/fixtures/pi-ai-thinking-format-union.ts`) and the local level
|
|
8
8
|
* whitelist. The settings page never offers the handwritten thinkingFormat
|
|
@@ -15,10 +15,10 @@ export type ThinkingLevel = (typeof THINKING_LEVELS)[number];
|
|
|
15
15
|
/** Thinking levels other than Off; Off has its own tri-state control. */
|
|
16
16
|
export declare const THINKING_LEVELS_WITHOUT_OFF: ("minimal" | "low" | "medium" | "high" | "xhigh" | "max")[];
|
|
17
17
|
/**
|
|
18
|
-
* openai-completions thinkingFormat values from llm-pi-ai catalog.ts
|
|
18
|
+
* openai-completions thinkingFormat values from llm-pi-ai catalog.ts 0.1.2-alpha.2.
|
|
19
19
|
* Test pin only — not a writable UI fallback.
|
|
20
20
|
*/
|
|
21
|
-
export declare const FALLBACK_THINKING_FORMATS: readonly ["openai", "deepseek", "openrouter", "together", "zai", "qwen", "chat-template", "qwen-chat-template", "string-thinking", "ant-ling"];
|
|
21
|
+
export declare const FALLBACK_THINKING_FORMATS: readonly ["openai", "deepseek", "openrouter", "together", "baseten", "zai", "qwen", "chat-template", "qwen-chat-template", "string-thinking", "ant-ling"];
|
|
22
22
|
export type ThinkingFormat = (typeof FALLBACK_THINKING_FORMATS)[number];
|
|
23
23
|
/** Wire protocol this plugin's v1 editor supports. */
|
|
24
24
|
export declare const OPENAI_COMPLETIONS = "openai-completions";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/core/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,8DAA8D;AAC9D,eAAO,MAAM,eAAe,sEAQlB,CAAA;AAEV,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAE5D,yEAAyE;AACzE,eAAO,MAAM,2BAA2B,6DAEvC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/core/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,8DAA8D;AAC9D,eAAO,MAAM,eAAe,sEAQlB,CAAA;AAEV,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAE5D,yEAAyE;AACzE,eAAO,MAAM,2BAA2B,6DAEvC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,2JAY5B,CAAA;AAEV,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvE,sDAAsD;AACtD,eAAO,MAAM,kBAAkB,uBAAuB,CAAA;AAEtD,6CAA6C;AAC7C,eAAO,MAAM,YAAY,cAAc,CAAA;AAEvC,kDAAkD;AAClD,eAAO,MAAM,eAAe,iBAAiB,CAAA;AAE7C,+CAA+C;AAC/C,eAAO,MAAM,iBAAiB,sBAAsB,CAAA;AAEpD,kEAAkE;AAClE,eAAO,MAAM,kBAAkB,YAAgB,CAAA;AAE/C,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,4BAA6B,CAAA;AAE1D,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE7D;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,aAAa,EAAsB,CAAA"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export interface RouteDraft {
|
|
3
3
|
provider: string;
|
|
4
4
|
displayName: string;
|
|
5
|
-
/** Path inside the llm-pi-ai section (`
|
|
5
|
+
/** Path inside the llm-pi-ai section (`listConfigurableProviders[].settingsPath`). */
|
|
6
6
|
settingsPath: readonly string[];
|
|
7
7
|
/** Namespace revision (one value for the whole llm-pi-ai document). */
|
|
8
8
|
revision: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drafts.d.ts","sourceRoot":"","sources":["../../../src/core/drafts.ts"],"names":[],"mappings":"AAQA,iEAAiE;AACjE,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,
|
|
1
|
+
{"version":3,"file":"drafts.d.ts","sourceRoot":"","sources":["../../../src/core/drafts.ts"],"names":[],"mappings":"AAQA,iEAAiE;AACjE,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,sFAAsF;IACtF,YAAY,EAAE,SAAS,MAAM,EAAE,CAAA;IAC/B,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IACjC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IACzC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACvC,gFAAgF;IAChF,aAAa,EAAE,OAAO,CAAA;CACvB;AAED,kEAAkE;AAClE,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAEjE;AAED,0CAA0C;AAC1C,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAErE;AAED,iFAAiF;AACjF,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,SAAS,M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AAO,CAAC,CAAA;IACrC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAc3D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,SAAS,UAAU,EAAE,EAC9B,QAAQ,EAAE,SAAS,UAAU,EAAE,EAC/B,OAAO,EAAE;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,GAClC;IAAE,MAAM,EAAE,UAAU,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAgChD;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAGlE;AAED,6DAA6D;AAC7D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAE5F;AAED,gFAAgF;AAChF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAK5F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/core/filter.ts"],"names":[],"mappings":"AAQA,
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/core/filter.ts"],"names":[],"mappings":"AAQA,4FAA4F;AAC5F,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,MAAM,CAMR;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,CAAC,EAAE,WAAW,GAAG,mBAAmB,GAAG,SAAS,GAAG,iBAAiB,CAAA;CAC3E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,sBAAsB,EAC7B,OAAO,EAAE,OAAO,EAChB,gBAAgB,CAAC,EAAE,MAAM,GACxB,gBAAgB,CAelB;AAED,6EAA6E;AAC7E,wBAAgB,SAAS,CACvB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC3C,QAAQ,EAAE,MAAM,GACf,OAAO,CAKT;AAED,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,EAAE,CAK1D"}
|
|
@@ -18,7 +18,7 @@ export type PathOp = {
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function pathOps(base: readonly string[], before: unknown, after: Record<string, unknown>): PathOp[];
|
|
20
20
|
export interface SaveSlices {
|
|
21
|
-
/** Profile path from `
|
|
21
|
+
/** Profile path from `listConfigurableProviders[].settingsPath` (not a hardcoded route id). */
|
|
22
22
|
settingsPath: readonly string[];
|
|
23
23
|
/** Models array before the edit (user layer). */
|
|
24
24
|
beforeModels: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-ops.d.ts","sourceRoot":"","sources":["../../../src/core/path-ops.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,MAAM,GACd;IAAE,EAAE,EAAE,KAAK,CAAC;IAA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EAAE,CAUzD"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-effort-declare",
|
|
3
3
|
"description": "Declare per-model reasoning efforts, image input, and openai-completions dialect on hand-declared llm-pi-ai routes. Writes the official namespace; does not intercept llm/stream or replace the Models page.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.5",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
},
|
|
34
34
|
"client": {
|
|
35
35
|
"inject": [
|
|
36
|
-
"@deepseek-ai/dsh-client-runtime",
|
|
37
36
|
"@deepseek-ai/dsh-client-locale",
|
|
38
37
|
"@deepseek-ai/dsh-client-ui-settings",
|
|
39
38
|
"@deepseek-ai/dsh-api-remotes"
|
|
@@ -42,19 +41,17 @@
|
|
|
42
41
|
}
|
|
43
42
|
},
|
|
44
43
|
"peerDependencies": {
|
|
45
|
-
"@deepseek-ai/dsh-api-remotes": "^0.1.
|
|
46
|
-
"@deepseek-ai/dsh-client-locale": "^0.1.
|
|
47
|
-
"@deepseek-ai/dsh-client-
|
|
48
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.8",
|
|
44
|
+
"@deepseek-ai/dsh-api-remotes": "^0.1.2-alpha.2",
|
|
45
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.2-alpha.2",
|
|
46
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.1.2-alpha.2",
|
|
49
47
|
"react": "^18.2.0"
|
|
50
48
|
},
|
|
51
49
|
"devDependencies": {
|
|
52
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
53
|
-
"@deepseek-ai/dsh-api-remotes": "^0.1.
|
|
54
|
-
"@deepseek-ai/dsh-client-locale": "^0.1.
|
|
55
|
-
"@deepseek-ai/dsh-client-
|
|
56
|
-
"@deepseek-ai/dsh-client-ui-
|
|
57
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.8",
|
|
50
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
51
|
+
"@deepseek-ai/dsh-api-remotes": "^0.1.2-alpha.2",
|
|
52
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.2-alpha.2",
|
|
53
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.1.2-alpha.2",
|
|
54
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.2-alpha.2",
|
|
58
55
|
"@types/node": "^22.20.0",
|
|
59
56
|
"@types/react": "~18.3.1",
|
|
60
57
|
"lightningcss": "^1.32.0",
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* openai-completions compat for hand-declared llm-pi-ai routes.
|
|
4
4
|
*/
|
|
5
5
|
import { useCallback, useEffect, useRef, useState, type ReactNode } from 'react'
|
|
6
|
-
import type { IApiClient } from '@deepseek-ai/dsh-api-remotes/client'
|
|
7
6
|
import type { SettingsDescribeFace } from '@deepseek-ai/dsh-client-ui-settings/client'
|
|
7
|
+
import type { LlmDirectoryRemote, SettingsWriteRemote } from './remotes.ts'
|
|
8
8
|
import { LLM_PI_AI_NS, THINKING_LEVELS_WITHOUT_OFF } from '../core/catalog.ts'
|
|
9
9
|
import {
|
|
10
10
|
alignDraft,
|
|
@@ -53,7 +53,8 @@ export type Invalidation =
|
|
|
53
53
|
| { source: 'settings'; revision: number }
|
|
54
54
|
|
|
55
55
|
export interface EffortDeclareSectionInjected {
|
|
56
|
-
|
|
56
|
+
llm: LlmDirectoryRemote
|
|
57
|
+
settings: SettingsWriteRemote
|
|
57
58
|
describe: SettingsDescribeFace
|
|
58
59
|
schema: SchemaOps
|
|
59
60
|
subscribeInvalidate: (listener: (event: Invalidation) => void) => () => void
|
|
@@ -342,7 +343,8 @@ function RouteCard(props: {
|
|
|
342
343
|
|
|
343
344
|
export function EffortDeclareSection(props: EffortDeclareSectionProps): ReactNode {
|
|
344
345
|
const t = props.t
|
|
345
|
-
const
|
|
346
|
+
const llm = props.llm
|
|
347
|
+
const settings = props.settings
|
|
346
348
|
const describe = props.describe
|
|
347
349
|
const schema = props.schema
|
|
348
350
|
const [status, setStatus] = useState<'loading' | 'ready' | 'error'>('loading')
|
|
@@ -407,10 +409,10 @@ export function EffortDeclareSection(props: EffortDeclareSectionProps): ReactNod
|
|
|
407
409
|
}
|
|
408
410
|
|
|
409
411
|
const loadSnapshotThenSettle = async (generation: number, preserveDirty: boolean): Promise<void> => {
|
|
410
|
-
if (
|
|
412
|
+
if (llm === undefined || typeof llm.listConfigurableProviders !== 'function' || describe === undefined || schema === undefined) return
|
|
411
413
|
if (!generationIsCurrent(generationRef, generation)) return
|
|
412
414
|
try {
|
|
413
|
-
const result = await loadDrafts(
|
|
415
|
+
const result = await loadDrafts(llm, describe, schema, 'snapshot')
|
|
414
416
|
settleReload(generation, preserveDirty, result)
|
|
415
417
|
} catch (failure) {
|
|
416
418
|
failGeneration(generation, failure)
|
|
@@ -418,7 +420,7 @@ export function EffortDeclareSection(props: EffortDeclareSectionProps): ReactNod
|
|
|
418
420
|
}
|
|
419
421
|
|
|
420
422
|
const reload = useCallback((preserveDirty: boolean, mode: LoadDraftsMode = 'ensure'): void => {
|
|
421
|
-
if (
|
|
423
|
+
if (llm === undefined || typeof llm.listConfigurableProviders !== 'function' || describe === undefined || schema === undefined) {
|
|
422
424
|
setStatus('error')
|
|
423
425
|
setError(t('loadError'))
|
|
424
426
|
return
|
|
@@ -426,15 +428,15 @@ export function EffortDeclareSection(props: EffortDeclareSectionProps): ReactNod
|
|
|
426
428
|
const { generation } = beginGeneration()
|
|
427
429
|
if (draftsRef.current.length === 0) setStatus('loading')
|
|
428
430
|
setError('')
|
|
429
|
-
void loadDrafts(
|
|
431
|
+
void loadDrafts(llm, describe, schema, mode).then((result) => {
|
|
430
432
|
settleReload(generation, preserveDirty, result)
|
|
431
433
|
}, (failure: unknown) => {
|
|
432
434
|
failGeneration(generation, failure)
|
|
433
435
|
})
|
|
434
|
-
}, [
|
|
436
|
+
}, [llm, describe, schema, t])
|
|
435
437
|
|
|
436
438
|
const refreshAtRevision = useCallback((revision: number, preserveDirty: boolean): void => {
|
|
437
|
-
if (
|
|
439
|
+
if (llm === undefined || typeof llm.listConfigurableProviders !== 'function' || describe === undefined || schema === undefined) return
|
|
438
440
|
const { generation, signal } = beginGeneration()
|
|
439
441
|
if (draftsRef.current.length === 0) setStatus('loading')
|
|
440
442
|
setError('')
|
|
@@ -444,7 +446,7 @@ export function EffortDeclareSection(props: EffortDeclareSectionProps): ReactNod
|
|
|
444
446
|
}, (failure: unknown) => {
|
|
445
447
|
failGeneration(generation, failure)
|
|
446
448
|
})
|
|
447
|
-
}, [
|
|
449
|
+
}, [llm, describe, schema, t])
|
|
448
450
|
|
|
449
451
|
const flushPendingSettings = (refresh: (revision: number, preserveDirty: boolean) => void): void => {
|
|
450
452
|
const pending = pendingRevisionRef.current
|
|
@@ -492,7 +494,7 @@ export function EffortDeclareSection(props: EffortDeclareSectionProps): ReactNod
|
|
|
492
494
|
}
|
|
493
495
|
|
|
494
496
|
const save = async (draft: RouteDraft): Promise<void> => {
|
|
495
|
-
if (
|
|
497
|
+
if (settings === undefined || typeof settings.mutate !== 'function' || describe === undefined || schema === undefined) return
|
|
496
498
|
if (status === 'loading' || busyRouteRef.current !== null) {
|
|
497
499
|
patchNotice(draft.provider, { kind: 'error', text: t('saveBusy') })
|
|
498
500
|
return
|
|
@@ -545,16 +547,12 @@ export function EffortDeclareSection(props: EffortDeclareSectionProps): ReactNod
|
|
|
545
547
|
}
|
|
546
548
|
}
|
|
547
549
|
}
|
|
548
|
-
const response = await
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
expectedRevision: draft.revision,
|
|
552
|
-
})
|
|
553
|
-
if (!response.result.ok) {
|
|
554
|
-
const conflict = response.result.error.code === 'settings-conflict'
|
|
550
|
+
const response = await settings.mutate(LLM_PI_AI_NS, ops, draft.revision)
|
|
551
|
+
if (!response.ok) {
|
|
552
|
+
const conflict = response.error.code === 'settings/conflict'
|
|
555
553
|
patchNotice(draft.provider, {
|
|
556
554
|
kind: conflict ? 'conflict' : 'error',
|
|
557
|
-
text: conflict ? t('conflict') : response.
|
|
555
|
+
text: conflict ? t('conflict') : response.error.message,
|
|
558
556
|
})
|
|
559
557
|
if (conflict) {
|
|
560
558
|
const { generation, signal } = beginGeneration()
|
|
@@ -567,7 +565,7 @@ export function EffortDeclareSection(props: EffortDeclareSectionProps): ReactNod
|
|
|
567
565
|
}
|
|
568
566
|
return
|
|
569
567
|
}
|
|
570
|
-
const view = response.
|
|
568
|
+
const view = response.value
|
|
571
569
|
echoedRevisionRef.current = view.revision
|
|
572
570
|
describe.acceptView(view)
|
|
573
571
|
applyDrafts(applySaveSuccess(draftsRef.current, draft.provider, {
|
package/src/client/README.en.md
CHANGED
|
@@ -9,19 +9,20 @@
|
|
|
9
9
|
|
|
10
10
|
Browser half: registers **Reasoning efforts** in the Web UI settings panel and writes per-model `reasoningEfforts` and `input` on `llm-pi-ai` through the official settings RPC.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Missing inject services keep the plugin PENDING so `apply` does not run. Do not wrap `apply` in a blanket `try/catch` (same as the official Models page). Missing RPC methods show as a load error on the page; do not treat an empty list as success. Locale, CSS, and event subscriptions are cleaned up through `ctx.effect` on unload.
|
|
13
13
|
|
|
14
|
-
Cross-plugin work uses Cordis services only (`
|
|
14
|
+
Cross-plugin work uses Cordis services only (`remote` / `remote.llm` / `remote.settings`, `settingsScope`, `settingsSchema`, `slots`, `locale`). Do not value-import `@deepseek-ai/dsh-client-ui-settings-models`: the client bundle purity rule forbids inlining other `@deepseek-ai/*` packages except platform modules in the shell’s frozen table.
|
|
15
15
|
|
|
16
16
|
## What's in this directory
|
|
17
17
|
|
|
18
18
|
| File | Role |
|
|
19
19
|
| --- | --- |
|
|
20
|
-
| [`index.ts`](./index.ts) | Registers zh/en copy, CSS (`ctx.effect` insert/remove), and `settings.section` (id `effort-declare`, order 12). `describe.subscribe` only syncs `writable` (it fires for every namespace, including this page’s own `acceptView`). `settings/document-updated` (`llm-pi-ai` only) carries the Host revision; the section skips its own mutate echo, waits until the mirror revision has **caught up**, then `getSnapshot()` — it does not use `ensure()` as refresh. Provider directory changes come from `llm/adapters-updated`; `connection/reset` uses `ensure()` so an in-flight official `load()` is awaited. `locale: NS` lets the framework inject `t`; `inject` only returns `
|
|
20
|
+
| [`index.ts`](./index.ts) | Registers zh/en copy, CSS (`ctx.effect` insert/remove), and `settings.section` (id `effort-declare`, order 12). `describe.subscribe` only syncs `writable` (it fires for every namespace, including this page’s own `acceptView`). `settings/document-updated` (`llm-pi-ai` only) carries the Host revision; the section skips its own mutate echo, waits until the mirror revision has **caught up**, then `getSnapshot()` — it does not use `ensure()` as refresh. Provider directory changes come from `llm/adapters-updated`; `connection/reset` uses `ensure()` so an in-flight official `load()` is awaited. `locale: NS` lets the framework inject `t`; the slot `inject()` only returns `llm` / `settings` / `describe` / `schema` / `subscribeInvalidate`. |
|
|
21
21
|
| [`EffortDeclareSection.tsx`](./EffortDeclareSection.tsx) | Route cards, presets, Off tri-state, per-model **Accepts image input**, advanced protocol switches, save and cancel. Save is exclusive for the whole `llm-pi-ai` namespace (ref-guarded against double-click); `busy` is “Saving…” on the in-flight card, `saveLocked` disables the others. Save is blocked by `modelRowError` for empty efforts, Off-only, and illegal `input`. A successful write syncs `draftsRef` immediately and folds `acceptView` + `applySaveSuccess`. External `document-updated` events that arrive during save are replayed afterwards. A reload with no conflict clears that card’s conflict/error notice. Footer shows the version and copyright years frozen at pack time. |
|
|
22
22
|
| [`build-info.ts`](./build-info.ts) | Reads `package.json` version and UTC pack year injected by tsdown `define`, and formats the footer line. |
|
|
23
23
|
| [`globals.d.ts`](./globals.d.ts) | Types for `__PLUGIN_VERSION__` and `__COPYRIGHT_TO__`. |
|
|
24
|
-
| [`load-drafts.ts`](./load-drafts.ts) | Builds drafts from `llm.
|
|
24
|
+
| [`load-drafts.ts`](./load-drafts.ts) | Builds drafts from `llm.listConfigurableProviders` + the settings mirror; drafts come from `user`, protocol classification may use `value`. `thinkingFormat` choices come only from the live schema union. First paint uses `ensure()`; refresh reads `getSnapshot()` only, with helpers that wait for the namespace revision. |
|
|
25
|
+
| [`remotes.ts`](./remotes.ts) | The DSH 0.1.2 Remote methods this page calls: `listConfigurableProviders` and `settings.mutate` (`{ ok, value }` on success, `{ ok: false, error }` on failure, conflict code `settings/conflict`). |
|
|
25
26
|
| [`locales.ts`](./locales.ts) | Copy namespace `plugin-effort-declare` (efforts, image input, and validation errors). |
|
|
26
27
|
| [`effort-declare.module.css`](./effort-declare.module.css) | `--dsw-alias-*` tokens only, so dark theme stays correct. |
|
|
27
28
|
| [`schema-ops.ts`](./schema-ops.ts) | Binds `settingsSchema` as plain callbacks (including `validate`) so the service identity is not passed into React. |
|
package/src/client/README.md
CHANGED
|
@@ -9,19 +9,20 @@
|
|
|
9
9
|
|
|
10
10
|
浏览器半区:在 Web UI 的设置面板注册「推理档位」,并经官方 settings RPC 向 `llm-pi-ai` 写入每模型的 `reasoningEfforts` 与 `input`。
|
|
11
11
|
|
|
12
|
-
`apply`
|
|
12
|
+
缺失的 inject 服务会让插件停在 PENDING,`apply` 不会跑到。不要给 `apply` 套整段 `try/catch`(与官方模型页相同)。RPC 方法缺失时设置页显示加载错误,不要用空列表冒充成功。卸载时 locale、CSS 与事件订阅随 `ctx.effect` 清理。
|
|
13
13
|
|
|
14
|
-
跨插件协作只使用 Cordis 服务(`
|
|
14
|
+
跨插件协作只使用 Cordis 服务(`remote` / `remote.llm` / `remote.settings`、`settingsScope`、`settingsSchema`、`slots`、`locale`)。不要 value-import `@deepseek-ai/dsh-client-ui-settings-models`:client bundle 的 purity 规则禁止把其它 `@deepseek-ai/*` 打进包内(shell 冻结模块表里的平台模块除外)。
|
|
15
15
|
|
|
16
16
|
## 这个目录里有什么
|
|
17
17
|
|
|
18
18
|
| 文件 | 说明 |
|
|
19
19
|
| --- | --- |
|
|
20
|
-
| [`index.ts`](./index.ts) | 注册 zh/en 文案、CSS(`ctx.effect` 插入/移除)与 `settings.section`(id `effort-declare`,order 12)。`describe.subscribe` 只同步 `writable`(任意 namespace 都会触发,含自己的 `acceptView`)。`settings/document-updated`(仅 `llm-pi-ai`)带上 Host 的 revision;设置页跳过自己这次 mutate 的回声,等镜像 revision **追上**后再 `getSnapshot()`,不把 `ensure()` 当刷新。提供方目录来自 `llm/adapters-updated`;`connection/reset` 走 `ensure()` 以便等待官方镜像的 in-flight `load()`。`locale: NS` 由框架注入 `t
|
|
20
|
+
| [`index.ts`](./index.ts) | 注册 zh/en 文案、CSS(`ctx.effect` 插入/移除)与 `settings.section`(id `effort-declare`,order 12)。`describe.subscribe` 只同步 `writable`(任意 namespace 都会触发,含自己的 `acceptView`)。`settings/document-updated`(仅 `llm-pi-ai`)带上 Host 的 revision;设置页跳过自己这次 mutate 的回声,等镜像 revision **追上**后再 `getSnapshot()`,不把 `ensure()` 当刷新。提供方目录来自 `llm/adapters-updated`;`connection/reset` 走 `ensure()` 以便等待官方镜像的 in-flight `load()`。`locale: NS` 由框架注入 `t`;slot 的 `inject()` 只返回 `llm` / `settings` / `describe` / `schema` / `subscribeInvalidate`。 |
|
|
21
21
|
| [`EffortDeclareSection.tsx`](./EffortDeclareSection.tsx) | 路由卡片、预设、Off 三态、每模型「支持图片输入」、高级协议开关、保存与取消。保存互斥到整个 `llm-pi-ai` namespace(以 ref 防连点);`busy` 只给正在 mutate 的卡显示「保存中」,其它卡 `saveLocked`。保存前用 `modelRowError` 拦截空档位、只开 Off 与非法 `input`。自己写入成功立刻同步 `draftsRef` 并走 `acceptView` + `applySaveSuccess`。保存过程中到达的外部 `document-updated` 会在结束后补刷。无冲突的 reload 清掉该卡 conflict/error notice。页脚显示打包时冻结的版本与版权年。 |
|
|
22
22
|
| [`build-info.ts`](./build-info.ts) | 读取 tsdown `define` 注入的 `package.json` version 与 UTC 打包年,拼出页脚文案。 |
|
|
23
23
|
| [`globals.d.ts`](./globals.d.ts) | `__PLUGIN_VERSION__` / `__COPYRIGHT_TO__` 的类型声明。 |
|
|
24
|
-
| [`load-drafts.ts`](./load-drafts.ts) | 从 `llm.
|
|
24
|
+
| [`load-drafts.ts`](./load-drafts.ts) | 从 `llm.listConfigurableProviders` + 镜像组装草稿;草稿取自 `user`,协议分类可用 `value`。`thinkingFormat` 可选项只来自现场 schema union。首屏 `ensure()`;刷新只读 `getSnapshot()`,并提供等 namespace revision 的 helper。 |
|
|
25
|
+
| [`remotes.ts`](./remotes.ts) | 本页实际调用的 DSH 0.1.2 Remote 方法:`listConfigurableProviders` 与 `settings.mutate`(成功 `{ ok, value }`,失败 `{ ok: false, error }`,冲突码 `settings/conflict`)。 |
|
|
25
26
|
| [`locales.ts`](./locales.ts) | 文案 namespace `plugin-effort-declare`(含档位、图片输入与校验错误)。 |
|
|
26
27
|
| [`effort-declare.module.css`](./effort-declare.module.css) | 仅使用 `--dsw-alias-*` 设计令牌,保证暗色主题正确。 |
|
|
27
28
|
| [`schema-ops.ts`](./schema-ops.ts) | 将 `settingsSchema` 收成普通回调(含 `validate`),避免把服务身份带进 React。 |
|
package/src/client/index.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* dsh-plugin-effort-declare — browser half: settings.section for per-model
|
|
3
3
|
* reasoning effort declarations.
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
6
|
-
import type { ConnectionHandle } from '@deepseek-ai/dsh-api-remotes/client'
|
|
5
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
7
6
|
import type {} from '@deepseek-ai/dsh-client-ui-settings/client'
|
|
8
7
|
import type {} from '@deepseek-ai/dsh-client-locale/client'
|
|
9
8
|
import type {} from '@deepseek-ai/dsh-api-remotes/client'
|
|
9
|
+
import type { SlotCore } from '@deepseek-ai/dsh-client-ui-slots'
|
|
10
10
|
import { EffortDeclareSection } from './EffortDeclareSection.tsx'
|
|
11
11
|
import type { EffortDeclareSectionInjected, Invalidation } from './EffortDeclareSection.tsx'
|
|
12
12
|
import { bindSchema } from './schema-ops.ts'
|
|
@@ -21,7 +21,36 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* `slots` and `connection/reset` are provided by the unpublished
|
|
26
|
+
* dsh-client-runtime wrapper. 0.1.2-alpha.2 did not publish that package;
|
|
27
|
+
* the shapes match the official models page and SlotCore.
|
|
28
|
+
*/
|
|
29
|
+
declare module '@deepseek-ai/cordis' {
|
|
30
|
+
interface Events {
|
|
31
|
+
/**
|
|
32
|
+
* A connection generation was (re-)established. Wire-derived caches must
|
|
33
|
+
* treat their state as stale and repull.
|
|
34
|
+
* @mode emit
|
|
35
|
+
*/
|
|
36
|
+
'connection/reset'(): void
|
|
37
|
+
}
|
|
38
|
+
interface Context {
|
|
39
|
+
slots: SlotCore & {
|
|
40
|
+
inject(name: string, factory: () => unknown): unknown
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const inject = [
|
|
46
|
+
'slots',
|
|
47
|
+
'locale',
|
|
48
|
+
'remote',
|
|
49
|
+
'remote.llm',
|
|
50
|
+
'remote.settings',
|
|
51
|
+
'settingsScope',
|
|
52
|
+
'settingsSchema',
|
|
53
|
+
]
|
|
25
54
|
|
|
26
55
|
const PLUGIN_ID = 'dsh-plugin-effort-declare'
|
|
27
56
|
|
|
@@ -39,11 +68,10 @@ function mountPluginCss(): () => void {
|
|
|
39
68
|
return () => { tag?.remove() }
|
|
40
69
|
}
|
|
41
70
|
|
|
42
|
-
export function apply(ctx:
|
|
71
|
+
export function apply(ctx: Context): void {
|
|
43
72
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), `${PLUGIN_ID}: dictionaries`)
|
|
44
73
|
ctx.effect(() => mountPluginCss(), `${PLUGIN_ID}: css`)
|
|
45
74
|
|
|
46
|
-
const connection = ctx.get('connection') as ConnectionHandle
|
|
47
75
|
const settingsSchema = ctx.settingsSchema
|
|
48
76
|
const schema = bindSchema({
|
|
49
77
|
rehydrate: serialized => settingsSchema.rehydrate(serialized),
|
|
@@ -97,7 +125,8 @@ export function apply(ctx: ClientContext): void {
|
|
|
97
125
|
label: () => t('nav'),
|
|
98
126
|
locale: NS,
|
|
99
127
|
inject: (): EffortDeclareSectionInjected => ({
|
|
100
|
-
|
|
128
|
+
llm: ctx.remote.llm,
|
|
129
|
+
settings: ctx.remote.settings,
|
|
101
130
|
describe,
|
|
102
131
|
schema,
|
|
103
132
|
subscribeInvalidate,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Load editable route drafts from llm.
|
|
2
|
+
* Load editable route drafts from llm.listConfigurableProviders + the llm-pi-ai namespace.
|
|
3
3
|
* Drafts come from the user layer; route protocol classification may use effective value.
|
|
4
4
|
*
|
|
5
5
|
* First paint uses `ensure()` (idle-only). Refresh never calls `ensure()`:
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* by revision (including older delayed echoes), not ignored as a generic
|
|
9
9
|
* document-updated.
|
|
10
10
|
*/
|
|
11
|
-
import type { IApiClient, SettingsNamespaceView } from '@deepseek-ai/dsh-api-remotes/client'
|
|
12
11
|
import type { SettingsDescribeFace } from '@deepseek-ai/dsh-client-ui-settings/client'
|
|
12
|
+
import type { LlmDirectoryRemote } from './remotes.ts'
|
|
13
13
|
import {
|
|
14
14
|
LLM_PI_AI_NS,
|
|
15
15
|
SCHEMA_PROBE_ROUTE,
|
|
@@ -136,7 +136,7 @@ export async function waitForNamespaceRevisionChange(
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
async function assembleDrafts(
|
|
139
|
-
|
|
139
|
+
llm: LlmDirectoryRemote,
|
|
140
140
|
describe: Pick<SettingsDescribeFace, 'getSnapshot'>,
|
|
141
141
|
schema: SchemaOps,
|
|
142
142
|
): Promise<LoadDraftsResult> {
|
|
@@ -144,16 +144,16 @@ async function assembleDrafts(
|
|
|
144
144
|
if (mirrored.view === undefined) {
|
|
145
145
|
return { writable: false, formats: [], drafts: [], error: mirrored.error ?? undefined }
|
|
146
146
|
}
|
|
147
|
-
const providersResponse = await
|
|
148
|
-
if (!providersResponse.
|
|
147
|
+
const providersResponse = await llm.listConfigurableProviders()
|
|
148
|
+
if (!providersResponse.ok) {
|
|
149
149
|
return {
|
|
150
150
|
writable: mirrored.view.writable,
|
|
151
151
|
formats: [],
|
|
152
152
|
drafts: [],
|
|
153
|
-
error: providersResponse.
|
|
153
|
+
error: providersResponse.error.message,
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
const namespaces = new Map(mirrored.view.namespaces.map(
|
|
156
|
+
const namespaces = new Map(mirrored.view.namespaces.map(view => [view.ns, view]))
|
|
157
157
|
const pi = namespaces.get(LLM_PI_AI_NS)
|
|
158
158
|
let formats: string[] = []
|
|
159
159
|
let schemaDefaultApi: string | undefined
|
|
@@ -169,7 +169,7 @@ async function assembleDrafts(
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
const drafts: RouteDraft[] = []
|
|
172
|
-
for (const entry of providersResponse.
|
|
172
|
+
for (const entry of providersResponse.value) {
|
|
173
173
|
const settingsPath = entry.settingsPath !== undefined && entry.settingsPath.length > 0
|
|
174
174
|
? [...entry.settingsPath]
|
|
175
175
|
: ['providers', entry.provider]
|
|
@@ -191,11 +191,11 @@ async function assembleDrafts(
|
|
|
191
191
|
* `snapshot`: refresh after the mirror revision already moved — do not ensure.
|
|
192
192
|
*/
|
|
193
193
|
export async function loadDrafts(
|
|
194
|
-
|
|
194
|
+
llm: LlmDirectoryRemote,
|
|
195
195
|
describe: Pick<SettingsDescribeFace, 'ensure' | 'getSnapshot'>,
|
|
196
196
|
schema: SchemaOps,
|
|
197
197
|
mode: LoadDraftsMode = 'ensure',
|
|
198
198
|
): Promise<LoadDraftsResult> {
|
|
199
199
|
if (mode === 'ensure') await describe.ensure()
|
|
200
|
-
return assembleDrafts(
|
|
200
|
+
return assembleDrafts(llm, describe, schema)
|
|
201
201
|
}
|
package/src/client/locales.ts
CHANGED
|
@@ -55,7 +55,7 @@ export const zh: Record<EffortDeclareKey, string> = {
|
|
|
55
55
|
title: '推理档位声明',
|
|
56
56
|
intro: '声明手工模型可提供的推理档位,以及是否接受图片输入。未声明则不显示 Effort 行,图片附件也会被拒绝。档位仍在输入框菜单中选择;密钥、目录与当前选中项不在本页修改。',
|
|
57
57
|
empty: '没有可编辑的手工 openai-completions 路由。',
|
|
58
|
-
emptyHint: '请先到「模型」页添加提供方(llm-pi-ai 手工路由)。官方 DeepSeek 与 catalog 路由不在本页编辑。需要 DSH ≥ 0.1.
|
|
58
|
+
emptyHint: '请先到「模型」页添加提供方(llm-pi-ai 手工路由)。官方 DeepSeek 与 catalog 路由不在本页编辑。需要 DSH ≥ 0.1.2-alpha.2。',
|
|
59
59
|
loadError: '无法加载提供方或设置。',
|
|
60
60
|
loading: '正在加载…',
|
|
61
61
|
readOnly: '当前设置为只读,无法保存。',
|
|
@@ -102,7 +102,7 @@ export const en: Record<EffortDeclareKey, string> = {
|
|
|
102
102
|
title: 'Reasoning effort declarations',
|
|
103
103
|
intro: 'Declare reasoning levels and image input for hand-added models. Undeclared models omit the Effort row and refuse image attachments. Effort is still chosen in the composer menu; keys, catalogs, and the current selection are not modified here.',
|
|
104
104
|
empty: 'No editable hand-declared openai-completions routes.',
|
|
105
|
-
emptyHint: 'Add a provider on the Models page first (an llm-pi-ai hand-declared route). Official DeepSeek and catalog routes are not edited here. Requires DSH ≥ 0.1.
|
|
105
|
+
emptyHint: 'Add a provider on the Models page first (an llm-pi-ai hand-declared route). Official DeepSeek and catalog routes are not edited here. Requires DSH ≥ 0.1.2-alpha.2.',
|
|
106
106
|
loadError: 'Could not load providers or settings.',
|
|
107
107
|
loading: 'Loading…',
|
|
108
108
|
readOnly: 'Settings are read-only; saving is disabled.',
|