dsh-opendesign-corouter 0.1.17 → 0.1.19
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 +1 -1
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/lib/catalog.d.ts +12 -0
- package/lib/client-config-writes.d.ts +9 -1
- package/lib/client.d.ts +6 -1
- package/lib/client.js +93 -18
- package/lib/config.d.ts +20 -3
- package/lib/device-auth.d.ts +1 -1
- package/lib/generated/typert.host.js +12 -3
- package/lib/generated/typert.remote-client.js +12 -3
- package/lib/index.d.ts +4 -0
- package/lib/index.js +127 -60
- package/lib/index.js.map +3 -3
- package/lib/reasoning.d.ts +13 -0
- package/lib/remote.d.ts +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ dsh plugin --profile web add /absolute/path/to/dsh-opendesign-corouter-0.1.15.tg
|
|
|
63
63
|
|
|
64
64
|
推理协议可选 **OpenAI Chat Completions、OpenAI Responses、Anthropic Messages**。模型发现始终使用当前网关的 OpenAI 兼容 `/models` 接口,不随推理协议切换。
|
|
65
65
|
|
|
66
|
-
思考档位按精确型号的厂商文档维护,并按当前协议筛选。34 款提供离散档位,4 款为固定思考或开关/预算控制,Muse Wonder
|
|
66
|
+
思考档位按精确型号的厂商文档维护,并按当前协议筛选。34 款提供离散档位,4 款为固定思考或开关/预算控制,Muse Wonder 的精确别名尚待确认。34 款都带目录默认档位:未选择档位时插件按该值显式发送,模型选择器因此不提供“Default”项。默认取厂商声明;GPT-6 Astra(low)与 Muse Spark 1.3(high)的厂商未声明默认,取已发布实现记录的路由默认。旧配置中的无效默认档位可在参数设置中改为模型默认。[逐模型来源与网关验证状态](docs/reasoning-evidence.md)
|
|
67
67
|
|
|
68
68
|
> **分组不等于计费隔离。** 赠送额度耗尽后是否转扣套餐余额或钱包,由服务端和账号权益决定。选择“套餐赠送”不能保证绝不消耗钱包余额。
|
|
69
69
|
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 第三方代码与资料
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
本项目的消息/图片兼容处理、套餐模型元数据、思考增量拼写兼容与配置写入的重试策略参考 [dsh-opendesign-go 0.1.11](https://github.com/EliteOtaku/dsh-opendesign-go)。额度归一化及登录生命周期的基础处理改编自 [dsh-subusage 0.16.2](https://github.com/KouzakiUmi/dsh-subusage);临时授权窗口的 Chrome 启动策略改编自 [dsh-subusage 0.16.3](https://github.com/KouzakiUmi/dsh-subusage) 的 `lib/cookie-login.js`。空轮判定参考 [dsh-empty-turn-guard 0.4.0](https://github.com/FYTXY/dsh-empty-turn-guard)。设置布局参考 [dsh-code-pill](https://github.com/KouzakiUmi/dsh-code-pill)。
|
|
4
4
|
|
|
5
5
|
离线主题夹具使用 [DeepSeek Harness 官方主题令牌](https://github.com/deepseek-ai/deepseek-harness/blob/22ddee3792402c3e70ec5f86a63c3e3e895a2f60/packages/client/ui-theme/src/styles/design-platform.css),仅供测试,不随插件安装包分发。
|
|
6
6
|
|
package/lib/catalog.d.ts
CHANGED
|
@@ -45,10 +45,22 @@ export interface CatalogModel {
|
|
|
45
45
|
inputModalities?: readonly ('text' | 'image')[];
|
|
46
46
|
/** Undefined means unconfirmed; an empty array means no discrete effort selector. */
|
|
47
47
|
reasoningEfforts?: readonly string[];
|
|
48
|
+
/**
|
|
49
|
+
* Vendor-documented default effort, always a member of `reasoningEfforts`.
|
|
50
|
+
* The adapter reports it as the route default, so a request that names no
|
|
51
|
+
* effort sends this documented value instead of leaving the choice to an
|
|
52
|
+
* untrusted relay. Omission means the vendor documents no default: nothing
|
|
53
|
+
* is guessed and the provider's own default stands.
|
|
54
|
+
*/
|
|
55
|
+
defaultEffort?: string;
|
|
48
56
|
}
|
|
49
57
|
/**
|
|
50
58
|
* `plan` 为官网 12 款 Core / Design Plan 模型,加预检确认覆盖的 M3.1 Flash;
|
|
51
59
|
* 其余 26 项归 `paid`(Plan / 钱包付费通道)。
|
|
60
|
+
*
|
|
61
|
+
* `defaultEffort` 只写有出处的默认档位:厂商文档声明的默认(docs/reasoning-evidence.md 矩阵),
|
|
62
|
+
* 或在厂商未声明时由已发布实现记录的路由默认(GPT-6 Astra=low、Muse Spark 1.3=high)。
|
|
63
|
+
* muse-wonder 的档位集合本身未知,保持缺省:请求不发送档位,由上游决定。
|
|
52
64
|
*/
|
|
53
65
|
export declare const MODELS: readonly CatalogModel[];
|
|
54
66
|
export declare function modelsFor(group: 'plan' | 'paid'): readonly CatalogModel[];
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* The coordinator talks to the Host configuration form only: it projects the value a caller
|
|
10
10
|
* wants to save, hands the write to the form, and hands the value back to the form snapshot once
|
|
11
|
-
* the write is done.
|
|
11
|
+
* the write is done. A clear travels the same queue but asks the form to drop the field, because
|
|
12
|
+
* an empty value and an unnamed field are different states for the Host.
|
|
12
13
|
*/
|
|
13
14
|
import type { ConfigForm, FormValues } from './client.js';
|
|
14
15
|
export interface ConfigWriteSnapshot {
|
|
@@ -29,6 +30,13 @@ export interface ConfigWrites {
|
|
|
29
30
|
* already has a pending write, or when the Host rejects the write.
|
|
30
31
|
*/
|
|
31
32
|
set(field: string, value: unknown, baseValue?: unknown): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Queue one field clear.
|
|
35
|
+
*
|
|
36
|
+
* A cleared field goes back to being unnamed: the Host drops it from the profile instead of
|
|
37
|
+
* storing an empty value. Returns false when the Host offers no clear path.
|
|
38
|
+
*/
|
|
39
|
+
clear(field: string): Promise<boolean>;
|
|
32
40
|
/** Stop the coordinator: queued writes never start and subscribers are released. */
|
|
33
41
|
dispose(): void;
|
|
34
42
|
}
|
package/lib/client.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ import { type ApiProtocol } from './protocol-options.js';
|
|
|
7
7
|
import type { ModelSettings, ModelSettingsMap } from './model-settings.js';
|
|
8
8
|
import { type ContextWindowPresetId } from './context-budget.js';
|
|
9
9
|
import { type ModelDirectoryService } from './client-context-quick.js';
|
|
10
|
+
/** Must match `DEFAULT_API_KEY_REF` in src/config.ts; the browser bundle keeps its own copy. */
|
|
11
|
+
export declare const DEFAULT_KEY_REF = "COROUTER_API_KEY";
|
|
10
12
|
declare const TABS: readonly [{
|
|
11
13
|
readonly id: "overview";
|
|
12
14
|
readonly label: "概览";
|
|
@@ -46,6 +48,8 @@ export interface ConfigForm {
|
|
|
46
48
|
getSnapshot(): FormSnapshot;
|
|
47
49
|
subscribe(listener: () => void): () => void;
|
|
48
50
|
set(field: string, value: unknown): Promise<boolean>;
|
|
51
|
+
/** Drop one field back to unnamed; absent on a Host that only writes values. */
|
|
52
|
+
unset?(field: string): Promise<boolean>;
|
|
49
53
|
}
|
|
50
54
|
export interface ConfigForms {
|
|
51
55
|
get(namespace: string): ConfigForm;
|
|
@@ -237,9 +241,10 @@ export interface AdvancedProps {
|
|
|
237
241
|
status: Status | undefined;
|
|
238
242
|
formSnapshot: FormSnapshot;
|
|
239
243
|
setFormField: (field: string, value: unknown) => Promise<boolean>;
|
|
244
|
+
clearFormField: (field: string) => Promise<boolean>;
|
|
240
245
|
pendingField: readonly string[];
|
|
241
246
|
}
|
|
242
|
-
export declare function Advanced({ status, formSnapshot, setFormField, pendingField }: AdvancedProps): React.FunctionComponentElement<{
|
|
247
|
+
export declare function Advanced({ status, formSnapshot, setFormField, clearFormField, pendingField }: AdvancedProps): React.FunctionComponentElement<{
|
|
243
248
|
children?: React.ReactNode | undefined;
|
|
244
249
|
}>;
|
|
245
250
|
/** Approval is an ordinary official link; the Host may also show it in a temporary window. */
|
package/lib/client.js
CHANGED
|
@@ -32,6 +32,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
32
|
var client_exports = {};
|
|
33
33
|
__export(client_exports, {
|
|
34
34
|
Advanced: () => Advanced,
|
|
35
|
+
DEFAULT_KEY_REF: () => DEFAULT_KEY_REF,
|
|
35
36
|
LoginApproval: () => LoginApproval,
|
|
36
37
|
ModelRow: () => ModelRow,
|
|
37
38
|
Models: () => Models,
|
|
@@ -20233,13 +20234,22 @@ function parseStatusModel(value) {
|
|
|
20233
20234
|
...value.inputModalities === void 0 ? {} : { inputModalities: parseModalities(value.inputModalities) },
|
|
20234
20235
|
...value.contextWindow === void 0 ? {} : { contextWindow: positiveInteger(value.contextWindow, "\u4E0A\u4E0B\u6587\u9884\u7B97", 1e8) },
|
|
20235
20236
|
...value.maxOutputTokens === void 0 ? {} : { maxOutputTokens: positiveInteger(value.maxOutputTokens, "\u6700\u5927\u8F93\u51FA", 1e7) },
|
|
20236
|
-
...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) }
|
|
20237
|
+
...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) },
|
|
20238
|
+
...value.defaultEffort === void 0 ? {} : { defaultEffort: parseEffort(value.defaultEffort) }
|
|
20237
20239
|
};
|
|
20238
20240
|
}
|
|
20241
|
+
function parseEffort(value) {
|
|
20242
|
+
const effort = text(value, "\u9ED8\u8BA4\u601D\u8003\u6863\u4F4D", 32);
|
|
20243
|
+
if (!/^[A-Za-z][A-Za-z0-9_-]*$/u.test(effort)) throw new Error("\u9ED8\u8BA4\u601D\u8003\u6863\u4F4D\u683C\u5F0F\u65E0\u6548");
|
|
20244
|
+
return effort;
|
|
20245
|
+
}
|
|
20239
20246
|
function parseStatusConfig(value) {
|
|
20240
20247
|
if (!record2(value)) throw new Error("\u914D\u7F6E\u89C6\u56FE\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
20241
|
-
|
|
20242
|
-
|
|
20248
|
+
if (typeof value.apiKeyEnv !== "string" || value.apiKeyEnv.length > MAX_ENV_REF) {
|
|
20249
|
+
throw new Error(`\u51ED\u636E\u5F15\u7528\u540D\u5FC5\u987B\u662F\u6700\u591A ${MAX_ENV_REF} \u5B57\u7B26\u7684\u5B57\u7B26\u4E32`);
|
|
20250
|
+
}
|
|
20251
|
+
const apiKeyEnv = value.apiKeyEnv;
|
|
20252
|
+
if (apiKeyEnv !== "" && !ENV_REF.test(apiKeyEnv)) throw new Error("\u51ED\u636E\u5F15\u7528\u540D\u5FC5\u987B\u662F\u5408\u6CD5\u6807\u8BC6\u7B26");
|
|
20243
20253
|
return {
|
|
20244
20254
|
emptyTurnGuard: flag(value.emptyTurnGuard, "\u7A7A\u8F6E\u4FDD\u62A4\u5F00\u5173"),
|
|
20245
20255
|
...value.turnCompletionReview === void 0 ? {} : { turnCompletionReview: flag(value.turnCompletionReview, "\u7ED3\u675F\u56DE\u5408\u6838\u9A8C\u5F00\u5173") },
|
|
@@ -20415,18 +20425,24 @@ var ConfigWritesImpl = class {
|
|
|
20415
20425
|
};
|
|
20416
20426
|
}
|
|
20417
20427
|
async set(field, value, baseValue) {
|
|
20428
|
+
return this.enqueue(field, value, baseValue, false);
|
|
20429
|
+
}
|
|
20430
|
+
async clear(field) {
|
|
20431
|
+
return this.enqueue(field, void 0, void 0, true);
|
|
20432
|
+
}
|
|
20433
|
+
async enqueue(field, value, baseValue, clear) {
|
|
20418
20434
|
if (this.disposed) return false;
|
|
20419
20435
|
const current = this.form.getSnapshot();
|
|
20420
20436
|
if (!writableSnapshot(current)) return false;
|
|
20421
20437
|
if (this.inflight.has(field)) return false;
|
|
20422
20438
|
const baseline = baseValue !== void 0 ? baseValue : readField(current.value, field);
|
|
20423
|
-
const task = { field, value, baseline, resolve: () => {
|
|
20439
|
+
const task = { field, value, baseline, clear, resolve: () => {
|
|
20424
20440
|
} };
|
|
20425
20441
|
const accepted = new Promise((resolve) => {
|
|
20426
20442
|
task.resolve = resolve;
|
|
20427
20443
|
});
|
|
20428
20444
|
this.inflight.set(field, task);
|
|
20429
|
-
this.overlay.set(field, value);
|
|
20445
|
+
if (!clear) this.overlay.set(field, value);
|
|
20430
20446
|
this.publish();
|
|
20431
20447
|
this.queue.push(task);
|
|
20432
20448
|
this.drain();
|
|
@@ -20469,6 +20485,15 @@ var ConfigWritesImpl = class {
|
|
|
20469
20485
|
if (this.disposed) return false;
|
|
20470
20486
|
const current = this.form.getSnapshot();
|
|
20471
20487
|
if (!writableSnapshot(current)) return false;
|
|
20488
|
+
if (task.clear) {
|
|
20489
|
+
const unset = this.form.unset;
|
|
20490
|
+
if (unset === void 0) return false;
|
|
20491
|
+
try {
|
|
20492
|
+
return await unset.call(this.form, task.field) === true;
|
|
20493
|
+
} catch {
|
|
20494
|
+
return false;
|
|
20495
|
+
}
|
|
20496
|
+
}
|
|
20472
20497
|
let payload = task.value;
|
|
20473
20498
|
if (task.field === "modelSettings") {
|
|
20474
20499
|
const rebased = rebaseModelSettings(task.baseline, task.value, readField(current.value, "modelSettings"));
|
|
@@ -20821,6 +20846,7 @@ function ContextQuickControl({ provider, modelId, selecting, directoryUnavailabl
|
|
|
20821
20846
|
// src/client.ts
|
|
20822
20847
|
var h2 = React2.createElement;
|
|
20823
20848
|
var SETTINGS_NS = "llm-opendesign-corouter";
|
|
20849
|
+
var DEFAULT_KEY_REF = "COROUTER_API_KEY";
|
|
20824
20850
|
var OFFICIAL_SITE = "https://corouter.open-design.ai/zh/";
|
|
20825
20851
|
var TABS = [
|
|
20826
20852
|
{ id: "overview", label: "\u6982\u89C8" },
|
|
@@ -21584,6 +21610,8 @@ function EffortField({ id, model, value, disabled, pending, disabledReason, onSa
|
|
|
21584
21610
|
const [saving, setSaving] = React2.useState(false);
|
|
21585
21611
|
const [error62, setError] = React2.useState(void 0);
|
|
21586
21612
|
const listed = model.reasoningEfforts ?? [];
|
|
21613
|
+
const modelDefault = model.defaultEffort;
|
|
21614
|
+
const defaultLabel = modelDefault === void 0 ? "\u4E0D\u6307\u5B9A\u6863\u4F4D" : `\u6A21\u578B\u9ED8\u8BA4\uFF08${modelDefault}\uFF09`;
|
|
21587
21615
|
const invalidDefault = value !== void 0 && !listed.includes(value);
|
|
21588
21616
|
const invalidDraft = editing && draft !== "" && !listed.includes(draft);
|
|
21589
21617
|
const options = [...listed];
|
|
@@ -21594,7 +21622,7 @@ function EffortField({ id, model, value, disabled, pending, disabledReason, onSa
|
|
|
21594
21622
|
const busy = saving || pending;
|
|
21595
21623
|
const reason = busy ? "\u6B63\u5728\u4FDD\u5B58\u6A21\u578B\u8BBE\u7F6E\uFF0C\u5B8C\u6210\u540E\u53EF\u7EE7\u7EED\u7F16\u8F91\u3002" : disabled ? `${disabledReason ?? "\u914D\u7F6E\u4E0D\u53EF\u5199"}\uFF0C\u65E0\u6CD5\u7F16\u8F91\u3002` : void 0;
|
|
21596
21624
|
const externallyChanged = editing && value !== baseValue && !(saving && value === draft);
|
|
21597
|
-
const hint = reason ?? (editing ? externallyChanged ? "\u914D\u7F6E\u5DF2\u4ECE\u5176\u4ED6\u4F4D\u7F6E\u66F4\u65B0\uFF1B\u53D6\u6D88\u53EF\u67E5\u770B\u6700\u65B0\u503C\uFF0C\u4FDD\u5B58\u5C06\u4F7F\u7528\u5F53\u524D\u8349\u7A3F\u3002" : invalidDraft ? "\u5F53\u524D\u8349\u7A3F\u4E0D\u9002\u7528\u4E8E\u6B64\u6A21\u578B\u6216\u534F\u8BAE\uFF0C\u8BF7\u9009\u62E9\u5176\u4ED6\u6863\u4F4D\u6216\
|
|
21625
|
+
const hint = reason ?? (editing ? externallyChanged ? "\u914D\u7F6E\u5DF2\u4ECE\u5176\u4ED6\u4F4D\u7F6E\u66F4\u65B0\uFF1B\u53D6\u6D88\u53EF\u67E5\u770B\u6700\u65B0\u503C\uFF0C\u4FDD\u5B58\u5C06\u4F7F\u7528\u5F53\u524D\u8349\u7A3F\u3002" : invalidDraft ? "\u5F53\u524D\u8349\u7A3F\u4E0D\u9002\u7528\u4E8E\u6B64\u6A21\u578B\u6216\u534F\u8BAE\uFF0C\u8BF7\u9009\u62E9\u5176\u4ED6\u6863\u4F4D\u6216\u6539\u7528\u6A21\u578B\u9ED8\u8BA4\u3002" : `\u9009\u62E9\u201C${defaultLabel}\u201D\u4F1A\u5220\u9664\u5DF2\u4FDD\u5B58\u6863\u4F4D\uFF1B\u4FDD\u5B58\u524D\u4EC5\u4FEE\u6539\u672C\u5730\u8349\u7A3F\u3002` : invalidDefault ? "\u5DF2\u4FDD\u5B58\u7684\u6863\u4F4D\u4E0D\u9002\u7528\u4E8E\u5F53\u524D\u6A21\u578B\u6216\u534F\u8BAE\uFF0C\u53EF\u7F16\u8F91\u540E\u9009\u62E9\u5176\u4ED6\u6863\u4F4D\u6216\u6539\u7528\u6A21\u578B\u9ED8\u8BA4\u3002" : unavailable ? "\u5F53\u524D\u6A21\u578B\u6216\u534F\u8BAE\u672A\u63D0\u4F9B\u53EF\u8C03\u6574\u7684\u601D\u8003\u6863\u4F4D\u3002" : modelDefault === void 0 ? "\u8BE5\u6A21\u578B\u672A\u58F0\u660E\u9ED8\u8BA4\u6863\u4F4D\uFF0C\u672A\u8BBE\u7F6E\u65F6\u4E0D\u53D1\u9001\u6863\u4F4D\u8BBE\u7F6E\u3002" : `\u672A\u8BBE\u7F6E\u65F6\u6309\u6A21\u578B\u9ED8\u8BA4\u6863\u4F4D\u300C${modelDefault}\u300D\u53D1\u9001\uFF0C\u4E0D\u7559\u7ED9\u4E0A\u6E38\u51B3\u5B9A\u3002`);
|
|
21598
21626
|
const cancel = () => {
|
|
21599
21627
|
if (saving) return;
|
|
21600
21628
|
setEditing(false);
|
|
@@ -21649,7 +21677,7 @@ function EffortField({ id, model, value, disabled, pending, disabledReason, onSa
|
|
|
21649
21677
|
setError(void 0);
|
|
21650
21678
|
}
|
|
21651
21679
|
}, [
|
|
21652
|
-
h2("option", { key: "", value: "" },
|
|
21680
|
+
h2("option", { key: "", value: "" }, defaultLabel),
|
|
21653
21681
|
...options.map((effort) => h2("option", { key: effort, value: effort, disabled: !listed.includes(effort) }, listed.includes(effort) ? effort : `${effort}\uFF08\u5F53\u524D\u4E0D\u53EF\u7528\uFF09`))
|
|
21654
21682
|
]),
|
|
21655
21683
|
h2(
|
|
@@ -21681,7 +21709,7 @@ function EffortField({ id, model, value, disabled, pending, disabledReason, onSa
|
|
|
21681
21709
|
}
|
|
21682
21710
|
}, "\u7F16\u8F91")
|
|
21683
21711
|
),
|
|
21684
|
-
h2("p", { className: "odc-effort-value" }, invalidDefault ? `${value}\uFF08\u5F53\u524D\u4E0D\u53EF\u7528\uFF09` : value ??
|
|
21712
|
+
h2("p", { className: "odc-effort-value" }, invalidDefault ? `${value}\uFF08\u5F53\u524D\u4E0D\u53EF\u7528\uFF09` : value ?? defaultLabel)
|
|
21685
21713
|
),
|
|
21686
21714
|
h2("small", {
|
|
21687
21715
|
className: "odc-hint",
|
|
@@ -21785,7 +21813,7 @@ function ModelRow({ model, settings, authoritative, writable, pending, disabledR
|
|
|
21785
21813
|
`\u5F53\u524D\u603B\u7A97\u53E3 ${formatTokens(effectiveWindow)}\uFF08\u542B\u8F93\u51FA\u9884\u7559\uFF09`,
|
|
21786
21814
|
`\u8F93\u51FA\u80FD\u529B\u53C2\u8003 ${formatTokens(model.maxOutputTokens)}`,
|
|
21787
21815
|
`\u81EA\u52A8\u8F93\u51FA\u9884\u7559 ${formatTokens(autoReserve)}`,
|
|
21788
|
-
...model.reasoningEfforts === void 0 || model.reasoningEfforts.length === 0 ? [] : [`\u601D\u8003\u6863\u4F4D ${model.reasoningEfforts.join(" / ")}`]
|
|
21816
|
+
...model.reasoningEfforts === void 0 || model.reasoningEfforts.length === 0 ? [] : [`\u601D\u8003\u6863\u4F4D ${model.reasoningEfforts.join(" / ")}${model.defaultEffort === void 0 ? "" : `\uFF08\u6A21\u578B\u9ED8\u8BA4 ${model.defaultEffort}\uFF09`}`]
|
|
21789
21817
|
].join(" \xB7 ");
|
|
21790
21818
|
return h2(
|
|
21791
21819
|
"li",
|
|
@@ -21854,7 +21882,7 @@ function ModelRow({ model, settings, authoritative, writable, pending, disabledR
|
|
|
21854
21882
|
h2("p", { className: "odc-model-meta" }, facts),
|
|
21855
21883
|
model.id === "claude-opus-5.5" && model.contextWindow === 1e6 ? h2("p", { className: "odc-hint" }, "\u4E0A\u4E0B\u6587 1,000,000 \u4E3A\u5382\u5546\u53C2\u8003\uFF0C\u7F51\u5173\u5B9E\u9645\u5BB9\u91CF\u672A\u9A8C\u8BC1\uFF1B\u6863\u4F4D\u603B\u7A97\u53E3\u4E0D\u4F1A\u8D85\u8FC7\u8BE5\u53C2\u8003\u5BB9\u91CF\u3002") : null,
|
|
21856
21884
|
model.id === "muse-wonder" && model.contextWindow === 1048576 ? h2("p", { className: "odc-hint" }, "\u4E0A\u4E0B\u6587 1,048,576 \u4E3A\u6682\u5B9A\u53C2\u8003\uFF0C\u7F51\u5173\u578B\u53F7\u6620\u5C04\u53CA\u5B9E\u9645\u5BB9\u91CF\u672A\u9A8C\u8BC1\uFF1B\u6863\u4F4D\u603B\u7A97\u53E3\u4E0D\u4F1A\u8D85\u8FC7\u8BE5\u53C2\u8003\u5BB9\u91CF\u3002") : null,
|
|
21857
|
-
samplingRestricted && model.id === "claude-opus-4.8" ? h2("p", { className: "odc-hint" }, "\
|
|
21885
|
+
samplingRestricted && model.id === "claude-opus-4.8" ? h2("p", { className: "odc-hint" }, "\u672A\u9009\u62E9\u6863\u4F4D\u65F6\u6309\u5382\u5546\u9ED8\u8BA4\u6863\u4F4D high \u53D1\u9001\u81EA\u9002\u5E94\u601D\u8003\uFF1B\u5382\u5546\u5728\u5B8C\u5168\u7701\u7565\u601D\u8003\u914D\u7F6E\u65F6\u4E0D\u542F\u7528\u3002") : null,
|
|
21858
21886
|
samplingRestricted && model.maxOutputTokens === void 0 && settings.maxTokens === void 0 ? h2("p", { className: "odc-hint" }, "Messages \u9ED8\u8BA4\u6700\u5927\u8F93\u51FA 4096\uFF1B\u8F83\u9AD8\u601D\u8003\u6DF1\u5EA6\u53EF\u80FD\u9700\u8981\u589E\u5927\u3002") : null,
|
|
21859
21887
|
price === void 0 ? null : h2(PriceDetails, { tiers: price.tiers }),
|
|
21860
21888
|
h2("p", { className: "odc-hint" }, "\u6570\u503C\u79BB\u5F00\u8F93\u5165\u6846\u540E\u4FDD\u5B58\uFF0C\u7559\u7A7A\u7EE7\u627F\u9ED8\u8BA4\uFF1B\u4E0A\u4E0B\u6587\u7A97\u53E3\u4E3A\u4E09\u6863\u4E92\u65A5\u9009\u62E9\u3002"),
|
|
@@ -22082,13 +22110,14 @@ function NumberField({ id, label, hint, value, min, max, integer: integer2, disa
|
|
|
22082
22110
|
}, error62 ?? hint)
|
|
22083
22111
|
);
|
|
22084
22112
|
}
|
|
22085
|
-
function Advanced({ status, formSnapshot, setFormField, pendingField }) {
|
|
22113
|
+
function Advanced({ status, formSnapshot, setFormField, clearFormField, pendingField }) {
|
|
22086
22114
|
const [apiKeyEnv, setApiKeyEnv] = React2.useState(status?.config.apiKeyEnv ?? "");
|
|
22087
22115
|
const [keyNotice, setKeyNotice] = React2.useState(null);
|
|
22088
22116
|
const mounted = useMounted();
|
|
22117
|
+
const formReady = formSnapshot.status === "ready" && formSnapshot.value !== void 0;
|
|
22089
22118
|
React2.useEffect(() => {
|
|
22090
|
-
setApiKeyEnv(formSnapshot.value?.apiKeyEnv ?? status?.config.apiKeyEnv ?? "");
|
|
22091
|
-
}, [formSnapshot.value?.apiKeyEnv, status?.config.apiKeyEnv]);
|
|
22119
|
+
setApiKeyEnv(formReady ? formSnapshot.value?.apiKeyEnv ?? "" : status?.config.apiKeyEnv ?? "");
|
|
22120
|
+
}, [formReady, formSnapshot.value?.apiKeyEnv, status?.config.apiKeyEnv]);
|
|
22092
22121
|
const writable = formSnapshot.status === "ready" && formSnapshot.value !== void 0 && formSnapshot.writable;
|
|
22093
22122
|
const configuredProtocol = formSnapshot.value?.apiProtocol ?? status?.config.apiProtocol;
|
|
22094
22123
|
const protocol = configuredProtocol !== void 0 && API_PROTOCOL_OPTIONS.some((option) => option.id === configuredProtocol) ? configuredProtocol : "chat-completions";
|
|
@@ -22104,6 +22133,30 @@ function Advanced({ status, formSnapshot, setFormField, pendingField }) {
|
|
|
22104
22133
|
const selected = API_PROTOCOL_OPTIONS.find((option) => option.id === protocol);
|
|
22105
22134
|
const saveKeyRef = async () => {
|
|
22106
22135
|
const value = apiKeyEnv.trim();
|
|
22136
|
+
if (value === "") {
|
|
22137
|
+
const saved = formReady ? formSnapshot.value?.apiKeyEnv : void 0;
|
|
22138
|
+
if (saved === void 0) {
|
|
22139
|
+
setKeyNotice({ kind: "status", text: `\u5F53\u524D\u672A\u586B\u5199\u5F15\u7528\u540D\uFF1B\u8BF7\u6C42\u6CBF\u7528\u9ED8\u8BA4\u5F15\u7528 ${DEFAULT_KEY_REF}\uFF0C\u65E0\u9700\u4FDD\u5B58\u3002` });
|
|
22140
|
+
return;
|
|
22141
|
+
}
|
|
22142
|
+
setKeyNotice(null);
|
|
22143
|
+
try {
|
|
22144
|
+
const cleared = await clearFormField("apiKeyEnv");
|
|
22145
|
+
if (mounted.current) {
|
|
22146
|
+
if (cleared) setKeyNotice({ kind: "status", text: `\u5DF2\u6E05\u9664\u5F15\u7528\u540D\uFF1B\u8BF7\u6C42\u6CBF\u7528\u9ED8\u8BA4\u5F15\u7528 ${DEFAULT_KEY_REF}\u3002` });
|
|
22147
|
+
else {
|
|
22148
|
+
setApiKeyEnv(saved);
|
|
22149
|
+
setKeyNotice({ kind: "error", text: "\u5F15\u7528\u540D\u672A\u6E05\u9664\uFF0C\u5DF2\u4FDD\u7559\u539F\u503C\uFF0C\u8BF7\u91CD\u8BD5\u3002" });
|
|
22150
|
+
}
|
|
22151
|
+
}
|
|
22152
|
+
} catch {
|
|
22153
|
+
if (mounted.current) {
|
|
22154
|
+
setApiKeyEnv(saved);
|
|
22155
|
+
setKeyNotice({ kind: "error", text: GENERIC_ERROR });
|
|
22156
|
+
}
|
|
22157
|
+
}
|
|
22158
|
+
return;
|
|
22159
|
+
}
|
|
22107
22160
|
if (!/^[A-Za-z_][A-Za-z0-9_]{0,127}$/u.test(value)) {
|
|
22108
22161
|
setKeyNotice({ kind: "error", text: "\u5F15\u7528\u540D\u9700\u4E3A 1\u2013128 \u4F4D\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF\uFF0C\u4E14\u4E0D\u80FD\u4EE5\u6570\u5B57\u5F00\u5934\u3002" });
|
|
22109
22162
|
return;
|
|
@@ -22208,7 +22261,7 @@ function Advanced({ status, formSnapshot, setFormField, pendingField }) {
|
|
|
22208
22261
|
"section",
|
|
22209
22262
|
{ className: "odc-card" },
|
|
22210
22263
|
h2("h3", null, "\u51ED\u636E\u4E0E\u7F51\u5173"),
|
|
22211
|
-
h2("p", { className: "odc-hint" },
|
|
22264
|
+
h2("p", { className: "odc-hint" }, `\u8FD9\u91CC\u53EA\u4FDD\u5B58\u51ED\u636E\u5F15\u7528\u540D\u79F0\uFF0C\u4E0D\u586B\u5199 Key \u672C\u8EAB\uFF1B\u7F51\u5173\u5730\u5740\u7531\u63D2\u4EF6\u914D\u7F6E\u6258\u7BA1\u3002\u5F15\u7528\u540D\u7559\u7A7A\u65F6\u8BF7\u6C42\u6CBF\u7528 ${DEFAULT_KEY_REF}\uFF0C\u4FDD\u5B58\u7A7A\u503C\u5373\u6E05\u9664\u5DF2\u4FDD\u5B58\u7684\u5F15\u7528\u540D\u3002`),
|
|
22212
22265
|
h2(
|
|
22213
22266
|
"div",
|
|
22214
22267
|
{ className: "odc-field" },
|
|
@@ -22218,12 +22271,13 @@ function Advanced({ status, formSnapshot, setFormField, pendingField }) {
|
|
|
22218
22271
|
className: "odc-input",
|
|
22219
22272
|
type: "text",
|
|
22220
22273
|
value: apiKeyEnv,
|
|
22274
|
+
placeholder: DEFAULT_KEY_REF,
|
|
22221
22275
|
disabled: !writable || pendingField.includes("apiKeyEnv"),
|
|
22222
22276
|
autoCapitalize: "off",
|
|
22223
22277
|
spellCheck: false,
|
|
22224
22278
|
onChange: (event) => setApiKeyEnv(event.target.value)
|
|
22225
22279
|
}),
|
|
22226
|
-
h2("small", { className: "odc-hint" }, "\u5F15\u7528\u540D\u5BF9\u5E94\u7684\u51ED\u636E\u4ECD\u4F18\u5148\u4E8E\u672C\u63D2\u4EF6\u4FDD\u5B58\u7684 Key\u3002")
|
|
22280
|
+
h2("small", { className: "odc-hint" }, "\u5F15\u7528\u540D\u5BF9\u5E94\u7684\u51ED\u636E\u4ECD\u4F18\u5148\u4E8E\u672C\u63D2\u4EF6\u4FDD\u5B58\u7684 Key\uFF1BDSH \u6A21\u578B\u9875\u53EA\u62A5\u544A\u8FD9\u91CC\u8BBE\u7F6E\u7684\u5F15\u7528\u540D\uFF0C\u4E0D\u663E\u793A\u672C\u63D2\u4EF6\u4FDD\u5B58\u7684 Key \u4E0E\u8BBE\u5907\u767B\u5F55\u3002")
|
|
22227
22281
|
),
|
|
22228
22282
|
h2(
|
|
22229
22283
|
"div",
|
|
@@ -22441,7 +22495,7 @@ function Connection({ status, formSnapshot, setFormField, pendingField, caller,
|
|
|
22441
22495
|
if (!mounted.current || version2 !== actionVersion.current) return;
|
|
22442
22496
|
setApiKey("");
|
|
22443
22497
|
onStatus(next);
|
|
22444
|
-
setNotice({ kind: "status", text: next.apiKeySource === "reference" ? `API Key \u5DF2\u4FDD\u5B58\uFF1B\u5F53\u524D\u4ECD\u4F18\u5148\u4F7F\u7528\u73AF\u5883\u6216\u51ED\u636E\u5F15\u7528 ${next.config.apiKeyEnv}\u3002` : next.apiKeySource === "stored" ? "API Key \u5DF2\u4FDD\u5B58\u5E76\u7528\u4E8E\u5F53\u524D\u7F51\u5173\u3002" : "API Key \u5DF2\u4FDD\u5B58\u3002" });
|
|
22498
|
+
setNotice({ kind: "status", text: next.apiKeySource === "reference" ? `API Key \u5DF2\u4FDD\u5B58\uFF1B\u5F53\u524D\u4ECD\u4F18\u5148\u4F7F\u7528\u73AF\u5883\u6216\u51ED\u636E\u5F15\u7528 ${next.config.apiKeyEnv || DEFAULT_KEY_REF}\u3002` : next.apiKeySource === "stored" ? "API Key \u5DF2\u4FDD\u5B58\u5E76\u7528\u4E8E\u5F53\u524D\u7F51\u5173\u3002" : "API Key \u5DF2\u4FDD\u5B58\u3002" });
|
|
22445
22499
|
} catch {
|
|
22446
22500
|
if (!mounted.current || version2 !== actionVersion.current) return;
|
|
22447
22501
|
setApiKey("");
|
|
@@ -22477,7 +22531,7 @@ function Connection({ status, formSnapshot, setFormField, pendingField, caller,
|
|
|
22477
22531
|
}
|
|
22478
22532
|
}, [state, login?.jobId, busy, keyBusy, opening, status]);
|
|
22479
22533
|
const desktopChecked = formSnapshot.value?.useDesktopCredential ?? status?.config.useDesktopCredential ?? true;
|
|
22480
|
-
const keySource = status?.apiKeySource === "reference" ? `\u73AF\u5883\u6216\u51ED\u636E\u5F15\u7528\uFF08${status.config.apiKeyEnv}\uFF09` : status?.apiKeySource === "stored" ? "\u5DF2\u4FDD\u5B58\u7684 API Key" : status?.apiKeySource === "device" ? "\u8BBE\u5907\u6388\u6743" : status?.apiKeyConfigured ? "\u5C1A\u672A\u786E\u8BA4" : "\u672A\u914D\u7F6E";
|
|
22534
|
+
const keySource = status?.apiKeySource === "reference" ? `\u73AF\u5883\u6216\u51ED\u636E\u5F15\u7528\uFF08${status.config.apiKeyEnv || DEFAULT_KEY_REF}\uFF09` : status?.apiKeySource === "stored" ? "\u5DF2\u4FDD\u5B58\u7684 API Key" : status?.apiKeySource === "device" ? "\u8BBE\u5907\u6388\u6743" : status?.apiKeyConfigured ? "\u5C1A\u672A\u786E\u8BA4" : "\u672A\u914D\u7F6E";
|
|
22481
22535
|
return h2(
|
|
22482
22536
|
React2.Fragment,
|
|
22483
22537
|
null,
|
|
@@ -22697,6 +22751,27 @@ function SettingsPage({ caller, form }) {
|
|
|
22697
22751
|
}
|
|
22698
22752
|
}
|
|
22699
22753
|
}, [form, mounted, refresh, writes]);
|
|
22754
|
+
const clearFormField = React2.useCallback(async (field) => {
|
|
22755
|
+
const snapshot = form.getSnapshot();
|
|
22756
|
+
if (snapshot.status !== "ready" || snapshot.value === void 0 || !snapshot.writable || writes.getSnapshot().pendingFields.includes(field)) return false;
|
|
22757
|
+
if (writes.getSnapshot().pendingFields.length === 0) batchWriteFailed.current = false;
|
|
22758
|
+
pageBatchActive.current = true;
|
|
22759
|
+
setFormNotice({ kind: "status", text: "\u6B63\u5728\u4FDD\u5B58\u8BBE\u7F6E\u2026" });
|
|
22760
|
+
try {
|
|
22761
|
+
const accepted = await writes.clear(field);
|
|
22762
|
+
if (!accepted) batchWriteFailed.current = true;
|
|
22763
|
+
if (accepted && mounted.current) void loadStatus();
|
|
22764
|
+
return accepted;
|
|
22765
|
+
} catch {
|
|
22766
|
+
batchWriteFailed.current = true;
|
|
22767
|
+
return false;
|
|
22768
|
+
} finally {
|
|
22769
|
+
if (mounted.current && writes.getSnapshot().pendingFields.length === 0) {
|
|
22770
|
+
pageBatchActive.current = false;
|
|
22771
|
+
setFormNotice(batchWriteFailed.current ? { kind: "error", text: "\u8BBE\u7F6E\u672A\u4FDD\u5B58\uFF0C\u5DF2\u6062\u590D\u539F\u503C\uFF0C\u8BF7\u91CD\u8BD5\u3002" } : { kind: "status", text: "\u8BBE\u7F6E\u5DF2\u4FDD\u5B58\u3002" });
|
|
22772
|
+
}
|
|
22773
|
+
}
|
|
22774
|
+
}, [form, mounted, writes, loadStatus]);
|
|
22700
22775
|
const refreshModelsBusy = React2.useRef(false);
|
|
22701
22776
|
const refreshModels = React2.useCallback(async () => {
|
|
22702
22777
|
if (refreshModelsBusy.current) return;
|
|
@@ -22820,7 +22895,7 @@ function SettingsPage({ caller, form }) {
|
|
|
22820
22895
|
} else if (tab === "connection") {
|
|
22821
22896
|
content = h2(Connection, { status, formSnapshot, setFormField, pendingField, caller, onLoginStatus: acceptLoginStatus, onStatus: acceptStatus });
|
|
22822
22897
|
} else {
|
|
22823
|
-
content = h2(Advanced, { status, formSnapshot, setFormField, pendingField });
|
|
22898
|
+
content = h2(Advanced, { status, formSnapshot, setFormField, clearFormField, pendingField });
|
|
22824
22899
|
}
|
|
22825
22900
|
return h2(
|
|
22826
22901
|
"div",
|
package/lib/config.d.ts
CHANGED
|
@@ -7,8 +7,17 @@ export declare const SETTINGS_NS = "llm-opendesign-corouter";
|
|
|
7
7
|
export declare const PLAN_PROVIDER = "opendesign-corouter-plan";
|
|
8
8
|
export declare const PAID_PROVIDER = "opendesign-corouter-paid";
|
|
9
9
|
export declare const DEFAULT_BASE_URL = "https://amr-link.open-design.ai/v1";
|
|
10
|
+
/**
|
|
11
|
+
* Reference resolved when no profile names one.
|
|
12
|
+
*
|
|
13
|
+
* The Host's model page reads a *named* reference out of this namespace and reports it as
|
|
14
|
+
* missing whenever that reference holds nothing, so an unset owner must stay unset: a schema
|
|
15
|
+
* default would claim the reference on every install and make the native page warn about a key
|
|
16
|
+
* the plugin never asked for. The plugin keeps using this default internally.
|
|
17
|
+
*/
|
|
18
|
+
export declare const DEFAULT_API_KEY_REF = "COROUTER_API_KEY";
|
|
10
19
|
export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
|
|
11
|
-
apiKeyEnv: Schema<string, string, "volatile
|
|
20
|
+
apiKeyEnv: Schema<string, string, "volatile">;
|
|
12
21
|
baseURL: Schema<string, string, "volatile-defined">;
|
|
13
22
|
apiProtocol: Schema<"chat-completions" | "responses" | "messages", "chat-completions" | "responses" | "messages", "volatile-defined">;
|
|
14
23
|
modelSettings: Schema<NoInfer<import("@deepseek-ai/cosmokit").Dict<unknown, string>>, NoInfer<ModelSettingsMap>, "volatile-defined">;
|
|
@@ -23,7 +32,7 @@ export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
|
|
|
23
32
|
streamIdleTimeoutMs: Schema<number, number, "volatile-defined">;
|
|
24
33
|
maxRequestImageBytes: Schema<number, number, "volatile-defined">;
|
|
25
34
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
26
|
-
apiKeyEnv: Schema<string, string, "volatile
|
|
35
|
+
apiKeyEnv: Schema<string, string, "volatile">;
|
|
27
36
|
baseURL: Schema<string, string, "volatile-defined">;
|
|
28
37
|
apiProtocol: Schema<"chat-completions" | "responses" | "messages", "chat-completions" | "responses" | "messages", "volatile-defined">;
|
|
29
38
|
modelSettings: Schema<NoInfer<import("@deepseek-ai/cosmokit").Dict<unknown, string>>, NoInfer<ModelSettingsMap>, "volatile-defined">;
|
|
@@ -40,7 +49,8 @@ export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
|
|
|
40
49
|
}>>, "plain">;
|
|
41
50
|
export type LiveConfig = ReturnType<typeof Config>;
|
|
42
51
|
export interface RuntimeConfig {
|
|
43
|
-
|
|
52
|
+
/** Credential reference this profile names; absent when the profile names none. */
|
|
53
|
+
apiKeyEnv?: string;
|
|
44
54
|
baseURL: string;
|
|
45
55
|
useDesktopCredential: boolean;
|
|
46
56
|
emptyTurnGuard: boolean;
|
|
@@ -56,4 +66,11 @@ export interface RuntimeConfig {
|
|
|
56
66
|
turnReviewNoProgressLimit?: number;
|
|
57
67
|
}
|
|
58
68
|
export declare function assertBaseURL(raw: string): string;
|
|
69
|
+
/**
|
|
70
|
+
* The reference requests resolve when the profile names none; the profile itself stays unnamed.
|
|
71
|
+
*
|
|
72
|
+
* No default and no inherited value: a patch that leaves this field out keeps the profile
|
|
73
|
+
* unnamed, which is also what lets the settings page clear it instead of writing a name back.
|
|
74
|
+
*/
|
|
75
|
+
export declare function apiKeyRef(config: RuntimeConfig): string;
|
|
59
76
|
export declare function readConfig(config: LiveConfig): RuntimeConfig;
|
package/lib/device-auth.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface DeviceTokens {
|
|
|
3
3
|
runtimeKey: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const DEVICE_AUTH_ENDPOINT = "https://amr-api.open-design.ai/api/v1/cli/device-authorizations";
|
|
6
|
-
export declare const DEVICE_AUTH_PLUGIN_VERSION = "0.1.
|
|
6
|
+
export declare const DEVICE_AUTH_PLUGIN_VERSION = "0.1.19";
|
|
7
7
|
export declare const DEVICE_REQUEST_TIMEOUT_MS = 20000;
|
|
8
8
|
/** One bounded launch step of the temporary activation window. */
|
|
9
9
|
export declare const DEVICE_OPEN_TIMEOUT_MS = 30000;
|
|
@@ -274,13 +274,22 @@ function parseStatusModel(value) {
|
|
|
274
274
|
...value.inputModalities === void 0 ? {} : { inputModalities: parseModalities(value.inputModalities) },
|
|
275
275
|
...value.contextWindow === void 0 ? {} : { contextWindow: positiveInteger(value.contextWindow, "\u4E0A\u4E0B\u6587\u9884\u7B97", 1e8) },
|
|
276
276
|
...value.maxOutputTokens === void 0 ? {} : { maxOutputTokens: positiveInteger(value.maxOutputTokens, "\u6700\u5927\u8F93\u51FA", 1e7) },
|
|
277
|
-
...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) }
|
|
277
|
+
...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) },
|
|
278
|
+
...value.defaultEffort === void 0 ? {} : { defaultEffort: parseEffort(value.defaultEffort) }
|
|
278
279
|
};
|
|
279
280
|
}
|
|
281
|
+
function parseEffort(value) {
|
|
282
|
+
const effort = text(value, "\u9ED8\u8BA4\u601D\u8003\u6863\u4F4D", 32);
|
|
283
|
+
if (!/^[A-Za-z][A-Za-z0-9_-]*$/u.test(effort)) throw new Error("\u9ED8\u8BA4\u601D\u8003\u6863\u4F4D\u683C\u5F0F\u65E0\u6548");
|
|
284
|
+
return effort;
|
|
285
|
+
}
|
|
280
286
|
function parseStatusConfig(value) {
|
|
281
287
|
if (!record(value)) throw new Error("\u914D\u7F6E\u89C6\u56FE\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
282
|
-
|
|
283
|
-
|
|
288
|
+
if (typeof value.apiKeyEnv !== "string" || value.apiKeyEnv.length > MAX_ENV_REF) {
|
|
289
|
+
throw new Error(`\u51ED\u636E\u5F15\u7528\u540D\u5FC5\u987B\u662F\u6700\u591A ${MAX_ENV_REF} \u5B57\u7B26\u7684\u5B57\u7B26\u4E32`);
|
|
290
|
+
}
|
|
291
|
+
const apiKeyEnv = value.apiKeyEnv;
|
|
292
|
+
if (apiKeyEnv !== "" && !ENV_REF.test(apiKeyEnv)) throw new Error("\u51ED\u636E\u5F15\u7528\u540D\u5FC5\u987B\u662F\u5408\u6CD5\u6807\u8BC6\u7B26");
|
|
284
293
|
return {
|
|
285
294
|
emptyTurnGuard: flag(value.emptyTurnGuard, "\u7A7A\u8F6E\u4FDD\u62A4\u5F00\u5173"),
|
|
286
295
|
...value.turnCompletionReview === void 0 ? {} : { turnCompletionReview: flag(value.turnCompletionReview, "\u7ED3\u675F\u56DE\u5408\u6838\u9A8C\u5F00\u5173") },
|
|
@@ -274,13 +274,22 @@ function parseStatusModel(value) {
|
|
|
274
274
|
...value.inputModalities === void 0 ? {} : { inputModalities: parseModalities(value.inputModalities) },
|
|
275
275
|
...value.contextWindow === void 0 ? {} : { contextWindow: positiveInteger(value.contextWindow, "\u4E0A\u4E0B\u6587\u9884\u7B97", 1e8) },
|
|
276
276
|
...value.maxOutputTokens === void 0 ? {} : { maxOutputTokens: positiveInteger(value.maxOutputTokens, "\u6700\u5927\u8F93\u51FA", 1e7) },
|
|
277
|
-
...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) }
|
|
277
|
+
...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) },
|
|
278
|
+
...value.defaultEffort === void 0 ? {} : { defaultEffort: parseEffort(value.defaultEffort) }
|
|
278
279
|
};
|
|
279
280
|
}
|
|
281
|
+
function parseEffort(value) {
|
|
282
|
+
const effort = text(value, "\u9ED8\u8BA4\u601D\u8003\u6863\u4F4D", 32);
|
|
283
|
+
if (!/^[A-Za-z][A-Za-z0-9_-]*$/u.test(effort)) throw new Error("\u9ED8\u8BA4\u601D\u8003\u6863\u4F4D\u683C\u5F0F\u65E0\u6548");
|
|
284
|
+
return effort;
|
|
285
|
+
}
|
|
280
286
|
function parseStatusConfig(value) {
|
|
281
287
|
if (!record(value)) throw new Error("\u914D\u7F6E\u89C6\u56FE\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
282
|
-
|
|
283
|
-
|
|
288
|
+
if (typeof value.apiKeyEnv !== "string" || value.apiKeyEnv.length > MAX_ENV_REF) {
|
|
289
|
+
throw new Error(`\u51ED\u636E\u5F15\u7528\u540D\u5FC5\u987B\u662F\u6700\u591A ${MAX_ENV_REF} \u5B57\u7B26\u7684\u5B57\u7B26\u4E32`);
|
|
290
|
+
}
|
|
291
|
+
const apiKeyEnv = value.apiKeyEnv;
|
|
292
|
+
if (apiKeyEnv !== "" && !ENV_REF.test(apiKeyEnv)) throw new Error("\u51ED\u636E\u5F15\u7528\u540D\u5FC5\u987B\u662F\u5408\u6CD5\u6807\u8BC6\u7B26");
|
|
284
293
|
return {
|
|
285
294
|
emptyTurnGuard: flag(value.emptyTurnGuard, "\u7A7A\u8F6E\u4FDD\u62A4\u5F00\u5173"),
|
|
286
295
|
...value.turnCompletionReview === void 0 ? {} : { turnCompletionReview: flag(value.turnCompletionReview, "\u7ED3\u675F\u56DE\u5408\u6838\u9A8C\u5F00\u5173") },
|
package/lib/index.d.ts
CHANGED
|
@@ -65,6 +65,10 @@ export declare class OpenDesignCoRouterService extends TypertRemoteService {
|
|
|
65
65
|
* Persist the snapshot through the Host form service.
|
|
66
66
|
* `unsupported` means no settings service is composed (nothing to report);
|
|
67
67
|
* `unavailable` means the service exists but exposes no writable form for this plugin.
|
|
68
|
+
*
|
|
69
|
+
* A settings write rewrites the whole composed profile and may rebuild the plugin tree, so
|
|
70
|
+
* only a concurrent revision conflict (`SETTINGS_CONFLICT`) is worth re-reading the revision
|
|
71
|
+
* and trying once more. Every other failure repeats identically and is reported immediately.
|
|
68
72
|
*/
|
|
69
73
|
private _persistModels;
|
|
70
74
|
/** Serialize snapshot writes so the newest successful refresh is the last one persisted. */
|