dsh-model-think-level 2.3.5 → 2.4.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 +197 -73
- package/lib/camouflage-store.d.ts +55 -0
- package/lib/camouflage.d.ts +91 -0
- package/lib/client/AdvancedPane.d.ts +38 -0
- package/lib/client/CamouflageEditor.d.ts +100 -0
- package/lib/client/ConfigPane.d.ts +2 -4
- package/lib/client/HeadersEditor.d.ts +21 -1
- package/lib/client/auto-continue-pref.d.ts +32 -14
- package/lib/client/injection/model-order-drag.d.ts +3 -1
- package/lib/client/locales.d.ts +18 -2
- package/lib/client/styles.d.ts +1 -1
- package/lib/client.js +320 -73
- package/lib/client.js.map +4 -4
- package/lib/constants.d.ts +14 -0
- package/lib/headers-core.d.ts +17 -2
- package/lib/index.js +336 -63
- package/lib/index.js.map +4 -4
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +6 -2
package/lib/constants.d.ts
CHANGED
|
@@ -157,6 +157,20 @@ export declare const AUTOFILL_MARKER = "reasoningEffortsAutofilled";
|
|
|
157
157
|
* so a future first-class field can adopt the stored values as-is.
|
|
158
158
|
*/
|
|
159
159
|
export declare const DEFAULT_EFFORT_FIELD = "defaultEffort";
|
|
160
|
+
/**
|
|
161
|
+
* Same-origin host route owning the request-camouflage document: `GET` answers
|
|
162
|
+
* every route's selected client identity, `POST` saves one route's choice.
|
|
163
|
+
* Backing file: `<DSH_HOME>/dsh-model-think-level/camouflage.json` (see
|
|
164
|
+
* {@link CAMOUFLAGE_FILE}).
|
|
165
|
+
*
|
|
166
|
+
* The choice is plugin-owned rather than a pi-ai profile field because the
|
|
167
|
+
* official add-provider card writes the WHOLE profile, which would drop a key
|
|
168
|
+
* its schema does not know — and because a preset expands into several wire
|
|
169
|
+
* headers the user's own `headers` dictionary must not have to carry.
|
|
170
|
+
*/
|
|
171
|
+
export declare const CAMOUFLAGE_PATH = "/dsh-model-think-level/camouflage";
|
|
172
|
+
/** File name of the camouflage document inside the plugin's home dir. */
|
|
173
|
+
export declare const CAMOUFLAGE_FILE = "camouflage.json";
|
|
160
174
|
/**
|
|
161
175
|
* Same-origin host route owning the image-generation config surface: `GET`
|
|
162
176
|
* answers the derived image-model list merged with the stored overrides,
|
package/lib/headers-core.d.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @module dsh-model-think-level/headers-core
|
|
19
19
|
*/
|
|
20
|
+
import type { CamouflagePreset } from './camouflage.js';
|
|
20
21
|
/** One route's configured request headers and its fetch matching metadata. */
|
|
21
22
|
export interface HeaderOverride {
|
|
22
23
|
/** `scheme://host:port` of the route's endpoint, exactly as Fetch would print it. */
|
|
@@ -37,6 +38,13 @@ export interface HeaderOverride {
|
|
|
37
38
|
userAgent?: string;
|
|
38
39
|
/** Whether this route actually declares sendable request headers. */
|
|
39
40
|
hasHeaders: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The client identity this route asks the wire to present, when the user
|
|
43
|
+
* picked one in the advanced pane. Absent means "send whatever the adapter
|
|
44
|
+
* sent" — the conservative default. The identity is stored in the plugin's
|
|
45
|
+
* own document, not in the profile, so it survives an official card save.
|
|
46
|
+
*/
|
|
47
|
+
camouflage?: CamouflagePreset;
|
|
40
48
|
}
|
|
41
49
|
/** Backwards-compatible name retained for callers that only knew the UA seam. */
|
|
42
50
|
export type UserAgentOverride = HeaderOverride;
|
|
@@ -99,8 +107,15 @@ export declare function headersOf(profile: Record<string, unknown> | undefined):
|
|
|
99
107
|
* @returns the value, or undefined when the route declares none.
|
|
100
108
|
*/
|
|
101
109
|
export declare function declaredUserAgent(profile: Record<string, unknown> | undefined): string | undefined;
|
|
102
|
-
/** Build the route index from each provider profile's endpoint and header declaration.
|
|
103
|
-
|
|
110
|
+
/** Build the route index from each provider profile's endpoint and header declaration.
|
|
111
|
+
*
|
|
112
|
+
* @param providers - the settings document's provider profiles.
|
|
113
|
+
* @param camouflages - route → client identity, from the plugin's own document.
|
|
114
|
+
* Optional: a deployment with no camouflage file builds exactly the index it
|
|
115
|
+
* built before, and a route named here that the settings no longer carry is
|
|
116
|
+
* simply never matched.
|
|
117
|
+
*/
|
|
118
|
+
export declare function buildHeaderIndex(providers: Record<string, Record<string, unknown>>, camouflages?: Readonly<Record<string, CamouflagePreset | undefined>>): HeaderIndex;
|
|
104
119
|
/** Original public name retained while callers migrate to the generic index. */
|
|
105
120
|
export declare function buildUserAgentIndex(providers: Record<string, Record<string, unknown>>): UserAgentIndex;
|
|
106
121
|
/** The pathname of a request URL, normalized the way {@link pathPrefixOf} is. */
|