dsh-model-think-level 2.3.6 → 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 +13 -0
- 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/HeadersEditor.d.ts +21 -1
- package/lib/client/injection/model-order-drag.d.ts +3 -1
- package/lib/client/locales.d.ts +8 -0
- package/lib/client/styles.d.ts +1 -1
- package/lib/client.js +93 -39
- 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/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ DSH 自带的 Models 页只认得它自己目录里的模型。中转站、自
|
|
|
18
18
|
- **多密钥** — 一个供应商放 N 把密钥,按把启停、按把圈定模型范围、按把指定协议;保存后自动探测每把密钥能服务哪些模型。
|
|
19
19
|
- **自动重试** — 401/403/408/429/5xx 和「分组里没有这个模型」自动换下一把密钥,配冷却排序,把还在冷却里的密钥排到最后;请求一旦开始输出内容就不再重放。
|
|
20
20
|
- **自定义请求头** — 每个路由可配任意请求头(含 `user-agent`),在 fetch 层按请求重新盖回去;同源冲突、与官方适配器或同类插件的争抢都会被检出。
|
|
21
|
+
- **请求伪装** — 每个路由可选 Codex / Claude 两种官方 CLI 身份:客户端请求头,以及 Claude 的 Messages 请求体身份段一并补齐;默认关闭,与自定义请求头同一区块。
|
|
21
22
|
- **生图** — 勾一下「生图」就能把任意模型变成生图模型,对话模型调用原生工具 `generate_image` 出图,支持参考图改图、多图并出、默认参数与超时。
|
|
22
23
|
- **自动继续** — 会话因为断线、超时、撞上输出上限停住时,替你补一条「继续」,可展开配置等待秒数和最多重试次数。
|
|
23
24
|
- **余额** — 每个供应商可选配一个只读余额接口,模型页直接显示余额,支持手动刷新。
|
|
@@ -96,6 +97,18 @@ dsh plugin add .
|
|
|
96
97
|
- `user-agent` 最长 512 字符。
|
|
97
98
|
- 冲突会被检出并提示:同源上别的路由已占用同名请求头、官方 `dsh-llm-pi-ai` 的 `transformHeaders` 已经在处理这组头、或者别的同类插件也在写同一个头。
|
|
98
99
|
|
|
100
|
+
### 高级配置:请求伪装
|
|
101
|
+
|
|
102
|
+
「请求头」下面是**同一个表单**里的第二个区块:**请求伪装**。默认关闭,按路由保存,可选 **Codex** 或 **Claude**——让该路由的请求以对应厂商官方 CLI 的身份发出,而不是以 SDK 的默认身份。
|
|
103
|
+
|
|
104
|
+
- 两个区块之间有一条分割线,**取消 / 保存只有一组,放在最下面**:它提交的是整个高级配置(请求头 + 伪装)。伪装是草稿——点选项只是改了表单,按保存才写入;按取消回到已保存的值。
|
|
105
|
+
|
|
106
|
+
- 存的是插件自己的文件 `<DSH_HOME>/dsh-model-think-level/camouflage.json`,不写进官方供应商档案;换了版本、删了文件就回到关闭。
|
|
107
|
+
- **Codex**:改 `user-agent` 为 `codex_cli_rs/<版本>`,补 `originator: codex_cli_rs` 和一个稳定的 `x-codex-session-id`;请求体不动。
|
|
108
|
+
- **Claude**:改 `user-agent` 为 `claude-cli/<版本>`,补 `x-app: cli`、`anthropic-version`、`anthropic-beta`,并在 `/v1/messages` 的请求体里补上校验要看的身份 system 段与 `metadata.user_id`——tools、图片、签名块一律原样保留。请求体的改动会同步重算 `content-length`。
|
|
109
|
+
- 与自定义请求头的优先级:伪装先落,**请求头表里的同名项最后生效**——你在表里显式写了 `user-agent`,就以你的为准;`anthropic-version` 只有缺失时才补,已有值保留。
|
|
110
|
+
- 只影响这个路由真实发出的请求。探测密钥、余额、生图这类旁路请求不带伪装。
|
|
111
|
+
|
|
99
112
|
### 高级设置:生图默认参数与自动继续
|
|
100
113
|
|
|
101
114
|
模型页标题行的按钮打开「高级设置」浮层,目前有两张卡。浮层高度固定(折叠、展开都不变,内容超出时才在浮层内部滚动),两张卡都能点卡片名或右侧箭头展开:
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The camouflage document: which client identity each provider route asks the
|
|
3
|
+
* wire to present.
|
|
4
|
+
*
|
|
5
|
+
* It lives in the plugin's own home directory rather than in the pi-ai profile
|
|
6
|
+
* for the same reason the key index does: the official add-provider card writes
|
|
7
|
+
* the WHOLE profile at `providers.<route>`, so a field the official schema does
|
|
8
|
+
* not know would be dropped by the first save. It also keeps the identity out of
|
|
9
|
+
* the user's `headers` dictionary — a preset expands into several headers, and
|
|
10
|
+
* unfolding them into the user's own list would make "turn it off" a manual
|
|
11
|
+
* cleanup instead of one switch.
|
|
12
|
+
*
|
|
13
|
+
* The document holds no secrets: route names and one of two preset names. It is
|
|
14
|
+
* parsed leniently (an unreadable file means "nothing camouflaged") and written
|
|
15
|
+
* atomically, like the key index and the UI order.
|
|
16
|
+
*
|
|
17
|
+
* @module dsh-model-think-level/camouflage-store
|
|
18
|
+
*/
|
|
19
|
+
import { type CamouflagePreset } from './camouflage.js';
|
|
20
|
+
/** The whole stored document. */
|
|
21
|
+
export interface CamouflageDocument {
|
|
22
|
+
/** Schema version; a future shape can migrate by reading this. */
|
|
23
|
+
readonly version: 1;
|
|
24
|
+
/** Route → the identity its requests present. Absent means "as sent". */
|
|
25
|
+
readonly providers: Readonly<Record<string, CamouflagePreset>>;
|
|
26
|
+
}
|
|
27
|
+
/** A fresh, empty document. */
|
|
28
|
+
export declare function emptyCamouflage(): CamouflageDocument;
|
|
29
|
+
/** Absolute path of the document beside the key index. */
|
|
30
|
+
export declare function camouflageFilePath(home?: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Parse an already-decoded document. Never throws and never trusts the input:
|
|
33
|
+
* an entry with an unknown preset is dropped, so a file written by a newer
|
|
34
|
+
* build costs only the settings this build cannot express.
|
|
35
|
+
* @param raw - the decoded JSON value (or anything else).
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseCamouflage(raw: unknown): CamouflageDocument;
|
|
38
|
+
/** Read the document. Never throws; an absent file means "nothing stored". */
|
|
39
|
+
export declare function readCamouflage(file?: string): CamouflageDocument;
|
|
40
|
+
/** Write the document at one path, atomically. */
|
|
41
|
+
export declare function writeCamouflage(document: CamouflageDocument, file?: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Set or clear one route's identity.
|
|
44
|
+
*
|
|
45
|
+
* `undefined` removes the entry rather than storing "off": the document then
|
|
46
|
+
* says exactly what it means, and a route deleted and re-created cannot inherit
|
|
47
|
+
* a stale identity.
|
|
48
|
+
* @param route - the provider route key.
|
|
49
|
+
* @param preset - the identity, or undefined to clear it.
|
|
50
|
+
* @param file - document path (tests pass a temp file).
|
|
51
|
+
* @returns the document as it now stands on disk.
|
|
52
|
+
*/
|
|
53
|
+
export declare function setRouteCamouflage(route: string, preset: CamouflagePreset | undefined, file?: string): CamouflageDocument;
|
|
54
|
+
/** One route's stored identity, never resolving through Object.prototype. */
|
|
55
|
+
export declare function camouflageOf(document: CamouflageDocument, route: string): CamouflagePreset | undefined;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request camouflage: the client identities a provider account may demand on
|
|
3
|
+
* the wire, and the exact headers/bodies that make a request look like the
|
|
4
|
+
* official CLI of that vendor.
|
|
5
|
+
*
|
|
6
|
+
* This module is deliberately pure: it owns no storage, no fetch wrapper and
|
|
7
|
+
* no settings document. The host reads the per-route choice from the plugin's
|
|
8
|
+
* own file (`camouflage-store.ts`), folds it into the header index as
|
|
9
|
+
* `HeaderOverride.camouflage`, and the two request seams
|
|
10
|
+
* (`headers-fetch.ts` for the wire headers and body, `headers-pi-ai.ts` for a
|
|
11
|
+
* protocol switch) call into the planners here.
|
|
12
|
+
*
|
|
13
|
+
* The two identities are modelled on what gateway projects actually check, not
|
|
14
|
+
* on what a browser can spoof:
|
|
15
|
+
*
|
|
16
|
+
* - `codex` — an OpenAI Codex CLI. The checks seen in the wild accept a
|
|
17
|
+
* `codex_cli_rs/...` user agent OR an `originator: codex_cli_rs` header, and
|
|
18
|
+
* then require at least one `x-codex-*` header to be present. The identity
|
|
19
|
+
* therefore ships all three: the agent string, the originator, and a session
|
|
20
|
+
* header carrying a stable per-process id.
|
|
21
|
+
* - `claude` — a Claude Code CLI. The checks require a
|
|
22
|
+
* `claude-cli/<major>.<minor>.<patch>` user agent, a non-empty `x-app`,
|
|
23
|
+
* `anthropic-beta` and `anthropic-version`, a Claude Code system block in the
|
|
24
|
+
* Messages body, and a parseable `metadata.user_id`. The planner supplies
|
|
25
|
+
* every one of those; `anthropic-version` is normally already set by the
|
|
26
|
+
* SDK and is only filled in when absent.
|
|
27
|
+
*
|
|
28
|
+
* Nothing here fabricates an OAuth token, an account id or a billing header:
|
|
29
|
+
* a fake credential is a different failure mode (a hard 401) and is not what
|
|
30
|
+
* these gates ask for. Camouflage only changes the CLIENT identity.
|
|
31
|
+
*
|
|
32
|
+
* @module dsh-model-think-level/camouflage
|
|
33
|
+
*/
|
|
34
|
+
/** The identities a provider editor may pick. */
|
|
35
|
+
export type CamouflagePreset = 'codex' | 'claude';
|
|
36
|
+
/** Every preset, in the order the editor lists them. */
|
|
37
|
+
export declare const CAMOUFLAGE_PRESETS: readonly CamouflagePreset[];
|
|
38
|
+
/** Whether a stored/downloaded value names a preset this build understands. */
|
|
39
|
+
export declare function isCamouflagePreset(value: unknown): value is CamouflagePreset;
|
|
40
|
+
/** A preset's display name, in the product's own words (the GUI translates). */
|
|
41
|
+
export declare const CAMOUFLAGE_LABEL: Readonly<Record<CamouflagePreset, string>>;
|
|
42
|
+
/** The `user-agent` a preset puts on the wire. */
|
|
43
|
+
export declare function camouflageUserAgent(preset: CamouflagePreset): string;
|
|
44
|
+
/**
|
|
45
|
+
* Whether a URL speaks the Anthropic Messages wire, which is the only body
|
|
46
|
+
* shape the Claude identity patches. Path matching (not the route's declared
|
|
47
|
+
* protocol) is used because a key may switch the wire under a route.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isAnthropicMessagesUrl(url: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The headers a preset adds, as a plain record. Names are lower-case because
|
|
52
|
+
* `Headers` normalises them anyway and the index comparisons are name-based.
|
|
53
|
+
*
|
|
54
|
+
* A value already present on the request is only replaced for the identity's
|
|
55
|
+
* OWN marker headers; see {@link applyCamouflageHeaders}.
|
|
56
|
+
*/
|
|
57
|
+
export declare function camouflageHeaders(preset: CamouflagePreset): Record<string, string>;
|
|
58
|
+
/**
|
|
59
|
+
* Apply a preset's headers to a request. The identity's own markers are forced
|
|
60
|
+
* (a leftover `user-agent` from a generic SDK is exactly what the gate rejects);
|
|
61
|
+
* `anthropic-version` is only filled in when absent, because the SDK's value is
|
|
62
|
+
* the protocol's own and newer than what this module could safely hard-code.
|
|
63
|
+
*
|
|
64
|
+
* @returns whether anything was written (the wrapper's cheap "no patch" test).
|
|
65
|
+
*/
|
|
66
|
+
export declare function applyCamouflageHeaders(headers: Headers, preset: CamouflagePreset): boolean;
|
|
67
|
+
/** The Claude Code identity block the Messages gate looks for. */
|
|
68
|
+
export declare const CLAUDE_CODE_SYSTEM_TEXT = "You are Claude Code, Anthropic's CLI for Claude.";
|
|
69
|
+
/**
|
|
70
|
+
* Build the `metadata.user_id` a Claude Code client sends.
|
|
71
|
+
*
|
|
72
|
+
* The shape is `user_<device>_account_<account>_session_<session>`; the gate
|
|
73
|
+
* only requires `device_id` and `session_id` to be present, so the account
|
|
74
|
+
* segment is a stable placeholder rather than a fabricated account.
|
|
75
|
+
*/
|
|
76
|
+
export declare function camouflageClaudeUserId(): string;
|
|
77
|
+
/**
|
|
78
|
+
* Patch one JSON request body for a preset. Returns `undefined` when the body
|
|
79
|
+
* needs no change (or is not a JSON object), so callers can keep the original
|
|
80
|
+
* text and its identity.
|
|
81
|
+
*
|
|
82
|
+
* The Claude patch is the minimum the Messages gate reads: the identity system
|
|
83
|
+
* block (prepended, keeping the caller's own blocks intact) and a parseable
|
|
84
|
+
* `metadata.user_id`. Tools, images, signatures and thinking blocks are never
|
|
85
|
+
* touched — corrupting them would break the agent loop the request belongs to.
|
|
86
|
+
*
|
|
87
|
+
* @param text - the request body, already decoded as UTF-8.
|
|
88
|
+
* @param preset - the selected identity.
|
|
89
|
+
* @param url - the request URL, used to decide whether this is a Messages body.
|
|
90
|
+
*/
|
|
91
|
+
export declare function patchCamouflageBody(text: string, preset: CamouflagePreset, url: string): string | undefined;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The advanced-configuration pane of one provider card, assembled.
|
|
3
|
+
*
|
|
4
|
+
* The pane is one form over two sections — the request headers, then how the
|
|
5
|
+
* route presents itself — and ends in ONE commit row under both. Splitting the
|
|
6
|
+
* sections into two components with two commit rows would have made the pane
|
|
7
|
+
* read as two forms and put a 保存 between them, which is exactly the shape
|
|
8
|
+
* that was wrong: a Save above the disguise looked like a Save for the headers
|
|
9
|
+
* alone, and the section below it looked left out of the form.
|
|
10
|
+
*
|
|
11
|
+
* So this component owns what the sections share: the disguise draft lives
|
|
12
|
+
* here, the header editor renders it as {@link CamouflageEditor} through its
|
|
13
|
+
* `extras` seat, and the editor's own Save commits both ({@link
|
|
14
|
+
* useCamouflage}'s `commit` runs after the header write, before the card
|
|
15
|
+
* closes). The disguise therefore only reaches the host on Save; picking a
|
|
16
|
+
* preset and pressing 取消 leaves nothing behind.
|
|
17
|
+
*
|
|
18
|
+
* @module dsh-model-think-level/client/AdvancedPane
|
|
19
|
+
*/
|
|
20
|
+
import type { ReactNode } from 'react';
|
|
21
|
+
import type { RemoteApi } from './types.js';
|
|
22
|
+
/** Props of {@link AdvancedPane}. */
|
|
23
|
+
export interface AdvancedPaneProps {
|
|
24
|
+
/** The provider route this card edits. */
|
|
25
|
+
route: string;
|
|
26
|
+
/** The write seam for the header section. */
|
|
27
|
+
api: RemoteApi;
|
|
28
|
+
/** Localized copy. */
|
|
29
|
+
t: (key: string, params?: Record<string, string | number>) => string;
|
|
30
|
+
/** Close the whole card, as the official footer's 取消 does. */
|
|
31
|
+
onDismiss?: () => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Render the pane: headers, then the disguise, then the single commit row.
|
|
35
|
+
* @param props - route identity, write seam, copy and the card dismiss seam.
|
|
36
|
+
* @returns the pane.
|
|
37
|
+
*/
|
|
38
|
+
export declare function AdvancedPane({ route, api, t, onDismiss }: AdvancedPaneProps): ReactNode;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The request-camouflage section of a provider's advanced configuration.
|
|
3
|
+
*
|
|
4
|
+
* It is a SECTION of the advanced pane, not a second card: it renders inside
|
|
5
|
+
* the request-header section's own container (`HeadersEditor` takes it as
|
|
6
|
+
* `extras`), below the header table and above the pane's single commit row, and
|
|
7
|
+
* separates itself from the headers with the same hairline the host draws
|
|
8
|
+
* between card sections. That is also what puts the pane's 取消/保存 under BOTH
|
|
9
|
+
* sections, which is the shape the pane was supposed to have: one form, one
|
|
10
|
+
* commit row.
|
|
11
|
+
*
|
|
12
|
+
* The choice is a DRAFT until the pane's Save runs. This module therefore only
|
|
13
|
+
* renders the switch; {@link useCamouflage} holds the draft, reads the stored
|
|
14
|
+
* value and commits it, and the pane wires the commit into its own Save. A
|
|
15
|
+
* preset that is clicked and then abandoned with 取消 never reaches the host.
|
|
16
|
+
*
|
|
17
|
+
* The create-provider card has no commit row of its own (its 保存 is the
|
|
18
|
+
* official one that declares the route), so it uses {@link CamouflageField}:
|
|
19
|
+
* the same switch, committed as soon as it is chosen — inert until the route
|
|
20
|
+
* exists, which is exactly the moment that card's 保存 creates it.
|
|
21
|
+
*
|
|
22
|
+
* @module dsh-model-think-level/client/CamouflageEditor
|
|
23
|
+
*/
|
|
24
|
+
import { type ReactNode } from 'react';
|
|
25
|
+
/** One identity the host understands. Kept in step with `camouflage.ts`. */
|
|
26
|
+
type CamouflagePreset = 'codex' | 'claude';
|
|
27
|
+
/** The switch's copy, as the host slot hands it down. */
|
|
28
|
+
type Copy = (key: string, params?: Record<string, string | number>) => string;
|
|
29
|
+
/** Everything the switch needs to paint: no reads, no writes. */
|
|
30
|
+
export interface CamouflageEditorProps {
|
|
31
|
+
/** Localized copy. */
|
|
32
|
+
t: Copy;
|
|
33
|
+
/** The draft the pane currently holds; `undefined` is 关闭. */
|
|
34
|
+
value: CamouflagePreset | undefined;
|
|
35
|
+
/** Whether this build's request seams are in place. */
|
|
36
|
+
installed: boolean;
|
|
37
|
+
/** Disable the options (the stored value is still being read). */
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/** Report a choice; the pane decides when it is written. */
|
|
40
|
+
onChange: (next: CamouflagePreset | undefined) => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Render the disguise switch.
|
|
44
|
+
*
|
|
45
|
+
* Presentational on purpose: the pane's Save owns the write, so a click here
|
|
46
|
+
* changes what the form holds and nothing else.
|
|
47
|
+
* @param props - draft value, availability and the change sink.
|
|
48
|
+
* @returns the section.
|
|
49
|
+
*/
|
|
50
|
+
export declare function CamouflageEditor({ t, value, installed, disabled, onChange }: CamouflageEditorProps): ReactNode;
|
|
51
|
+
/** The draft one route's pane holds, plus the two seams the pane drives. */
|
|
52
|
+
export interface CamouflageDraft {
|
|
53
|
+
/** The value on screen — the draft, not necessarily the stored one. */
|
|
54
|
+
value: CamouflagePreset | undefined;
|
|
55
|
+
/** The value the host currently has, i.e. what 取消 restores. */
|
|
56
|
+
saved: CamouflagePreset | undefined;
|
|
57
|
+
/** Whether this build's request seams are in place. */
|
|
58
|
+
installed: boolean;
|
|
59
|
+
/** Whether the stored value is still being read. */
|
|
60
|
+
loading: boolean;
|
|
61
|
+
/** Replace the draft. Writes nothing. */
|
|
62
|
+
setValue: (next: CamouflagePreset | undefined) => void;
|
|
63
|
+
/** Restore the stored value (the pane's 取消). */
|
|
64
|
+
reset: () => void;
|
|
65
|
+
/**
|
|
66
|
+
* Write the draft, if it differs from the stored value.
|
|
67
|
+
*
|
|
68
|
+
* Rejects when the host route could not be reached, so the pane can keep
|
|
69
|
+
* itself open instead of dismissing over a write that did not happen.
|
|
70
|
+
* @param next - the value to write instead of the one on screen (an
|
|
71
|
+
* immediate-mode caller passes its own choice: state updates are async).
|
|
72
|
+
*/
|
|
73
|
+
commit: (next?: {
|
|
74
|
+
preset: CamouflagePreset | undefined;
|
|
75
|
+
}) => Promise<void>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Read, hold and commit one route's disguise.
|
|
79
|
+
*
|
|
80
|
+
* The stored value is read once per route and seeds the draft; nothing is
|
|
81
|
+
* written until {@link CamouflageDraft.commit} runs.
|
|
82
|
+
* @param route - the provider route this pane edits.
|
|
83
|
+
* @param t - localized copy (for the error the caller renders).
|
|
84
|
+
* @returns the draft and its seams.
|
|
85
|
+
*/
|
|
86
|
+
export declare function useCamouflage(route: string, t: Copy): CamouflageDraft;
|
|
87
|
+
/**
|
|
88
|
+
* The create-provider card's copy of the section: the same switch, committed
|
|
89
|
+
* on click.
|
|
90
|
+
*
|
|
91
|
+
* That card has no commit row — the official 保存 declares the route the
|
|
92
|
+
* disguise is addressed to — so holding a draft here would have nothing to
|
|
93
|
+
* release it. The write is inert until that route exists, so choosing here and
|
|
94
|
+
* saving the card is still the one moment the identity starts being sent.
|
|
95
|
+
*/
|
|
96
|
+
export declare function CamouflageField({ route, t }: {
|
|
97
|
+
route: string;
|
|
98
|
+
t: Copy;
|
|
99
|
+
}): ReactNode;
|
|
100
|
+
export {};
|
|
@@ -102,6 +102,26 @@ export interface HeadersEditorProps {
|
|
|
102
102
|
* which is the write that declares the route the draft is addressed to.
|
|
103
103
|
*/
|
|
104
104
|
deferred?: DeferredHeaders;
|
|
105
|
+
/**
|
|
106
|
+
* Further sections of this pane, rendered above the commit row.
|
|
107
|
+
*
|
|
108
|
+
* The pane is the route's whole advanced configuration, not just headers:
|
|
109
|
+
* these render after the header table, inside the same section container, so
|
|
110
|
+
* the pane keeps ONE commit row and that row sits under every section. A
|
|
111
|
+
* sibling section rendered outside would need a commit row of its own, and
|
|
112
|
+
* two rows would make the pane read as two forms.
|
|
113
|
+
*/
|
|
114
|
+
extras?: ReactNode;
|
|
115
|
+
/**
|
|
116
|
+
* Commit the extras' draft as part of this pane's Save.
|
|
117
|
+
*
|
|
118
|
+
* Runs after the header write, before the card is dismissed. Rejecting keeps
|
|
119
|
+
* the pane open and reports an error: a dismissal over a write that did not
|
|
120
|
+
* happen would present the old state as the saved one.
|
|
121
|
+
*/
|
|
122
|
+
onCommitExtras?: () => Promise<void>;
|
|
123
|
+
/** Drop the extras' draft (this pane's 取消). */
|
|
124
|
+
onResetExtras?: () => void;
|
|
105
125
|
}
|
|
106
126
|
/** One editable header row; a stable `id` keeps React keys off the name. */
|
|
107
127
|
interface DraftRow {
|
|
@@ -122,5 +142,5 @@ export declare function headersFromDraft(draft: Draft): Record<string, string>;
|
|
|
122
142
|
* @param props - route identity, write seam, copy and the card dismiss seam.
|
|
123
143
|
* @returns the section.
|
|
124
144
|
*/
|
|
125
|
-
export declare function HeadersEditor({ route, api, t, onDismiss, deferred }: HeadersEditorProps): ReactNode;
|
|
145
|
+
export declare function HeadersEditor({ route, api, t, onDismiss, deferred, extras, onCommitExtras, onResetExtras, }: HeadersEditorProps): ReactNode;
|
|
126
146
|
export {};
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* Model-row drag reordering inside one provider's editor on the official Models
|
|
3
3
|
* settings page.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Older official editors render a provider's models as
|
|
6
6
|
* `div.modelList > div.modelEntry > div.modelRow` (a four-column grid: id,
|
|
7
7
|
* display name, and two icon buttons), straight from
|
|
8
8
|
* `models.map((model, index) => …)`. React owns those children, so — exactly as
|
|
9
9
|
* for the provider rows — a model is moved with a CSS `order`, and the id
|
|
10
10
|
* sequence that results is stored per provider by `../model-order.js`.
|
|
11
|
+
* Editors with a native `modelDragHandle` own both ordering and responsive
|
|
12
|
+
* layout; those lists must not receive another grip or a legacy grid override.
|
|
11
13
|
*
|
|
12
14
|
* Two differences from the provider list, and both are in the adapter:
|
|
13
15
|
* - the row is a grid of INPUTS, so only the grip drags. A drag that began on
|
package/lib/client/locales.d.ts
CHANGED
|
@@ -191,6 +191,14 @@ export declare const en: {
|
|
|
191
191
|
keysLastEnabledOff: string;
|
|
192
192
|
headersTitle: string;
|
|
193
193
|
headersHint: string;
|
|
194
|
+
camouflageTitle: string;
|
|
195
|
+
camouflageHint: string;
|
|
196
|
+
camouflageOff: string;
|
|
197
|
+
camouflageCodex: string;
|
|
198
|
+
camouflageClaude: string;
|
|
199
|
+
camouflageSaved: string;
|
|
200
|
+
camouflageError: string;
|
|
201
|
+
camouflageUnavailable: string;
|
|
194
202
|
headersEmpty: string;
|
|
195
203
|
headersAdd: string;
|
|
196
204
|
headersName: string;
|