dsh-client-auto-continue 0.14.3 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -6
- package/README.zh.md +15 -6
- package/lib/client.js +74 -5
- package/lib/client.js.map +2 -2
- package/lib/index.js +245 -16
- package/lib/types/client/bridge.d.ts +2 -0
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/locales.d.ts +15 -0
- package/lib/types/client/settings-card.d.ts +1 -0
- package/lib/types/host/engine.d.ts +27 -1
- package/lib/types/index.d.ts +8 -0
- package/lib/types/shared/core.d.ts +11 -0
- package/package.json +3 -3
- package/src/client/bridge.ts +10 -2
- package/src/client/index.ts +1 -0
- package/src/client/locales.ts +32 -2
- package/src/client/settings-card.tsx +32 -1
- package/src/client/styles.ts +1 -0
- package/src/host/engine.ts +255 -14
- package/src/index.ts +3 -0
- package/src/shared/core.ts +19 -0
package/src/shared/core.ts
CHANGED
|
@@ -17,6 +17,8 @@ export const LOCALIZED_TEXT_DEFAULTS = {
|
|
|
17
17
|
continueTextSilent:
|
|
18
18
|
'继续。你上一轮只输出了内部推理, 既没有回复也没有调用工具, 用户什么都没看到。每一轮都要以工具调用或可见回复结束。',
|
|
19
19
|
continueTextLoop: '继续',
|
|
20
|
+
continueTextInterrupted:
|
|
21
|
+
'继续。宿主在你上一轮运行期间重启了; 重启时未完成的工具调用已按「结果未知」收尾。从中断处继续, 重试可能有副作用的操作前先核实外部状态。',
|
|
20
22
|
guardPendingText: '(上一步工具「{tool}」可能未完成, 先确认状态再继续, 不要重复执行)',
|
|
21
23
|
guardDoneText: '(上一步工具「{tool}」已完成, 结果: {result}; 不要重复执行, 直接继续)',
|
|
22
24
|
loopText: '(检测到你可能陷入循环, 请停止重复刚才的动作, 换一种方式继续)',
|
|
@@ -27,6 +29,8 @@ export const LOCALIZED_TEXT_DEFAULTS = {
|
|
|
27
29
|
continueTextSilent:
|
|
28
30
|
'Continue. Your previous turn ended with internal reasoning only, with no message and no tool call, so nothing reached the user. Always finish a turn with a tool call or a visible answer.',
|
|
29
31
|
continueTextLoop: 'Continue',
|
|
32
|
+
continueTextInterrupted:
|
|
33
|
+
'Continue. The harness was restarted while your previous turn was still running; tool calls pending at the restart are recorded with unknown outcomes. Resume where you left off, verifying external state before retrying anything that may have side effects.',
|
|
30
34
|
guardPendingText:
|
|
31
35
|
'(The previous tool "{tool}" may not have completed. Check its state before continuing and do not run it again.)',
|
|
32
36
|
guardDoneText:
|
|
@@ -52,6 +56,8 @@ export interface AutoContinueSettings {
|
|
|
52
56
|
continueTextSilent?: string;
|
|
53
57
|
/** Text sent for each autonomous-loop continuation (same placeholders as `continueText`). */
|
|
54
58
|
continueTextLoop?: string;
|
|
59
|
+
/** Text sent when a turn is recovered after a harness restart closed it as interrupted. */
|
|
60
|
+
continueTextInterrupted?: string;
|
|
55
61
|
/** Idempotency guard: inspect the last tool call before resuming and steer the model. */
|
|
56
62
|
guardTools?: boolean;
|
|
57
63
|
/** Guard text appended when the last tool call has no confirmed result (it may have partially executed). */
|
|
@@ -164,6 +170,10 @@ export function resolveConfig(section: AutoContinueSettings | undefined): AutoCo
|
|
|
164
170
|
typeof value.continueTextLoop === 'string' && value.continueTextLoop.trim() !== ''
|
|
165
171
|
? value.continueTextLoop
|
|
166
172
|
: localized.continueTextLoop;
|
|
173
|
+
const interruptedText =
|
|
174
|
+
typeof value.continueTextInterrupted === 'string' && value.continueTextInterrupted.trim() !== ''
|
|
175
|
+
? value.continueTextInterrupted
|
|
176
|
+
: localized.continueTextInterrupted;
|
|
167
177
|
const guardPendingText =
|
|
168
178
|
typeof value.guardPendingText === 'string' && value.guardPendingText.trim() !== ''
|
|
169
179
|
? value.guardPendingText
|
|
@@ -180,6 +190,7 @@ export function resolveConfig(section: AutoContinueSettings | undefined): AutoCo
|
|
|
180
190
|
resumeCompletedTurns: booleanOr(value.resumeCompletedTurns, DEFAULT_CONFIG.resumeCompletedTurns),
|
|
181
191
|
continueTextSilent: silentText,
|
|
182
192
|
continueTextLoop: loopText,
|
|
193
|
+
continueTextInterrupted: interruptedText,
|
|
183
194
|
guardTools: booleanOr(value.guardTools, DEFAULT_CONFIG.guardTools),
|
|
184
195
|
guardPendingText,
|
|
185
196
|
guardDoneText,
|
|
@@ -788,6 +799,14 @@ function clientTimeZone(): string | undefined {
|
|
|
788
799
|
}
|
|
789
800
|
}
|
|
790
801
|
|
|
802
|
+
/** A sent recovery prompt, not proof that the following turn succeeded. */
|
|
803
|
+
export interface RecoveryAttempt {
|
|
804
|
+
sessionId: string;
|
|
805
|
+
at: number;
|
|
806
|
+
reason: 'error' | 'max-tokens' | 'silent' | 'interrupted' | 'loop-guard' | 'manual';
|
|
807
|
+
consecutive: number;
|
|
808
|
+
}
|
|
809
|
+
|
|
791
810
|
/** 一天的自动继续统计(host 单实例内存态)。 */
|
|
792
811
|
export interface DayStats {
|
|
793
812
|
/** 本地日期 YYYY-MM-DD。 */
|