dsh-model-think-level 2.0.3 → 2.2.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/README.md +39 -22
- package/lib/autofill.d.ts +20 -2
- package/lib/balance.d.ts +44 -0
- package/lib/client/ComposerSlider.d.ts +19 -0
- package/lib/client/ConfigPane.d.ts +45 -0
- package/lib/client/EffortEditor.d.ts +1 -8
- package/lib/client/KeyManager.d.ts +2 -2
- package/lib/client/balance-client.d.ts +34 -0
- package/lib/client/events.d.ts +31 -2
- package/lib/client/image-config-client.d.ts +52 -0
- package/lib/client/index.d.ts +1 -0
- package/lib/client/injection/autofill-run.d.ts +2 -2
- package/lib/client/injection/compat-guard.d.ts +33 -0
- package/lib/client/injection/config-button-seat.d.ts +96 -0
- package/lib/client/injection/create-key-seat.d.ts +3 -3
- package/lib/client/injection/create-keys-pane.d.ts +4 -2
- package/lib/client/injection/editor-tab-bar.d.ts +1 -1
- package/lib/client/injection/editor-tabs.d.ts +1 -1
- package/lib/client/injection/image-card.d.ts +85 -0
- package/lib/client/injection/imagegen-completion.d.ts +43 -0
- package/lib/client/injection/imagegen-entry.d.ts +22 -0
- package/lib/client/injection/key-prefetch.d.ts +56 -0
- package/lib/client/injection/key-reveal.d.ts +2 -3
- package/lib/client/injection/model-order-drag.d.ts +1 -1
- package/lib/client/injection/models-page-editor.d.ts +25 -29
- package/lib/client/injection/models-page-mutation.d.ts +6 -0
- package/lib/client/injection/models-page.d.ts +15 -3
- package/lib/client/injection/provider-balance.d.ts +94 -0
- package/lib/client/injection/provider-delete-seat.d.ts +4 -1
- package/lib/client/injection/provider-disabled-group.d.ts +4 -1
- package/lib/client/injection/provider-endpoints.d.ts +2 -2
- package/lib/client/injection/provider-order-drag.d.ts +5 -1
- package/lib/client/injection/provider-toggle.d.ts +4 -1
- package/lib/client/injection/row-drag.d.ts +7 -0
- package/lib/client/injection/staged-keys.d.ts +24 -12
- package/lib/client/key-manager-client.d.ts +82 -19
- package/lib/client/locales.d.ts +40 -6
- package/lib/client/model-order.d.ts +9 -0
- package/lib/client/ops.d.ts +1 -0
- package/lib/client/order-sync.d.ts +63 -0
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/types.d.ts +4 -1
- package/lib/client.js +517 -13
- package/lib/client.js.map +4 -4
- package/lib/constants.d.ts +53 -0
- package/lib/fingerprint/estimate.d.ts +16 -0
- package/lib/fingerprint/run.d.ts +6 -0
- package/lib/fingerprint/store.d.ts +2 -2
- package/lib/fingerprint/verdict.d.ts +24 -0
- package/lib/headers-core.d.ts +3 -1
- package/lib/headers-fetch.d.ts +25 -0
- package/lib/image/command.d.ts +84 -0
- package/lib/image/config.d.ts +150 -0
- package/lib/image/generate.d.ts +135 -0
- package/lib/image/legacy-cleanup.d.ts +29 -0
- package/lib/image/sizes.d.ts +28 -0
- package/lib/image/tool.d.ts +107 -0
- package/lib/index.js +3969 -1555
- package/lib/index.js.map +4 -4
- package/lib/key-index.d.ts +48 -7
- package/lib/key-probe.d.ts +42 -17
- package/lib/key-refs.d.ts +43 -19
- package/lib/key-route-core.d.ts +100 -32
- package/lib/key-serves.d.ts +81 -0
- package/lib/knowledge.d.ts +26 -0
- package/lib/listing.d.ts +18 -20
- package/lib/order-store.d.ts +78 -0
- package/package.json +1 -8
package/lib/listing.d.ts
CHANGED
|
@@ -15,25 +15,35 @@
|
|
|
15
15
|
export declare const ANTHROPIC_VERSION = "2023-06-01";
|
|
16
16
|
/** Largest model-list page accepted by Anthropic's public endpoint. */
|
|
17
17
|
export declare const ANTHROPIC_MODEL_LIMIT = 1000;
|
|
18
|
-
/** Largest model-list page requested of Gemini's native endpoint. */
|
|
19
|
-
export declare const GEMINI_MODEL_LIMIT = 1000;
|
|
20
18
|
/** Largest listing reply a probe accepts (the official discovery's bound). */
|
|
21
19
|
export declare const MAX_RESPONSE_BYTES: number;
|
|
22
|
-
/** Protocols whose model listing this module can read (the harness discovery set
|
|
20
|
+
/** Protocols whose model listing this module can read (the harness discovery set). */
|
|
23
21
|
export declare const LISTABLE_PROTOCOLS: ReadonlySet<string>;
|
|
24
22
|
/**
|
|
25
23
|
* A URL safe to echo in responses: a baseURL may carry userinfo
|
|
26
|
-
* (https://user:pass@host)
|
|
24
|
+
* (https://user:pass@host) or a key in its query (?api_key=… — a common relay
|
|
25
|
+
* spelling), and failure messages must never repeat either. The path is what
|
|
26
|
+
* identifies the probe; credentials live in the userinfo and the query, both
|
|
27
|
+
* of which are dropped, along with the fragment. A string that is not a
|
|
28
|
+
* parseable URL is replaced with a placeholder — echoing the raw input back
|
|
29
|
+
* would defeat the whole point (the opaque `user:pass@host` spelling parses
|
|
30
|
+
* as a non-special scheme whose userinfo setters are no-ops).
|
|
27
31
|
*/
|
|
28
32
|
export declare function displayUrl(raw: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Redact credential-bearing URL shapes from free-form error text: any
|
|
35
|
+
* `user:password@` authority (with or without a scheme — the opaque spelling
|
|
36
|
+
* parses as scheme+path and survives URL-level stripping) loses its secret.
|
|
37
|
+
* Applied to upstream error messages before they reach a response body, since
|
|
38
|
+
* undici's own texts quote the original URL verbatim.
|
|
39
|
+
*/
|
|
40
|
+
export declare function redactUrlSecrets(text: string): string;
|
|
29
41
|
/**
|
|
30
42
|
* Probe-listing URL, mirroring the harness's own model discovery:
|
|
31
43
|
* OpenAI-compatible protocols list at `{baseURL}/models`; Anthropic Messages
|
|
32
44
|
* uses its native route at `{root}/v1/models?limit=1000`, where the root is the
|
|
33
45
|
* base without trailing slashes and without one trailing `/v1` segment
|
|
34
|
-
* (gateway documentation publishes both spellings of the same root).
|
|
35
|
-
* native protocol lists at `{base}/v1beta/models?pageSize=1000` on the same
|
|
36
|
-
* version-qualified base its requests speak (see {@link geminiRequestBaseUrl}).
|
|
46
|
+
* (gateway documentation publishes both spellings of the same root).
|
|
37
47
|
*/
|
|
38
48
|
export declare function probeListingUrl(baseURL: string, api: string): string;
|
|
39
49
|
/**
|
|
@@ -42,14 +52,6 @@ export declare function probeListingUrl(baseURL: string, api: string): string;
|
|
|
42
52
|
* the request endpoint at exactly `/v1/messages`.
|
|
43
53
|
*/
|
|
44
54
|
export declare function anthropicRequestBaseUrl(baseURL: string): string;
|
|
45
|
-
/**
|
|
46
|
-
* The base URL a Gemini-native request needs. pi-ai's Google client takes
|
|
47
|
-
* `model.baseUrl` verbatim with `apiVersion: ''`, so the version segment must
|
|
48
|
-
* already sit in the path; a bare origin is completed with `/v1beta` (the
|
|
49
|
-
* official spelling), while a path the user spelled out is kept as the
|
|
50
|
-
* gateway's own.
|
|
51
|
-
*/
|
|
52
|
-
export declare function geminiRequestBaseUrl(baseURL: string): string;
|
|
53
55
|
/**
|
|
54
56
|
* Compose the raw-models probe request's headers, mirroring the discipline of
|
|
55
57
|
* the harness's own model discovery: the provider
|
|
@@ -81,11 +83,7 @@ export declare function readBounded(response: Response, url: string): Promise<st
|
|
|
81
83
|
* official parser: the standard `data` array takes precedence; the
|
|
82
84
|
* enriched `models` map uses each property key as the endpoint-facing id
|
|
83
85
|
* (the nested `id` only falls back for an empty key — gateways may put a
|
|
84
|
-
* canonical identity there instead of the alias they accept on requests)
|
|
85
|
-
* Gemini's native `models` ARRAY unwraps each `models/<id>` resource name into
|
|
86
|
-
* the bare id the request path needs, keeps only entries a chat request can
|
|
87
|
-
* address (`generateContent`), and reads the display label from
|
|
88
|
-
* `displayName` (the raw `name` is the resource path, not a label). Only
|
|
86
|
+
* canonical identity there instead of the alias they accept on requests). Only
|
|
89
87
|
* object-valued entries are models, and entries without a usable id are
|
|
90
88
|
* dropped. Returns undefined when the listing names none of these shapes.
|
|
91
89
|
*/
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The UI-order document: the sequence the user set by dragging the provider
|
|
3
|
+
* rows, and every provider's model-row sequence, mirrored host-side.
|
|
4
|
+
*
|
|
5
|
+
* The live preference lives in the browser half's localStorage
|
|
6
|
+
* (provider-order.ts / model-order.ts) — fast, and shared across tabs through
|
|
7
|
+
* storage events. localStorage does not travel, though, and the orderings are
|
|
8
|
+
* exactly the kind of setting a user wants on every machine, so the document
|
|
9
|
+
* is mirrored into `<DSH_HOME>/dsh-model-think-level/ui-order.json` beside the
|
|
10
|
+
* key index: a file the user can carry through any sync mechanism. The client
|
|
11
|
+
* is the only writer (it pulls at boot and pushes every drag, last-writer-wins
|
|
12
|
+
* on the `savedAt` stamp); the host only reads, stores and serves it.
|
|
13
|
+
*
|
|
14
|
+
* The file holds no secrets — provider routes and model ids only — which is
|
|
15
|
+
* what makes it safe to point a sync tool at. It is parsed leniently: an
|
|
16
|
+
* unreadable or malformed document degrades to "nothing stored", never an
|
|
17
|
+
* error, and a partial payload MERGES over what is already stored, so a
|
|
18
|
+
* buggy writer cannot wipe a good file with an empty one. Every write is
|
|
19
|
+
* atomic, like the key index's.
|
|
20
|
+
*
|
|
21
|
+
* @module dsh-model-think-level/order-store
|
|
22
|
+
*/
|
|
23
|
+
/** The whole synced ordering state, stamped by the writing client. */
|
|
24
|
+
export interface UiOrderDocument {
|
|
25
|
+
readonly version: 1;
|
|
26
|
+
/**
|
|
27
|
+
* Epoch ms of the writing client's last ORDER CHANGE — set by the browser
|
|
28
|
+
* at change time, not by the host at write time, so machines can arbitrate
|
|
29
|
+
* which side is newer. Zero means "unstamped" (a hand-made file).
|
|
30
|
+
*/
|
|
31
|
+
readonly savedAt: number;
|
|
32
|
+
/** The dragged provider-row sequence, first row first. */
|
|
33
|
+
readonly providerOrder: readonly string[];
|
|
34
|
+
/** Every provider's dragged model-row sequence, keyed by provider id. */
|
|
35
|
+
readonly modelOrder: Readonly<Record<string, readonly string[]>>;
|
|
36
|
+
/**
|
|
37
|
+
* The provider ids switched OFF on the Models page. The DISABLED set, not
|
|
38
|
+
* the enabled one — an empty list means "everything is on", which is a real
|
|
39
|
+
* state a machine can hold and another machine must be able to adopt, not
|
|
40
|
+
* the absence of an opinion.
|
|
41
|
+
*/
|
|
42
|
+
readonly providersDisabled: readonly string[];
|
|
43
|
+
}
|
|
44
|
+
/** A fresh, empty document. */
|
|
45
|
+
export declare function emptyUiOrder(): UiOrderDocument;
|
|
46
|
+
/** Absolute path of the document beside the key index. */
|
|
47
|
+
export declare function uiOrderFilePath(home?: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Parse an already-decoded payload, dropping whatever does not fit. Never
|
|
50
|
+
* throws: this file is a UI preference, so a corrupt one is an empty one.
|
|
51
|
+
* @param raw - the decoded JSON value (or anything else).
|
|
52
|
+
*/
|
|
53
|
+
export declare function parseUiOrder(raw: unknown): UiOrderDocument;
|
|
54
|
+
/**
|
|
55
|
+
* Fold a (possibly partial) payload over a current document: a field the
|
|
56
|
+
* payload carries in a usable shape replaces the stored one, every other
|
|
57
|
+
* field keeps the stored value. A writer that can only name what it knows —
|
|
58
|
+
* or a corrupted body — therefore can never blank a good file.
|
|
59
|
+
* @param current - the stored document.
|
|
60
|
+
* @param patch - the incoming payload, as posted by the client.
|
|
61
|
+
* @param at - the savedAt to stamp when the payload carries no usable one.
|
|
62
|
+
*/
|
|
63
|
+
export declare function mergeUiOrder(current: UiOrderDocument, patch: unknown, at: number): UiOrderDocument;
|
|
64
|
+
/**
|
|
65
|
+
* Read the document. Never throws: an absent file and an unreadable one both
|
|
66
|
+
* mean "nothing stored yet" — the client decides whether to adopt or to seed.
|
|
67
|
+
* @param file - document path (tests pass a temp file).
|
|
68
|
+
*/
|
|
69
|
+
export declare function readUiOrder(file?: string): UiOrderDocument;
|
|
70
|
+
/** Write the document at one path, atomically. */
|
|
71
|
+
export declare function writeUiOrder(document: UiOrderDocument, file?: string): void;
|
|
72
|
+
/**
|
|
73
|
+
* Read, fold a payload over it, and write back — the POST route's whole body.
|
|
74
|
+
* The read and the write bracket one synchronous section, so two overlapping
|
|
75
|
+
* requests cannot interleave the read-modify-write.
|
|
76
|
+
* @returns the document as it now stands on disk.
|
|
77
|
+
*/
|
|
78
|
+
export declare function commitUiOrder(patch: unknown, at: number, file?: string): UiOrderDocument;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-model-think-level",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "DSH 的第三方模型补齐思考等级:在官方 Models 页每个模型行注入 Thinking 开关和强度/模态编辑器,在输入框模型菜单加供应商→模型选择器、视觉徽章与等级行,并带搜索、拖拽排序、供应商启用开关;以及按路由接管请求头与 user-agent。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GaoHu1997 <gaohu9712@163.com>",
|
|
@@ -26,13 +26,6 @@
|
|
|
26
26
|
"llm-settings"
|
|
27
27
|
],
|
|
28
28
|
"type": "module",
|
|
29
|
-
"pnpm": {
|
|
30
|
-
"onlyBuiltDependencies": [
|
|
31
|
-
"@google/genai",
|
|
32
|
-
"esbuild",
|
|
33
|
-
"protobufjs"
|
|
34
|
-
]
|
|
35
|
-
},
|
|
36
29
|
"main": "lib/index.js",
|
|
37
30
|
"types": "./lib/index.d.ts",
|
|
38
31
|
"exports": {
|