@eddyskywalker/dsh-chatgpt-subscription 0.90.2 → 0.91.1
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/lib/client.js +536 -184
- package/lib/client.js.map +1 -1
- package/lib/codemode.js +376 -76
- package/lib/index.js +2379 -1503
- package/lib/{plan-mode-CoublSCJ.js → plan-mode-cY8pp0PZ.js} +1 -1
- package/lib/{plan-mode-pipeline-DvVmLaxR.js → plan-mode-pipeline-DQ8TM6mP.js} +21 -18
- package/lib/plan-mode-pipeline.js +1 -1
- package/lib/plan-mode.js +1 -1
- package/lib/{preset-sync-B9yKbQPc.js → preset-sync-gvhSzmlr.js} +44 -1
- package/lib/{progress-updates-DwpfBXOx.js → progress-updates-jiHnSAmz.js} +12 -1
- package/lib/progress-updates.js +1 -1
- package/lib/{tool-result-pruner-Dy6X17gv.js → tool-result-pruner-Baz9Lrov.js} +85 -41
- package/lib/tool-result-pruner.js +1 -1
- package/lib/types/client/features/subagent/SubagentCard.d.ts.map +1 -1
- package/lib/types/client/features/subagent/locales.d.ts +11 -2
- package/lib/types/client/features/subagent/locales.d.ts.map +1 -1
- package/lib/types/client/features/subagent/styles.d.ts +1 -1
- package/lib/types/client/features/subagent/styles.d.ts.map +1 -1
- package/lib/types/client/features/subagent/subagent-card-controller.d.ts +13 -0
- package/lib/types/client/features/subagent/subagent-card-controller.d.ts.map +1 -1
- package/lib/types/client/locales-ru/claude-api.d.ts.map +1 -1
- package/lib/types/client/locales-ru/claude.d.ts.map +1 -1
- package/lib/types/client/providers/claude/ClaudeSection.d.ts.map +1 -1
- package/lib/types/client/providers/claude/locales.d.ts +8 -2
- package/lib/types/client/providers/claude/locales.d.ts.map +1 -1
- package/lib/types/client/providers/claude/useClaudeSection.d.ts +1 -0
- package/lib/types/client/providers/claude/useClaudeSection.d.ts.map +1 -1
- package/lib/types/client/providers/claude-api/ClaudeApiSection.d.ts.map +1 -1
- package/lib/types/client/providers/claude-api/api.d.ts +4 -2
- package/lib/types/client/providers/claude-api/api.d.ts.map +1 -1
- package/lib/types/client/providers/claude-api/locales.d.ts +87 -5
- package/lib/types/client/providers/claude-api/locales.d.ts.map +1 -1
- package/lib/types/client/providers/claude-api/styles.d.ts.map +1 -1
- package/lib/types/client/providers/claude-api/useClaudeApiSection.d.ts +16 -7
- package/lib/types/client/providers/claude-api/useClaudeApiSection.d.ts.map +1 -1
- package/lib/types/compat.d.ts +1 -1
- package/lib/types/entries/codemode.d.ts.map +1 -1
- package/lib/types/entries/plan-mode-pipeline.d.ts.map +1 -1
- package/lib/types/host/common/llm-compat.d.ts +14 -0
- package/lib/types/host/common/llm-compat.d.ts.map +1 -1
- package/lib/types/host/providers/claude/routes.d.ts.map +1 -1
- package/lib/types/host/providers/claude/token-store.d.ts +3 -0
- package/lib/types/host/providers/claude/token-store.d.ts.map +1 -1
- package/lib/types/host/providers/claude-api/account-pool.d.ts +44 -0
- package/lib/types/host/providers/claude-api/account-pool.d.ts.map +1 -0
- package/lib/types/host/providers/claude-api/adapter.d.ts +10 -2
- package/lib/types/host/providers/claude-api/adapter.d.ts.map +1 -1
- package/lib/types/host/providers/claude-api/catalog-manager.d.ts +3 -2
- package/lib/types/host/providers/claude-api/catalog-manager.d.ts.map +1 -1
- package/lib/types/host/providers/claude-api/routes.d.ts +3 -7
- package/lib/types/host/providers/claude-api/routes.d.ts.map +1 -1
- package/lib/types/host/providers/claude-api/token-store.d.ts +4 -0
- package/lib/types/host/providers/claude-api/token-store.d.ts.map +1 -1
- package/lib/types/host/providers/cline-pass/adapter.d.ts.map +1 -1
- package/lib/types/host/providers/glm-coding-plan/adapter.d.ts.map +1 -1
- package/lib/types/host/providers/glm-coding-plan/mapper-anthropic.d.ts +1 -1
- package/lib/types/host/providers/glm-coding-plan/mapper-anthropic.d.ts.map +1 -1
- package/lib/types/host/providers/glm-coding-plan/mapper-openai.d.ts.map +1 -1
- package/lib/types/host/providers/glm-coding-plan/model-catalog.d.ts.map +1 -1
- package/lib/types/host/providers/minimax-code/adapter.d.ts.map +1 -1
- package/lib/types/host/providers/opendesign/adapter.d.ts.map +1 -1
- package/lib/types/host/providers/qianwen-token-plan/adapter.d.ts.map +1 -1
- package/lib/types/host/providers/step-code/adapter.d.ts.map +1 -1
- package/lib/types/host/runtime/cache-warmup/install.d.ts.map +1 -1
- package/lib/types/host/runtime/cache-warmup/retrieval-intent.d.ts.map +1 -1
- package/lib/types/host/runtime/codemode/executor.d.ts +50 -0
- package/lib/types/host/runtime/codemode/executor.d.ts.map +1 -1
- package/lib/types/host/runtime/codemode/transport.d.ts +6 -2
- package/lib/types/host/runtime/codemode/transport.d.ts.map +1 -1
- package/lib/types/host/runtime/compact-after-turn/index.d.ts +34 -3
- package/lib/types/host/runtime/compact-after-turn/index.d.ts.map +1 -1
- package/lib/types/host/runtime/deepseek-v41-flash/index.d.ts +2 -2
- package/lib/types/host/runtime/deepseek-v41-flash/index.d.ts.map +1 -1
- package/lib/types/host/runtime/deepseek-v41-flash/observation-tagger.d.ts.map +1 -1
- package/lib/types/host/runtime/deepseek-v41-flash/state-anchor.d.ts +17 -3
- package/lib/types/host/runtime/deepseek-v41-flash/state-anchor.d.ts.map +1 -1
- package/lib/types/host/runtime/guards/compaction-policy-guard.d.ts.map +1 -1
- package/lib/types/host/runtime/guards/plan-mode-cache-guard.d.ts.map +1 -1
- package/lib/types/host/runtime/guards/ptc-sdk-cache-guard.d.ts.map +1 -1
- package/lib/types/host/runtime/guards/subagent-model-authorization.d.ts +11 -3
- package/lib/types/host/runtime/guards/subagent-model-authorization.d.ts.map +1 -1
- package/lib/types/host/runtime/guards/subagent-route-audit.d.ts +0 -11
- package/lib/types/host/runtime/guards/subagent-route-audit.d.ts.map +1 -1
- package/lib/types/host/runtime/guards/team-policy-cache-guard.d.ts +2 -0
- package/lib/types/host/runtime/guards/team-policy-cache-guard.d.ts.map +1 -1
- package/lib/types/host/runtime/guards/timeline-cache-guard.d.ts.map +1 -1
- package/lib/types/host/runtime/open-models/index.d.ts +2 -2
- package/lib/types/host/runtime/open-models/index.d.ts.map +1 -1
- package/lib/types/host/runtime/open-models/observation-guard.d.ts.map +1 -1
- package/lib/types/host/runtime/open-models/profiles.d.ts +10 -2
- package/lib/types/host/runtime/open-models/profiles.d.ts.map +1 -1
- package/lib/types/host/runtime/open-models/state-anchor.d.ts +3 -0
- package/lib/types/host/runtime/open-models/state-anchor.d.ts.map +1 -1
- package/lib/types/host/runtime/presets/agent-preset.d.ts +12 -7
- package/lib/types/host/runtime/presets/agent-preset.d.ts.map +1 -1
- package/lib/types/host/runtime/progress-updates/index.d.ts.map +1 -1
- package/lib/types/index.d.ts +3 -2
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/claude-api-contracts.d.ts +18 -0
- package/lib/types/shared/claude-api-contracts.d.ts.map +1 -1
- package/lib/types/shared/claude-contracts.d.ts +3 -0
- package/lib/types/shared/claude-contracts.d.ts.map +1 -1
- package/package.json +56 -52
- package/presets/dispatch/agent.cordis.yml +5 -4
package/lib/client.js
CHANGED
|
@@ -11366,6 +11366,8 @@ window.__ModuleLoader__.load({
|
|
|
11366
11366
|
fastModeHint: "仅对支持的模型发送 speed: fast;被拒时自动纠正,并按账号和模型记住结论。",
|
|
11367
11367
|
cacheKeepalive: "cache-keepalive(cache_touch)",
|
|
11368
11368
|
cacheKeepaliveHint: "默认关闭;仅 1 小时主对话优先用 cache_touch,失败回退现有续热。尚未经真实订阅直连验证。",
|
|
11369
|
+
autoCompactSubagents: "子代理完成后自动压缩",
|
|
11370
|
+
autoCompactSubagentsHint: "默认开启。子代理任务完成后压缩它自己的上下文,便于后续继续对话;不影响主对话,压缩失败不影响任务结果。",
|
|
11369
11371
|
effortLow: "低 (low)",
|
|
11370
11372
|
effortMedium: "中 (medium)",
|
|
11371
11373
|
effortHigh: "高 (high)",
|
|
@@ -11493,6 +11495,8 @@ window.__ModuleLoader__.load({
|
|
|
11493
11495
|
fastModeHint: "Sends speed: fast only for supported models; corrects refusals and remembers the result per account and model.",
|
|
11494
11496
|
cacheKeepalive: "cache-keepalive (cache_touch)",
|
|
11495
11497
|
cacheKeepaliveHint: "Off by default. For 1-hour main conversations, try cache_touch first and fall back to the existing warmup. Not yet verified directly with a real subscription.",
|
|
11498
|
+
autoCompactSubagents: "Compact subagents after completion",
|
|
11499
|
+
autoCompactSubagentsHint: "On by default. Compacts the subagent’s own context after each run for later follow-ups; the main conversation is untouched and compaction failure does not change the task result.",
|
|
11496
11500
|
defaultEffortAuto: "Use the model default",
|
|
11497
11501
|
effortLow: "Low",
|
|
11498
11502
|
effortMedium: "Medium",
|
|
@@ -11909,6 +11913,7 @@ window.__ModuleLoader__.load({
|
|
|
11909
11913
|
};
|
|
11910
11914
|
const updateFastMode = (checked) => updateBooleanSetting("fastMode", checked);
|
|
11911
11915
|
const updateCacheKeepalive = (checked) => updateBooleanSetting("cacheKeepalive", checked);
|
|
11916
|
+
const updateAutoCompactSubagents = (checked) => updateBooleanSetting("autoCompactSubagents", checked);
|
|
11912
11917
|
const saveContextWindow = async (modelId) => {
|
|
11913
11918
|
const raw = contextDrafts[modelId] || "";
|
|
11914
11919
|
const parsed = parsePositiveCapacity$1(raw);
|
|
@@ -12082,6 +12087,7 @@ window.__ModuleLoader__.load({
|
|
|
12082
12087
|
updateSubagentCacheTtl,
|
|
12083
12088
|
updateFastMode,
|
|
12084
12089
|
updateCacheKeepalive,
|
|
12090
|
+
updateAutoCompactSubagents,
|
|
12085
12091
|
saveContextWindow,
|
|
12086
12092
|
resetContextWindow,
|
|
12087
12093
|
resetAllContextWindows,
|
|
@@ -12137,7 +12143,7 @@ window.__ModuleLoader__.load({
|
|
|
12137
12143
|
});
|
|
12138
12144
|
const { status, loading, busy, error, flow, connection, pasteValue, contextDrafts, savingModel, maxTokensDrafts } = state;
|
|
12139
12145
|
const { accounts, hasAdopted, contextModels, overrideCount, maxTokensOverrideCount, quota, windows, poolLabels } = derived;
|
|
12140
|
-
const { login, cancelLogin, submitPaste, adopt, stopImporting, accountAction, setStrategy, relogin, refreshQuota, refreshCatalog, testConnection, toggleModel, setAllModels, updateEffort, updateCacheTtl, updateSubagentCacheTtl, updateFastMode, updateCacheKeepalive, saveContextWindow, resetContextWindow, resetAllContextWindows, updateMaxTokensDraft, saveMaxTokens, resetMaxTokens, resetAllMaxTokens, updateContextDraft, setPasteValue } = actions;
|
|
12146
|
+
const { login, cancelLogin, submitPaste, adopt, stopImporting, accountAction, setStrategy, relogin, refreshQuota, refreshCatalog, testConnection, toggleModel, setAllModels, updateEffort, updateCacheTtl, updateSubagentCacheTtl, updateFastMode, updateCacheKeepalive, updateAutoCompactSubagents, saveContextWindow, resetContextWindow, resetAllContextWindows, updateMaxTokensDraft, saveMaxTokens, resetMaxTokens, resetAllMaxTokens, updateContextDraft, setPasteValue } = actions;
|
|
12141
12147
|
const t = useLineDict(NS_CLAUDE, zh$18);
|
|
12142
12148
|
if (loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12143
12149
|
className: "dsha-page",
|
|
@@ -12489,6 +12495,21 @@ window.__ModuleLoader__.load({
|
|
|
12489
12495
|
}
|
|
12490
12496
|
})]
|
|
12491
12497
|
}),
|
|
12498
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12499
|
+
className: "dsha-pref-row",
|
|
12500
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t.autoCompactSubagents }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12501
|
+
className: "dsha-muted",
|
|
12502
|
+
children: t.autoCompactSubagentsHint
|
|
12503
|
+
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
12504
|
+
type: "checkbox",
|
|
12505
|
+
"aria-label": t.autoCompactSubagents,
|
|
12506
|
+
checked: status?.autoCompactSubagents !== false,
|
|
12507
|
+
disabled: busy !== null || status === null,
|
|
12508
|
+
onChange: (event) => {
|
|
12509
|
+
updateAutoCompactSubagents(event.currentTarget.checked);
|
|
12510
|
+
}
|
|
12511
|
+
})]
|
|
12512
|
+
}),
|
|
12492
12513
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12493
12514
|
className: "dsha-muted",
|
|
12494
12515
|
style: { paddingTop: 10 },
|
|
@@ -24756,7 +24777,6 @@ window.__ModuleLoader__.load({
|
|
|
24756
24777
|
}
|
|
24757
24778
|
//#endregion
|
|
24758
24779
|
//#region src/shared/claude-api-contracts.ts
|
|
24759
|
-
/** Public host/client contract for the Claude API line. No API key and no device id cross this boundary. */
|
|
24760
24780
|
const CLAUDE_API_PROVIDER_ID = "claude-api";
|
|
24761
24781
|
const CLAUDE_API_PROVIDER_NAME = "Claude API";
|
|
24762
24782
|
const CLAUDE_API_ROUTE_PREFIX = "/claude-api/api";
|
|
@@ -24819,9 +24839,15 @@ window.__ModuleLoader__.load({
|
|
|
24819
24839
|
//#region src/client/providers/claude-api/locales.ts
|
|
24820
24840
|
const NS_CLAUDE_API = "dsh-claude-api";
|
|
24821
24841
|
const zh$6 = {
|
|
24842
|
+
...accountPoolZh,
|
|
24822
24843
|
title: "Claude API",
|
|
24823
|
-
pageDesc: "
|
|
24844
|
+
pageDesc: "每个账号可配置独立 API Key 与 Anthropic Messages 兼容端点;默认主账号优先,故障时自动切换。",
|
|
24824
24845
|
loading: "正在读取线路状态…",
|
|
24846
|
+
accountAlias: "账号名称",
|
|
24847
|
+
editAccount: "编辑",
|
|
24848
|
+
saveAccount: "保存账号",
|
|
24849
|
+
cancel: "取消",
|
|
24850
|
+
keyKeepPlaceholder: "留空则保留当前 Key",
|
|
24825
24851
|
enabled: "启用 Claude API",
|
|
24826
24852
|
keySection: "API Key",
|
|
24827
24853
|
keyPlaceholder: "sk-ant-…",
|
|
@@ -24876,11 +24902,15 @@ window.__ModuleLoader__.load({
|
|
|
24876
24902
|
effortMax: "最高",
|
|
24877
24903
|
optionsSection: "请求选项",
|
|
24878
24904
|
optionsHint: "这些选项只作用于本线路发出的请求。",
|
|
24879
|
-
cacheTtl: "
|
|
24905
|
+
cacheTtl: "主对话的提示缓存时长",
|
|
24906
|
+
subagentCacheTtl: "子代理与后台请求的缓存时长",
|
|
24907
|
+
subagentCacheTtlHint: "子代理、上下文压缩、生成标题等主对话以外的请求。",
|
|
24880
24908
|
cacheTtl5m: "5 分钟",
|
|
24881
24909
|
cacheTtl1h: "1 小时",
|
|
24882
24910
|
fastMode: "快速模式",
|
|
24883
24911
|
serverCompaction: "服务端压缩",
|
|
24912
|
+
autoCompactSubagents: "子代理完成后自动压缩",
|
|
24913
|
+
autoCompactSubagentsHint: "默认开启。只压缩子代理自己的上下文,不影响主对话;压缩失败不影响任务结果。",
|
|
24884
24914
|
moreNotes: "计费与兼容说明",
|
|
24885
24915
|
cacheTtlNote: "选择 1 小时后,缓存写入按基础输入价格的 2 倍计费。选择 1 小时时,子代理或后台任务运行期间本线路约每 55 分钟发一次很小的续热请求,避免缓存过期;5 分钟时长不会这样做。",
|
|
24886
24916
|
fastModeNote: "快速模式按溢价计费,并且只对支持它的模型生效。",
|
|
@@ -24898,9 +24928,15 @@ window.__ModuleLoader__.load({
|
|
|
24898
24928
|
const dictionaries$6 = {
|
|
24899
24929
|
zh: zh$6,
|
|
24900
24930
|
en: {
|
|
24931
|
+
...accountPoolEn,
|
|
24901
24932
|
title: "Claude API",
|
|
24902
|
-
pageDesc: "
|
|
24933
|
+
pageDesc: "Each account has its own API key and compatible Messages endpoint. The primary account serves first, with automatic failover.",
|
|
24903
24934
|
loading: "Reading the line status…",
|
|
24935
|
+
accountAlias: "Account name",
|
|
24936
|
+
editAccount: "Edit",
|
|
24937
|
+
saveAccount: "Save account",
|
|
24938
|
+
cancel: "Cancel",
|
|
24939
|
+
keyKeepPlaceholder: "Leave blank to keep the current key",
|
|
24904
24940
|
enabled: "Enable Claude API",
|
|
24905
24941
|
keySection: "API Key",
|
|
24906
24942
|
keyPlaceholder: "sk-ant-…",
|
|
@@ -24955,11 +24991,15 @@ window.__ModuleLoader__.load({
|
|
|
24955
24991
|
effortMax: "Maximum",
|
|
24956
24992
|
optionsSection: "Request options",
|
|
24957
24993
|
optionsHint: "These options apply only to requests sent by this line.",
|
|
24958
|
-
cacheTtl: "
|
|
24994
|
+
cacheTtl: "Main conversation prompt cache duration",
|
|
24995
|
+
subagentCacheTtl: "Cache duration for subagents and background requests",
|
|
24996
|
+
subagentCacheTtlHint: "Subagents, context compaction, titles and other requests outside the main conversation.",
|
|
24959
24997
|
cacheTtl5m: "5 minutes",
|
|
24960
24998
|
cacheTtl1h: "1 hour",
|
|
24961
24999
|
fastMode: "Fast mode",
|
|
24962
25000
|
serverCompaction: "Server-side compaction",
|
|
25001
|
+
autoCompactSubagents: "Compact subagents after completion",
|
|
25002
|
+
autoCompactSubagentsHint: "On by default. Only the subagent’s own context is compacted; the main conversation is untouched and failure does not change the task result.",
|
|
24963
25003
|
moreNotes: "Pricing and compatibility notes",
|
|
24964
25004
|
cacheTtlNote: "With 1 hour selected, cache writes are billed at twice the base input price. With the 1-hour duration, while subagents or background tasks are running the line sends one small keepalive request about every 55 minutes so the cache does not expire; the 5-minute duration never does this.",
|
|
24965
25005
|
fastModeNote: "Fast mode is premium-priced and only applies to models that support it.",
|
|
@@ -24983,14 +25023,16 @@ window.__ModuleLoader__.load({
|
|
|
24983
25023
|
*
|
|
24984
25024
|
* GET /status -> ClaudeApiStatusDto
|
|
24985
25025
|
* POST /settings ClaudeApiSettingsUpdateDto -> ClaudeApiStatusDto
|
|
24986
|
-
* POST /
|
|
24987
|
-
*
|
|
25026
|
+
* POST /accounts account CRUD and rotation strategy
|
|
25027
|
+
* POST /key legacy primary-account key update
|
|
25028
|
+
* DELETE /key legacy primary-account delete
|
|
24988
25029
|
* POST /test -> ClaudeApiConnectionDto
|
|
24989
25030
|
* POST /catalog/refresh
|
|
24990
25031
|
*/
|
|
24991
25032
|
const CLAUDE_API_CLIENT_ROUTES = {
|
|
24992
25033
|
status: "/status",
|
|
24993
25034
|
settings: "/settings",
|
|
25035
|
+
accounts: "/accounts",
|
|
24994
25036
|
key: "/key",
|
|
24995
25037
|
test: "/test",
|
|
24996
25038
|
catalogRefresh: "/catalog/refresh"
|
|
@@ -24998,7 +25040,7 @@ window.__ModuleLoader__.load({
|
|
|
24998
25040
|
const api$6 = createLineApi(CLAUDE_API_ROUTE_PREFIX, CLAUDE_API_PROVIDER_NAME);
|
|
24999
25041
|
const get = api$6.get;
|
|
25000
25042
|
const post = api$6.post;
|
|
25001
|
-
|
|
25043
|
+
api$6.request;
|
|
25002
25044
|
const messageOf = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
25003
25045
|
//#endregion
|
|
25004
25046
|
//#region src/client/providers/claude-api/useClaudeApiSection.ts
|
|
@@ -25014,8 +25056,11 @@ window.__ModuleLoader__.load({
|
|
|
25014
25056
|
const [busy, setBusy] = (0, react.useState)(null);
|
|
25015
25057
|
const [error, setError] = (0, react.useState)(null);
|
|
25016
25058
|
const [connection, setConnection] = (0, react.useState)(null);
|
|
25059
|
+
const [accountFormOpen, setAccountFormOpen] = (0, react.useState)(false);
|
|
25060
|
+
const [editingAccountId, setEditingAccountId] = (0, react.useState)(null);
|
|
25061
|
+
const [aliasValue, setAliasValue] = (0, react.useState)("");
|
|
25017
25062
|
const [keyValue, setKeyValue] = (0, react.useState)("");
|
|
25018
|
-
const [endpointDraft, setEndpointDraftState] = (0, react.useState)(
|
|
25063
|
+
const [endpointDraft, setEndpointDraftState] = (0, react.useState)("");
|
|
25019
25064
|
const [endpointError, setEndpointError] = (0, react.useState)(null);
|
|
25020
25065
|
const [contextDrafts, setContextDrafts] = (0, react.useState)({});
|
|
25021
25066
|
const [capacityInvalid, setCapacityInvalid] = (0, react.useState)(false);
|
|
@@ -25109,18 +25154,47 @@ window.__ModuleLoader__.load({
|
|
|
25109
25154
|
change,
|
|
25110
25155
|
onModelChange
|
|
25111
25156
|
]);
|
|
25157
|
+
const openAddAccount = (0, react.useCallback)(() => {
|
|
25158
|
+
setAccountFormOpen(true);
|
|
25159
|
+
setEditingAccountId(null);
|
|
25160
|
+
setAliasValue("");
|
|
25161
|
+
setKeyValue("");
|
|
25162
|
+
setEndpointDraftState(status?.defaultBaseUrl ?? "https://api.anthropic.com");
|
|
25163
|
+
setEndpointError(null);
|
|
25164
|
+
setConnection(null);
|
|
25165
|
+
}, [status?.defaultBaseUrl]);
|
|
25166
|
+
const openEditAccount = (0, react.useCallback)((account) => {
|
|
25167
|
+
setAccountFormOpen(true);
|
|
25168
|
+
setEditingAccountId(account.id);
|
|
25169
|
+
setAliasValue(account.alias);
|
|
25170
|
+
setKeyValue("");
|
|
25171
|
+
setEndpointDraftState(account.baseUrl);
|
|
25172
|
+
setEndpointError(null);
|
|
25173
|
+
setConnection(null);
|
|
25174
|
+
}, []);
|
|
25175
|
+
const cancelAccountForm = (0, react.useCallback)(() => {
|
|
25176
|
+
setAccountFormOpen(false);
|
|
25177
|
+
setEditingAccountId(null);
|
|
25178
|
+
setAliasValue("");
|
|
25179
|
+
setKeyValue("");
|
|
25180
|
+
setEndpointError(null);
|
|
25181
|
+
}, []);
|
|
25112
25182
|
return {
|
|
25113
25183
|
status,
|
|
25114
25184
|
loading,
|
|
25115
25185
|
busy,
|
|
25116
25186
|
error,
|
|
25117
25187
|
connection,
|
|
25188
|
+
accountFormOpen,
|
|
25189
|
+
editingAccountId,
|
|
25190
|
+
aliasValue,
|
|
25118
25191
|
keyValue,
|
|
25119
25192
|
endpointDraft,
|
|
25120
25193
|
endpointError,
|
|
25121
25194
|
contextDrafts,
|
|
25122
25195
|
capacityInvalid,
|
|
25123
25196
|
savingModel,
|
|
25197
|
+
setAliasValue,
|
|
25124
25198
|
setKeyValue,
|
|
25125
25199
|
setEndpointDraft: (draft) => {
|
|
25126
25200
|
setEndpointDraftState(draft);
|
|
@@ -25133,14 +25207,28 @@ window.__ModuleLoader__.load({
|
|
|
25133
25207
|
[id]: draft
|
|
25134
25208
|
}));
|
|
25135
25209
|
},
|
|
25136
|
-
|
|
25137
|
-
|
|
25138
|
-
|
|
25139
|
-
|
|
25210
|
+
openAddAccount,
|
|
25211
|
+
openEditAccount,
|
|
25212
|
+
cancelAccountForm,
|
|
25213
|
+
saveAccount: (0, react.useCallback)(async () => {
|
|
25214
|
+
const normalized = normalizeClaudeApiBaseUrl(endpointDraft);
|
|
25215
|
+
if (!normalized.ok) {
|
|
25216
|
+
setEndpointError(normalized.reason);
|
|
25217
|
+
return;
|
|
25218
|
+
}
|
|
25219
|
+
if (editingAccountId === null && keyValue.trim() === "") return;
|
|
25220
|
+
setBusy("account");
|
|
25140
25221
|
setError(null);
|
|
25222
|
+
setEndpointError(null);
|
|
25141
25223
|
try {
|
|
25142
|
-
await change(() => post(CLAUDE_API_CLIENT_ROUTES.
|
|
25143
|
-
|
|
25224
|
+
await change(() => post(CLAUDE_API_CLIENT_ROUTES.accounts, {
|
|
25225
|
+
action: "save",
|
|
25226
|
+
...editingAccountId === null ? {} : { accountId: editingAccountId },
|
|
25227
|
+
alias: aliasValue,
|
|
25228
|
+
baseUrl: normalized.value,
|
|
25229
|
+
...keyValue.trim() === "" ? {} : { apiKey: keyValue.trim() }
|
|
25230
|
+
}), settle);
|
|
25231
|
+
cancelAccountForm();
|
|
25144
25232
|
setConnection(null);
|
|
25145
25233
|
onModelChange?.();
|
|
25146
25234
|
scheduleFollowUps();
|
|
@@ -25150,34 +25238,62 @@ window.__ModuleLoader__.load({
|
|
|
25150
25238
|
setBusy(null);
|
|
25151
25239
|
}
|
|
25152
25240
|
}, [
|
|
25241
|
+
aliasValue,
|
|
25242
|
+
cancelAccountForm,
|
|
25153
25243
|
change,
|
|
25244
|
+
editingAccountId,
|
|
25245
|
+
endpointDraft,
|
|
25154
25246
|
keyValue,
|
|
25155
25247
|
onModelChange,
|
|
25156
25248
|
scheduleFollowUps,
|
|
25157
25249
|
settle
|
|
25158
25250
|
]),
|
|
25159
|
-
|
|
25160
|
-
setBusy("
|
|
25251
|
+
accountAction: (0, react.useCallback)(async (action, accountId) => {
|
|
25252
|
+
setBusy(action + "-" + accountId);
|
|
25161
25253
|
setError(null);
|
|
25162
25254
|
try {
|
|
25163
|
-
await change(() =>
|
|
25255
|
+
await change(() => post(CLAUDE_API_CLIENT_ROUTES.accounts, {
|
|
25256
|
+
action,
|
|
25257
|
+
accountId
|
|
25258
|
+
}), settle);
|
|
25259
|
+
if (action === "delete" && editingAccountId === accountId) cancelAccountForm();
|
|
25164
25260
|
setConnection(null);
|
|
25165
|
-
|
|
25261
|
+
if (action === "set-primary" || action === "delete") {
|
|
25262
|
+
onModelChange?.();
|
|
25263
|
+
scheduleFollowUps();
|
|
25264
|
+
}
|
|
25166
25265
|
} catch (cause) {
|
|
25167
25266
|
setError(messageOf(cause));
|
|
25168
25267
|
} finally {
|
|
25169
25268
|
setBusy(null);
|
|
25170
25269
|
}
|
|
25171
25270
|
}, [
|
|
25271
|
+
cancelAccountForm,
|
|
25172
25272
|
change,
|
|
25273
|
+
editingAccountId,
|
|
25173
25274
|
onModelChange,
|
|
25275
|
+
scheduleFollowUps,
|
|
25174
25276
|
settle
|
|
25175
25277
|
]),
|
|
25176
|
-
|
|
25177
|
-
setBusy("
|
|
25278
|
+
setStrategy: (0, react.useCallback)(async (rotationStrategy) => {
|
|
25279
|
+
setBusy("strategy");
|
|
25178
25280
|
setError(null);
|
|
25179
25281
|
try {
|
|
25180
|
-
await change(() => post(CLAUDE_API_CLIENT_ROUTES.
|
|
25282
|
+
await change(() => post(CLAUDE_API_CLIENT_ROUTES.accounts, {
|
|
25283
|
+
action: "strategy",
|
|
25284
|
+
strategy: rotationStrategy
|
|
25285
|
+
}), settle);
|
|
25286
|
+
} catch (cause) {
|
|
25287
|
+
setError(messageOf(cause));
|
|
25288
|
+
} finally {
|
|
25289
|
+
setBusy(null);
|
|
25290
|
+
}
|
|
25291
|
+
}, [change, settle]),
|
|
25292
|
+
testConnection: (0, react.useCallback)(async (accountId) => {
|
|
25293
|
+
setBusy("connection" + (accountId ? "-" + accountId : ""));
|
|
25294
|
+
setError(null);
|
|
25295
|
+
try {
|
|
25296
|
+
await change(() => post(CLAUDE_API_CLIENT_ROUTES.test, accountId ? { accountId } : {}), setConnection);
|
|
25181
25297
|
await loadStatus(true);
|
|
25182
25298
|
} catch (cause) {
|
|
25183
25299
|
setError(messageOf(cause));
|
|
@@ -25203,34 +25319,6 @@ window.__ModuleLoader__.load({
|
|
|
25203
25319
|
scheduleFollowUps,
|
|
25204
25320
|
settle
|
|
25205
25321
|
]),
|
|
25206
|
-
saveEndpoint: (0, react.useCallback)(async () => {
|
|
25207
|
-
const result = normalizeClaudeApiBaseUrl(endpointDraft ?? status?.baseUrl ?? "");
|
|
25208
|
-
if (!result.ok) {
|
|
25209
|
-
setEndpointError(result.reason);
|
|
25210
|
-
return;
|
|
25211
|
-
}
|
|
25212
|
-
setEndpointError(null);
|
|
25213
|
-
try {
|
|
25214
|
-
await update({ baseUrl: result.value }, "endpoint");
|
|
25215
|
-
setEndpointDraftState(null);
|
|
25216
|
-
setConnection(null);
|
|
25217
|
-
scheduleFollowUps();
|
|
25218
|
-
} catch {}
|
|
25219
|
-
}, [
|
|
25220
|
-
endpointDraft,
|
|
25221
|
-
scheduleFollowUps,
|
|
25222
|
-
status,
|
|
25223
|
-
update
|
|
25224
|
-
]),
|
|
25225
|
-
restoreEndpoint: (0, react.useCallback)(async () => {
|
|
25226
|
-
setEndpointError(null);
|
|
25227
|
-
try {
|
|
25228
|
-
await update({ baseUrl: null }, "endpoint-reset");
|
|
25229
|
-
setEndpointDraftState(null);
|
|
25230
|
-
setConnection(null);
|
|
25231
|
-
scheduleFollowUps();
|
|
25232
|
-
} catch {}
|
|
25233
|
-
}, [scheduleFollowUps, update]),
|
|
25234
25322
|
update,
|
|
25235
25323
|
toggleModel: (0, react.useCallback)((id, enabled) => {
|
|
25236
25324
|
if (status === null) return;
|
|
@@ -25247,6 +25335,7 @@ window.__ModuleLoader__.load({
|
|
|
25247
25335
|
setCapacityInvalid(true);
|
|
25248
25336
|
return;
|
|
25249
25337
|
}
|
|
25338
|
+
setCapacityInvalid(false);
|
|
25250
25339
|
setSavingModel(id);
|
|
25251
25340
|
try {
|
|
25252
25341
|
await update({ contextWindowOverrides: { [id]: parsed } }, "context:" + id);
|
|
@@ -25268,8 +25357,10 @@ window.__ModuleLoader__.load({
|
|
|
25268
25357
|
}, [status, update]),
|
|
25269
25358
|
setDefaultEffort: (defaultReasoningEffort) => update({ defaultReasoningEffort }, "effort"),
|
|
25270
25359
|
setCacheTtl: (cacheTtl) => update({ cacheTtl }, "options"),
|
|
25360
|
+
setSubagentCacheTtl: (subagentCacheTtl) => update({ subagentCacheTtl }, "options"),
|
|
25271
25361
|
setFastMode: (fastMode) => update({ fastMode }, "options"),
|
|
25272
|
-
setServerCompaction: (serverCompaction) => update({ serverCompaction }, "options")
|
|
25362
|
+
setServerCompaction: (serverCompaction) => update({ serverCompaction }, "options"),
|
|
25363
|
+
setAutoCompactSubagents: (autoCompactSubagents) => update({ autoCompactSubagents }, "options")
|
|
25273
25364
|
};
|
|
25274
25365
|
}
|
|
25275
25366
|
//#endregion
|
|
@@ -25311,31 +25402,47 @@ window.__ModuleLoader__.load({
|
|
|
25311
25402
|
});
|
|
25312
25403
|
const models = status?.models ?? [];
|
|
25313
25404
|
const enabledModels = models.filter((model) => model.enabled);
|
|
25314
|
-
const
|
|
25405
|
+
const accounts = status?.accounts ?? [];
|
|
25315
25406
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25316
25407
|
className: "dsha-page dshca-page",
|
|
25317
25408
|
"data-provider": "claude-api",
|
|
25318
25409
|
children: [
|
|
25319
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
25320
|
-
|
|
25410
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(AccountPoolSection, {
|
|
25411
|
+
accounts,
|
|
25412
|
+
activeAccountId: status?.activeAccountId,
|
|
25413
|
+
rotationStrategy: status?.rotationStrategy ?? "sequential",
|
|
25414
|
+
busy,
|
|
25415
|
+
labels: {
|
|
25416
|
+
...t,
|
|
25417
|
+
accountPool: t.title
|
|
25418
|
+
},
|
|
25419
|
+
onLogin: view.openAddAccount,
|
|
25420
|
+
onSetPrimary: (id) => void view.accountAction("set-primary", id),
|
|
25421
|
+
onDelete: (id) => void view.accountAction("delete", id),
|
|
25422
|
+
onClearCooldown: (id) => void view.accountAction("clear-cooldown", id),
|
|
25423
|
+
onRelogin: (id) => {
|
|
25424
|
+
const account = accounts.find((entry) => entry.id === id);
|
|
25425
|
+
if (account) view.openEditAccount(account);
|
|
25426
|
+
},
|
|
25427
|
+
onSetStrategy: (strategy) => void view.setStrategy(strategy),
|
|
25428
|
+
omitDetails: ["email", "expires"],
|
|
25429
|
+
renderDetails: (entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
25430
|
+
t.endpoint,
|
|
25431
|
+
": ",
|
|
25432
|
+
entry.baseUrl
|
|
25433
|
+
] }),
|
|
25434
|
+
renderAccountActions: (entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
25435
|
+
className: "dsha-btn",
|
|
25436
|
+
disabled: busy !== null,
|
|
25437
|
+
onClick: () => view.openEditAccount(entry),
|
|
25438
|
+
children: t.editAccount
|
|
25439
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
25440
|
+
className: "dsha-btn",
|
|
25441
|
+
disabled: busy !== null,
|
|
25442
|
+
onClick: () => void view.testConnection(entry.id),
|
|
25443
|
+
children: busy === "connection-" + entry.id ? t.testingConnection : t.testConnection
|
|
25444
|
+
})] }),
|
|
25321
25445
|
children: [
|
|
25322
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25323
|
-
className: "dsha-grouphead",
|
|
25324
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t.title }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25325
|
-
className: "dsha-actions",
|
|
25326
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
25327
|
-
className: "dsha-btn",
|
|
25328
|
-
disabled: busy !== null || !status?.authenticated,
|
|
25329
|
-
onClick: () => void view.testConnection(),
|
|
25330
|
-
children: busy === "connection" ? t.testingConnection : t.testConnection
|
|
25331
|
-
}), status?.authenticated && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
25332
|
-
className: "dsha-btn",
|
|
25333
|
-
disabled: busy !== null,
|
|
25334
|
-
onClick: () => void view.removeKey(),
|
|
25335
|
-
children: busy === "remove-key" ? t.removingKey : t.removeKey
|
|
25336
|
-
})]
|
|
25337
|
-
})]
|
|
25338
|
-
}),
|
|
25339
25446
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
25340
25447
|
className: "dsha-muted",
|
|
25341
25448
|
children: t.pageDesc
|
|
@@ -25350,19 +25457,86 @@ window.__ModuleLoader__.load({
|
|
|
25350
25457
|
onChange: (event) => void view.update({ enabled: event.currentTarget.checked }).catch(() => void 0)
|
|
25351
25458
|
})]
|
|
25352
25459
|
}),
|
|
25353
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
25354
|
-
className: "
|
|
25355
|
-
children:
|
|
25356
|
-
|
|
25357
|
-
|
|
25358
|
-
|
|
25359
|
-
|
|
25360
|
-
|
|
25361
|
-
|
|
25362
|
-
|
|
25363
|
-
|
|
25364
|
-
|
|
25365
|
-
|
|
25460
|
+
view.accountFormOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25461
|
+
className: "dshca-account-form",
|
|
25462
|
+
children: [
|
|
25463
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25464
|
+
className: "dsha-pref-row",
|
|
25465
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t.accountAlias }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
25466
|
+
className: "dsha-select",
|
|
25467
|
+
type: "text",
|
|
25468
|
+
"aria-label": t.accountAlias,
|
|
25469
|
+
value: view.aliasValue,
|
|
25470
|
+
disabled: busy !== null,
|
|
25471
|
+
onChange: (event) => view.setAliasValue(event.currentTarget.value),
|
|
25472
|
+
onKeyDown: (event) => {
|
|
25473
|
+
if (event.key === "Enter") view.saveAccount();
|
|
25474
|
+
}
|
|
25475
|
+
})]
|
|
25476
|
+
}),
|
|
25477
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25478
|
+
className: "dsha-pref-row dshca-endpoint-row",
|
|
25479
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t.endpoint }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25480
|
+
className: "dshca-endpoint-control",
|
|
25481
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
25482
|
+
className: "dsha-select",
|
|
25483
|
+
type: "text",
|
|
25484
|
+
inputMode: "url",
|
|
25485
|
+
autoComplete: "off",
|
|
25486
|
+
spellCheck: false,
|
|
25487
|
+
"aria-label": t.endpoint,
|
|
25488
|
+
"aria-invalid": view.endpointError !== null,
|
|
25489
|
+
placeholder: status?.defaultBaseUrl ?? "https://api.anthropic.com",
|
|
25490
|
+
value: view.endpointDraft,
|
|
25491
|
+
disabled: busy !== null,
|
|
25492
|
+
onChange: (event) => view.setEndpointDraft(event.currentTarget.value),
|
|
25493
|
+
onKeyDown: (event) => {
|
|
25494
|
+
if (event.key === "Enter") view.saveAccount();
|
|
25495
|
+
}
|
|
25496
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
25497
|
+
className: "dsha-btn",
|
|
25498
|
+
disabled: busy !== null,
|
|
25499
|
+
onClick: () => view.setEndpointDraft(status?.defaultBaseUrl ?? "https://api.anthropic.com"),
|
|
25500
|
+
children: t.restoreEndpoint
|
|
25501
|
+
})]
|
|
25502
|
+
})]
|
|
25503
|
+
}),
|
|
25504
|
+
view.endpointError !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
25505
|
+
className: "dsha-error dshca-endpoint-error",
|
|
25506
|
+
role: "alert",
|
|
25507
|
+
children: t[ENDPOINT_ERROR_KEYS[view.endpointError]]
|
|
25508
|
+
}),
|
|
25509
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25510
|
+
className: "dshca-key-row",
|
|
25511
|
+
children: [
|
|
25512
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
25513
|
+
className: "dsha-select",
|
|
25514
|
+
type: "password",
|
|
25515
|
+
autoComplete: "off",
|
|
25516
|
+
"aria-label": t.keySection,
|
|
25517
|
+
placeholder: view.editingAccountId === null ? t.keyPlaceholder : t.keyKeepPlaceholder,
|
|
25518
|
+
value: view.keyValue,
|
|
25519
|
+
disabled: busy !== null,
|
|
25520
|
+
onChange: (event) => view.setKeyValue(event.currentTarget.value),
|
|
25521
|
+
onKeyDown: (event) => {
|
|
25522
|
+
if (event.key === "Enter") view.saveAccount();
|
|
25523
|
+
}
|
|
25524
|
+
}),
|
|
25525
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
25526
|
+
className: "dsha-btn dsha-btn-primary",
|
|
25527
|
+
disabled: busy !== null || view.editingAccountId === null && view.keyValue.trim() === "",
|
|
25528
|
+
onClick: () => void view.saveAccount(),
|
|
25529
|
+
children: busy === "account" ? t.savingKey : t.saveAccount
|
|
25530
|
+
}),
|
|
25531
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
25532
|
+
className: "dsha-btn",
|
|
25533
|
+
disabled: busy !== null,
|
|
25534
|
+
onClick: view.cancelAccountForm,
|
|
25535
|
+
children: t.cancel
|
|
25536
|
+
})
|
|
25537
|
+
]
|
|
25538
|
+
})
|
|
25539
|
+
]
|
|
25366
25540
|
}),
|
|
25367
25541
|
status !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25368
25542
|
className: "dsha-row dshca-version-row",
|
|
@@ -25374,68 +25548,6 @@ window.__ModuleLoader__.load({
|
|
|
25374
25548
|
children: status.clientVersion.value + SEPARATOR + t[VERSION_SOURCE_KEYS[status.clientVersion.source]] + (status.clientVersion.pending !== null ? SEPARATOR + t.versionPending.replace("{version}", status.clientVersion.pending) : "")
|
|
25375
25549
|
})]
|
|
25376
25550
|
}),
|
|
25377
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25378
|
-
className: "dsha-pref-row dshca-endpoint-row",
|
|
25379
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t.endpoint }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25380
|
-
className: "dshca-endpoint-control",
|
|
25381
|
-
children: [
|
|
25382
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
25383
|
-
className: "dsha-select",
|
|
25384
|
-
type: "text",
|
|
25385
|
-
inputMode: "url",
|
|
25386
|
-
autoComplete: "off",
|
|
25387
|
-
spellCheck: false,
|
|
25388
|
-
"aria-label": t.endpoint,
|
|
25389
|
-
"aria-invalid": view.endpointError !== null,
|
|
25390
|
-
placeholder: status?.defaultBaseUrl ?? "https://api.anthropic.com",
|
|
25391
|
-
value: view.endpointDraft ?? status?.baseUrl ?? "",
|
|
25392
|
-
disabled: busy !== null,
|
|
25393
|
-
onChange: (event) => view.setEndpointDraft(event.currentTarget.value),
|
|
25394
|
-
onKeyDown: (event) => {
|
|
25395
|
-
if (event.key === "Enter") view.saveEndpoint();
|
|
25396
|
-
}
|
|
25397
|
-
}),
|
|
25398
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
25399
|
-
className: "dsha-btn",
|
|
25400
|
-
disabled: busy !== null || view.endpointDraft === null,
|
|
25401
|
-
onClick: () => void view.saveEndpoint(),
|
|
25402
|
-
children: busy === "endpoint" ? t.saving : t.save
|
|
25403
|
-
}),
|
|
25404
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
25405
|
-
className: "dsha-btn",
|
|
25406
|
-
disabled: busy !== null || endpointIsDefault && view.endpointDraft === null,
|
|
25407
|
-
onClick: () => void view.restoreEndpoint(),
|
|
25408
|
-
children: t.restoreEndpoint
|
|
25409
|
-
})
|
|
25410
|
-
]
|
|
25411
|
-
})]
|
|
25412
|
-
}),
|
|
25413
|
-
view.endpointError !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
25414
|
-
className: "dsha-error dshca-endpoint-error",
|
|
25415
|
-
role: "alert",
|
|
25416
|
-
children: t[ENDPOINT_ERROR_KEYS[view.endpointError]]
|
|
25417
|
-
}),
|
|
25418
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25419
|
-
className: "dshca-key-row",
|
|
25420
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
25421
|
-
className: "dsha-select",
|
|
25422
|
-
type: "password",
|
|
25423
|
-
autoComplete: "off",
|
|
25424
|
-
"aria-label": t.keySection,
|
|
25425
|
-
placeholder: t.keyPlaceholder,
|
|
25426
|
-
value: view.keyValue,
|
|
25427
|
-
disabled: busy !== null,
|
|
25428
|
-
onChange: (event) => view.setKeyValue(event.currentTarget.value),
|
|
25429
|
-
onKeyDown: (event) => {
|
|
25430
|
-
if (event.key === "Enter") view.saveKey();
|
|
25431
|
-
}
|
|
25432
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
25433
|
-
className: "dsha-btn dsha-btn-primary",
|
|
25434
|
-
disabled: busy !== null || view.keyValue.trim() === "",
|
|
25435
|
-
onClick: () => void view.saveKey(),
|
|
25436
|
-
children: busy === "key" ? t.savingKey : t.saveKey
|
|
25437
|
-
})]
|
|
25438
|
-
}),
|
|
25439
25551
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
25440
25552
|
className: "dsha-muted",
|
|
25441
25553
|
children: status?.serving === false && status.conflict ? t.routeConflict.replace("{detail}", status.conflict) : t.routeOwned
|
|
@@ -25559,6 +25671,26 @@ window.__ModuleLoader__.load({
|
|
|
25559
25671
|
}, ttl))
|
|
25560
25672
|
})]
|
|
25561
25673
|
}),
|
|
25674
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25675
|
+
className: "dsha-pref-row",
|
|
25676
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t.subagentCacheTtl }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
25677
|
+
className: "dsha-muted",
|
|
25678
|
+
children: t.subagentCacheTtlHint
|
|
25679
|
+
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
25680
|
+
className: "dsha-select",
|
|
25681
|
+
"aria-label": t.subagentCacheTtl,
|
|
25682
|
+
value: status?.subagentCacheTtl ?? "5m",
|
|
25683
|
+
disabled: busy !== null || status === null,
|
|
25684
|
+
onChange: (event) => {
|
|
25685
|
+
const value = event.currentTarget.value;
|
|
25686
|
+
if (isClaudeApiCacheTtl(value)) view.setSubagentCacheTtl(value).catch(() => void 0);
|
|
25687
|
+
},
|
|
25688
|
+
children: CLAUDE_API_CACHE_TTLS.map((ttl) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
25689
|
+
value: ttl,
|
|
25690
|
+
children: t[CACHE_TTL_KEYS[ttl]]
|
|
25691
|
+
}, ttl))
|
|
25692
|
+
})]
|
|
25693
|
+
}),
|
|
25562
25694
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25563
25695
|
className: "dsha-pref-row",
|
|
25564
25696
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t.fastMode }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
@@ -25579,6 +25711,19 @@ window.__ModuleLoader__.load({
|
|
|
25579
25711
|
onChange: (event) => void view.setServerCompaction(event.currentTarget.checked).catch(() => void 0)
|
|
25580
25712
|
})]
|
|
25581
25713
|
}),
|
|
25714
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25715
|
+
className: "dsha-pref-row",
|
|
25716
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t.autoCompactSubagents }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
25717
|
+
className: "dsha-muted",
|
|
25718
|
+
children: t.autoCompactSubagentsHint
|
|
25719
|
+
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
25720
|
+
type: "checkbox",
|
|
25721
|
+
"aria-label": t.autoCompactSubagents,
|
|
25722
|
+
checked: status?.autoCompactSubagents !== false,
|
|
25723
|
+
disabled: busy !== null || status === null,
|
|
25724
|
+
onChange: (event) => void view.setAutoCompactSubagents(event.currentTarget.checked).catch(() => void 0)
|
|
25725
|
+
})]
|
|
25726
|
+
}),
|
|
25582
25727
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
|
|
25583
25728
|
className: "dshca-details",
|
|
25584
25729
|
children: [
|
|
@@ -27939,6 +28084,8 @@ window.__ModuleLoader__.load({
|
|
|
27939
28084
|
fastModeHint: "Host отправляет speed: fast только поддерживаемым моделям; при отказе исправляет запрос и запоминает результат.",
|
|
27940
28085
|
cacheKeepalive: "cache-keepalive (cache_touch)",
|
|
27941
28086
|
cacheKeepaliveHint: "По умолчанию выключено; для диалога 1 ч сначала cache_touch, при ошибке — прежний keepalive. Реальная подписка напрямую ещё не проверена.",
|
|
28087
|
+
autoCompactSubagents: "Автоматически сжимать субагентов после завершения",
|
|
28088
|
+
autoCompactSubagentsHint: "Включено по умолчанию. После запуска сжимается только контекст самого субагента для последующих обращений; основной диалог не меняется, а ошибка сжатия не меняет результат задачи.",
|
|
27942
28089
|
effortLow: "Низкий (low)",
|
|
27943
28090
|
effortMedium: "Средний (medium)",
|
|
27944
28091
|
effortHigh: "Высокий (high)",
|
|
@@ -29955,9 +30102,17 @@ window.__ModuleLoader__.load({
|
|
|
29955
30102
|
//#endregion
|
|
29956
30103
|
//#region src/client/locales-ru/claude-api.ts
|
|
29957
30104
|
const dictionary$6 = {
|
|
30105
|
+
...accountPoolRu,
|
|
30106
|
+
strategySequential: "Последовательно (сначала основной, затем резервный)",
|
|
30107
|
+
noAccounts: "Аккаунтов пока нет. Добавьте адрес и API-ключ.",
|
|
29958
30108
|
title: "Claude API",
|
|
29959
|
-
pageDesc: "
|
|
30109
|
+
pageDesc: "У каждого аккаунта свой API-ключ и совместимый эндпоинт Messages; сначала используется основной, при сбое — резервный.",
|
|
29960
30110
|
loading: "Чтение состояния линии…",
|
|
30111
|
+
accountAlias: "Имя аккаунта",
|
|
30112
|
+
editAccount: "Изменить",
|
|
30113
|
+
saveAccount: "Сохранить аккаунт",
|
|
30114
|
+
cancel: "Отмена",
|
|
30115
|
+
keyKeepPlaceholder: "Оставьте пустым, чтобы сохранить текущий ключ",
|
|
29961
30116
|
enabled: "Включить Claude API",
|
|
29962
30117
|
keySection: "API-ключ",
|
|
29963
30118
|
keyPlaceholder: "sk-ant-…",
|
|
@@ -30012,11 +30167,15 @@ window.__ModuleLoader__.load({
|
|
|
30012
30167
|
effortMax: "Максимальный",
|
|
30013
30168
|
optionsSection: "Параметры запросов",
|
|
30014
30169
|
optionsHint: "Эти параметры действуют только на запросы этой линии.",
|
|
30015
|
-
cacheTtl: "Срок кэша
|
|
30170
|
+
cacheTtl: "Срок кэша основного диалога",
|
|
30171
|
+
subagentCacheTtl: "Срок кэша субагентов и фоновых запросов",
|
|
30172
|
+
subagentCacheTtlHint: "Субагенты, сжатие контекста, заголовки и другие запросы вне основного диалога.",
|
|
30016
30173
|
cacheTtl5m: "5 минут",
|
|
30017
30174
|
cacheTtl1h: "1 час",
|
|
30018
30175
|
fastMode: "Быстрый режим",
|
|
30019
30176
|
serverCompaction: "Сжатие на стороне сервера",
|
|
30177
|
+
autoCompactSubagents: "Автоматически сжимать субагентов после завершения",
|
|
30178
|
+
autoCompactSubagentsHint: "Включено по умолчанию. Сжимается только контекст субагента; основной диалог не меняется, а ошибка сжатия не меняет результат задачи.",
|
|
30020
30179
|
moreNotes: "Тарификация и совместимость",
|
|
30021
30180
|
cacheTtlNote: "При выборе 1 часа запись в кэш оплачивается по двойной базовой цене входных токенов. При длительности 1 час, пока работают субагенты или фоновые задачи, линия примерно каждые 55 минут отправляет один небольшой запрос поддержания кэша, чтобы срок кэша не истёк; при длительности 5 минут этого не происходит.",
|
|
30022
30181
|
fastModeNote: "Быстрый режим оплачивается по повышенному тарифу и действует только для моделей, которые его поддерживают.",
|
|
@@ -65452,7 +65611,8 @@ window.__ModuleLoader__.load({
|
|
|
65452
65611
|
function installClaudeApiStyles() {
|
|
65453
65612
|
installPluginStyle("claude-api", `
|
|
65454
65613
|
.dshca-page{display:flex;flex-direction:column;gap:12px}
|
|
65455
|
-
.dshca-
|
|
65614
|
+
.dshca-account-form{border-top:0.5px solid var(--dsw-alias-border-l2);margin-top:10px;padding-top:10px}
|
|
65615
|
+
.dshca-key-row{align-items:stretch;display:grid;gap:8px;grid-template-columns:minmax(0,1fr) auto auto;margin-top:10px;width:100%}
|
|
65456
65616
|
.dshca-key-row input{box-sizing:border-box;display:block;height:32px;max-width:none;min-width:0;width:100%}
|
|
65457
65617
|
.dshca-key-row .dsha-btn{align-items:center;display:inline-flex;height:32px;justify-content:center;min-width:80px;white-space:nowrap}
|
|
65458
65618
|
.dshca-endpoint-control{align-items:center;display:flex;flex:1 1 auto;gap:8px;justify-content:flex-end;min-width:0}
|
|
@@ -65609,6 +65769,9 @@ window.__ModuleLoader__.load({
|
|
|
65609
65769
|
function nativeAllowedRoutes(defaults, overrides) {
|
|
65610
65770
|
return cloneRoutes([...defaults, ...Object.values(overrides).flat()]);
|
|
65611
65771
|
}
|
|
65772
|
+
function sameDefaultModel(left, right) {
|
|
65773
|
+
return left === void 0 || right === void 0 ? left === right : routeKey(left) === routeKey(right);
|
|
65774
|
+
}
|
|
65612
65775
|
function sameRouteSet(left, right) {
|
|
65613
65776
|
if (left.length !== right.length) return false;
|
|
65614
65777
|
const keys = new Set(right.map(routeKey));
|
|
@@ -65852,6 +66015,7 @@ window.__ModuleLoader__.load({
|
|
|
65852
66015
|
draftActive;
|
|
65853
66016
|
draftActiveCleared = false;
|
|
65854
66017
|
draftEnabled;
|
|
66018
|
+
draftDefaultModel;
|
|
65855
66019
|
draftDefault;
|
|
65856
66020
|
draftOverrides;
|
|
65857
66021
|
draftDefaultFork;
|
|
@@ -65920,6 +66084,9 @@ window.__ModuleLoader__.load({
|
|
|
65920
66084
|
resetLimit: (field) => {
|
|
65921
66085
|
this.resetLimit(field);
|
|
65922
66086
|
},
|
|
66087
|
+
selectDefaultModel: (key) => {
|
|
66088
|
+
this.selectDefaultModel(key);
|
|
66089
|
+
},
|
|
65923
66090
|
toggleEnabled: () => {
|
|
65924
66091
|
this.toggleEnabled();
|
|
65925
66092
|
},
|
|
@@ -65985,6 +66152,18 @@ window.__ModuleLoader__.load({
|
|
|
65985
66152
|
currentEnabled() {
|
|
65986
66153
|
return this.modelSelection.getSnapshot().value?.enabled === true;
|
|
65987
66154
|
}
|
|
66155
|
+
/** 宿主保存的子智能体默认模型(省略表示继承父 Agent)。 */
|
|
66156
|
+
currentDefaultModel() {
|
|
66157
|
+
const raw = this.modelSelection.getSnapshot().value?.defaultModel;
|
|
66158
|
+
if (typeof raw?.provider !== "string" || typeof raw?.model !== "string") return void 0;
|
|
66159
|
+
const provider = raw.provider.trim();
|
|
66160
|
+
const model = raw.model.trim();
|
|
66161
|
+
if (provider.length === 0 || model.length === 0 || provider === "undefined" || model === "undefined") return void 0;
|
|
66162
|
+
return {
|
|
66163
|
+
provider,
|
|
66164
|
+
model
|
|
66165
|
+
};
|
|
66166
|
+
}
|
|
65988
66167
|
/**
|
|
65989
66168
|
* 全局默认列表。
|
|
65990
66169
|
*
|
|
@@ -66020,6 +66199,9 @@ window.__ModuleLoader__.load({
|
|
|
66020
66199
|
enabled() {
|
|
66021
66200
|
return this.draftEnabled ?? this.currentEnabled();
|
|
66022
66201
|
}
|
|
66202
|
+
desiredDefaultModel() {
|
|
66203
|
+
return this.draftDefault !== void 0 ? this.draftDefaultModel : this.currentDefaultModel();
|
|
66204
|
+
}
|
|
66023
66205
|
defaultRoutes() {
|
|
66024
66206
|
return cloneRoutes(this.draftDefault ?? this.currentDefault());
|
|
66025
66207
|
}
|
|
@@ -66049,6 +66231,7 @@ window.__ModuleLoader__.load({
|
|
|
66049
66231
|
ensureDraft() {
|
|
66050
66232
|
if (this.draftDefault !== void 0) return;
|
|
66051
66233
|
this.draftEnabled = this.currentEnabled();
|
|
66234
|
+
this.draftDefaultModel = this.currentDefaultModel();
|
|
66052
66235
|
this.draftDefault = this.currentDefault();
|
|
66053
66236
|
this.draftOverrides = this.currentOverrides();
|
|
66054
66237
|
this.draftDefaultFork = this.currentDefaultFork();
|
|
@@ -66061,6 +66244,7 @@ window.__ModuleLoader__.load({
|
|
|
66061
66244
|
this.draftActive = void 0;
|
|
66062
66245
|
this.draftActiveCleared = false;
|
|
66063
66246
|
this.draftEnabled = void 0;
|
|
66247
|
+
this.draftDefaultModel = void 0;
|
|
66064
66248
|
this.draftDefault = void 0;
|
|
66065
66249
|
this.draftOverrides = void 0;
|
|
66066
66250
|
this.draftDefaultFork = void 0;
|
|
@@ -66094,6 +66278,27 @@ window.__ModuleLoader__.load({
|
|
|
66094
66278
|
this.failed = false;
|
|
66095
66279
|
this.publish();
|
|
66096
66280
|
}
|
|
66281
|
+
selectDefaultModel(key) {
|
|
66282
|
+
const snapshot = this.modelSelection.getSnapshot();
|
|
66283
|
+
if (this.saving || snapshot.status !== "ready" || !snapshot.writable) return;
|
|
66284
|
+
if (key === void 0 || key === "") {
|
|
66285
|
+
this.ensureDraft();
|
|
66286
|
+
this.draftDefaultModel = void 0;
|
|
66287
|
+
this.failed = false;
|
|
66288
|
+
this.publish();
|
|
66289
|
+
return;
|
|
66290
|
+
}
|
|
66291
|
+
const candidate = this.defaultModelCandidates().find((item) => item.key === key);
|
|
66292
|
+
const route = candidate !== void 0 ? {
|
|
66293
|
+
provider: candidate.provider,
|
|
66294
|
+
model: candidate.model
|
|
66295
|
+
} : parseRouteKey(key);
|
|
66296
|
+
if (route === void 0) return;
|
|
66297
|
+
this.ensureDraft();
|
|
66298
|
+
this.draftDefaultModel = route;
|
|
66299
|
+
this.failed = false;
|
|
66300
|
+
this.publish();
|
|
66301
|
+
}
|
|
66097
66302
|
toggleEnabled() {
|
|
66098
66303
|
const snapshot = this.modelSelection.getSnapshot();
|
|
66099
66304
|
if (this.saving || snapshot.status !== "ready" || !snapshot.writable) return;
|
|
@@ -66184,6 +66389,41 @@ window.__ModuleLoader__.load({
|
|
|
66184
66389
|
this.clearDraft();
|
|
66185
66390
|
this.publish();
|
|
66186
66391
|
}
|
|
66392
|
+
/** 默认子智能体模型下拉候选:全量目录模型 + 当前/草稿中已保存但暂不可用的默认路由。 */
|
|
66393
|
+
defaultModelCandidates() {
|
|
66394
|
+
const desired = this.desiredDefaultModel();
|
|
66395
|
+
const desiredKey = desired === void 0 ? void 0 : routeKey(desired);
|
|
66396
|
+
const retained = /* @__PURE__ */ new Map();
|
|
66397
|
+
for (const route of [this.currentDefaultModel(), desired]) if (route !== void 0) retained.set(routeKey(route), route);
|
|
66398
|
+
const rows = [];
|
|
66399
|
+
for (const group of this.catalogGroups) {
|
|
66400
|
+
if (!group.provider || group.provider === "undefined") continue;
|
|
66401
|
+
for (const model of group.models) {
|
|
66402
|
+
if (!model.id || model.id === "undefined") continue;
|
|
66403
|
+
const key = `${group.provider}/${model.id}`;
|
|
66404
|
+
retained.delete(key);
|
|
66405
|
+
rows.push({
|
|
66406
|
+
provider: group.provider,
|
|
66407
|
+
model: model.id,
|
|
66408
|
+
key,
|
|
66409
|
+
providerName: group.providerName,
|
|
66410
|
+
modelName: model.name,
|
|
66411
|
+
available: true,
|
|
66412
|
+
selected: desiredKey === key
|
|
66413
|
+
});
|
|
66414
|
+
}
|
|
66415
|
+
}
|
|
66416
|
+
for (const [key, route] of retained) rows.push({
|
|
66417
|
+
provider: route.provider,
|
|
66418
|
+
model: route.model,
|
|
66419
|
+
key,
|
|
66420
|
+
providerName: route.provider,
|
|
66421
|
+
modelName: route.model,
|
|
66422
|
+
available: false,
|
|
66423
|
+
selected: desiredKey === key
|
|
66424
|
+
});
|
|
66425
|
+
return rows;
|
|
66426
|
+
}
|
|
66187
66427
|
/** 当前目标的候选行:目录 ∪ 已保存 ∪ 草稿里出现的每一条。 */
|
|
66188
66428
|
candidates() {
|
|
66189
66429
|
const selected = new Set(this.activeRoutes().map(routeKey));
|
|
@@ -66261,6 +66501,7 @@ window.__ModuleLoader__.load({
|
|
|
66261
66501
|
const state = this.store.getSnapshot();
|
|
66262
66502
|
if (this.disposed || this.saving || !state.available || !state.writable || !state.dirty || state.invalid) return;
|
|
66263
66503
|
const desiredEnabled = this.enabled();
|
|
66504
|
+
const desiredDefaultModel = this.desiredDefaultModel();
|
|
66264
66505
|
const desiredDefault = this.defaultRoutes();
|
|
66265
66506
|
const desiredOverrides = this.overrides();
|
|
66266
66507
|
const desiredDefaultFork = this.defaultAllowParentFork();
|
|
@@ -66303,22 +66544,35 @@ window.__ModuleLoader__.load({
|
|
|
66303
66544
|
const unionRoutes = nativeAllowedRoutes(desiredDefault, desiredOverrides);
|
|
66304
66545
|
const scope = this.modelSelection;
|
|
66305
66546
|
const modelSnapshot = scope.getSnapshot();
|
|
66306
|
-
|
|
66307
|
-
|
|
66308
|
-
|
|
66309
|
-
|
|
66310
|
-
|
|
66311
|
-
|
|
66312
|
-
|
|
66313
|
-
|
|
66314
|
-
|
|
66315
|
-
|
|
66547
|
+
const defaultModelDirty = !sameDefaultModel(this.currentDefaultModel(), desiredDefaultModel);
|
|
66548
|
+
if ((this.currentEnabled() !== desiredEnabled || !sameRouteSet(modelSnapshot.value?.allowedModels ?? [], unionRoutes) || defaultModelDirty) && modelSnapshot.status === "ready") {
|
|
66549
|
+
const ops = [
|
|
66550
|
+
{
|
|
66551
|
+
op: "set",
|
|
66552
|
+
path: ["enabled"],
|
|
66553
|
+
value: desiredEnabled
|
|
66554
|
+
},
|
|
66555
|
+
{
|
|
66556
|
+
op: "set",
|
|
66557
|
+
path: ["allowedModels"],
|
|
66558
|
+
value: unionRoutes
|
|
66559
|
+
},
|
|
66560
|
+
...defaultModelDirty ? [desiredDefaultModel === void 0 ? {
|
|
66561
|
+
op: "unset",
|
|
66562
|
+
path: ["defaultModel"]
|
|
66563
|
+
} : {
|
|
66564
|
+
op: "set",
|
|
66565
|
+
path: ["defaultModel"],
|
|
66566
|
+
value: { ...desiredDefaultModel }
|
|
66567
|
+
}] : []
|
|
66568
|
+
];
|
|
66316
66569
|
if (typeof scope.mutate === "function") {
|
|
66317
66570
|
if (await scope.mutate(ops, modelSnapshot.revision ?? this.draftRevision) === false) throw new Error("The deployment rejected the subagent model selection settings.");
|
|
66318
66571
|
} else if (typeof scope.set === "function") {
|
|
66319
66572
|
const ok1 = await scope.set("enabled", desiredEnabled);
|
|
66320
66573
|
const ok2 = await scope.set("allowedModels", unionRoutes);
|
|
66321
|
-
|
|
66574
|
+
const ok3 = defaultModelDirty ? await scope.set("defaultModel", desiredDefaultModel) : true;
|
|
66575
|
+
if (ok1 === false || ok2 === false || ok3 === false) throw new Error("The deployment rejected the subagent model selection settings.");
|
|
66322
66576
|
}
|
|
66323
66577
|
}
|
|
66324
66578
|
if (state.maxDepth.invalid || state.maxActiveSubagents.invalid) throw new Error("invalid limits");
|
|
@@ -66393,6 +66647,8 @@ window.__ModuleLoader__.load({
|
|
|
66393
66647
|
const maxDepth = this.limitField("maxDepth", 0, 1);
|
|
66394
66648
|
const maxActive = this.limitField("maxActiveSubagents", 1, 8);
|
|
66395
66649
|
const enabled = this.enabled();
|
|
66650
|
+
const desiredDefaultModel = this.desiredDefaultModel();
|
|
66651
|
+
const currentDefaultModel = this.currentDefaultModel();
|
|
66396
66652
|
const desiredDefault = this.defaultRoutes();
|
|
66397
66653
|
const desiredOverrides = this.overrides();
|
|
66398
66654
|
const desiredDefaultFork = this.defaultAllowParentFork();
|
|
@@ -66403,7 +66659,7 @@ window.__ModuleLoader__.load({
|
|
|
66403
66659
|
const currentForkOverrides = this.currentForkOverrides();
|
|
66404
66660
|
const hostAllowed = cloneRoutes(modelSnapshot.value?.allowedModels ?? []);
|
|
66405
66661
|
const pendingRouteSync = modelsAvailable && (this.draftDefault !== void 0 || enabled && this.preferencesStatus === "ready") && !sameRouteSet(hostAllowed, nativeAllowedRoutes(desiredDefault, desiredOverrides));
|
|
66406
|
-
const modelsDirty = this.currentEnabled() !== enabled || !sameRouteSet(currentDefault, desiredDefault) || !sameOverrides(currentOverrides, desiredOverrides) || currentDefaultFork !== desiredDefaultFork || !sameForkOverrides(currentForkOverrides, desiredForkOverrides) || pendingRouteSync;
|
|
66662
|
+
const modelsDirty = this.currentEnabled() !== enabled || !sameDefaultModel(currentDefaultModel, desiredDefaultModel) || !sameRouteSet(currentDefault, desiredDefault) || !sameOverrides(currentOverrides, desiredOverrides) || currentDefaultFork !== desiredDefaultFork || !sameForkOverrides(currentForkOverrides, desiredForkOverrides) || pendingRouteSync;
|
|
66407
66663
|
const depthPersistedOverridden = userHas(limitsSnapshot.user, "maxDepth");
|
|
66408
66664
|
const activePersistedOverridden = userHas(limitsSnapshot.user, "maxActiveSubagents");
|
|
66409
66665
|
const depthDirty = this.draftDepthCleared ? depthPersistedOverridden : this.draftDepth !== void 0 && maxDepth.value !== String(readNumber(limitsSnapshot.value, "maxDepth", 1));
|
|
@@ -66423,6 +66679,8 @@ window.__ModuleLoader__.load({
|
|
|
66423
66679
|
maxDepth,
|
|
66424
66680
|
maxActiveSubagents: maxActive,
|
|
66425
66681
|
enabled,
|
|
66682
|
+
defaultModelKey: desiredDefaultModel === void 0 ? void 0 : routeKey(desiredDefaultModel),
|
|
66683
|
+
defaultModelCandidates: this.defaultModelCandidates(),
|
|
66426
66684
|
activeTarget: this.activeTarget,
|
|
66427
66685
|
defaultCount: desiredDefault.length,
|
|
66428
66686
|
overridesByMainModel: desiredOverrides,
|
|
@@ -66641,8 +66899,47 @@ window.__ModuleLoader__.load({
|
|
|
66641
66899
|
const activeAnyOverridden = state.activeTargetOverridden || state.activeTargetForkOverridden;
|
|
66642
66900
|
const limitsHeadingId = headingId + "-limits";
|
|
66643
66901
|
const modelsHeadingId = headingId + "-models";
|
|
66902
|
+
const defaultModelId = headingId + "-default-model";
|
|
66644
66903
|
const mainModelId = headingId + "-main-model";
|
|
66645
66904
|
const blocked = !state.dirty || state.invalid || state.saving || !state.writable;
|
|
66905
|
+
const defaultGroups = /* @__PURE__ */ new Map();
|
|
66906
|
+
const defaultUnavailable = [];
|
|
66907
|
+
for (const candidate of state.defaultModelCandidates) {
|
|
66908
|
+
if (!candidate.available) {
|
|
66909
|
+
defaultUnavailable.push(candidate);
|
|
66910
|
+
continue;
|
|
66911
|
+
}
|
|
66912
|
+
const group = defaultGroups.get(candidate.provider);
|
|
66913
|
+
if (group === void 0) defaultGroups.set(candidate.provider, {
|
|
66914
|
+
providerName: candidate.providerName,
|
|
66915
|
+
rows: [candidate]
|
|
66916
|
+
});
|
|
66917
|
+
else group.rows.push(candidate);
|
|
66918
|
+
}
|
|
66919
|
+
const catalogFeedback = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
66920
|
+
state.catalogStatus === "loading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
66921
|
+
className: "dsh-subagent-notice",
|
|
66922
|
+
role: "status",
|
|
66923
|
+
children: t("subagentModelSelectionLoading")
|
|
66924
|
+
}) : null,
|
|
66925
|
+
state.catalogStatus === "error" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
66926
|
+
className: "dsh-subagent-catalog-error",
|
|
66927
|
+
role: "alert",
|
|
66928
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("subagentModelSelectionLoadFailed") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
66929
|
+
type: "button",
|
|
66930
|
+
"data-dsh-part": "subagent-retry-catalog",
|
|
66931
|
+
disabled: state.saving,
|
|
66932
|
+
onClick: () => {
|
|
66933
|
+
props.retryCatalog();
|
|
66934
|
+
},
|
|
66935
|
+
children: t("subagentModelSelectionRetry")
|
|
66936
|
+
})]
|
|
66937
|
+
}) : null,
|
|
66938
|
+
state.catalogPartial ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
66939
|
+
className: "dsh-subagent-notice",
|
|
66940
|
+
children: t("subagentModelSelectionPartial")
|
|
66941
|
+
}) : null
|
|
66942
|
+
] });
|
|
66646
66943
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
66647
66944
|
className: "dsh-subagent-form",
|
|
66648
66945
|
"data-dsh-plugin": "subagent",
|
|
@@ -66730,6 +67027,54 @@ window.__ModuleLoader__.load({
|
|
|
66730
67027
|
id: modelsHeadingId,
|
|
66731
67028
|
children: t("subagentModelSelectionTitle")
|
|
66732
67029
|
}),
|
|
67030
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
67031
|
+
className: "dsh-subagent-default-row",
|
|
67032
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
67033
|
+
className: "dsh-subagent-default-meta",
|
|
67034
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
67035
|
+
className: "dsh-subagent-label",
|
|
67036
|
+
htmlFor: defaultModelId,
|
|
67037
|
+
children: t("subagentDefaultModel")
|
|
67038
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
67039
|
+
className: "dsh-subagent-hint",
|
|
67040
|
+
id: defaultModelId + "-hint",
|
|
67041
|
+
children: t("subagentDefaultModelHint")
|
|
67042
|
+
})]
|
|
67043
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
67044
|
+
id: defaultModelId,
|
|
67045
|
+
className: "dsh-subagent-select dsh-subagent-default-select",
|
|
67046
|
+
"data-dsh-part": "subagent-default-model",
|
|
67047
|
+
"aria-label": t("subagentDefaultModel"),
|
|
67048
|
+
"aria-describedby": defaultModelId + "-hint",
|
|
67049
|
+
value: state.defaultModelKey ?? "",
|
|
67050
|
+
disabled,
|
|
67051
|
+
onChange: (event) => {
|
|
67052
|
+
const next = event.target.value;
|
|
67053
|
+
props.selectDefaultModel(next === "" ? void 0 : next);
|
|
67054
|
+
},
|
|
67055
|
+
children: [
|
|
67056
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
67057
|
+
value: "",
|
|
67058
|
+
children: t("subagentDefaultModelInherit")
|
|
67059
|
+
}),
|
|
67060
|
+
[...defaultGroups].map(([provider, group]) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("optgroup", {
|
|
67061
|
+
label: group.providerName,
|
|
67062
|
+
children: group.rows.map((candidate) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
67063
|
+
value: candidate.key,
|
|
67064
|
+
children: candidate.modelName + " · " + group.providerName
|
|
67065
|
+
}, candidate.key))
|
|
67066
|
+
}, provider)),
|
|
67067
|
+
defaultUnavailable.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("optgroup", {
|
|
67068
|
+
label: t("subagentModelSelectionUnavailableGroup"),
|
|
67069
|
+
children: defaultUnavailable.map((candidate) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
67070
|
+
value: candidate.key,
|
|
67071
|
+
children: candidate.provider + "/" + candidate.model
|
|
67072
|
+
}, candidate.key))
|
|
67073
|
+
}) : null
|
|
67074
|
+
]
|
|
67075
|
+
})]
|
|
67076
|
+
}),
|
|
67077
|
+
!state.enabled ? catalogFeedback : null,
|
|
66733
67078
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
66734
67079
|
className: "dsh-subagent-permission",
|
|
66735
67080
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -66896,28 +67241,7 @@ window.__ModuleLoader__.load({
|
|
|
66896
67241
|
})
|
|
66897
67242
|
]
|
|
66898
67243
|
}),
|
|
66899
|
-
|
|
66900
|
-
className: "dsh-subagent-notice",
|
|
66901
|
-
role: "status",
|
|
66902
|
-
children: t("subagentModelSelectionLoading")
|
|
66903
|
-
}) : null,
|
|
66904
|
-
state.catalogStatus === "error" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
66905
|
-
className: "dsh-subagent-catalog-error",
|
|
66906
|
-
role: "alert",
|
|
66907
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("subagentModelSelectionLoadFailed") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
66908
|
-
type: "button",
|
|
66909
|
-
"data-dsh-part": "subagent-retry-catalog",
|
|
66910
|
-
disabled: state.saving,
|
|
66911
|
-
onClick: () => {
|
|
66912
|
-
props.retryCatalog();
|
|
66913
|
-
},
|
|
66914
|
-
children: t("subagentModelSelectionRetry")
|
|
66915
|
-
})]
|
|
66916
|
-
}) : null,
|
|
66917
|
-
state.catalogPartial ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
66918
|
-
className: "dsh-subagent-notice",
|
|
66919
|
-
children: t("subagentModelSelectionPartial")
|
|
66920
|
-
}) : null,
|
|
67244
|
+
catalogFeedback,
|
|
66921
67245
|
state.candidates.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
|
|
66922
67246
|
className: "dsh-subagent-models",
|
|
66923
67247
|
children: [
|
|
@@ -67042,6 +67366,9 @@ window.__ModuleLoader__.load({
|
|
|
67042
67366
|
subagentDepthInvalid: "请输入不小于 0 的整数。",
|
|
67043
67367
|
subagentCapacityInvalid: "请输入不小于 1 的整数。",
|
|
67044
67368
|
subagentModelSelectionTitle: "模型选择",
|
|
67369
|
+
subagentDefaultModel: "子智能体默认模型",
|
|
67370
|
+
subagentDefaultModelInherit: "与父 Agent 相同",
|
|
67371
|
+
subagentDefaultModelHint: "父智能体未指定模型时使用此项;已单独配置模型的委派工具保持自身配置。",
|
|
67045
67372
|
subagentModelSelectionToggle: "允许 Agent 为子智能体选择模型",
|
|
67046
67373
|
subagentModelSelectionChoose: "开启后,Agent 可以从下方授权模型中,为每个子智能体选择提供方、模型和推理强度。修改会立即对所有会话生效。",
|
|
67047
67374
|
subagentModelSelectionAllowed: "Agent 可选择的模型",
|
|
@@ -67095,6 +67422,9 @@ window.__ModuleLoader__.load({
|
|
|
67095
67422
|
subagentDepthInvalid: "Enter a whole number of 0 or more.",
|
|
67096
67423
|
subagentCapacityInvalid: "Enter a whole number of 1 or more.",
|
|
67097
67424
|
subagentModelSelectionTitle: "Model selection",
|
|
67425
|
+
subagentDefaultModel: "Default Subagent model",
|
|
67426
|
+
subagentDefaultModelInherit: "Same as parent agent",
|
|
67427
|
+
subagentDefaultModelHint: "Used when an agent starts a Subagent without choosing a model. A delegation tool with its own configured model keeps that model.",
|
|
67098
67428
|
subagentModelSelectionToggle: "Allow agents to choose models for Subagents",
|
|
67099
67429
|
subagentModelSelectionChoose: "When enabled, agents can choose a provider, model, and reasoning effort for each Subagent from the authorized models below. Changes apply immediately to every session.",
|
|
67100
67430
|
subagentModelSelectionAllowed: "Models agents may choose",
|
|
@@ -67516,6 +67846,28 @@ window.__ModuleLoader__.load({
|
|
|
67516
67846
|
min-width: 0;
|
|
67517
67847
|
}
|
|
67518
67848
|
|
|
67849
|
+
.dsh-subagent-default-row {
|
|
67850
|
+
display: flex;
|
|
67851
|
+
align-items: center;
|
|
67852
|
+
justify-content: space-between;
|
|
67853
|
+
gap: 16px;
|
|
67854
|
+
padding: 12px 0;
|
|
67855
|
+
}
|
|
67856
|
+
|
|
67857
|
+
.dsh-subagent-default-meta {
|
|
67858
|
+
display: grid;
|
|
67859
|
+
gap: 4px;
|
|
67860
|
+
flex: 1;
|
|
67861
|
+
min-width: 0;
|
|
67862
|
+
}
|
|
67863
|
+
|
|
67864
|
+
.dsh-subagent-default-select {
|
|
67865
|
+
flex: 0 1 260px;
|
|
67866
|
+
width: auto;
|
|
67867
|
+
min-width: 160px;
|
|
67868
|
+
max-width: 60%;
|
|
67869
|
+
}
|
|
67870
|
+
|
|
67519
67871
|
.dsh-subagent-switch {
|
|
67520
67872
|
box-sizing: border-box;
|
|
67521
67873
|
position: relative;
|