dsh-client-auto-continue 0.11.8 → 0.11.9

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.
@@ -14,6 +14,8 @@ export const LOCALIZED_TEXT_DEFAULTS = {
14
14
  zh: {
15
15
  continueText: '继续',
16
16
  continueTextMaxTokens: '继续',
17
+ continueTextSilent:
18
+ '继续。你上一轮只输出了内部推理, 既没有回复也没有调用工具, 用户什么都没看到。每一轮都要以工具调用或可见回复结束。',
17
19
  guardPendingText: '(上一步工具「{tool}」可能未完成, 先确认状态再继续, 不要重复执行)',
18
20
  guardDoneText: '(上一步工具「{tool}」已完成, 结果: {result}; 不要重复执行, 直接继续)',
19
21
  loopText: '(检测到你可能陷入循环, 请停止重复刚才的动作, 换一种方式继续)',
@@ -21,6 +23,8 @@ export const LOCALIZED_TEXT_DEFAULTS = {
21
23
  en: {
22
24
  continueText: 'Continue',
23
25
  continueTextMaxTokens: 'Continue',
26
+ continueTextSilent:
27
+ '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.',
24
28
  guardPendingText:
25
29
  '(The previous tool "{tool}" may not have completed. Check its state before continuing and do not run it again.)',
26
30
  guardDoneText:
@@ -38,6 +42,10 @@ export interface AutoContinueSettings {
38
42
  continueText?: string;
39
43
  /** Text sent when the output token ceiling is reached (same placeholders as `continueText`). */
40
44
  continueTextMaxTokens?: string;
45
+ /** Resume observed model activity that completes without visible output. */
46
+ resumeSilentTurns?: boolean;
47
+ /** Text sent to resume a silent turn (same placeholders as `continueText`). */
48
+ continueTextSilent?: string;
41
49
  /** Idempotency guard: inspect the last tool call before resuming and steer the model. */
42
50
  guardTools?: boolean;
43
51
  /** Guard text appended when the last tool call has no confirmed result (it may have partially executed). */
@@ -50,11 +58,11 @@ export interface AutoContinueSettings {
50
58
  cooldownMs?: number;
51
59
  /** Max consecutive auto-continues per session before stopping. */
52
60
  maxConsecutive?: number;
53
- /** Scan recently interrupted sessions on page load / reconnect. */
61
+ /** Recover delayed interrupted sessions during the host startup window. */
54
62
  scanOnBoot?: boolean;
55
- /** Max sessions the scan checks (most recently updated). */
63
+ /** Max eligible recoveries per scan pass (most recently active first). */
56
64
  scanLimit?: number;
57
- /** Scan only considers interruptions inside this window (ms). */
65
+ /** Interruption freshness and duration of startup polling (ms). */
58
66
  freshMs?: number;
59
67
  /** Log `[auto-continue]` lines to the browser console. */
60
68
  verbose?: boolean;
@@ -93,6 +101,7 @@ export type AutoContinueConfig = Required<AutoContinueSettings>;
93
101
  export const DEFAULT_CONFIG: AutoContinueConfig = {
94
102
  locale: 'zh',
95
103
  ...LOCALIZED_TEXT_DEFAULTS.zh,
104
+ resumeSilentTurns: true,
96
105
  guardTools: true,
97
106
  graceMs: 3000,
98
107
  cooldownMs: 20000,
@@ -136,6 +145,10 @@ export function resolveConfig(section: AutoContinueSettings | undefined): AutoCo
136
145
  typeof value.continueTextMaxTokens === 'string' && value.continueTextMaxTokens.trim() !== ''
137
146
  ? value.continueTextMaxTokens
138
147
  : localized.continueTextMaxTokens;
148
+ const silentText =
149
+ typeof value.continueTextSilent === 'string' && value.continueTextSilent.trim() !== ''
150
+ ? value.continueTextSilent
151
+ : localized.continueTextSilent;
139
152
  const guardPendingText =
140
153
  typeof value.guardPendingText === 'string' && value.guardPendingText.trim() !== ''
141
154
  ? value.guardPendingText
@@ -148,6 +161,8 @@ export function resolveConfig(section: AutoContinueSettings | undefined): AutoCo
148
161
  locale,
149
162
  continueText: text,
150
163
  continueTextMaxTokens: maxTokensText,
164
+ resumeSilentTurns: booleanOr(value.resumeSilentTurns, DEFAULT_CONFIG.resumeSilentTurns),
165
+ continueTextSilent: silentText,
151
166
  guardTools: booleanOr(value.guardTools, DEFAULT_CONFIG.guardTools),
152
167
  guardPendingText,
153
168
  guardDoneText,
@@ -183,7 +198,7 @@ export function resolveConfig(section: AutoContinueSettings | undefined): AutoCo
183
198
  /**
184
199
  * 视为「非人为中断」的回合结束原因, 用于启动/重连扫描。
185
200
  * - `interrupted` 只由崩溃修复在宿主重载时写入(loop 永不实时发出), 因此仅在扫描路径处理;
186
- * - 实时事件路径只对 `error` / `max-tokens` 自动续跑;
201
+ * - 实时事件路径只对 `error` / `max-tokens` 自动续跑; 另外续跑没有可见输出的 `completed` / `no-visible-output` 回合(不属于本类型);
187
202
  * - `aborted`(用户停止)与 `blocked`(策略拒绝)永不自动继续。
188
203
  */
189
204
  type NonHumanReason = 'error' | 'interrupted' | 'max-tokens';
@@ -813,6 +828,10 @@ export interface SessionState {
813
828
  lastTurn: number | undefined;
814
829
  /** 我们最近一次自动发送的时间戳; 0 = 没有待确认的恢复。 */
815
830
  pendingRecoveryAt: number;
831
+ /** unknown: no observed start; empty: no model activity; silent: activity without visible output. */
832
+ turnOutput: 'unknown' | 'empty' | 'silent' | 'visible';
833
+ outputTurn: number | undefined;
834
+ outputStartSeq: number;
816
835
  /** 当前连续短句数(loop guard 信号 1: 空转)。 */
817
836
  shortRun: number;
818
837
  /** 最后一条短句的时间(时间窗判定用)。 */
@@ -846,6 +865,9 @@ export const freshState = (): SessionState => ({
846
865
  tools: new ToolInvocationTracker(),
847
866
  lastTurn: undefined,
848
867
  pendingRecoveryAt: 0,
868
+ turnOutput: 'unknown',
869
+ outputTurn: undefined,
870
+ outputStartSeq: 0,
849
871
  shortRun: 0,
850
872
  lastShortAt: 0,
851
873
  lastAssistantText: '',