@eddyskywalker/dsh-chatgpt-subscription 0.55.0 → 0.56.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/CHANGELOG.md +14 -0
- package/README.md +148 -1268
- package/lib/client.js +242 -17
- package/lib/client.js.map +1 -1
- package/lib/index.js +157 -44
- package/lib/plan-mode.js +3 -7
- package/lib/tool-result-pruner.js +1 -1
- package/lib/types/client/locales-ru/index.d.ts +2 -3
- package/lib/types/client/locales-ru/index.d.ts.map +1 -1
- package/lib/types/client/minimax-code/commands-contract.d.ts +1 -1
- package/lib/types/client/subagent/SubagentCard.d.ts.map +1 -1
- package/lib/types/client/subagent/locales.d.ts +14 -2
- package/lib/types/client/subagent/locales.d.ts.map +1 -1
- package/lib/types/client/subagent/styles.d.ts +1 -1
- package/lib/types/client/subagent/styles.d.ts.map +1 -1
- package/lib/types/client/subagent/subagent-card-controller.d.ts +26 -3
- package/lib/types/client/subagent/subagent-card-controller.d.ts.map +1 -1
- package/lib/types/compat.d.ts +1 -1
- package/lib/types/entry-plan-mode.d.ts +3 -7
- package/lib/types/entry-plan-mode.d.ts.map +1 -1
- package/lib/types/entry-tool-result-pruner.d.ts +1 -1
- package/lib/types/host/agent-preset.d.ts +5 -0
- package/lib/types/host/agent-preset.d.ts.map +1 -1
- package/lib/types/host/common/llm-compat.d.ts +3 -1
- package/lib/types/host/common/llm-compat.d.ts.map +1 -1
- package/lib/types/host/kimi-code/repeat-breaker.d.ts +1 -1
- package/lib/types/host/plan-mode-cache-guard.d.ts.map +1 -1
- package/lib/types/host/preferences.d.ts.map +1 -1
- package/lib/types/host/routes.d.ts.map +1 -1
- package/lib/types/host/subagent-model-authorization.d.ts +34 -16
- package/lib/types/host/subagent-model-authorization.d.ts.map +1 -1
- package/lib/types/host/subagent-route-audit.d.ts +6 -1
- package/lib/types/host/subagent-route-audit.d.ts.map +1 -1
- package/lib/types/index.d.ts +2 -2
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/contracts.d.ts +19 -0
- package/lib/types/shared/contracts.d.ts.map +1 -1
- package/lib/types/shared/preferences.d.ts +22 -1
- package/lib/types/shared/preferences.d.ts.map +1 -1
- package/package.json +46 -43
- package/presets/dispatch/README.md +6 -5
- package/presets/dispatch/agent.cordis.yml +18 -14
package/lib/client.js
CHANGED
|
@@ -56616,6 +56616,22 @@ window.__ModuleLoader__.load({
|
|
|
56616
56616
|
function routeKey(route) {
|
|
56617
56617
|
return `${route.provider}/${route.model}`;
|
|
56618
56618
|
}
|
|
56619
|
+
/**
|
|
56620
|
+
* 把 `<provider>/<model>` 拆回一条路由。
|
|
56621
|
+
*
|
|
56622
|
+
* provider id 与 model id 都可能含 `/`(例如 `openrouter/anthropic/claude`),
|
|
56623
|
+
* 所以只按**第一个**斜杠拆;这与 `list_subagent_models` 的输出约定一致。
|
|
56624
|
+
* @param key - 目标键。
|
|
56625
|
+
* @returns 路由,或 undefined(不是路由形态)。
|
|
56626
|
+
*/
|
|
56627
|
+
function parseRouteKey(key) {
|
|
56628
|
+
const cut = key.indexOf("/");
|
|
56629
|
+
if (cut <= 0 || cut === key.length - 1) return void 0;
|
|
56630
|
+
return {
|
|
56631
|
+
provider: key.slice(0, cut),
|
|
56632
|
+
model: key.slice(cut + 1)
|
|
56633
|
+
};
|
|
56634
|
+
}
|
|
56619
56635
|
/** 过滤并克隆非空合法路由。 */
|
|
56620
56636
|
function cloneRoutes(routes) {
|
|
56621
56637
|
const out = [];
|
|
@@ -56647,6 +56663,22 @@ window.__ModuleLoader__.load({
|
|
|
56647
56663
|
if (leftKeys.length !== rightKeys.length) return false;
|
|
56648
56664
|
return leftKeys.every((key, index) => key === rightKeys[index] && sameRouteSet(left[key] ?? [], right[key] ?? []));
|
|
56649
56665
|
}
|
|
56666
|
+
function normalizeForkOverrides(raw) {
|
|
56667
|
+
const out = {};
|
|
56668
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return out;
|
|
56669
|
+
for (const [rawKey, value] of Object.entries(raw)) {
|
|
56670
|
+
const key = rawKey.trim();
|
|
56671
|
+
if (parseRouteKey(key) === void 0 || typeof value !== "boolean") continue;
|
|
56672
|
+
out[key] = value;
|
|
56673
|
+
}
|
|
56674
|
+
return out;
|
|
56675
|
+
}
|
|
56676
|
+
function sameForkOverrides(left, right) {
|
|
56677
|
+
const leftKeys = Object.keys(left).sort();
|
|
56678
|
+
const rightKeys = Object.keys(right).sort();
|
|
56679
|
+
if (leftKeys.length !== rightKeys.length) return false;
|
|
56680
|
+
return leftKeys.every((key, index) => key === rightKeys[index] && left[key] === right[key]);
|
|
56681
|
+
}
|
|
56650
56682
|
/** 最小快照 store:`useSyncExternalStore` 要求引用在两次变更之间稳定。 */
|
|
56651
56683
|
function createStore(initial) {
|
|
56652
56684
|
let snapshot = initial;
|
|
@@ -56720,7 +56752,9 @@ window.__ModuleLoader__.load({
|
|
|
56720
56752
|
if (typeof parsed !== "object" || parsed === null) return void 0;
|
|
56721
56753
|
return {
|
|
56722
56754
|
subagentDefaultModels: Array.isArray(parsed.subagentDefaultModels) ? cloneRoutes(parsed.subagentDefaultModels) : [],
|
|
56723
|
-
subagentModelsByMainModel: parsed.subagentModelsByMainModel ?? {}
|
|
56755
|
+
subagentModelsByMainModel: parsed.subagentModelsByMainModel ?? {},
|
|
56756
|
+
subagentDefaultAllowParentFork: parsed.subagentDefaultAllowParentFork === true,
|
|
56757
|
+
subagentAllowParentForkByMainModel: normalizeForkOverrides(parsed.subagentAllowParentForkByMainModel)
|
|
56724
56758
|
};
|
|
56725
56759
|
} catch {
|
|
56726
56760
|
return;
|
|
@@ -56733,14 +56767,22 @@ window.__ModuleLoader__.load({
|
|
|
56733
56767
|
const mergedOverrides = { ...prev?.subagentModelsByMainModel ?? {} };
|
|
56734
56768
|
for (const [k, v] of Object.entries(patch.subagentModelsByMainModel ?? {})) if (v === null || !Array.isArray(v) || v.length === 0) delete mergedOverrides[k];
|
|
56735
56769
|
else mergedOverrides[k] = cloneRoutes(v);
|
|
56770
|
+
const mergedForkOverrides = normalizeForkOverrides(prev?.subagentAllowParentForkByMainModel);
|
|
56771
|
+
for (const [k, v] of Object.entries(patch.subagentAllowParentForkByMainModel ?? {})) {
|
|
56772
|
+
const trimmed = k.trim();
|
|
56773
|
+
if (v === null) delete mergedForkOverrides[trimmed];
|
|
56774
|
+
else if (typeof v === "boolean" && parseRouteKey(trimmed) !== void 0) mergedForkOverrides[trimmed] = v;
|
|
56775
|
+
}
|
|
56736
56776
|
localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify({
|
|
56737
56777
|
subagentDefaultModels: Array.isArray(patch.subagentDefaultModels) ? cloneRoutes(patch.subagentDefaultModels) : prev?.subagentDefaultModels ?? [],
|
|
56738
|
-
subagentModelsByMainModel: mergedOverrides
|
|
56778
|
+
subagentModelsByMainModel: mergedOverrides,
|
|
56779
|
+
subagentDefaultAllowParentFork: typeof patch.subagentDefaultAllowParentFork === "boolean" ? patch.subagentDefaultAllowParentFork : prev?.subagentDefaultAllowParentFork === true,
|
|
56780
|
+
subagentAllowParentForkByMainModel: mergedForkOverrides
|
|
56739
56781
|
}));
|
|
56740
56782
|
} catch {}
|
|
56741
56783
|
}
|
|
56742
56784
|
/**
|
|
56743
|
-
*
|
|
56785
|
+
* 读本插件偏好里的子代理模型配置。
|
|
56744
56786
|
* @returns 偏好切片;读取失败时 undefined(卡片照常可用,只是从空列表起步)。
|
|
56745
56787
|
*/
|
|
56746
56788
|
async function readSubagentPreferences() {
|
|
@@ -56752,10 +56794,14 @@ window.__ModuleLoader__.load({
|
|
|
56752
56794
|
if (preferences === void 0 || preferences === null) return local;
|
|
56753
56795
|
const serverDefaults = Array.isArray(preferences.subagentDefaultModels) ? cloneRoutes(preferences.subagentDefaultModels) : [];
|
|
56754
56796
|
const serverByMain = preferences.subagentModelsByMainModel ?? {};
|
|
56755
|
-
|
|
56797
|
+
const serverDefaultFork = preferences.subagentDefaultAllowParentFork === true;
|
|
56798
|
+
const serverForkByMain = normalizeForkOverrides(preferences.subagentAllowParentForkByMainModel);
|
|
56799
|
+
if (serverDefaults.length === 0 && Object.keys(serverByMain).length === 0 && !serverDefaultFork && Object.keys(serverForkByMain).length === 0 && local !== void 0) return local;
|
|
56756
56800
|
return {
|
|
56757
56801
|
subagentDefaultModels: serverDefaults,
|
|
56758
|
-
subagentModelsByMainModel: serverByMain
|
|
56802
|
+
subagentModelsByMainModel: serverByMain,
|
|
56803
|
+
subagentDefaultAllowParentFork: serverDefaultFork,
|
|
56804
|
+
subagentAllowParentForkByMainModel: serverForkByMain
|
|
56759
56805
|
};
|
|
56760
56806
|
} catch {
|
|
56761
56807
|
return local;
|
|
@@ -56851,6 +56897,8 @@ window.__ModuleLoader__.load({
|
|
|
56851
56897
|
draftEnabled;
|
|
56852
56898
|
draftDefault;
|
|
56853
56899
|
draftOverrides;
|
|
56900
|
+
draftDefaultFork;
|
|
56901
|
+
draftForkOverrides;
|
|
56854
56902
|
draftRevision;
|
|
56855
56903
|
activeTarget = GLOBAL_TARGET;
|
|
56856
56904
|
saving = false;
|
|
@@ -56921,12 +56969,18 @@ window.__ModuleLoader__.load({
|
|
|
56921
56969
|
toggleModel: (key) => {
|
|
56922
56970
|
this.toggleModel(key);
|
|
56923
56971
|
},
|
|
56972
|
+
toggleAllowParentFork: () => {
|
|
56973
|
+
this.toggleAllowParentFork();
|
|
56974
|
+
},
|
|
56924
56975
|
setActiveTarget: (target) => {
|
|
56925
56976
|
this.setActiveTarget(target);
|
|
56926
56977
|
},
|
|
56927
56978
|
resetActiveTarget: () => {
|
|
56928
56979
|
this.resetActiveTarget();
|
|
56929
56980
|
},
|
|
56981
|
+
resetActiveTargetFork: () => {
|
|
56982
|
+
this.resetActiveTargetFork();
|
|
56983
|
+
},
|
|
56930
56984
|
retryCatalog: () => {
|
|
56931
56985
|
this.loadCatalogOnce();
|
|
56932
56986
|
},
|
|
@@ -57000,6 +57054,12 @@ window.__ModuleLoader__.load({
|
|
|
57000
57054
|
}
|
|
57001
57055
|
return out;
|
|
57002
57056
|
}
|
|
57057
|
+
currentDefaultFork() {
|
|
57058
|
+
return this.preferences?.subagentDefaultAllowParentFork === true;
|
|
57059
|
+
}
|
|
57060
|
+
currentForkOverrides() {
|
|
57061
|
+
return normalizeForkOverrides(this.preferences?.subagentAllowParentForkByMainModel);
|
|
57062
|
+
}
|
|
57003
57063
|
enabled() {
|
|
57004
57064
|
return this.draftEnabled ?? this.currentEnabled();
|
|
57005
57065
|
}
|
|
@@ -57012,6 +57072,17 @@ window.__ModuleLoader__.load({
|
|
|
57012
57072
|
for (const [key, value] of Object.entries(source)) out[key] = cloneRoutes(value);
|
|
57013
57073
|
return out;
|
|
57014
57074
|
}
|
|
57075
|
+
defaultAllowParentFork() {
|
|
57076
|
+
return this.draftDefaultFork ?? this.currentDefaultFork();
|
|
57077
|
+
}
|
|
57078
|
+
forkOverrides() {
|
|
57079
|
+
return { ...this.draftForkOverrides ?? this.currentForkOverrides() };
|
|
57080
|
+
}
|
|
57081
|
+
activeAllowParentFork() {
|
|
57082
|
+
if (this.activeTarget === "default") return this.defaultAllowParentFork();
|
|
57083
|
+
const own = this.forkOverrides()[this.activeTarget];
|
|
57084
|
+
return typeof own === "boolean" ? own : this.defaultAllowParentFork();
|
|
57085
|
+
}
|
|
57015
57086
|
/** 当前目标生效的列表(专属列表优先,否则回落到全局默认)。 */
|
|
57016
57087
|
activeRoutes() {
|
|
57017
57088
|
if (this.activeTarget === "default") return this.defaultRoutes();
|
|
@@ -57023,6 +57094,8 @@ window.__ModuleLoader__.load({
|
|
|
57023
57094
|
this.draftEnabled = this.currentEnabled();
|
|
57024
57095
|
this.draftDefault = this.currentDefault();
|
|
57025
57096
|
this.draftOverrides = this.currentOverrides();
|
|
57097
|
+
this.draftDefaultFork = this.currentDefaultFork();
|
|
57098
|
+
this.draftForkOverrides = this.currentForkOverrides();
|
|
57026
57099
|
this.draftRevision = this.modelSelection.getSnapshot().revision;
|
|
57027
57100
|
}
|
|
57028
57101
|
clearDraft() {
|
|
@@ -57033,6 +57106,8 @@ window.__ModuleLoader__.load({
|
|
|
57033
57106
|
this.draftEnabled = void 0;
|
|
57034
57107
|
this.draftDefault = void 0;
|
|
57035
57108
|
this.draftOverrides = void 0;
|
|
57109
|
+
this.draftDefaultFork = void 0;
|
|
57110
|
+
this.draftForkOverrides = void 0;
|
|
57036
57111
|
this.draftRevision = void 0;
|
|
57037
57112
|
this.failed = false;
|
|
57038
57113
|
}
|
|
@@ -57109,13 +57184,41 @@ window.__ModuleLoader__.load({
|
|
|
57109
57184
|
this.activeTarget = target === "" ? GLOBAL_TARGET : target;
|
|
57110
57185
|
this.publish();
|
|
57111
57186
|
}
|
|
57112
|
-
/**
|
|
57187
|
+
/** 切换当前目标的同源分叉(`subagent_fork`)开关。 */
|
|
57188
|
+
toggleAllowParentFork() {
|
|
57189
|
+
if (this.saving || !this.enabled()) return;
|
|
57190
|
+
if (this.modelSelection.getSnapshot().status !== "ready") return;
|
|
57191
|
+
this.ensureDraft();
|
|
57192
|
+
if (this.activeTarget === "default") this.draftDefaultFork = !this.defaultAllowParentFork();
|
|
57193
|
+
else {
|
|
57194
|
+
const forkOverrides = this.draftForkOverrides ?? this.currentForkOverrides();
|
|
57195
|
+
const current = forkOverrides[this.activeTarget] ?? this.defaultAllowParentFork();
|
|
57196
|
+
forkOverrides[this.activeTarget] = !current;
|
|
57197
|
+
this.draftForkOverrides = forkOverrides;
|
|
57198
|
+
}
|
|
57199
|
+
this.failed = false;
|
|
57200
|
+
this.publish();
|
|
57201
|
+
}
|
|
57202
|
+
/** 让当前主代理的同源分叉策略单独恢复「跟随全局默认」。 */
|
|
57203
|
+
resetActiveTargetFork() {
|
|
57204
|
+
if (this.saving || this.activeTarget === "default") return;
|
|
57205
|
+
this.ensureDraft();
|
|
57206
|
+
const forkOverrides = this.draftForkOverrides ?? this.currentForkOverrides();
|
|
57207
|
+
delete forkOverrides[this.activeTarget];
|
|
57208
|
+
this.draftForkOverrides = forkOverrides;
|
|
57209
|
+
this.failed = false;
|
|
57210
|
+
this.publish();
|
|
57211
|
+
}
|
|
57212
|
+
/** 让当前目标恢复「跟随全局默认」:删掉它的专属列表与专属同源分叉覆盖。 */
|
|
57113
57213
|
resetActiveTarget() {
|
|
57114
57214
|
if (this.saving || this.activeTarget === "default") return;
|
|
57115
57215
|
this.ensureDraft();
|
|
57116
57216
|
const overrides = this.draftOverrides ?? this.currentOverrides();
|
|
57117
57217
|
delete overrides[this.activeTarget];
|
|
57118
57218
|
this.draftOverrides = overrides;
|
|
57219
|
+
const forkOverrides = this.draftForkOverrides ?? this.currentForkOverrides();
|
|
57220
|
+
delete forkOverrides[this.activeTarget];
|
|
57221
|
+
this.draftForkOverrides = forkOverrides;
|
|
57119
57222
|
this.failed = false;
|
|
57120
57223
|
this.publish();
|
|
57121
57224
|
}
|
|
@@ -57166,16 +57269,18 @@ window.__ModuleLoader__.load({
|
|
|
57166
57269
|
/** 主代理模型下拉的分组(目录分组 + 已保存但不可用的孤儿)。 */
|
|
57167
57270
|
mainModelGroups() {
|
|
57168
57271
|
const overrides = this.overrides();
|
|
57272
|
+
const forkOverrides = this.forkOverrides();
|
|
57169
57273
|
const groups = [];
|
|
57170
57274
|
for (const group of this.catalogGroups) {
|
|
57171
57275
|
if (!group.provider || group.provider === "undefined") continue;
|
|
57172
57276
|
const models = group.models.filter((model) => Boolean(model.id) && model.id !== "undefined").map((model) => {
|
|
57173
57277
|
const key = `${group.provider}/${model.id}`;
|
|
57278
|
+
const overridden = overrides[key] !== void 0 || forkOverrides[key] !== void 0;
|
|
57174
57279
|
return {
|
|
57175
57280
|
key,
|
|
57176
57281
|
model: model.id,
|
|
57177
57282
|
modelName: model.name,
|
|
57178
|
-
overridden
|
|
57283
|
+
overridden
|
|
57179
57284
|
};
|
|
57180
57285
|
});
|
|
57181
57286
|
if (models.length > 0) groups.push({
|
|
@@ -57190,7 +57295,7 @@ window.__ModuleLoader__.load({
|
|
|
57190
57295
|
orphanMainModels() {
|
|
57191
57296
|
const known = /* @__PURE__ */ new Set();
|
|
57192
57297
|
for (const group of this.catalogGroups) for (const model of group.models) known.add(`${group.provider}/${model.id}`);
|
|
57193
|
-
return Object.keys(this.overrides()).filter((key) => !known.has(key));
|
|
57298
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(this.overrides()), ...Object.keys(this.forkOverrides())])].filter((key) => !known.has(key));
|
|
57194
57299
|
}
|
|
57195
57300
|
/**
|
|
57196
57301
|
* 一次保存三份存储。
|
|
@@ -57201,6 +57306,8 @@ window.__ModuleLoader__.load({
|
|
|
57201
57306
|
const desiredEnabled = this.enabled();
|
|
57202
57307
|
const desiredDefault = this.defaultRoutes();
|
|
57203
57308
|
const desiredOverrides = this.overrides();
|
|
57309
|
+
const desiredDefaultFork = this.defaultAllowParentFork();
|
|
57310
|
+
const desiredForkOverrides = this.forkOverrides();
|
|
57204
57311
|
const generation = this.saveGeneration;
|
|
57205
57312
|
this.saving = true;
|
|
57206
57313
|
this.failed = false;
|
|
@@ -57212,16 +57319,28 @@ window.__ModuleLoader__.load({
|
|
|
57212
57319
|
const list = desiredOverrides[key];
|
|
57213
57320
|
patch[key] = list !== void 0 && list.length > 0 ? cloneRoutes(list) : null;
|
|
57214
57321
|
}
|
|
57322
|
+
const initialFork = this.currentForkOverrides();
|
|
57323
|
+
const forkPatch = {};
|
|
57324
|
+
for (const key of /* @__PURE__ */ new Set([...Object.keys(initialFork), ...Object.keys(desiredForkOverrides)])) {
|
|
57325
|
+
const flag = desiredForkOverrides[key];
|
|
57326
|
+
forkPatch[key] = typeof flag === "boolean" ? flag : null;
|
|
57327
|
+
}
|
|
57215
57328
|
await this.savePreferences({
|
|
57216
57329
|
subagentDefaultModels: cloneRoutes(desiredDefault),
|
|
57217
|
-
subagentModelsByMainModel: patch
|
|
57330
|
+
subagentModelsByMainModel: patch,
|
|
57331
|
+
subagentDefaultAllowParentFork: desiredDefaultFork,
|
|
57332
|
+
subagentAllowParentForkByMainModel: forkPatch
|
|
57218
57333
|
});
|
|
57219
57334
|
if (this.disposed || generation !== this.saveGeneration) return;
|
|
57220
57335
|
const nextOverrides = {};
|
|
57221
57336
|
for (const [k, v] of Object.entries(desiredOverrides)) if (v.length > 0) nextOverrides[k] = cloneRoutes(v);
|
|
57337
|
+
const nextForkOverrides = {};
|
|
57338
|
+
for (const [k, v] of Object.entries(desiredForkOverrides)) if (typeof v === "boolean") nextForkOverrides[k] = v;
|
|
57222
57339
|
this.preferences = {
|
|
57223
57340
|
subagentDefaultModels: cloneRoutes(desiredDefault),
|
|
57224
|
-
subagentModelsByMainModel: nextOverrides
|
|
57341
|
+
subagentModelsByMainModel: nextOverrides,
|
|
57342
|
+
subagentDefaultAllowParentFork: desiredDefaultFork,
|
|
57343
|
+
subagentAllowParentForkByMainModel: nextForkOverrides
|
|
57225
57344
|
};
|
|
57226
57345
|
this.preferencesStatus = "ready";
|
|
57227
57346
|
const union = /* @__PURE__ */ new Map();
|
|
@@ -57328,13 +57447,17 @@ window.__ModuleLoader__.load({
|
|
|
57328
57447
|
const enabled = this.enabled();
|
|
57329
57448
|
const desiredDefault = this.defaultRoutes();
|
|
57330
57449
|
const desiredOverrides = this.overrides();
|
|
57450
|
+
const desiredDefaultFork = this.defaultAllowParentFork();
|
|
57451
|
+
const desiredForkOverrides = this.forkOverrides();
|
|
57331
57452
|
const currentOverrides = this.currentOverrides();
|
|
57332
57453
|
const currentDefault = this.currentDefault();
|
|
57454
|
+
const currentDefaultFork = this.currentDefaultFork();
|
|
57455
|
+
const currentForkOverrides = this.currentForkOverrides();
|
|
57333
57456
|
const union = /* @__PURE__ */ new Map();
|
|
57334
57457
|
for (const route of desiredDefault) union.set(routeKey(route), route);
|
|
57335
57458
|
for (const list of Object.values(desiredOverrides)) for (const route of list) union.set(routeKey(route), route);
|
|
57336
57459
|
const hostAllowed = cloneRoutes(modelSnapshot.value?.allowedModels ?? []);
|
|
57337
|
-
const modelsDirty = this.currentEnabled() !== enabled || !sameRouteSet(currentDefault, desiredDefault) || !sameOverrides(currentOverrides, desiredOverrides) || this.draftDefault !== void 0 && !sameRouteSet(hostAllowed, [...union.values()]);
|
|
57460
|
+
const modelsDirty = this.currentEnabled() !== enabled || !sameRouteSet(currentDefault, desiredDefault) || !sameOverrides(currentOverrides, desiredOverrides) || currentDefaultFork !== desiredDefaultFork || !sameForkOverrides(currentForkOverrides, desiredForkOverrides) || this.draftDefault !== void 0 && !sameRouteSet(hostAllowed, [...union.values()]);
|
|
57338
57461
|
const depthPersistedOverridden = userHas(limitsSnapshot.user, "maxDepth");
|
|
57339
57462
|
const activePersistedOverridden = userHas(limitsSnapshot.user, "maxActiveSubagents");
|
|
57340
57463
|
const depthDirty = this.draftDepthCleared ? depthPersistedOverridden : this.draftDepth !== void 0 && maxDepth.value !== String(readNumber(limitsSnapshot.value, "maxDepth", 1));
|
|
@@ -57343,6 +57466,7 @@ window.__ModuleLoader__.load({
|
|
|
57343
57466
|
const emptyOverride = Object.values(desiredOverrides).some((list) => list.length === 0);
|
|
57344
57467
|
const invalid = maxDepth.invalid || maxActive.invalid || enabled && (desiredDefault.length === 0 || emptyOverride);
|
|
57345
57468
|
const activeOverridden = this.activeTarget !== "default" && desiredOverrides[this.activeTarget] !== void 0;
|
|
57469
|
+
const activeForkOverridden = this.activeTarget !== "default" && desiredForkOverrides[this.activeTarget] !== void 0;
|
|
57346
57470
|
return {
|
|
57347
57471
|
available: limitsAvailable || modelsAvailable,
|
|
57348
57472
|
writable: (limitsAvailable ? limitsSnapshot.writable : true) && (modelsAvailable ? modelSnapshot.writable : true),
|
|
@@ -57363,6 +57487,10 @@ window.__ModuleLoader__.load({
|
|
|
57363
57487
|
candidates: this.candidates(),
|
|
57364
57488
|
activeTargetOverridden: activeOverridden,
|
|
57365
57489
|
activeTargetCount: this.activeRoutes().length,
|
|
57490
|
+
defaultAllowParentFork: desiredDefaultFork,
|
|
57491
|
+
forkOverridesByMainModel: desiredForkOverrides,
|
|
57492
|
+
activeTargetAllowParentFork: this.activeAllowParentFork(),
|
|
57493
|
+
activeTargetForkOverridden: activeForkOverridden,
|
|
57366
57494
|
preferencesStatus: this.preferencesStatus
|
|
57367
57495
|
};
|
|
57368
57496
|
}
|
|
@@ -57563,7 +57691,8 @@ window.__ModuleLoader__.load({
|
|
|
57563
57691
|
return key;
|
|
57564
57692
|
};
|
|
57565
57693
|
const activeModelKey = state.activeTarget;
|
|
57566
|
-
const overrideKeys = Object.keys(state.overridesByMainModel);
|
|
57694
|
+
const overrideKeys = [.../* @__PURE__ */ new Set([...Object.keys(state.overridesByMainModel), ...Object.keys(state.forkOverridesByMainModel)])];
|
|
57695
|
+
const activeAnyOverridden = state.activeTargetOverridden || state.activeTargetForkOverridden;
|
|
57567
57696
|
const limitsHeadingId = headingId + "-limits";
|
|
57568
57697
|
const modelsHeadingId = headingId + "-models";
|
|
57569
57698
|
const mainModelId = headingId + "-main-model";
|
|
@@ -57742,7 +57871,7 @@ window.__ModuleLoader__.load({
|
|
|
57742
57871
|
onClick: () => {
|
|
57743
57872
|
props.setActiveTarget(key);
|
|
57744
57873
|
},
|
|
57745
|
-
children: mainModelName(key) + " (" + String(state.overridesByMainModel[key]?.length ??
|
|
57874
|
+
children: mainModelName(key) + " (" + String(state.overridesByMainModel[key]?.length ?? state.defaultCount) + ")"
|
|
57746
57875
|
}, key))]
|
|
57747
57876
|
}),
|
|
57748
57877
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -57754,10 +57883,13 @@ window.__ModuleLoader__.load({
|
|
|
57754
57883
|
}) : state.activeTargetOverridden ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
57755
57884
|
className: "dsh-subagent-hint",
|
|
57756
57885
|
children: withCount(t("subagentTargetOverrideStatus"), state.activeTargetCount)
|
|
57886
|
+
}) : state.activeTargetForkOverridden ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
57887
|
+
className: "dsh-subagent-hint",
|
|
57888
|
+
children: t("subagentTargetForkOnlyOverrideStatus")
|
|
57757
57889
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
57758
57890
|
className: "dsh-subagent-hint",
|
|
57759
57891
|
children: t("subagentTargetFollowGlobalStatus")
|
|
57760
|
-
}), activeModelKey !== "default" &&
|
|
57892
|
+
}), activeModelKey !== "default" && activeAnyOverridden ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
57761
57893
|
type: "button",
|
|
57762
57894
|
className: "dsh-subagent-reset",
|
|
57763
57895
|
"data-dsh-part": "subagent-reset-to-global",
|
|
@@ -57770,6 +57902,54 @@ window.__ModuleLoader__.load({
|
|
|
57770
57902
|
})
|
|
57771
57903
|
]
|
|
57772
57904
|
}),
|
|
57905
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
|
|
57906
|
+
className: "dsh-subagent-fork-card",
|
|
57907
|
+
"data-dsh-part": "subagent-fork-card",
|
|
57908
|
+
children: [
|
|
57909
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", { children: t("subagentForkTitle") }),
|
|
57910
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
57911
|
+
className: "dsh-subagent-fork-head",
|
|
57912
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
57913
|
+
className: "dsh-subagent-fork-title-group",
|
|
57914
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
57915
|
+
className: "dsh-subagent-fork-label",
|
|
57916
|
+
children: t("subagentForkToggle")
|
|
57917
|
+
}), activeModelKey !== "default" && state.activeTargetForkOverridden ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
57918
|
+
className: "dsh-subagent-badges",
|
|
57919
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
57920
|
+
className: "dsh-subagent-override-tag",
|
|
57921
|
+
children: t("overridden")
|
|
57922
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
57923
|
+
type: "button",
|
|
57924
|
+
className: "dsh-subagent-reset-link",
|
|
57925
|
+
"data-dsh-part": "subagent-fork-reset",
|
|
57926
|
+
disabled,
|
|
57927
|
+
onClick: () => {
|
|
57928
|
+
props.resetActiveTargetFork();
|
|
57929
|
+
},
|
|
57930
|
+
children: t("reset")
|
|
57931
|
+
})]
|
|
57932
|
+
}) : null]
|
|
57933
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
57934
|
+
type: "button",
|
|
57935
|
+
role: "switch",
|
|
57936
|
+
"aria-checked": state.activeTargetAllowParentFork,
|
|
57937
|
+
"aria-label": t("subagentForkToggle"),
|
|
57938
|
+
className: "dsh-subagent-switch",
|
|
57939
|
+
"data-dsh-part": "subagent-fork-switch",
|
|
57940
|
+
disabled,
|
|
57941
|
+
onClick: () => {
|
|
57942
|
+
props.toggleAllowParentFork();
|
|
57943
|
+
},
|
|
57944
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "dsh-subagent-switch-thumb" })
|
|
57945
|
+
})]
|
|
57946
|
+
}),
|
|
57947
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
57948
|
+
className: "dsh-subagent-hint",
|
|
57949
|
+
children: t("subagentForkHint")
|
|
57950
|
+
})
|
|
57951
|
+
]
|
|
57952
|
+
}),
|
|
57773
57953
|
state.catalogStatus === "loading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
57774
57954
|
className: "dsh-subagent-notice",
|
|
57775
57955
|
role: "status",
|
|
@@ -57934,11 +58114,15 @@ window.__ModuleLoader__.load({
|
|
|
57934
58114
|
subagentChipGlobal: "全局默认 ({count})",
|
|
57935
58115
|
subagentTargetGlobalHint: "正在编辑全局默认子代理模型列表;未单独配置专属列表的主代理将使用此列表。",
|
|
57936
58116
|
subagentTargetOverrideStatus: "已为该主代理单独配置 {count} 个子代理模型",
|
|
58117
|
+
subagentTargetForkOnlyOverrideStatus: "子代理模型列表跟随全局默认;已为该主代理单独配置同源分叉策略",
|
|
57937
58118
|
subagentTargetFollowGlobalStatus: "当前跟随全局默认列表(勾选或取消下方模型即可为该主代理创建专属列表)",
|
|
57938
58119
|
subagentResetToGlobal: "恢复跟随全局默认",
|
|
57939
58120
|
subagentOverrideBadge: "(已覆盖)",
|
|
57940
58121
|
subagentPreferencesLoadFailed: "无法读取已保存的子代理模型偏好;保存时将以当前界面为准。",
|
|
57941
|
-
subagentModelPerTargetRequired: "保存前请至少选择一个模型(或点击「恢复跟随全局默认」)。"
|
|
58122
|
+
subagentModelPerTargetRequired: "保存前请至少选择一个模型(或点击「恢复跟随全局默认」)。",
|
|
58123
|
+
subagentForkTitle: "同源分叉",
|
|
58124
|
+
subagentForkToggle: "允许同源分叉(subagent_fork 继承当前主代理模型)",
|
|
58125
|
+
subagentForkHint: "开启后,subagent_fork 可直接继承当前主代理模型以复用会话上下文与前缀缓存,无需将该主模型加入下方冷启动可选列表;不影响冷启动 subagent 与团队派生。"
|
|
57942
58126
|
};
|
|
57943
58127
|
/** 英文对照,键集与中文完全一致。 */
|
|
57944
58128
|
const en = {
|
|
@@ -57983,11 +58167,15 @@ window.__ModuleLoader__.load({
|
|
|
57983
58167
|
subagentChipGlobal: "Global default ({count})",
|
|
57984
58168
|
subagentTargetGlobalHint: "Editing the global default subagent model list; main agents without their own list use it.",
|
|
57985
58169
|
subagentTargetOverrideStatus: "This main agent has {count} dedicated subagent models",
|
|
58170
|
+
subagentTargetForkOnlyOverrideStatus: "Subagent models follow the global default; same-model fork is overridden for this main agent",
|
|
57986
58171
|
subagentTargetFollowGlobalStatus: "Currently following the global default list (tick or untick a model below to create a dedicated list for this main agent)",
|
|
57987
58172
|
subagentResetToGlobal: "Follow the global default again",
|
|
57988
58173
|
subagentOverrideBadge: " (overridden)",
|
|
57989
58174
|
subagentPreferencesLoadFailed: "Saved subagent model preferences could not be read; saving will use what this page shows.",
|
|
57990
|
-
subagentModelPerTargetRequired: "Select at least one model before saving (or choose \"Follow the global default again\")."
|
|
58175
|
+
subagentModelPerTargetRequired: "Select at least one model before saving (or choose \"Follow the global default again\").",
|
|
58176
|
+
subagentForkTitle: "Same-model fork",
|
|
58177
|
+
subagentForkToggle: "Allow same-model fork (subagent_fork inherits the main agent model)",
|
|
58178
|
+
subagentForkHint: "When enabled, subagent_fork may inherit the main agent model to reuse conversation context and prefix cache without adding that model to the cold-spawn list below; cold-spawn subagent and teammate creation remain governed by the list."
|
|
57991
58179
|
};
|
|
57992
58180
|
/** 与其余线路同形的字典包(四个内置语言 id 都指向那两份)。 */
|
|
57993
58181
|
const dictionaries = {
|
|
@@ -58612,12 +58800,49 @@ window.__ModuleLoader__.load({
|
|
|
58612
58800
|
border-radius: var(--dsw-radius-lg, 10px);
|
|
58613
58801
|
}
|
|
58614
58802
|
|
|
58615
|
-
.dsh-subagent-models > legend
|
|
58803
|
+
.dsh-subagent-models > legend,
|
|
58804
|
+
.dsh-subagent-fork-card > legend {
|
|
58616
58805
|
padding: 0 4px;
|
|
58617
58806
|
font-size: 12px;
|
|
58618
58807
|
color: var(--dsw-alias-label-secondary);
|
|
58619
58808
|
}
|
|
58620
58809
|
|
|
58810
|
+
.dsh-subagent-fork-card {
|
|
58811
|
+
display: grid;
|
|
58812
|
+
align-content: start;
|
|
58813
|
+
gap: 4px;
|
|
58814
|
+
min-width: 0;
|
|
58815
|
+
margin: 0;
|
|
58816
|
+
padding: 10px;
|
|
58817
|
+
border: 0.5px solid var(--dsw-alias-border-l4);
|
|
58818
|
+
border-radius: var(--dsw-radius-lg, 10px);
|
|
58819
|
+
background: transparent;
|
|
58820
|
+
}
|
|
58821
|
+
|
|
58822
|
+
.dsh-subagent-fork-head {
|
|
58823
|
+
display: flex;
|
|
58824
|
+
align-items: center;
|
|
58825
|
+
justify-content: space-between;
|
|
58826
|
+
gap: 16px;
|
|
58827
|
+
min-width: 0;
|
|
58828
|
+
}
|
|
58829
|
+
|
|
58830
|
+
.dsh-subagent-fork-title-group {
|
|
58831
|
+
display: flex;
|
|
58832
|
+
flex-wrap: wrap;
|
|
58833
|
+
align-items: center;
|
|
58834
|
+
gap: 8px;
|
|
58835
|
+
flex: 1;
|
|
58836
|
+
min-width: 0;
|
|
58837
|
+
}
|
|
58838
|
+
|
|
58839
|
+
.dsh-subagent-fork-label {
|
|
58840
|
+
font-size: 13px;
|
|
58841
|
+
font-weight: 500;
|
|
58842
|
+
line-height: 1.5;
|
|
58843
|
+
color: var(--dsw-alias-label-primary);
|
|
58844
|
+
}
|
|
58845
|
+
|
|
58621
58846
|
.dsh-subagent-group {
|
|
58622
58847
|
display: grid;
|
|
58623
58848
|
gap: 6px;
|