dsh-model-think-level 2.0.2 → 2.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.
Files changed (61) hide show
  1. package/README.md +49 -23
  2. package/lib/balance.d.ts +44 -0
  3. package/lib/client/ComposerSlider.d.ts +19 -0
  4. package/lib/client/ConfigPane.d.ts +47 -0
  5. package/lib/client/EffortEditor.d.ts +34 -16
  6. package/lib/client/KeyManager.d.ts +2 -2
  7. package/lib/client/balance-client.d.ts +34 -0
  8. package/lib/client/capacity.d.ts +20 -4
  9. package/lib/client/configured-inputs.d.ts +11 -2
  10. package/lib/client/events.d.ts +31 -2
  11. package/lib/client/fingerprint-runner.d.ts +13 -1
  12. package/lib/client/image-config-client.d.ts +75 -0
  13. package/lib/client/injection/autofill-run.d.ts +2 -2
  14. package/lib/client/injection/config-button-seat.d.ts +96 -0
  15. package/lib/client/injection/create-key-seat.d.ts +3 -3
  16. package/lib/client/injection/create-keys-pane.d.ts +4 -2
  17. package/lib/client/injection/editor-tab-bar.d.ts +1 -1
  18. package/lib/client/injection/editor-tabs.d.ts +1 -1
  19. package/lib/client/injection/image-card.d.ts +85 -0
  20. package/lib/client/injection/imagegen-completion.d.ts +43 -0
  21. package/lib/client/injection/imagegen-entry.d.ts +22 -0
  22. package/lib/client/injection/key-prefetch.d.ts +44 -0
  23. package/lib/client/injection/key-reveal.d.ts +2 -3
  24. package/lib/client/injection/models-page-editor.d.ts +59 -28
  25. package/lib/client/injection/models-page.d.ts +15 -3
  26. package/lib/client/injection/provider-balance.d.ts +83 -0
  27. package/lib/client/injection/provider-endpoints.d.ts +2 -2
  28. package/lib/client/injection/row-drag.d.ts +7 -0
  29. package/lib/client/injection/staged-keys.d.ts +24 -12
  30. package/lib/client/key-manager-client.d.ts +70 -18
  31. package/lib/client/locales.d.ts +65 -15
  32. package/lib/client/ops.d.ts +12 -2
  33. package/lib/client/styles.d.ts +1 -1
  34. package/lib/client/types.d.ts +21 -3
  35. package/lib/client.js +721 -78
  36. package/lib/client.js.map +4 -4
  37. package/lib/constants.d.ts +58 -0
  38. package/lib/detection.d.ts +7 -0
  39. package/lib/fingerprint/estimate.d.ts +16 -0
  40. package/lib/fingerprint/run.d.ts +24 -0
  41. package/lib/fingerprint/store.d.ts +2 -2
  42. package/lib/fingerprint/verdict.d.ts +53 -3
  43. package/lib/headers-core.d.ts +3 -1
  44. package/lib/headers-fetch.d.ts +25 -0
  45. package/lib/image/command.d.ts +84 -0
  46. package/lib/image/config.d.ts +150 -0
  47. package/lib/image/generate.d.ts +135 -0
  48. package/lib/image/legacy-cleanup.d.ts +29 -0
  49. package/lib/image/sizes.d.ts +28 -0
  50. package/lib/image/tool.d.ts +107 -0
  51. package/lib/index.js +3876 -1745
  52. package/lib/index.js.map +4 -4
  53. package/lib/key-index.d.ts +37 -7
  54. package/lib/key-probe.d.ts +39 -99
  55. package/lib/key-refs.d.ts +43 -19
  56. package/lib/key-route-core.d.ts +100 -32
  57. package/lib/key-serves.d.ts +81 -0
  58. package/lib/knowledge.d.ts +21 -0
  59. package/lib/listing.d.ts +18 -20
  60. package/lib/multi-key-listing.d.ts +3 -3
  61. package/package.json +1 -8
@@ -108,6 +108,15 @@ export interface KnowledgeEntry {
108
108
  * audio, video) is recorded in 'note' until the core vocabulary grows.
109
109
  */
110
110
  input?: InputModalities;
111
+ /**
112
+ * The family is IMAGE GENERATION (生图): these models produce images from
113
+ * prompts and cannot serve a chat turn, so the composer's model switcher
114
+ * hides them and the row editor's modality pills stand down to the single
115
+ * 生图 answer. Such an entry declares `efforts: false` (a generator takes no
116
+ * reasoning_effort) and no `input` — the two chat-input answers would read
117
+ * it back as a vision chat model.
118
+ */
119
+ imageGen?: true;
111
120
  /**
112
121
  * Reference context window in tokens. Rendered as footnote advice, and a
113
122
  * mounted row's official capacity input echoes it (fill-only) when a
@@ -151,6 +160,14 @@ export interface EndpointFacts {
151
160
  * discipline: silence is not refusal.
152
161
  */
153
162
  input?: readonly string[];
163
+ /**
164
+ * The listing's OUTPUT-modality disclosure, normalized to lowercase strings,
165
+ * when it named one (OpenRouter's `architecture.output_modalities` and its
166
+ * flattened copies). This is the disclosure that answers "is this an image
167
+ * generator": a model whose listing says it outputs images and not text
168
+ * cannot serve a chat turn.
169
+ */
170
+ output?: readonly string[];
154
171
  /** Context length the listing disclosed, when it carries one. */
155
172
  contextLength?: number;
156
173
  }
@@ -175,6 +192,8 @@ export interface EffortSuggestion {
175
192
  input?: InputModalities;
176
193
  /** Where the modality part came from -- its confidence rides this. */
177
194
  inputSource?: InputSource;
195
+ /** Whether the model is an image generator (生图), when derivable. */
196
+ imageGen?: boolean;
178
197
  /** Reference context window; echoed into the row's official capacity input when one is mounted. */
179
198
  contextWindow?: number;
180
199
  /** Reference max output tokens (same echo rule as the context window). */
@@ -265,6 +284,8 @@ export declare function sanitizeCompatForProtocol(compat: CompatSuggestion, api:
265
284
  export declare function isSelfHostedRelay(route: RouteFacts): boolean;
266
285
  /** Lowest-confidence modality guess from the model id alone, or undefined. */
267
286
  export declare function inferModalitiesFromName(modelId: string): InputModalities | undefined;
287
+ /** Whether the id alone reads as an image generator (生图) -- the lowest-confidence tier. */
288
+ export declare function inferImageGenFromName(modelId: string): boolean;
268
289
  /**
269
290
  * Resolve the suggestion for one model on one route, fusing the available
270
291
  * signals by confidence:
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, plus the plugin's pinned Gemini). */
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), and failure messages must never repeat it.
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). Gemini's
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
  */
@@ -25,8 +25,8 @@
25
25
  * key's extras appended, scattering one letter across both ends.
26
26
  *
27
27
  * Probing is the caller's job: {@link collectKeyListings} only bounds how many
28
- * probes run at once and merges what comes back, so the panel, the `discover`
29
- * operation and the fetch overlay all share one merge.
28
+ * probes run at once and merges what comes back, so the fetch overlay and every
29
+ * other catalogue reader share one merge.
30
30
  *
31
31
  * @module dsh-model-think-level/multi-key-listing
32
32
  */
@@ -71,7 +71,7 @@ export declare function mergeKeyListings(results: readonly KeyProbeResult[], las
71
71
  export interface CollectKeyListingsOptions<Key> {
72
72
  /** The keys to ask, in the order the catalogue should read. */
73
73
  readonly keys: readonly Key[];
74
- /** Ask one key for its listing (typically `probeKeyModels`). */
74
+ /** Ask one key for its listing (the overlay's per-key probe). */
75
75
  readonly probe: (key: Key) => Promise<KeyProbeResult>;
76
76
  /**
77
77
  * The ref a key is known by. When given, a probe that THROWS is recorded as
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-model-think-level",
3
- "version": "2.0.2",
3
+ "version": "2.1.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": {