dsh-client-auto-continue 0.18.0 → 0.20.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 +38 -0
- package/README.md +230 -310
- package/README.ru.md +382 -0
- package/README.zh.md +229 -308
- package/docs/auto-continue-workflow.archify.json +3 -3
- package/docs/auto-continue-workflow.en.archify.json +3 -3
- package/docs/auto-continue-workflow.en.html +1 -1
- package/docs/auto-continue-workflow.html +1 -1
- package/docs/auto-continue-workflow.ru.svg +530 -0
- package/docs/banner-ru-dark.svg +38 -0
- package/docs/banner-ru.svg +38 -0
- package/docs/demo-ru-static.svg +115 -0
- package/docs/demo-ru.svg +147 -0
- package/docs/releases/v0.19.0.md +62 -0
- package/docs/releases/v0.20.0.md +46 -0
- package/docs/social-preview.png +0 -0
- package/docs/social-preview.svg +30 -1
- package/lib/client.js +297 -99
- package/lib/client.js.map +3 -3
- package/lib/index.js +496 -43
- package/lib/types/client/auto-continue-icon.d.ts +7 -0
- package/lib/types/client/bridge.d.ts +2 -0
- package/lib/types/client/composer-toggle.d.ts +2 -0
- package/lib/types/client/locales.d.ts +5 -0
- package/lib/types/client/settings-card.d.ts +1 -0
- package/lib/types/host/engine.d.ts +88 -4
- package/lib/types/index.d.ts +8 -0
- package/lib/types/shared/core.d.ts +21 -1
- package/locale/ru.json +6 -0
- package/package.json +5 -3
- package/scripts/build-docs-assets.mjs +126 -0
- package/src/client/auto-continue-icon.tsx +6 -27
- package/src/client/bridge.ts +26 -6
- package/src/client/composer-toggle.tsx +22 -11
- package/src/client/index.ts +5 -1
- package/src/client/locales.ts +215 -40
- package/src/client/settings-card.tsx +8 -2
- package/src/client/settings-notifications.ts +3 -2
- package/src/client/styles.ts +17 -19
- package/src/host/engine.ts +571 -41
- package/src/host/settings-migration.ts +1 -1
- package/src/index.ts +23 -1
- package/src/shared/core.ts +32 -2
package/lib/client.js
CHANGED
|
@@ -38,7 +38,10 @@ module.exports = __toCommonJS(index_exports);
|
|
|
38
38
|
|
|
39
39
|
// src/shared/core.ts
|
|
40
40
|
function resolveLocale(locale) {
|
|
41
|
-
|
|
41
|
+
if (typeof locale !== "string") return "en";
|
|
42
|
+
if (/^zh(?:-|$)/i.test(locale)) return "zh";
|
|
43
|
+
if (/^ru(?:-|$)/i.test(locale)) return "ru";
|
|
44
|
+
return "en";
|
|
42
45
|
}
|
|
43
46
|
var isSessionMode = (value) => value === "default" || value === "off" || value === "recover" || value === "loop";
|
|
44
47
|
function sessionMode(modes, sessionId) {
|
|
@@ -64,6 +67,16 @@ var LOCALIZED_TEXT_DEFAULTS = {
|
|
|
64
67
|
guardPendingText: '(The previous tool "{tool}" may not have completed. Check its state before continuing and do not run it again.)',
|
|
65
68
|
guardDoneText: '(The previous tool "{tool}" completed successfully. Result: {result}; do not run it again. Continue from there.)',
|
|
66
69
|
loopText: "(You may be stuck in a loop. Stop repeating the last action and continue with a different approach.)"
|
|
70
|
+
},
|
|
71
|
+
ru: {
|
|
72
|
+
continueText: "Продолжай",
|
|
73
|
+
continueTextMaxTokens: "Продолжай",
|
|
74
|
+
continueTextSilent: "Продолжай. Предыдущий ход закончился только внутренним рассуждением: ни ответа, ни вызова инструмента, поэтому пользователь ничего не увидел. Каждый ход должен заканчиваться вызовом инструмента или видимым ответом.",
|
|
75
|
+
continueTextLoop: "Продолжай",
|
|
76
|
+
continueTextInterrupted: "Продолжай. Хост перезапустился, пока предыдущий ход ещё выполнялся; вызовы инструментов, незавершённые на момент перезапуска, записаны с неизвестным результатом. Продолжай с места остановки, проверяя внешнее состояние перед повтором действий с возможными побочными эффектами.",
|
|
77
|
+
guardPendingText: "(Предыдущий инструмент «{tool}», возможно, не завершился. Проверь его состояние перед продолжением и не запускай его повторно.)",
|
|
78
|
+
guardDoneText: "(Предыдущий инструмент «{tool}» завершился успешно. Результат: {result}; не запускай его повторно, продолжай с этого места.)",
|
|
79
|
+
loopText: "(Похоже, ты застрял в цикле. Перестань повторять последнее действие и продолжай другим способом.)"
|
|
67
80
|
}
|
|
68
81
|
};
|
|
69
82
|
var DEFAULT_CONFIG = {
|
|
@@ -71,6 +84,7 @@ var DEFAULT_CONFIG = {
|
|
|
71
84
|
...LOCALIZED_TEXT_DEFAULTS.en,
|
|
72
85
|
usePluginSource: false,
|
|
73
86
|
resumeSilentTurns: true,
|
|
87
|
+
resumeSubagentSessions: false,
|
|
74
88
|
resumeCompletedTurns: false,
|
|
75
89
|
continueTextLoop: "",
|
|
76
90
|
guardTools: true,
|
|
@@ -145,6 +159,7 @@ var zh = {
|
|
|
145
159
|
"composer.loop": "自主循环",
|
|
146
160
|
"composer.paused": "全局已暂停",
|
|
147
161
|
"composer.unavailable": "等待宿主连接",
|
|
162
|
+
"composer.reconnecting": "正在重新连接状态桥…当前显示的是上次的设置,重连后才能修改。",
|
|
148
163
|
"composer.saving": "正在保存自动继续设置…",
|
|
149
164
|
"composer.saveFailed": "保存失败,请重试",
|
|
150
165
|
"field.pausedHint": "恢复意外中断的会话。关闭并保存后,全局暂停恢复并取消已排队的继续。循环守卫独立运行;如需停止自动打断,请同时关闭循环守卫。",
|
|
@@ -156,10 +171,12 @@ var zh = {
|
|
|
156
171
|
"default.continueTextMaxTokens": LOCALIZED_TEXT_DEFAULTS.zh.continueTextMaxTokens,
|
|
157
172
|
"field.resumeSilentTurns": "续跑无输出回合",
|
|
158
173
|
"field.resumeSilentTurnsHint": "已观察到模型活动但没有可见输出时续跑;不把空回合、图片或扩展内容误判为静默,冷却与连续上限照常生效。",
|
|
174
|
+
"field.resumeSubagentSessions": "续跑子代理会话",
|
|
175
|
+
"field.resumeSubagentSessionsHint": "当子代理所属主会话启用自动继续时,自动续跑其中断的子代理会话。子代理不会进入自主循环、不会被循环守卫重启,也不会由启动扫描恢复。默认关闭。DSH 已释放子代理时,引擎会通过宿主的子代理服务从持久化会话冷恢复它;宿主无法恢复时,把失败交给主会话处理,并在主会话自行恢复期间保持安静。",
|
|
159
176
|
"field.resumeCompletedTurns": "默认会话模式",
|
|
160
|
-
"field.resumeCompletedTurnsHint": "
|
|
177
|
+
"field.resumeCompletedTurnsHint": "用于未单独设置模式的会话。仅故障恢复继续中断和无输出回合;自主循环还会在正常完成后继续。无输出和失败回合仍计入连续重试次数。",
|
|
161
178
|
"field.resumeInterruptedChildren": "重启后唤醒子代理会话",
|
|
162
|
-
"field.resumeInterruptedChildrenHint": "
|
|
179
|
+
"field.resumeInterruptedChildrenHint": "DSH 重启后,将中断的子代理或团队成员会话清单发送给根会话,由其决定继续或收尾。默认关闭;你手动停止的根会话保持停止。",
|
|
163
180
|
"field.resumeGoals": "重新武装被重启失活的 goal",
|
|
164
181
|
"field.resumeGoalsHint": "会话被自动续跑时,把被宿主 disarm 的 active goal 重新 arm,让 goal 的自动继续轮能转起来。注意:这等于代替你做了授权,所以默认关闭。",
|
|
165
182
|
"field.resumePausedGoals": "恢复被暂停的 goal",
|
|
@@ -177,10 +194,10 @@ var zh = {
|
|
|
177
194
|
"field.continueTextSilentHint": "回合只输出推理就结束时自动发送的文本, 支持与继续文本相同的占位符。",
|
|
178
195
|
"default.continueTextSilent": LOCALIZED_TEXT_DEFAULTS.zh.continueTextSilent,
|
|
179
196
|
"field.continueTextInterrupted": "宿主重启后恢复的继续文本",
|
|
180
|
-
"field.continueTextInterruptedHint": "
|
|
197
|
+
"field.continueTextInterruptedHint": "DSH 重启后恢复中断会话时发送的文本。",
|
|
181
198
|
"default.continueTextInterrupted": LOCALIZED_TEXT_DEFAULTS.zh.continueTextInterrupted,
|
|
182
199
|
"field.guardTools": "幂等护栏",
|
|
183
|
-
"field.guardToolsHint": "
|
|
200
|
+
"field.guardToolsHint": "继续前,工具结果未确认时提醒模型核实状态,已成功时提醒跳过该操作。",
|
|
184
201
|
"field.guardPendingText": "结果未确认时的护栏文本",
|
|
185
202
|
"field.guardPendingTextHint": "上一步工具可能已部分执行时附加到继续文本之后, 支持 {tool} 占位符。",
|
|
186
203
|
"default.guardPendingText": LOCALIZED_TEXT_DEFAULTS.zh.guardPendingText,
|
|
@@ -190,28 +207,28 @@ var zh = {
|
|
|
190
207
|
"field.graceMs": "宽限期 (ms)",
|
|
191
208
|
"field.graceMsHint": "检测到中断后等待的时长; 期间宿主自行恢复则取消。",
|
|
192
209
|
"field.cooldownMs": "冷却时间 (ms)",
|
|
193
|
-
"field.cooldownMsHint": "
|
|
210
|
+
"field.cooldownMsHint": "同一会话两次恢复尝试的最小间隔。冷却期间失败会先等待冷却结束,再进入宽限期;正常完成后的自主循环不受此限制。",
|
|
194
211
|
"field.maxConsecutive": "最大连续次数",
|
|
195
|
-
"field.maxConsecutiveHint": "
|
|
212
|
+
"field.maxConsecutiveHint": "连续恢复尝试的上限;用户介入或回合成功且有可见输出后清零。正常完成后的自主循环不计入。",
|
|
196
213
|
"field.scanOnBoot": "启动恢复扫描",
|
|
197
|
-
"field.scanOnBootHint": "
|
|
214
|
+
"field.scanOnBootHint": "DSH 启动后,在扫描时间窗内查找并恢复近期中断的会话,包括当前未打开的会话。",
|
|
198
215
|
"field.scanLimit": "扫描会话数",
|
|
199
216
|
"field.scanLimitHint": "每次扫描最多恢复多少个符合条件的会话,优先最近活动的会话。",
|
|
200
217
|
"field.freshMs": "扫描时间窗 (ms)",
|
|
201
|
-
"field.freshMsHint": "
|
|
218
|
+
"field.freshMsHint": "恢复此时长内中断的会话;启动扫描也在此时长后结束。",
|
|
202
219
|
"field.verbose": "详细日志",
|
|
203
|
-
"field.verboseHint": "在 DSH
|
|
220
|
+
"field.verboseHint": "在 DSH 日志中记录自动继续活动,前缀为 [auto-continue];使用 CLI 时可在运行 DSH 的终端查看。",
|
|
204
221
|
"field.classify": "错误分类",
|
|
205
222
|
"field.classifyHint": "仅自动恢复临时性错误(网络/超时/5xx 等); 认证/余额/模型不存在等永久性错误跳过并通知。",
|
|
206
223
|
"field.retryableErrorPatterns": "自定义可恢复错误",
|
|
207
|
-
"field.retryableErrorPatternsHint": "
|
|
224
|
+
"field.retryableErrorPatternsHint": "每行填写一个具体文本片段,忽略大小写。匹配错误码、HTTP 状态或消息后允许重试;宽泛片段也会重试认证、余额等原本跳过的错误。",
|
|
208
225
|
"field.retryableErrorPatternsPlaceholder": "例如:Upstream rejected the request as invalid",
|
|
209
226
|
"field.backoffFactor": "退避系数",
|
|
210
227
|
"field.backoffFactorHint": "连续失败时冷却间隔的倍率(如 2 表示 20s→40s→80s 递增)。",
|
|
211
228
|
"field.backoffMaxMs": "最大退避间隔 (ms)",
|
|
212
|
-
"field.backoffMaxMsHint": "
|
|
229
|
+
"field.backoffMaxMsHint": "连续失败时,冷却间隔增长到此值后不再增加。",
|
|
213
230
|
"field.notify": "浏览器通知",
|
|
214
|
-
"field.notifyHint": "
|
|
231
|
+
"field.notifyHint": "开启后,自动继续活动和设置保存成功时会通知;关闭并保存时也会收到确认。首次开启需允许浏览器通知。",
|
|
215
232
|
"stats.title": "今日统计",
|
|
216
233
|
"stats.sent": "自动继续",
|
|
217
234
|
"stats.skipped": "跳过(永久错误)",
|
|
@@ -220,17 +237,17 @@ var zh = {
|
|
|
220
237
|
"stats.gaveUp": "停止(达上限)",
|
|
221
238
|
"stats.looped": "循环打断",
|
|
222
239
|
"field.loopGuard": "循环守卫",
|
|
223
|
-
"field.loopGuardHint": "
|
|
240
|
+
"field.loopGuardHint": "回合连续输出短句且无工具调用、重复文本或重复相同工具调用时,按以下阈值自动打断,并用循环提示文本重启。",
|
|
224
241
|
"field.loopShortChars": "短句长度上限 (字符)",
|
|
225
|
-
"field.loopShortCharsHint": "
|
|
242
|
+
"field.loopShortCharsHint": "模型消息文本短于此值时计为一条短句。",
|
|
226
243
|
"field.loopWindowMs": "短句时间窗 (ms)",
|
|
227
|
-
"field.loopWindowMsHint": "
|
|
244
|
+
"field.loopWindowMsHint": "仅统计此时间窗内的连续短句。",
|
|
228
245
|
"field.loopShortCount": "连续短句阈值",
|
|
229
246
|
"field.loopShortCountHint": "时间窗内连续多少条短句且期间无工具调用时判定空转循环。",
|
|
230
247
|
"field.loopRepeatText": "相同消息重复次数",
|
|
231
|
-
"field.loopRepeatTextHint": "
|
|
248
|
+
"field.loopRepeatTextHint": "连续输出相同消息达到此次数时打断,不限消息长度;也适用于单条流式消息内的重复段落。",
|
|
232
249
|
"field.loopToolRepeat": "同工具重复次数",
|
|
233
|
-
"field.loopToolRepeatHint": "
|
|
250
|
+
"field.loopToolRepeatHint": "工具、参数和结果均相同的连续调用达到此次数时打断。",
|
|
234
251
|
"field.loopText": "循环提示文本",
|
|
235
252
|
"field.loopTextHint": "打断后重启回合时发送的文本, 支持 {tool} 占位符。",
|
|
236
253
|
"default.loopText": LOCALIZED_TEXT_DEFAULTS.zh.loopText,
|
|
@@ -238,7 +255,7 @@ var zh = {
|
|
|
238
255
|
"stats.empty": "今天还没有自动继续记录。",
|
|
239
256
|
"stats.reset": "清零",
|
|
240
257
|
"recovery.title": "近期恢复尝试",
|
|
241
|
-
"recovery.hint": "
|
|
258
|
+
"recovery.hint": "按会话汇总当前 DSH 最近 20 次恢复尝试,插件重启后清空,不含正常自主续跑。",
|
|
242
259
|
"recovery.empty": "尚无恢复尝试。",
|
|
243
260
|
"recovery.count": "窗口内尝试",
|
|
244
261
|
"recovery.consecutive": "最近发送时连续次数",
|
|
@@ -257,9 +274,9 @@ var zh = {
|
|
|
257
274
|
"chrome.collapse": "收起设置",
|
|
258
275
|
"chrome.expand": "展开设置",
|
|
259
276
|
"chrome.unsaved": "未保存",
|
|
260
|
-
"chrome.readOnly": "
|
|
277
|
+
"chrome.readOnly": "设置为只读,无法修改。",
|
|
261
278
|
"chrome.unavailable": "设置暂不可用。",
|
|
262
|
-
"chrome.saveFailed": "
|
|
279
|
+
"chrome.saveFailed": "保存失败,修改已保留。请检查后重试。",
|
|
263
280
|
"chrome.discard": "放弃",
|
|
264
281
|
"chrome.saving": "保存中…",
|
|
265
282
|
"chrome.save": "保存",
|
|
@@ -309,6 +326,7 @@ var en = {
|
|
|
309
326
|
"composer.loop": "Autonomous loop",
|
|
310
327
|
"composer.paused": "Globally paused",
|
|
311
328
|
"composer.unavailable": "Waiting for host",
|
|
329
|
+
"composer.reconnecting": "Reconnecting to the host… Showing the last known setting; changes are available again once reconnected.",
|
|
312
330
|
"composer.saving": "Saving auto-continue setting…",
|
|
313
331
|
"composer.saveFailed": "Could not save. Try again.",
|
|
314
332
|
"field.pausedHint": "Resume interrupted sessions. Turn off and save to pause recovery globally and cancel queued continuations. The loop guard stays active; turn it off separately to stop automatic interruptions.",
|
|
@@ -320,10 +338,12 @@ var en = {
|
|
|
320
338
|
"default.continueTextMaxTokens": LOCALIZED_TEXT_DEFAULTS.en.continueTextMaxTokens,
|
|
321
339
|
"field.resumeSilentTurns": "Resume silent turns",
|
|
322
340
|
"field.resumeSilentTurnsHint": "Resume observed model activity without visible output. No-op turns, images and extension blocks are not treated as silent; cooldown and retry limits still apply.",
|
|
341
|
+
"field.resumeSubagentSessions": "Resume subagent sessions",
|
|
342
|
+
"field.resumeSubagentSessionsHint": "Auto-continue interrupted subagent sessions when their main conversation has auto-continue enabled. Subagents never start the autonomous loop, are never loop-guard restarted, and are not recovered by the startup scan. Off by default. When DSH already disposed the subagent, the engine cold-resumes it from its persisted session through the host subagent service; if the host cannot resume it, the failure is handed to the main conversation, staying silent while that conversation recovers itself.",
|
|
323
343
|
"field.resumeCompletedTurns": "Default session mode",
|
|
324
|
-
"field.resumeCompletedTurnsHint": "Applies to sessions without their own mode. Recovery only
|
|
344
|
+
"field.resumeCompletedTurnsHint": "Applies to sessions without their own mode. Recovery only resumes interruptions and silent turns; autonomous loop also continues after normal completions. Silent and failed turns still count toward the consecutive retry limit.",
|
|
325
345
|
"field.resumeInterruptedChildren": "Wake child sessions after restart",
|
|
326
|
-
"field.resumeInterruptedChildrenHint": "
|
|
346
|
+
"field.resumeInterruptedChildrenHint": "After DSH restarts, send the root session a list of interrupted subagent or team-member sessions so it can continue or wrap up their work. Off by default; root sessions you stopped manually stay stopped.",
|
|
327
347
|
"field.resumeGoals": "Re-arm goals disarmed by a restart",
|
|
328
348
|
"field.resumeGoalsHint": "When a session is auto-continued, re-arm an active goal that the host disarmed so its continuation rounds can run again. This authorizes on your behalf, so it is off by default.",
|
|
329
349
|
"field.resumePausedGoals": "Resume paused goals",
|
|
@@ -341,10 +361,10 @@ var en = {
|
|
|
341
361
|
"field.continueTextSilentHint": "Text sent when a turn ends with reasoning only; same placeholders as the continue text.",
|
|
342
362
|
"default.continueTextSilent": LOCALIZED_TEXT_DEFAULTS.en.continueTextSilent,
|
|
343
363
|
"field.continueTextInterrupted": "Continue text (after harness restart)",
|
|
344
|
-
"field.continueTextInterruptedHint": "Text sent when
|
|
364
|
+
"field.continueTextInterruptedHint": "Text sent when resuming an interrupted session after DSH restarts.",
|
|
345
365
|
"default.continueTextInterrupted": LOCALIZED_TEXT_DEFAULTS.en.continueTextInterrupted,
|
|
346
366
|
"field.guardTools": "Idempotency guard",
|
|
347
|
-
"field.guardToolsHint": "Before resuming,
|
|
367
|
+
"field.guardToolsHint": "Before resuming, remind the model to check unconfirmed tool results or skip an action that already succeeded.",
|
|
348
368
|
"field.guardPendingText": "Guard text (unconfirmed result)",
|
|
349
369
|
"field.guardPendingTextHint": "Appended when the last tool may have partially executed; supports the {tool} placeholder.",
|
|
350
370
|
"default.guardPendingText": LOCALIZED_TEXT_DEFAULTS.en.guardPendingText,
|
|
@@ -354,28 +374,28 @@ var en = {
|
|
|
354
374
|
"field.graceMs": "Grace period (ms)",
|
|
355
375
|
"field.graceMsHint": "Wait after an interruption; cancelled if the host recovers on its own.",
|
|
356
376
|
"field.cooldownMs": "Cooldown (ms)",
|
|
357
|
-
"field.cooldownMsHint": "Minimum interval between recovery attempts
|
|
377
|
+
"field.cooldownMsHint": "Minimum interval between recovery attempts in the same session. Failures during cooldown wait until it ends, then enter the grace period. Autonomous continuations after normal completions are exempt.",
|
|
358
378
|
"field.maxConsecutive": "Max consecutive",
|
|
359
|
-
"field.maxConsecutiveHint": "
|
|
379
|
+
"field.maxConsecutiveHint": "Limit on consecutive recovery attempts. Resets on user intervention or a successful turn with visible output. Autonomous continuations after normal completions do not count.",
|
|
360
380
|
"field.scanOnBoot": "Scan on host startup",
|
|
361
|
-
"field.scanOnBootHint": "
|
|
381
|
+
"field.scanOnBootHint": "When DSH starts, find and resume recently interrupted sessions within the scan window, including sessions that are not currently open.",
|
|
362
382
|
"field.scanLimit": "Scan limit",
|
|
363
383
|
"field.scanLimitHint": "Maximum eligible sessions to recover per pass, most recently active first.",
|
|
364
384
|
"field.freshMs": "Scan window (ms)",
|
|
365
|
-
"field.freshMsHint": "
|
|
385
|
+
"field.freshMsHint": "Resume sessions interrupted within this duration. The startup scan also ends after this duration.",
|
|
366
386
|
"field.verbose": "Verbose logs",
|
|
367
|
-
"field.verboseHint": "
|
|
387
|
+
"field.verboseHint": "Record auto-continue activity in DSH logs with the [auto-continue] prefix. CLI users can view them in the terminal running DSH.",
|
|
368
388
|
"field.classify": "Classify errors",
|
|
369
389
|
"field.classifyHint": "Auto-resume transient failures only (network/timeout/5xx…); auth, balance and model errors are skipped and notified.",
|
|
370
390
|
"field.retryableErrorPatterns": "Custom retryable errors",
|
|
371
|
-
"field.retryableErrorPatternsHint": "
|
|
391
|
+
"field.retryableErrorPatternsHint": "Enter one specific text fragment per line, ignoring case. A match in the error code, HTTP status, or message allows a retry. Broad fragments can also retry normally skipped authentication or balance errors.",
|
|
372
392
|
"field.retryableErrorPatternsPlaceholder": "For example: Upstream rejected the request as invalid",
|
|
373
393
|
"field.backoffFactor": "Backoff factor",
|
|
374
394
|
"field.backoffFactorHint": "Cooldown multiplier per consecutive failure (2 = 20s→40s→80s…).",
|
|
375
395
|
"field.backoffMaxMs": "Max backoff (ms)",
|
|
376
|
-
"field.backoffMaxMsHint": "
|
|
396
|
+
"field.backoffMaxMsHint": "Cooldown stops increasing at this value after consecutive failures.",
|
|
377
397
|
"field.notify": "Browser notifications",
|
|
378
|
-
"field.notifyHint": "
|
|
398
|
+
"field.notifyHint": "When enabled, notify about auto-continue activity and successful settings saves. Turning this off and saving also sends a confirmation. Allow browser notifications when first enabling it.",
|
|
379
399
|
"stats.title": "Today's stats",
|
|
380
400
|
"stats.sent": "Auto-continued",
|
|
381
401
|
"stats.skipped": "Skipped (permanent)",
|
|
@@ -384,17 +404,17 @@ var en = {
|
|
|
384
404
|
"stats.gaveUp": "Gave up (cap)",
|
|
385
405
|
"stats.looped": "Loops broken",
|
|
386
406
|
"field.loopGuard": "Loop guard",
|
|
387
|
-
"field.loopGuardHint": "
|
|
407
|
+
"field.loopGuardHint": "Interrupt turns that produce consecutive short sentences without tool calls, repeat text, or repeat identical tool calls at the thresholds below. Restart with the loop text.",
|
|
388
408
|
"field.loopShortChars": "Short-sentence max (chars)",
|
|
389
|
-
"field.loopShortCharsHint": "A model message shorter than this counts as a short sentence
|
|
409
|
+
"field.loopShortCharsHint": "A model message shorter than this counts as a short sentence.",
|
|
390
410
|
"field.loopWindowMs": "Short-sentence window (ms)",
|
|
391
|
-
"field.loopWindowMsHint": "
|
|
411
|
+
"field.loopWindowMsHint": "Count consecutive short sentences only within this window.",
|
|
392
412
|
"field.loopShortCount": "Short-sentence threshold",
|
|
393
413
|
"field.loopShortCountHint": "How many consecutive short sentences inside the window, with no tool call, trip the loop guard.",
|
|
394
414
|
"field.loopRepeatText": "Identical message count",
|
|
395
|
-
"field.loopRepeatTextHint": "
|
|
415
|
+
"field.loopRepeatTextHint": "Interrupt after this many consecutive identical messages, regardless of length. Also applies to repeated paragraphs within a single streamed message.",
|
|
396
416
|
"field.loopToolRepeat": "Same-tool repeat count",
|
|
397
|
-
"field.loopToolRepeatHint": "
|
|
417
|
+
"field.loopToolRepeatHint": "Interrupt after this many consecutive calls with the same tool, arguments, and results.",
|
|
398
418
|
"field.loopText": "Loop text",
|
|
399
419
|
"field.loopTextHint": "Text sent after the loop guard restarts a turn; supports the {tool} placeholder.",
|
|
400
420
|
"default.loopText": LOCALIZED_TEXT_DEFAULTS.en.loopText,
|
|
@@ -402,7 +422,7 @@ var en = {
|
|
|
402
422
|
"stats.empty": "No auto-continue activity today.",
|
|
403
423
|
"stats.reset": "Reset",
|
|
404
424
|
"recovery.title": "Recent recovery attempts",
|
|
405
|
-
"recovery.hint": "
|
|
425
|
+
"recovery.hint": "The last 20 recovery attempts for this DSH instance, grouped by session. Cleared when the plugin restarts; normal autonomous continuations are excluded.",
|
|
406
426
|
"recovery.empty": "No recovery attempts yet.",
|
|
407
427
|
"recovery.count": "Attempts in window",
|
|
408
428
|
"recovery.consecutive": "Consecutive at last send",
|
|
@@ -421,9 +441,9 @@ var en = {
|
|
|
421
441
|
"chrome.collapse": "Hide settings",
|
|
422
442
|
"chrome.expand": "Show settings",
|
|
423
443
|
"chrome.unsaved": "Unsaved",
|
|
424
|
-
"chrome.readOnly": "
|
|
444
|
+
"chrome.readOnly": "Settings are read-only.",
|
|
425
445
|
"chrome.unavailable": "Settings are unavailable.",
|
|
426
|
-
"chrome.saveFailed": "
|
|
446
|
+
"chrome.saveFailed": "Could not save. Your edits are still here; review them and try again.",
|
|
427
447
|
"chrome.discard": "Discard",
|
|
428
448
|
"chrome.saving": "Saving…",
|
|
429
449
|
"chrome.save": "Save",
|
|
@@ -434,6 +454,173 @@ var en = {
|
|
|
434
454
|
"chrome.on": "On",
|
|
435
455
|
"chrome.off": "Off"
|
|
436
456
|
};
|
|
457
|
+
var ru = {
|
|
458
|
+
"chrome.saved": "Все изменения сохранены",
|
|
459
|
+
"notification.title": "Настройки авто-продолжения",
|
|
460
|
+
"notification.enabled": "Настройки сохранены. Уведомления браузера включены.",
|
|
461
|
+
"notification.disabled": "Настройки сохранены. Уведомления браузера выключены.",
|
|
462
|
+
"notification.saved": "Настройки авто-продолжения сохранены.",
|
|
463
|
+
"notification.blocked": "Настройки сохранены, но браузер не разрешает уведомления. Разрешите уведомления в настройках этого сайта.",
|
|
464
|
+
"notification.unsupported": "Настройки сохранены. Этот браузер не поддерживает уведомления.",
|
|
465
|
+
"notification.failed": "Настройки сохранены, но уведомление не удалось отправить. Проверьте разрешения на уведомления для сайта и в системе.",
|
|
466
|
+
"chrome.categories": "Категории настроек",
|
|
467
|
+
"repo.star": "Понравилось? Поставьте звезду",
|
|
468
|
+
"repo.link": "Репозиторий GitHub",
|
|
469
|
+
"repo.aria": "Открыть HsiangNianian/dsh-auto-continue на GitHub в новой вкладке",
|
|
470
|
+
"category.general.title": "Общие",
|
|
471
|
+
"category.general.description": "Управление запуском, отображением и уведомлениями авто-продолжения.",
|
|
472
|
+
"category.recovery.title": "Стратегия повторов",
|
|
473
|
+
"category.recovery.description": "Время ожидания, лимиты повторов и классификация ошибок.",
|
|
474
|
+
"category.startup.title": "Восстановление при запуске",
|
|
475
|
+
"category.startup.description": "Поиск недавно прерванных сессий после перезапуска DSH.",
|
|
476
|
+
"category.prompts.title": "Текст продолжения",
|
|
477
|
+
"category.prompts.description": "Оставьте пустым, чтобы использовать встроенный текст на текущем языке DSH.",
|
|
478
|
+
"category.safety.title": "Защита",
|
|
479
|
+
"category.safety.description": "Защита от повторного выполнения инструментов и разрыв холостых циклов.",
|
|
480
|
+
"category.status.title": "Состояние и журнал",
|
|
481
|
+
"category.status.description": "Активность и приостановленные сессии.",
|
|
482
|
+
"field.paused": "Включить авто-продолжение глобально",
|
|
483
|
+
"field.showComposerToggle": "Показывать переключатель авто-продолжения в поле ввода",
|
|
484
|
+
"field.showComposerToggleHint": "Показывается по умолчанию. Скрытие не меняет режимы сессий. Применится после нажатия «Сохранить».",
|
|
485
|
+
"composer.label": "Авто-продолжение",
|
|
486
|
+
"composer.mode": "Режим авто-продолжения",
|
|
487
|
+
"composer.scope": "Действует только на эту сессию: сохраняется сразу и синхронизируется между вкладками. «Выключено» также отключает здесь прерывания защитой от циклов.",
|
|
488
|
+
"composer.default": "Как по умолчанию",
|
|
489
|
+
"composer.off": "Выключено",
|
|
490
|
+
"composer.recover": "Только восстановление",
|
|
491
|
+
"composer.loop": "Автономный цикл",
|
|
492
|
+
"composer.paused": "Приостановлено глобально",
|
|
493
|
+
"composer.unavailable": "Ожидание хоста",
|
|
494
|
+
"composer.reconnecting": "Переподключение к хосту… Показана последняя известная настройка; изменить её можно после переподключения.",
|
|
495
|
+
"composer.saving": "Сохранение авто-продолжения…",
|
|
496
|
+
"composer.saveFailed": "Не удалось сохранить. Повторите попытку.",
|
|
497
|
+
"field.pausedHint": "Восстанавливать прерванные сессии. Выключите и сохраните, чтобы приостановить восстановление глобально и отменить запланированные продолжения. Защита от циклов продолжает работать; чтобы остановить автоматические прерывания, отключите её отдельно.",
|
|
498
|
+
"field.continueText": "Текст продолжения",
|
|
499
|
+
"field.continueTextHint": "Сообщение, автоматически отправляемое после прерывания.",
|
|
500
|
+
"default.continueText": LOCALIZED_TEXT_DEFAULTS.ru.continueText,
|
|
501
|
+
"field.continueTextMaxTokens": "Текст продолжения (лимит токенов)",
|
|
502
|
+
"field.continueTextMaxTokensHint": "Отправляется при достижении лимита выходных токенов; те же подстановки, что и в тексте продолжения.",
|
|
503
|
+
"default.continueTextMaxTokens": LOCALIZED_TEXT_DEFAULTS.ru.continueTextMaxTokens,
|
|
504
|
+
"field.resumeSilentTurns": "Продолжать ходы без вывода",
|
|
505
|
+
"field.resumeSilentTurnsHint": "Продолжать при наблюдаемой активности модели без видимого вывода. Пустые ходы, изображения и блоки расширений тихими не считаются; задержка и лимиты повторов действуют.",
|
|
506
|
+
"field.resumeSubagentSessions": "Продолжать сессии субагентов",
|
|
507
|
+
"field.resumeSubagentSessionsHint": "Автоматически продолжать прерванные сессии субагентов, если в их основном диалоге включено авто-продолжение. Субагенты не запускают автономный цикл, не перезапускаются защитой от циклов и не восстанавливаются сканированием при запуске. По умолчанию выключено. Если DSH уже освободил субагент, движок холодно поднимает его из сохранённой сессии через сервис субагентов хоста; когда хост не может его поднять, сбой передаётся основному диалогу, и пока тот восстанавливается сам, передача молчит.",
|
|
508
|
+
"field.resumeCompletedTurns": "Режим сессии по умолчанию",
|
|
509
|
+
"field.resumeCompletedTurnsHint": "Для сессий без собственного режима. «Только восстановление» не трогает обычные завершения; «Автономный цикл» продолжает после них. Тихие и неудачные ходы по-прежнему расходуют бюджет повторов.",
|
|
510
|
+
"field.continueTextLoop": "Текст продолжения (автономный цикл)",
|
|
511
|
+
"field.continueTextLoopHint": "Текст, отправляемый при каждом продолжении автономного цикла.",
|
|
512
|
+
"default.continueTextLoop": LOCALIZED_TEXT_DEFAULTS.ru.continueTextLoop,
|
|
513
|
+
"field.continueTextSilent": "Текст продолжения (ход без вывода)",
|
|
514
|
+
"field.continueTextSilentHint": "Текст, отправляемый, когда ход заканчивается только рассуждениями; те же подстановки, что и в тексте продолжения.",
|
|
515
|
+
"default.continueTextSilent": LOCALIZED_TEXT_DEFAULTS.ru.continueTextSilent,
|
|
516
|
+
"field.continueTextInterrupted": "Текст продолжения (после перезапуска хоста)",
|
|
517
|
+
"field.continueTextInterruptedHint": "Текст, отправляемый, когда сканирование при запуске продолжает сессию, прерванную перезапуском; по умолчанию объясняет перезапуск и просит сверять состояние перед повтором.",
|
|
518
|
+
"default.continueTextInterrupted": LOCALIZED_TEXT_DEFAULTS.ru.continueTextInterrupted,
|
|
519
|
+
"field.guardTools": "Защита от повторного выполнения",
|
|
520
|
+
"field.guardToolsHint": "Перед продолжением проверяет последний вызов инструмента: если результат не подтверждён, просит сначала проверить состояние; если вызов успешен — не повторять его. Помогает не дублировать коммиты и вызовы API.",
|
|
521
|
+
"field.guardPendingText": "Текст защиты (результат не подтверждён)",
|
|
522
|
+
"field.guardPendingTextHint": "Добавляется, если последний инструмент мог выполниться частично; поддерживает подстановку {tool}.",
|
|
523
|
+
"default.guardPendingText": LOCALIZED_TEXT_DEFAULTS.ru.guardPendingText,
|
|
524
|
+
"field.guardDoneText": "Текст защиты (инструмент выполнен)",
|
|
525
|
+
"field.guardDoneTextHint": "Добавляется, если последний инструмент подтверждённо выполнен; поддерживает подстановки {tool} и {result} (фрагмент результата).",
|
|
526
|
+
"default.guardDoneText": LOCALIZED_TEXT_DEFAULTS.ru.guardDoneText,
|
|
527
|
+
"field.graceMs": "Период ожидания (мс)",
|
|
528
|
+
"field.graceMsHint": "Пауза после прерывания; отменяется, если хост восстановится сам.",
|
|
529
|
+
"field.cooldownMs": "Задержка перед повтором (мс)",
|
|
530
|
+
"field.cooldownMsHint": "Минимальный интервал между попытками восстановления; сбои в этот период ждут остаток интервала, затем — период ожидания. Обычные передачи автономного цикла от этого освобождены.",
|
|
531
|
+
"field.maxConsecutive": "Максимум подряд",
|
|
532
|
+
"field.maxConsecutiveHint": "Лимит последовательных попыток восстановления; сбрасывается при вмешательстве пользователя или завершении хода с видимым выводом. Обычные передачи автономного цикла не считаются.",
|
|
533
|
+
"field.scanOnBoot": "Сканирование при запуске хоста",
|
|
534
|
+
"field.scanOnBootHint": "Ждать поздно загружаемые прерванные сессии в окне сканирования при запуске; сохранённые сессии, которые хост не перезагрузил, тоже материализуются и проверяются; каждая готовая сессия проверяется один раз.",
|
|
535
|
+
"field.scanLimit": "Лимит сканирования",
|
|
536
|
+
"field.scanLimitHint": "Сколько подходящих сессий восстанавливать за проход; сначала самые недавно активные.",
|
|
537
|
+
"field.freshMs": "Окно сканирования (мс)",
|
|
538
|
+
"field.freshMsHint": "Учитываются только прерывания в этом окне; опрос при запуске тоже прекращается по его истечении.",
|
|
539
|
+
"field.verbose": "Подробный журнал",
|
|
540
|
+
"field.verboseHint": "Записывать активность движка в журнал хоста DSH с префиксом [auto-continue]; при работе через CLI эти строки видны в терминале, где запущен DSH.",
|
|
541
|
+
"field.classify": "Классификация ошибок",
|
|
542
|
+
"field.classifyHint": "Автоматически восстанавливать только временные сбои (сеть, тайм-аут, 5xx…); ошибки авторизации, баланса и модели пропускаются с уведомлением.",
|
|
543
|
+
"field.retryableErrorPatterns": "Свои восстанавливаемые ошибки",
|
|
544
|
+
"field.retryableErrorPatternsHint": "По одному литеральному фрагменту на строку без учёта регистра. Совпадение с кодом ошибки, HTTP-статусом или сообщением переопределяет встроенную классификацию. Указывайте только стабильный текст провайдера; широкие совпадения также запускают повтор для обычно пропускаемых ошибок аутентификации и баланса.",
|
|
545
|
+
"field.retryableErrorPatternsPlaceholder": "Например: Upstream rejected the request as invalid",
|
|
546
|
+
"field.backoffFactor": "Коэффициент задержки",
|
|
547
|
+
"field.backoffFactorHint": "Множитель задержки при повторных сбоях (2 = 20 с → 40 с → 80 с…).",
|
|
548
|
+
"field.backoffMaxMs": "Максимальная задержка (мс)",
|
|
549
|
+
"field.backoffMaxMsHint": "Верхняя граница адаптивной задержки.",
|
|
550
|
+
"field.notify": "Уведомления браузера",
|
|
551
|
+
"field.notifyHint": "Уведомлять о событиях авто-продолжения и успешном сохранении настроек. Сохранение изменения этого параметра тоже подтверждает его состояние. При первом включении нужно разрешить уведомления в браузере.",
|
|
552
|
+
"stats.title": "Статистика за сегодня",
|
|
553
|
+
"stats.sent": "Авто-продолжений",
|
|
554
|
+
"stats.skipped": "Пропущено (постоянные)",
|
|
555
|
+
"stats.recovered": "Восстановлено",
|
|
556
|
+
"stats.failed": "Сбоев после продолжения",
|
|
557
|
+
"stats.gaveUp": "Остановлено (лимит)",
|
|
558
|
+
"stats.looped": "Разорвано циклов",
|
|
559
|
+
"field.loopGuard": "Защита от циклов",
|
|
560
|
+
"field.loopGuardHint": "Распознаёт холостой ход: много коротких фраз без вызовов инструментов, повторяющиеся абзацы в одном потоковом сообщении или повтор одного инструмента — затем отменяет ход и перезапускает его с текстом цикла.",
|
|
561
|
+
"field.loopShortChars": "Макс. длина короткой фразы (символов)",
|
|
562
|
+
"field.loopShortCharsHint": "Сообщение модели короче этого значения считается короткой фразой (признак холостого хода).",
|
|
563
|
+
"field.loopWindowMs": "Окно коротких фраз (мс)",
|
|
564
|
+
"field.loopWindowMsHint": "Короткие фразы должны идти подряд внутри этого окна; обычные рассуждения, растянутые во времени, не считаются.",
|
|
565
|
+
"field.loopShortCount": "Порог коротких фраз",
|
|
566
|
+
"field.loopShortCountHint": "Сколько коротких фраз подряд в окне без вызова инструмента запускают защиту от циклов.",
|
|
567
|
+
"field.loopRepeatText": "Порог одинаковых сообщений",
|
|
568
|
+
"field.loopRepeatTextHint": "Сколько одинаковых сообщений подряд запускают защиту (сильнейший признак, любая длина; также используется для повторяющихся абзацев внутри одного потокового сообщения).",
|
|
569
|
+
"field.loopToolRepeat": "Порог повторов инструмента",
|
|
570
|
+
"field.loopToolRepeatHint": "Сколько вызовов одного инструмента с одинаковыми аргументами и результатом подряд запускают защиту; изменение аргументов или результата считается прогрессом.",
|
|
571
|
+
"field.loopText": "Текст цикла",
|
|
572
|
+
"field.loopTextHint": "Отправляется после перезапуска хода защитой от циклов; поддерживает подстановку {tool}.",
|
|
573
|
+
"default.loopText": LOCALIZED_TEXT_DEFAULTS.ru.loopText,
|
|
574
|
+
"stats.byCode": "По коду ошибки",
|
|
575
|
+
"stats.empty": "Сегодня ещё не было авто-продолжений.",
|
|
576
|
+
"stats.reset": "Сбросить",
|
|
577
|
+
"recovery.title": "Недавние попытки восстановления",
|
|
578
|
+
"recovery.hint": "Счётчики по сессиям для последних 20 подсказок восстановления на этом хосте; очищаются при перезапуске плагина. Обычные автономные продолжения не учитываются. Отправленная подсказка не означает завершения задачи. Если восстановление повторяется, проверьте диалог и подумайте о передаче в новую сессию.",
|
|
579
|
+
"recovery.empty": "Попыток восстановления пока нет.",
|
|
580
|
+
"recovery.count": "Попыток в окне",
|
|
581
|
+
"recovery.consecutive": "Подряд при последней отправке",
|
|
582
|
+
"recovery.latest": "Последняя причина",
|
|
583
|
+
"recovery.reason.error": "Ошибка запроса",
|
|
584
|
+
"recovery.reason.max-tokens": "Лимит вывода",
|
|
585
|
+
"recovery.reason.silent": "Нет видимого вывода",
|
|
586
|
+
"recovery.reason.interrupted": "Прерывание при перезапуске хоста",
|
|
587
|
+
"recovery.reason.loop-guard": "Защита от циклов",
|
|
588
|
+
"recovery.reason.manual": "Ручное продолжение",
|
|
589
|
+
"pause.title": "Приостановленные сессии",
|
|
590
|
+
"pause.none": "Нет приостановленных сессий.",
|
|
591
|
+
"pause.clearAll": "Снять все",
|
|
592
|
+
"pause.unpause": "Продолжить",
|
|
593
|
+
"pause.minutes": "мин",
|
|
594
|
+
"chrome.collapse": "Скрыть настройки",
|
|
595
|
+
"chrome.expand": "Показать настройки",
|
|
596
|
+
"chrome.unsaved": "Не сохранено",
|
|
597
|
+
"chrome.readOnly": "В этом развёртывании настройки доступны только для чтения.",
|
|
598
|
+
"chrome.unavailable": "Настройки недоступны.",
|
|
599
|
+
"chrome.saveFailed": "Развёртывание не приняло эти значения; они оставлены, чтобы вы их исправили.",
|
|
600
|
+
"chrome.discard": "Отменить",
|
|
601
|
+
"chrome.saving": "Сохранение…",
|
|
602
|
+
"chrome.save": "Сохранить",
|
|
603
|
+
"chrome.overridden": "Изменено",
|
|
604
|
+
"chrome.reset": "Сбросить",
|
|
605
|
+
"chrome.invalidNumber": "Введите число или оставьте поле пустым, чтобы использовать значение по умолчанию.",
|
|
606
|
+
"chrome.inherit": "Наследовать",
|
|
607
|
+
"chrome.on": "Вкл",
|
|
608
|
+
"chrome.off": "Выкл",
|
|
609
|
+
"field.usePluginSource": "Отправлять сообщения автопродолжения с меткой плагина",
|
|
610
|
+
"field.usePluginSourceHint": "По умолчанию выключено, чтобы сохранить обычный источник «сообщение пользователя». Включите, чтобы помечать сообщения как пришедшие от плагина. Нажмите «Сохранить», чтобы применить.",
|
|
611
|
+
"field.resumeInterruptedChildren": "Будить дочерние сессии после перезапуска",
|
|
612
|
+
"field.resumeInterruptedChildrenHint": "Когда стартовый скан находит сессию субагента или участника команды, прерванную перезапуском, родительской сессии отправляется одно сообщение со списком таких детей, чтобы родитель мог продолжить или завершить их. Пропускается, если родитель завершился штатно или был остановлен вручную. По умолчанию выключено.",
|
|
613
|
+
"field.resumeGoals": "Перевзводить цели, снятые перезапуском",
|
|
614
|
+
"field.resumeGoalsHint": "Когда сессия автопродолжается, активная цель, снятая хостом при перезапуске, снова взводится, чтобы её раунды продолжения могли выполняться. Это действует от вашего имени, поэтому по умолчанию выключено.",
|
|
615
|
+
"field.resumePausedGoals": "Возобновлять приостановленные цели",
|
|
616
|
+
"field.resumePausedGoalsHint": "Также возобновлять цели, приостановленные вами вручную (требует включённого «Перевзводить цели, снятые перезапуском»). Пауза обычно осознанное решение — оставляйте выключенным, если не нужно.",
|
|
617
|
+
"field.pauseWhenOffline": "Пауза при отсутствии сети",
|
|
618
|
+
"field.pauseWhenOfflineHint": "Перед повтором сетевой ошибки (недоступный хост, сбой DNS, таймаут транспорта) проверять, что хост в сети. Пока сети нет, повтор ждёт, не расходуя попытки, и продолжается, когда сеть вернулась. При заданном HTTP(S)_PROXY проверяются только сетевые интерфейсы.",
|
|
619
|
+
"field.offlineCheckMs": "Интервал повторной проверки сети (мс)",
|
|
620
|
+
"field.offlineCheckMsHint": "Как часто отложенный повтор снова проверяет сеть. Минимум 1000.",
|
|
621
|
+
"field.loopMaxIterations": "Лимит раундов автономного цикла",
|
|
622
|
+
"field.loopMaxIterationsHint": "Максимум автономных раундов на сессию; 0 — без лимита. По достижении цикл останавливается и сообщает об этом один раз; отправка сообщения или повторное включение цикла начинают счёт заново."
|
|
623
|
+
};
|
|
437
624
|
|
|
438
625
|
// src/client/settings-card.tsx
|
|
439
626
|
var import_react = require("react");
|
|
@@ -489,7 +676,7 @@ var EMPTY_STATS = {
|
|
|
489
676
|
looped: 0,
|
|
490
677
|
byCode: {}
|
|
491
678
|
};
|
|
492
|
-
var state = { stats: EMPTY_STATS, paused: [], recoveryAttempts: [] };
|
|
679
|
+
var state = { stats: EMPTY_STATS, paused: [], recoveryAttempts: [], connected: false };
|
|
493
680
|
var listeners = /* @__PURE__ */ new Set();
|
|
494
681
|
function pausedSessions() {
|
|
495
682
|
return state.paused;
|
|
@@ -503,8 +690,11 @@ function readRecoveryAttempts() {
|
|
|
503
690
|
function readSessionPolicy() {
|
|
504
691
|
return state.sessionPolicy;
|
|
505
692
|
}
|
|
693
|
+
function isBridgeConnected() {
|
|
694
|
+
return state.connected;
|
|
695
|
+
}
|
|
506
696
|
async function setSessionMode(sessionId, mode) {
|
|
507
|
-
if (!state.sessionPolicy?.writable) throw new Error("Session settings are unavailable");
|
|
697
|
+
if (!state.connected || !state.sessionPolicy?.writable) throw new Error("Session settings are unavailable");
|
|
508
698
|
const response = await fetch("/api/auto-continue-action", {
|
|
509
699
|
method: "POST",
|
|
510
700
|
headers: { "content-type": "application/json" },
|
|
@@ -544,7 +734,8 @@ function handleEvent(event) {
|
|
|
544
734
|
stats: event.stats ?? EMPTY_STATS,
|
|
545
735
|
paused: event.paused ?? [],
|
|
546
736
|
recoveryAttempts: event.recoveryAttempts ?? [],
|
|
547
|
-
sessionPolicy: policy && typeof policy.modes === "object" && policy.modes !== null && !Array.isArray(policy.modes) && (policy.defaultMode === "recover" || policy.defaultMode === "loop") && typeof policy.paused === "boolean" && typeof policy.writable === "boolean" ? policy : void 0
|
|
737
|
+
sessionPolicy: policy && typeof policy.modes === "object" && policy.modes !== null && !Array.isArray(policy.modes) && (policy.defaultMode === "recover" || policy.defaultMode === "loop") && typeof policy.paused === "boolean" && typeof policy.writable === "boolean" ? policy : void 0,
|
|
738
|
+
connected: true
|
|
548
739
|
};
|
|
549
740
|
for (const listener of listeners) listener();
|
|
550
741
|
} else if (event.type === "notice" && event.notice !== void 0) {
|
|
@@ -589,16 +780,23 @@ function startBridge() {
|
|
|
589
780
|
let stopped = false;
|
|
590
781
|
let controller;
|
|
591
782
|
const disconnected = () => {
|
|
592
|
-
|
|
783
|
+
if (!state.connected) return;
|
|
784
|
+
state = { ...state, connected: false };
|
|
785
|
+
for (const listener of listeners) listener();
|
|
786
|
+
};
|
|
787
|
+
const reset = () => {
|
|
788
|
+
state = { ...state, sessionPolicy: void 0, connected: false };
|
|
593
789
|
for (const listener of listeners) listener();
|
|
594
790
|
};
|
|
595
|
-
|
|
791
|
+
reset();
|
|
792
|
+
let failures = 0;
|
|
596
793
|
const loop = async () => {
|
|
597
794
|
while (!stopped) {
|
|
598
795
|
controller = new AbortController();
|
|
599
796
|
try {
|
|
600
797
|
const response = await fetch("/api/auto-continue-bridge", { signal: controller.signal });
|
|
601
798
|
if (!response.ok || response.body === null) throw new Error(`bridge HTTP ${response.status}`);
|
|
799
|
+
failures = 0;
|
|
602
800
|
const reader = response.body.getReader();
|
|
603
801
|
const decoder = new TextDecoder();
|
|
604
802
|
let buffer = "";
|
|
@@ -625,7 +823,9 @@ function startBridge() {
|
|
|
625
823
|
}
|
|
626
824
|
if (!stopped) {
|
|
627
825
|
disconnected();
|
|
628
|
-
|
|
826
|
+
const delay = failures === 0 ? 500 : 3e3;
|
|
827
|
+
failures += 1;
|
|
828
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
629
829
|
}
|
|
630
830
|
}
|
|
631
831
|
};
|
|
@@ -633,7 +833,7 @@ function startBridge() {
|
|
|
633
833
|
return () => {
|
|
634
834
|
stopped = true;
|
|
635
835
|
controller?.abort();
|
|
636
|
-
|
|
836
|
+
reset();
|
|
637
837
|
};
|
|
638
838
|
}
|
|
639
839
|
|
|
@@ -839,7 +1039,7 @@ var CardForm = class {
|
|
|
839
1039
|
|
|
840
1040
|
// src/client/styles.ts
|
|
841
1041
|
var css = `
|
|
842
|
-
.dshAcComposer { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; min-height:
|
|
1042
|
+
.dshAcComposer { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; min-height: 28px; max-width: 100%; font: inherit; }
|
|
843
1043
|
.dshAcComposerCore { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
|
|
844
1044
|
.dshAcComposerCore > span { min-width: 0; }
|
|
845
1045
|
.dshAcModeTrigger { display: inline-flex; align-items: center; gap: 3px; min-width: 0; max-width: 132px; height: 28px; margin-left: -1px; padding: 0 4px 0 7px; border: 0; border-radius: var(--dsw-radius-sm, 6px); background: none; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; font-weight: 500; line-height: 20px; cursor: pointer; }
|
|
@@ -862,13 +1062,24 @@ var css = `
|
|
|
862
1062
|
.dshAcCard .dshAcMode:disabled { opacity: .5; }
|
|
863
1063
|
.dshAcCard .dshAcMode:focus-visible { outline: 2px solid var(--dsh-ac-text); outline-offset: 3px; }
|
|
864
1064
|
.dshAcComposerLabel { display: inline-flex; align-items: center; gap: 5px; flex: none; color: var(--dsw-alias-label-secondary); font-size: 12px; white-space: nowrap; }
|
|
865
|
-
.
|
|
866
|
-
.
|
|
867
|
-
.
|
|
868
|
-
.
|
|
1065
|
+
.dshAcIconBtn { position: relative; display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 999px; background-color: transparent; color: var(--dsw-alias-label-secondary, inherit); opacity: .9; cursor: pointer; transition: opacity .15s ease, background-color .15s ease, color .15s ease; }
|
|
1066
|
+
.dshAcIconBtn > svg { display: block; width: 14px; height: 14px; }
|
|
1067
|
+
.dshAcIconBtn[data-state="on"] { color: var(--dsw-alias-brand-primary, #4d8cff); opacity: 1; background-color: rgba(77, 140, 255, .14); background-color: color-mix(in srgb, var(--dsw-alias-brand-primary, #4d8cff) 14%, transparent); }
|
|
1068
|
+
.dshAcIconBtn[data-state="on"]:hover:not(:disabled) { background-color: rgba(77, 140, 255, .22); background-color: color-mix(in srgb, var(--dsw-alias-brand-primary, #4d8cff) 22%, transparent); }
|
|
1069
|
+
.dshAcIconBtn[data-state="off"] { opacity: .5; }
|
|
1070
|
+
.dshAcIconBtn[data-state="off"]:hover:not(:disabled) { opacity: .8; background: var(--dsw-alias-interactive-bg-hover); }
|
|
1071
|
+
.dshAcIconBtn:disabled { cursor: default; opacity: .4; }
|
|
1072
|
+
/* Reconnecting keeps the last known state visible, just dimmed. */
|
|
1073
|
+
.dshAcIconBtn[data-stale="true"]:disabled { opacity: .65; }
|
|
1074
|
+
.dshAcIconBtn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--dsw-focus-ring-color, var(--dsw-alias-brand-primary)); }
|
|
1075
|
+
.dshAcGlyph { fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
|
|
1076
|
+
.dshAcIconBtn[data-state="on"] > .dshAcGlyph { stroke-width: 1.6; }
|
|
1077
|
+
/* In the composer the mode name moves into the menu and tooltip; only the chevron stays. */
|
|
1078
|
+
.dshAcComposer .dshAcModeTriggerLabel { display: none; }
|
|
1079
|
+
.dshAcComposer .dshAcModeTrigger, .dshAcComposer .dshAcModeMenu { max-width: 28px; margin-left: -4px; padding: 0 2px; }
|
|
869
1080
|
.dshAcSwitchTarget { display: inline-flex; align-items: center; flex: none; min-height: 32px; }
|
|
870
1081
|
.dshAcSwitchTarget > button { position: relative; }
|
|
871
|
-
.dshAcSwitchTarget > button::before { content: ''; position: absolute; inset: -
|
|
1082
|
+
.dshAcSwitchTarget > button::before { content: ''; position: absolute; inset: -4px; }
|
|
872
1083
|
.dshAcComposerError { color: var(--dsw-alias-state-error-primary, var(--dsw-alias-label-secondary)); font-size: 12px; max-width: 160px; }
|
|
873
1084
|
.dshAcComposerError:empty { display: none; }
|
|
874
1085
|
.dshAcToastIcon { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
|
|
@@ -981,23 +1192,10 @@ var css = `
|
|
|
981
1192
|
.dshAcFooter { align-items: flex-start; flex-direction: column; gap: 10px; }
|
|
982
1193
|
.dshAcFooter > div { width: 100%; justify-content: flex-end; }
|
|
983
1194
|
}
|
|
984
|
-
/* Match the native picker breakpoints when the composer provides a query container. */
|
|
985
|
-
@container (width <= 640px) {
|
|
986
|
-
.dshAcComposerCore { gap: 5px; }
|
|
987
|
-
.dshAcModeTrigger, .dshAcModeMenu { max-width: 104px; padding: 0 3px 0 6px; }
|
|
988
|
-
}
|
|
989
|
-
@container (width <= 460px) {
|
|
990
|
-
.dshAcComposerText { display: none; }
|
|
991
|
-
.dshAcModeTrigger, .dshAcModeMenu { max-width: 28px; padding: 0 2px; }
|
|
992
|
-
.dshAcModeTriggerLabel { display: none; }
|
|
993
|
-
}
|
|
994
1195
|
/* DS-Bot can remove the query container with display: contents. */
|
|
995
1196
|
@media (max-width: 640px) {
|
|
996
1197
|
.dshAcComposer { flex-direction: column; align-items: flex-start; width: min-content; }
|
|
997
1198
|
.dshAcComposer > .dshAcComposerLabel { white-space: normal; }
|
|
998
|
-
.dshAcComposerCore { gap: 5px; }
|
|
999
|
-
.dshAcComposerText, .dshAcModeTriggerLabel { display: none; }
|
|
1000
|
-
.dshAcModeTrigger, .dshAcModeMenu { max-width: 28px; padding: 0 2px; }
|
|
1001
1199
|
}
|
|
1002
1200
|
|
|
1003
1201
|
`;
|
|
@@ -1034,7 +1232,8 @@ function showSettingsNotification(notice, locale, permission) {
|
|
|
1034
1232
|
return permission === "unsupported" ? "notification.unsupported" : permission === "failed" ? "notification.failed" : "notification.blocked";
|
|
1035
1233
|
}
|
|
1036
1234
|
try {
|
|
1037
|
-
const
|
|
1235
|
+
const resolved = resolveLocale(locale);
|
|
1236
|
+
const copy = resolved === "zh" ? zh : resolved === "ru" ? ru : en;
|
|
1038
1237
|
const notification = new Notification(copy["notification.title"], { body: copy[message] });
|
|
1039
1238
|
notification.onclick = () => {
|
|
1040
1239
|
try {
|
|
@@ -1080,6 +1279,7 @@ var AutoContinueSettingsCardController = class {
|
|
|
1080
1279
|
textField("continueText"),
|
|
1081
1280
|
textField("continueTextMaxTokens"),
|
|
1082
1281
|
booleanField("resumeSilentTurns"),
|
|
1282
|
+
booleanField("resumeSubagentSessions"),
|
|
1083
1283
|
booleanField("resumeCompletedTurns"),
|
|
1084
1284
|
booleanField("resumeInterruptedChildren"),
|
|
1085
1285
|
booleanField("resumeGoals"),
|
|
@@ -1128,6 +1328,7 @@ var AutoContinueSettingsCardController = class {
|
|
|
1128
1328
|
continueText: this.form.field("continueText"),
|
|
1129
1329
|
continueTextMaxTokens: this.form.field("continueTextMaxTokens"),
|
|
1130
1330
|
resumeSilentTurns: this.form.field("resumeSilentTurns"),
|
|
1331
|
+
resumeSubagentSessions: this.form.field("resumeSubagentSessions"),
|
|
1131
1332
|
resumeCompletedTurns: this.form.field("resumeCompletedTurns"),
|
|
1132
1333
|
resumeInterruptedChildren: this.form.field("resumeInterruptedChildren"),
|
|
1133
1334
|
resumeGoals: this.form.field("resumeGoals"),
|
|
@@ -1192,10 +1393,12 @@ var AutoContinueSettingsCardController = class {
|
|
|
1192
1393
|
composerProjection() {
|
|
1193
1394
|
const snapshot = this.scope.getSnapshot();
|
|
1194
1395
|
const policy = readSessionPolicy();
|
|
1396
|
+
const connected = isBridgeConnected();
|
|
1195
1397
|
return {
|
|
1196
1398
|
visible: snapshot.status === "ready" && (snapshot.value?.showComposerToggle ?? DEFAULT_CONFIG.showComposerToggle),
|
|
1197
1399
|
policy,
|
|
1198
|
-
|
|
1400
|
+
reconnecting: policy !== void 0 && !connected,
|
|
1401
|
+
writable: connected && canWriteSettings(snapshot) && policy?.writable === true,
|
|
1199
1402
|
saving: new Set(this.composerSaving),
|
|
1200
1403
|
failed: new Set(this.composerFailed)
|
|
1201
1404
|
};
|
|
@@ -1225,7 +1428,7 @@ function AutoContinueSettingsPage(props) {
|
|
|
1225
1428
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { style: { listStyle: "none", margin: 0, padding: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AutoContinueSettingsCard, { ...props }) });
|
|
1226
1429
|
}
|
|
1227
1430
|
var groups = [
|
|
1228
|
-
{ id: "general", fields: ["paused", "showComposerToggle", "usePluginSource", "resumeSilentTurns", "resumeCompletedTurns", "loopMaxIterations", "notify"] },
|
|
1431
|
+
{ id: "general", fields: ["paused", "showComposerToggle", "usePluginSource", "resumeSilentTurns", "resumeSubagentSessions", "resumeCompletedTurns", "loopMaxIterations", "notify"] },
|
|
1229
1432
|
{ id: "recovery", fields: ["graceMs", "cooldownMs", "maxConsecutive", "classify", "retryableErrorPatterns", "backoffFactor", "backoffMaxMs", "pauseWhenOffline", "offlineCheckMs", "resumeGoals", "resumePausedGoals"] },
|
|
1230
1433
|
{ id: "startup", fields: ["scanOnBoot", "resumeInterruptedChildren", "scanLimit", "freshMs"] },
|
|
1231
1434
|
{ id: "prompts", fields: ["continueText", "continueTextMaxTokens", "continueTextSilent", "continueTextInterrupted", "continueTextLoop", "guardPendingText", "guardDoneText", "loopText"] },
|
|
@@ -1682,35 +1885,23 @@ function ModeMenu(props) {
|
|
|
1682
1885
|
|
|
1683
1886
|
// src/client/auto-continue-icon.tsx
|
|
1684
1887
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1685
|
-
var primitives2 = (() => {
|
|
1686
|
-
try {
|
|
1687
|
-
return require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1688
|
-
} catch {
|
|
1689
|
-
return {};
|
|
1690
|
-
}
|
|
1691
|
-
})();
|
|
1692
|
-
var HostRefresh = primitives2.IconRefreshOutlineRegular;
|
|
1693
1888
|
function AutoContinueIcon() {
|
|
1694
|
-
|
|
1695
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { className: "dshAcComposerIconFallback", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
|
|
1696
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M13.25 8a5.25 5.25 0 1 1-1.54-3.71" }),
|
|
1697
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M13.25 3.1v3.3h-3.3" })
|
|
1698
|
-
] });
|
|
1889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { className: "dshAcGlyph", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M8 8C7 5.6 6.1 4.6 4.8 4.6C3.1 4.6 2 6.1 2 8C2 9.9 3.1 11.4 4.8 11.4C6.1 11.4 7 10.4 8 8C9 5.6 9.9 4.6 11.2 4.6C12.9 4.6 14 6.1 14 8C14 9.9 12.9 11.4 11.2 11.4C9.9 11.4 9 10.4 8 8Z" }) });
|
|
1699
1890
|
}
|
|
1700
1891
|
|
|
1701
1892
|
// src/client/native-toast.tsx
|
|
1702
1893
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1703
|
-
var
|
|
1894
|
+
var primitives2 = (() => {
|
|
1704
1895
|
try {
|
|
1705
1896
|
return require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1706
1897
|
} catch {
|
|
1707
1898
|
return {};
|
|
1708
1899
|
}
|
|
1709
1900
|
})();
|
|
1710
|
-
var NativeToast =
|
|
1901
|
+
var NativeToast = primitives2.Toast;
|
|
1711
1902
|
var hasNativeToast = typeof NativeToast === "function";
|
|
1712
1903
|
function WarningIcon() {
|
|
1713
|
-
const Icon =
|
|
1904
|
+
const Icon = primitives2.IconWarningOutlineRegular;
|
|
1714
1905
|
if (Icon) return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, {});
|
|
1715
1906
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("svg", { className: "dshAcToastIcon", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
|
|
1716
1907
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M8 2.3 14.3 13H1.7L8 2.3Z" }),
|
|
@@ -1743,9 +1934,10 @@ function AutoContinueComposerToggle(props) {
|
|
|
1743
1934
|
const failed = state2.failed.has(props.sessionId);
|
|
1744
1935
|
const saving = state2.saving.has(props.sessionId);
|
|
1745
1936
|
const policy = state2.policy;
|
|
1746
|
-
const
|
|
1937
|
+
const ownMode = sessionMode(policy?.modes ?? {}, props.sessionId);
|
|
1938
|
+
const mode = ownMode === "default" ? policy?.inheritedModes?.[props.sessionId] ?? "default" : ownMode;
|
|
1747
1939
|
const disabled = !policy || !state2.writable || saving;
|
|
1748
|
-
const title = props.t(!policy ? "composer.unavailable" : !state2.writable ? "chrome.readOnly" : saving ? "composer.saving" : "composer.scope");
|
|
1940
|
+
const title = props.t(!policy ? "composer.unavailable" : state2.reconnecting ? "composer.reconnecting" : !state2.writable ? "chrome.readOnly" : saving ? "composer.saving" : "composer.scope");
|
|
1749
1941
|
const modeName = props.t(`composer.${mode}`);
|
|
1750
1942
|
const defaultName = policy ? `${props.t("composer.default")} (${props.t(`composer.${policy.defaultMode}`)})` : props.t("composer.default");
|
|
1751
1943
|
const fullModeLabel = mode === "default" ? defaultName : modeName;
|
|
@@ -1756,22 +1948,27 @@ function AutoContinueComposerToggle(props) {
|
|
|
1756
1948
|
{ id: "recover", label: props.t("composer.recover") },
|
|
1757
1949
|
{ id: "loop", label: props.t("composer.loop") }
|
|
1758
1950
|
];
|
|
1951
|
+
const enabled = !!policy && mode !== "off";
|
|
1952
|
+
const onMode = policy?.inheritedModes?.[props.sessionId] === "off" ? "recover" : "default";
|
|
1759
1953
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "dshAcComposer", title, "aria-busy": saving || void 0, children: [
|
|
1760
1954
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "dshAcComposerCore", children: [
|
|
1761
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.
|
|
1762
|
-
|
|
1763
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "dshAcComposerText", children: props.t("composer.label") })
|
|
1764
|
-
] }),
|
|
1765
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "dshAcSwitchTarget", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1766
|
-
NativeSwitch,
|
|
1955
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1956
|
+
"button",
|
|
1767
1957
|
{
|
|
1768
|
-
|
|
1769
|
-
|
|
1958
|
+
type: "button",
|
|
1959
|
+
role: "switch",
|
|
1960
|
+
className: "dshAcIconBtn",
|
|
1961
|
+
"data-state": enabled ? "on" : "off",
|
|
1962
|
+
"data-stale": state2.reconnecting || void 0,
|
|
1963
|
+
"aria-checked": enabled,
|
|
1964
|
+
"aria-label": `${props.t("composer.label")}: ${fullModeLabel}`,
|
|
1965
|
+
title: `${modeTitle}
|
|
1966
|
+
${title}`,
|
|
1770
1967
|
disabled,
|
|
1771
|
-
|
|
1772
|
-
|
|
1968
|
+
onClick: () => props.setMode(enabled ? "off" : onMode),
|
|
1969
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AutoContinueIcon, {})
|
|
1773
1970
|
}
|
|
1774
|
-
)
|
|
1971
|
+
),
|
|
1775
1972
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1776
1973
|
ModeMenu,
|
|
1777
1974
|
{
|
|
@@ -1799,6 +1996,7 @@ var SETTINGS_NS = "auto-continue";
|
|
|
1799
1996
|
var inject = ["slots", "locale"];
|
|
1800
1997
|
function apply(ctx) {
|
|
1801
1998
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), "auto-continue: dictionaries");
|
|
1999
|
+
ctx.effect(() => ctx.locale.register(NS, "ru", ru), "auto-continue: russian dictionary");
|
|
1802
2000
|
ctx.effect(() => startBridge(), "auto-continue: host bridge");
|
|
1803
2001
|
ctx.inject(["settingsScope"], (settingsCtx) => {
|
|
1804
2002
|
mountSettings(settingsCtx, settingsCtx.settingsScope.bind({ namespace: SETTINGS_NS }));
|