dsh-client-auto-continue 0.12.2 → 0.13.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/lib/index.js CHANGED
@@ -137,6 +137,7 @@ var DEFAULT_CONFIG = {
137
137
  backoffMaxMs: 3e5,
138
138
  notify: false,
139
139
  paused: false,
140
+ showComposerToggle: true,
140
141
  loopGuard: true,
141
142
  loopShortChars: 40,
142
143
  loopWindowMs: 3e4,
@@ -184,6 +185,7 @@ function resolveConfig(section) {
184
185
  backoffMaxMs: numberOr(value.backoffMaxMs, DEFAULT_CONFIG.backoffMaxMs),
185
186
  notify: booleanOr(value.notify, DEFAULT_CONFIG.notify),
186
187
  paused: booleanOr(value.paused, DEFAULT_CONFIG.paused),
188
+ showComposerToggle: booleanOr(value.showComposerToggle, DEFAULT_CONFIG.showComposerToggle),
187
189
  loopGuard: booleanOr(value.loopGuard, DEFAULT_CONFIG.loopGuard),
188
190
  loopShortChars: Math.max(1, numberOr(value.loopShortChars, DEFAULT_CONFIG.loopShortChars)),
189
191
  loopWindowMs: Math.max(1e3, numberOr(value.loopWindowMs, DEFAULT_CONFIG.loopWindowMs)),
@@ -1629,6 +1631,8 @@ var AutoContinueSchema = z2.object({
1629
1631
  notify: z2.boolean().default(false),
1630
1632
  /** Globally pause auto-continue: no live or scan send. */
1631
1633
  paused: z2.boolean().default(false),
1634
+ /** Show the global auto-continue switch in the conversation composer. */
1635
+ showComposerToggle: z2.boolean().default(true),
1632
1636
  /** Loop guard: detect a running turn spinning in place and restart it. */
1633
1637
  loopGuard: z2.boolean().default(true),
1634
1638
  /** A model message shorter than this many chars counts as a short sentence (loop signal). */
@@ -0,0 +1,16 @@
1
+ import type { InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
2
+ import type { SnapshotStore } from './dsh-store-compat.ts';
3
+ export interface ComposerToggleState {
4
+ visible: boolean;
5
+ enabled: boolean;
6
+ writable: boolean;
7
+ saving: boolean;
8
+ failed: boolean;
9
+ }
10
+ export interface ComposerToggleFace {
11
+ hooks: {
12
+ autoContinueComposer: SnapshotStore<ComposerToggleState>;
13
+ };
14
+ setEnabled: (enabled: boolean) => void;
15
+ }
16
+ export declare function AutoContinueComposerToggle(props: PropsLocale<'auto-continue'> & InjectFace<ComposerToggleFace>): import("react").JSX.Element | null;
@@ -4,6 +4,7 @@
4
4
  * Since 0.8.0 the auto-continue ENGINE runs inside the host process (single
5
5
  * instance — see src/host/engine.ts), so this half only:
6
6
  * - registers the `auto-continue` settings card in the available plugin UI,
7
+ * - adds a native composer switch backed by the same global pause setting,
7
8
  * - subscribes to the host status bridge (SSE) and shows browser
8
9
  * notifications with action buttons (Resume now / Pause 1h) via the bridge
9
10
  * action endpoint,
@@ -13,6 +14,11 @@ import type { Context as ClientContext } from '@deepseek-ai/cordis';
13
14
  import { type SettingsCardKey } from './locales.ts';
14
15
  declare module '@deepseek-ai/dsh-client-ui-slots' {
15
16
  interface SlotMap {
17
+ /** Official compact composer tools; never occupy the resident single slot. */
18
+ 'conversation.input.left': {
19
+ kind: 'list';
20
+ scope: 'session';
21
+ };
16
22
  /** DSH 0.1.7's bundle configuration seat; only the owner props we consume. */
17
23
  'plugins.bundle.config': {
18
24
  kind: 'keyed';
@@ -20,6 +20,12 @@ export declare const zh: {
20
20
  'section.live.title': string;
21
21
  'section.live.description': string;
22
22
  'field.paused': string;
23
+ 'field.showComposerToggle': string;
24
+ 'field.showComposerToggleHint': string;
25
+ 'composer.label': string;
26
+ 'composer.scope': string;
27
+ 'composer.saving': string;
28
+ 'composer.saveFailed': string;
23
29
  'field.pausedHint': string;
24
30
  'field.continueText': string;
25
31
  'field.continueTextHint': string;
@@ -0,0 +1,10 @@
1
+ import type { ComponentType } from 'react';
2
+ interface SwitchProps {
3
+ checked: boolean;
4
+ onChange: (checked: boolean) => void;
5
+ label: string;
6
+ disabled?: boolean;
7
+ title?: string;
8
+ }
9
+ export declare const NativeSwitch: ComponentType<SwitchProps>;
10
+ export {};
@@ -1,10 +1,12 @@
1
1
  import type { InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
2
2
  import { type AutoContinueSettings } from './engine.ts';
3
+ import type { ComposerToggleFace } from './composer-toggle.tsx';
3
4
  import { type SettingsScope, type SnapshotStore } from './dsh-store-compat.ts';
4
5
  import { type CardActions, type CardFieldState, type CardShell } from './settings-form.ts';
5
6
  /** What the auto-continue card renders. */
6
7
  export interface AutoContinueSettingsCardState extends CardShell {
7
8
  paused: CardFieldState;
9
+ showComposerToggle: CardFieldState;
8
10
  continueText: CardFieldState;
9
11
  continueTextMaxTokens: CardFieldState;
10
12
  resumeSilentTurns: CardFieldState;
@@ -43,8 +45,13 @@ export interface AutoContinueSettingsCardFace extends CardActions {
43
45
  }
44
46
  /** Bridges the `auto-continue` scope onto the card's staged form. */
45
47
  export declare class AutoContinueSettingsCardController {
48
+ private readonly scope;
46
49
  private readonly form;
47
50
  private readonly store;
51
+ private readonly composer;
52
+ private composerSaving;
53
+ private composerFailed;
54
+ private disposed;
48
55
  /**
49
56
  * @param scope - the bound settings scope for the `auto-continue` namespace.
50
57
  */
@@ -55,6 +62,9 @@ export declare class AutoContinueSettingsCardController {
55
62
  * @returns the card's snapshot and its form actions.
56
63
  */
57
64
  inject(): AutoContinueSettingsCardFace;
65
+ injectComposer(): ComposerToggleFace;
66
+ private composerProjection;
67
+ private setEnabled;
58
68
  /** Release this card's subscription to the provider-owned settings form. */
59
69
  dispose(): void;
60
70
  }
@@ -63,6 +63,8 @@ export declare const AutoContinueSchema: z<Schemastery.ObjectS<{
63
63
  notify: z<boolean, boolean>;
64
64
  /** Globally pause auto-continue: no live or scan send. */
65
65
  paused: z<boolean, boolean>;
66
+ /** Show the global auto-continue switch in the conversation composer. */
67
+ showComposerToggle: z<boolean, boolean>;
66
68
  /** Loop guard: detect a running turn spinning in place and restart it. */
67
69
  loopGuard: z<boolean, boolean>;
68
70
  /** A model message shorter than this many chars counts as a short sentence (loop signal). */
@@ -124,6 +126,8 @@ export declare const AutoContinueSchema: z<Schemastery.ObjectS<{
124
126
  notify: z<boolean, boolean>;
125
127
  /** Globally pause auto-continue: no live or scan send. */
126
128
  paused: z<boolean, boolean>;
129
+ /** Show the global auto-continue switch in the conversation composer. */
130
+ showComposerToggle: z<boolean, boolean>;
127
131
  /** Loop guard: detect a running turn spinning in place and restart it. */
128
132
  loopGuard: z<boolean, boolean>;
129
133
  /** A model message shorter than this many chars counts as a short sentence (loop signal). */
@@ -190,6 +194,8 @@ export declare const Config: z<Schemastery.ObjectS<{
190
194
  notify: z<boolean, boolean>;
191
195
  /** Globally pause auto-continue: no live or scan send. */
192
196
  paused: z<boolean, boolean>;
197
+ /** Show the global auto-continue switch in the conversation composer. */
198
+ showComposerToggle: z<boolean, boolean>;
193
199
  /** Loop guard: detect a running turn spinning in place and restart it. */
194
200
  loopGuard: z<boolean, boolean>;
195
201
  /** A model message shorter than this many chars counts as a short sentence (loop signal). */
@@ -251,6 +257,8 @@ export declare const Config: z<Schemastery.ObjectS<{
251
257
  notify: z<boolean, boolean>;
252
258
  /** Globally pause auto-continue: no live or scan send. */
253
259
  paused: z<boolean, boolean>;
260
+ /** Show the global auto-continue switch in the conversation composer. */
261
+ showComposerToggle: z<boolean, boolean>;
254
262
  /** Loop guard: detect a running turn spinning in place and restart it. */
255
263
  loopGuard: z<boolean, boolean>;
256
264
  /** A model message shorter than this many chars counts as a short sentence (loop signal). */
@@ -76,6 +76,8 @@ export interface AutoContinueSettings {
76
76
  notify?: boolean;
77
77
  /** Globally pause auto-continue: no live or scan send, queued pending sends cancelled. */
78
78
  paused?: boolean;
79
+ /** Show the global auto-continue switch in the conversation composer. */
80
+ showComposerToggle?: boolean;
79
81
  /** Loop guard: detect a running turn spinning in place (short talk without tools, or the same tool repeating) and restart it. */
80
82
  loopGuard?: boolean;
81
83
  /** A model message shorter than this many chars counts as a "short sentence" (loop signal). */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-client-auto-continue",
3
3
  "description": "DSH Web UI plugin: automatically sends a localized continue prompt when a request is interrupted by network errors or other non-human causes",
4
- "version": "0.12.2",
4
+ "version": "0.13.0",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/types/index.d.ts",
@@ -46,8 +46,8 @@
46
46
  "build": "node build.mjs && tsc -p tsconfig.build.json",
47
47
  "watch": "node build.mjs --watch",
48
48
  "typecheck": "tsc --noEmit",
49
- "test:runtime": "node tests/settings-host-live.mjs 0.1.7 && node tests/settings-host-live.mjs 0.2.0 && node tests/profile-compatibility.mjs && node tests/client-settings-services.mjs 0.2.0",
50
- "test": "node tests/scan-on-boot.mjs && node tests/silent-turn-boundaries.mjs && node tests/autonomous-loop.mjs && node tests/manual-resume-pauses.mjs && node tests/stats-freshness.mjs && node tests/simulate-host.mjs && node tests/settings-host-compat.mjs && node tests/simulate-client-loader.mjs && node tests/client-settings-services.mjs && node tests/client-settings-form.mjs && node tests/locale-mirror-bounded.mjs && node tests/settings-card-ui.mjs && node tests/prepare-github-package.mjs",
49
+ "test:runtime": "node tests/settings-host-live.mjs 0.1.7 && node tests/settings-host-live.mjs 0.2.0 && node tests/settings-host-live.mjs 0.2.1 && node tests/profile-compatibility.mjs 0.2.0 && node tests/profile-compatibility.mjs 0.2.1 && node tests/client-settings-services.mjs 0.2.0 && node tests/client-settings-services.mjs 0.2.1",
50
+ "test": "node tests/scan-on-boot.mjs && node tests/silent-turn-boundaries.mjs && node tests/autonomous-loop.mjs && node tests/manual-resume-pauses.mjs && node tests/stats-freshness.mjs && node tests/simulate-host.mjs && node tests/settings-host-compat.mjs && node tests/simulate-client-loader.mjs && node tests/client-settings-services.mjs && node tests/client-settings-form.mjs && node tests/locale-mirror-bounded.mjs && node tests/settings-card-ui.mjs && node tests/composer-toggle.mjs && node tests/prepare-github-package.mjs",
51
51
  "prepack": "npm run build"
52
52
  },
53
53
  "keywords": [
@@ -0,0 +1,34 @@
1
+ import type { InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
2
+ import type { SnapshotStore } from './dsh-store-compat.ts';
3
+ import { NativeSwitch } from './native-switch.tsx';
4
+
5
+ export interface ComposerToggleState {
6
+ visible: boolean;
7
+ enabled: boolean;
8
+ writable: boolean;
9
+ saving: boolean;
10
+ failed: boolean;
11
+ }
12
+
13
+ export interface ComposerToggleFace {
14
+ hooks: { autoContinueComposer: SnapshotStore<ComposerToggleState> };
15
+ setEnabled: (enabled: boolean) => void;
16
+ }
17
+
18
+ export function AutoContinueComposerToggle(props: PropsLocale<'auto-continue'> & InjectFace<ComposerToggleFace>) {
19
+ const state = props.useAutoContinueComposer((snapshot) => snapshot);
20
+ if (!state.visible) return null;
21
+ const title = props.t(!state.writable ? 'chrome.readOnly' : state.saving ? 'composer.saving' : 'composer.scope');
22
+ return (
23
+ <div className="dshAcComposer" title={title}>
24
+ <span className="dshAcComposerLabel">{props.t('composer.label')}</span>
25
+ <span className="dshAcSwitchTarget">
26
+ <NativeSwitch checked={state.enabled} onChange={props.setEnabled}
27
+ disabled={!state.writable || state.saving} label={props.t('composer.label')} title={title} />
28
+ </span>
29
+ <span className="dshAcComposerError" role="status">
30
+ {state.failed ? props.t('composer.saveFailed') : null}
31
+ </span>
32
+ </div>
33
+ );
34
+ }
@@ -4,6 +4,7 @@
4
4
  * Since 0.8.0 the auto-continue ENGINE runs inside the host process (single
5
5
  * instance — see src/host/engine.ts), so this half only:
6
6
  * - registers the `auto-continue` settings card in the available plugin UI,
7
+ * - adds a native composer switch backed by the same global pause setting,
7
8
  * - subscribes to the host status bridge (SSE) and shows browser
8
9
  * notifications with action buttons (Resume now / Pause 1h) via the bridge
9
10
  * action endpoint,
@@ -24,6 +25,7 @@ import {
24
25
  AutoContinueSettingsPage,
25
26
  } from './settings-card.tsx';
26
27
  import { startBridge } from './bridge.ts';
28
+ import { AutoContinueComposerToggle } from './composer-toggle.tsx';
27
29
  import type { SettingsScope } from './dsh-store-compat.ts';
28
30
 
29
31
  /** Dictionary namespace owned by this plugin. */
@@ -34,6 +36,11 @@ const SETTINGS_NS = 'auto-continue';
34
36
 
35
37
  declare module '@deepseek-ai/dsh-client-ui-slots' {
36
38
  interface SlotMap {
39
+ /** Official compact composer tools; never occupy the resident single slot. */
40
+ 'conversation.input.left': {
41
+ kind: 'list';
42
+ scope: 'session';
43
+ };
37
44
  /** DSH 0.1.7's bundle configuration seat; only the owner props we consume. */
38
45
  'plugins.bundle.config': {
39
46
  kind: 'keyed';
@@ -137,6 +144,18 @@ function mountSettings(ctx: ClientContext, scope: SettingsScope<AutoContinueSett
137
144
  const controller = new AutoContinueSettingsCardController(scope);
138
145
  ctx.effect(() => () => controller.dispose(), 'auto-continue: settings form');
139
146
 
147
+ ctx.slots.inject('conversation.input.left', () =>
148
+ ctx.slots.register(
149
+ {
150
+ name: 'conversation.input.left',
151
+ id: 'auto-continue',
152
+ locale: NS,
153
+ inject: () => controller.injectComposer(),
154
+ },
155
+ AutoContinueComposerToggle,
156
+ ),
157
+ );
158
+
140
159
  // Slot injection waits for the matching UI declaration. Keep the old
141
160
  // settings card and the new bundle page independent of service migration.
142
161
  ctx.slots.inject('settings.plugin.item', () =>
@@ -27,6 +27,12 @@ export const zh = {
27
27
  'section.live.title': '现场状态',
28
28
  'section.live.description': '看看今天接住了多少次,以及哪些会话还在暂停。',
29
29
  'field.paused': '暂停自动继续',
30
+ 'field.showComposerToggle': '在会话区显示自动继续开关',
31
+ 'field.showComposerToggleHint': '默认显示。隐藏开关不会暂停自动继续;点击保存后生效。',
32
+ 'composer.label': '自动继续',
33
+ 'composer.scope': '控制当前配置下所有会话的自动继续,修改立即保存。',
34
+ 'composer.saving': '正在保存自动继续设置…',
35
+ 'composer.saveFailed': '保存失败,请重试',
30
36
  'field.pausedHint': '全局暂停: 实时与扫描都不会再自动发送, 已排队的待发送也会取消。',
31
37
  'field.continueText': '继续文本',
32
38
  'field.continueTextHint': '中断后自动发送的消息内容。',
@@ -148,6 +154,12 @@ export const en: Record<SettingsCardKey, string> = {
148
154
  'section.live.title': 'Live signal',
149
155
  'section.live.description': 'See what the relay caught today and which sessions are still paused.',
150
156
  'field.paused': 'Pause auto-continue',
157
+ 'field.showComposerToggle': 'Show auto-continue switch in the composer',
158
+ 'field.showComposerToggleHint': 'Shown by default. Hiding the switch does not pause auto-continue. Click Save to apply.',
159
+ 'composer.label': 'Auto-continue',
160
+ 'composer.scope': 'Controls auto-continue for all sessions in this profile. Changes save immediately.',
161
+ 'composer.saving': 'Saving auto-continue setting…',
162
+ 'composer.saveFailed': 'Could not save. Try again.',
151
163
  'field.pausedHint': 'Globally pause: no live or scan auto-send fires, and queued pending sends are cancelled.',
152
164
  'field.continueText': 'Continue text',
153
165
  'field.continueTextHint': 'Message automatically sent after an interruption.',
@@ -0,0 +1,33 @@
1
+ import type { ComponentType } from 'react';
2
+
3
+ interface SwitchProps {
4
+ checked: boolean;
5
+ onChange: (checked: boolean) => void;
6
+ label: string;
7
+ disabled?: boolean;
8
+ title?: string;
9
+ }
10
+
11
+ // DSH 0.1.0-rc.7 predates this export. Keep its settings page usable while
12
+ // current hosts render their own Switch, including the active theme's styles.
13
+ function legacySwitch(props: SwitchProps) {
14
+ return (
15
+ <button type="button" role="switch" className="dshAcSwitch"
16
+ aria-checked={props.checked} aria-label={props.label} disabled={props.disabled}
17
+ title={props.title} onClick={() => props.onChange(!props.checked)}>
18
+ <span />
19
+ </button>
20
+ );
21
+ }
22
+
23
+ function resolveSwitch(): ComponentType<SwitchProps> {
24
+ try {
25
+ const { Switch } = require('@deepseek-ai/dsh-client-ui-primitives') as { Switch?: ComponentType<SwitchProps> };
26
+ if (typeof Switch === 'function') return Switch;
27
+ } catch {
28
+ // Legacy hosts can omit the primitives module from their client graph.
29
+ }
30
+ return legacySwitch;
31
+ }
32
+
33
+ export const NativeSwitch = resolveSwitch();
@@ -9,7 +9,9 @@
9
9
  */
10
10
  import { useEffect, useState, type ReactNode } from 'react';
11
11
  import type { InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
12
- import { type AutoContinueSettings } from './engine.ts';
12
+ import { DEFAULT_CONFIG, type AutoContinueSettings } from './engine.ts';
13
+ import type { ComposerToggleFace, ComposerToggleState } from './composer-toggle.tsx';
14
+ import { NativeSwitch } from './native-switch.tsx';
13
15
  import { createSnapshotStore, type SettingsScope, type SnapshotStore } from './dsh-store-compat.ts';
14
16
  import {
15
17
  pausedSessions,
@@ -37,6 +39,7 @@ injectStyles();
37
39
  /** What the auto-continue card renders. */
38
40
  export interface AutoContinueSettingsCardState extends CardShell {
39
41
  paused: CardFieldState;
42
+ showComposerToggle: CardFieldState;
40
43
  continueText: CardFieldState;
41
44
  continueTextMaxTokens: CardFieldState;
42
45
  resumeSilentTurns: CardFieldState;
@@ -79,13 +82,18 @@ export interface AutoContinueSettingsCardFace extends CardActions {
79
82
  export class AutoContinueSettingsCardController {
80
83
  private readonly form: CardForm<AutoContinueSettings>;
81
84
  private readonly store: SnapshotStore<AutoContinueSettingsCardState>;
85
+ private readonly composer: SnapshotStore<ComposerToggleState>;
86
+ private composerSaving = false;
87
+ private composerFailed = false;
88
+ private disposed = false;
82
89
 
83
90
  /**
84
91
  * @param scope - the bound settings scope for the `auto-continue` namespace.
85
92
  */
86
- constructor(scope: SettingsScope<AutoContinueSettings>) {
93
+ constructor(private readonly scope: SettingsScope<AutoContinueSettings>) {
87
94
  this.form = new CardForm(scope, [
88
95
  booleanField('paused'),
96
+ booleanField('showComposerToggle'),
89
97
  textField('continueText'),
90
98
  textField('continueTextMaxTokens'),
91
99
  booleanField('resumeSilentTurns'),
@@ -116,12 +124,14 @@ export class AutoContinueSettingsCardController {
116
124
  textField('loopText'),
117
125
  ]);
118
126
  this.store = this.form.bind(() => this.projection(), createSnapshotStore);
127
+ this.composer = this.form.bind(() => this.composerProjection(), createSnapshotStore);
119
128
  }
120
129
 
121
130
  private projection(): AutoContinueSettingsCardState {
122
131
  return {
123
132
  ...this.form.shell(),
124
133
  paused: this.form.field('paused'),
134
+ showComposerToggle: this.form.field('showComposerToggle'),
125
135
  continueText: this.form.field('continueText'),
126
136
  continueTextMaxTokens: this.form.field('continueTextMaxTokens'),
127
137
  resumeSilentTurns: this.form.field('resumeSilentTurns'),
@@ -161,8 +171,40 @@ export class AutoContinueSettingsCardController {
161
171
  return { hooks: { autoContinueSettingsCard: this.store }, ...this.form.actions() };
162
172
  }
163
173
 
174
+ injectComposer(): ComposerToggleFace {
175
+ return { hooks: { autoContinueComposer: this.composer }, setEnabled: (enabled) => void this.setEnabled(enabled) };
176
+ }
177
+
178
+ private composerProjection(): ComposerToggleState {
179
+ const snapshot = this.scope.getSnapshot();
180
+ return {
181
+ visible: snapshot.status === 'ready' && (snapshot.value?.showComposerToggle ?? DEFAULT_CONFIG.showComposerToggle),
182
+ enabled: !(snapshot.value?.paused ?? DEFAULT_CONFIG.paused),
183
+ writable: snapshot.status === 'ready' && snapshot.writable && snapshot.mode === 'host',
184
+ saving: this.composerSaving,
185
+ failed: this.composerFailed,
186
+ };
187
+ }
188
+
189
+ private async setEnabled(enabled: boolean): Promise<void> {
190
+ if (this.disposed || this.composerSaving || !this.composerProjection().writable) return;
191
+ this.composerSaving = true;
192
+ this.composerFailed = false;
193
+ this.composer.set(this.composerProjection());
194
+ try {
195
+ const result = await this.scope.set('paused', !enabled);
196
+ this.composerFailed = result === false || this.composerProjection().enabled !== enabled;
197
+ } catch {
198
+ this.composerFailed = true;
199
+ } finally {
200
+ this.composerSaving = false;
201
+ if (!this.disposed) this.composer.set(this.composerProjection());
202
+ }
203
+ }
204
+
164
205
  /** Release this card's subscription to the provider-owned settings form. */
165
206
  dispose(): void {
207
+ this.disposed = true;
166
208
  this.form.dispose();
167
209
  }
168
210
  }
@@ -418,6 +460,29 @@ function BooleanField(props: FieldProps) {
418
460
  );
419
461
  }
420
462
 
463
+ /** Visibility is staged with the rest of the form, including Reset/Discard. */
464
+ function ComposerVisibilityField(props: FieldProps) {
465
+ return (
466
+ <div className="dshAcField dshAcFieldWide">
467
+ <div className="dshAcHead">
468
+ <span className="dshAcLabel">{props.label}</span>
469
+ <span className="dshAcBadges">
470
+ {props.overridden ? <>
471
+ <span className="dshAcBadge">{props.t('chrome.overridden')}</span>
472
+ <button type="button" className="dshAcReset" disabled={props.disabled}
473
+ onClick={props.onReset}>{props.t('chrome.reset')}</button>
474
+ </> : null}
475
+ <span className="dshAcSwitchTarget">
476
+ <NativeSwitch checked={props.text === '' ? DEFAULT_CONFIG.showComposerToggle : props.text === 'true'}
477
+ onChange={(checked) => props.onEdit(String(checked))} label={props.label} disabled={props.disabled} />
478
+ </span>
479
+ </span>
480
+ </div>
481
+ <p className="dshAcHint">{props.hint}</p>
482
+ </div>
483
+ );
484
+ }
485
+
421
486
  type SettingsSectionTone = 'handoff' | 'autoloop' | 'safety' | 'recovery' | 'loop' | 'live';
422
487
 
423
488
  /** A real behavior group, not a decorative divider: each section maps to one phase of the relay. */
@@ -585,6 +650,15 @@ export function AutoContinueSettingsCard(props: AutoContinueSettingsCardProps) {
585
650
  onEdit={(text) => props.edit('paused', text)}
586
651
  onReset={() => props.resetField('paused')}
587
652
  />
653
+ <ComposerVisibilityField
654
+ id="auto-continue-show-composer-toggle"
655
+ label={t('field.showComposerToggle')}
656
+ hint={t('field.showComposerToggleHint')}
657
+ {...shared}
658
+ {...state.showComposerToggle}
659
+ onEdit={(text) => props.edit('showComposerToggle', text)}
660
+ onReset={() => props.resetField('showComposerToggle')}
661
+ />
588
662
  <ValueField
589
663
  id="auto-continue-continue-text"
590
664
  label={t('field.continueText')}
@@ -6,6 +6,20 @@
6
6
  */
7
7
 
8
8
  const css = `
9
+ .dshAcComposer { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; flex: 0 0 auto; font: inherit; }
10
+ .dshAcComposerLabel { color: var(--dsw-alias-label-secondary); font-size: 12px; white-space: nowrap; }
11
+ .dshAcSwitchTarget { display: inline-flex; align-items: center; min-height: 32px; }
12
+ .dshAcSwitchTarget > button { position: relative; }
13
+ .dshAcSwitchTarget > button::before { content: ''; position: absolute; inset: -6px -3px; }
14
+ .dshAcComposerError { color: var(--dsw-alias-state-error-primary, var(--dsw-alias-label-secondary)); font-size: 12px; max-width: 160px; }
15
+ .dshAcComposerError:empty { display: none; }
16
+ .dshAcSwitch { position: relative; box-sizing: border-box; flex: none; width: 36px; height: 20px; padding: 2px; border: 0; border-radius: 999px; background: var(--dsw-alias-border-l3); cursor: pointer; }
17
+ .dshAcSwitch[aria-checked='true'] { background: var(--dsw-alias-brand-primary); }
18
+ .dshAcSwitch > span { display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--dsw-alias-label-primary-foreground); }
19
+ .dshAcSwitch[aria-checked='true'] > span { transform: translateX(16px); }
20
+ .dshAcSwitch[aria-checked='false'] > span { background: var(--dsw-alias-switch-thumb, var(--dsw-alias-label-primary-foreground)); }
21
+ .dshAcSwitch:disabled { opacity: .5; cursor: default; }
22
+ .dshAcSwitch:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }
9
23
  .dshAcCard {
10
24
  --dsh-ac-violet: #8b7cff;
11
25
  --dsh-ac-cyan: #45cce5;
package/src/index.ts CHANGED
@@ -74,6 +74,8 @@ export const AutoContinueSchema = z.object({
74
74
  notify: z.boolean().default(false),
75
75
  /** Globally pause auto-continue: no live or scan send. */
76
76
  paused: z.boolean().default(false),
77
+ /** Show the global auto-continue switch in the conversation composer. */
78
+ showComposerToggle: z.boolean().default(true),
77
79
  /** Loop guard: detect a running turn spinning in place and restart it. */
78
80
  loopGuard: z.boolean().default(true),
79
81
  /** A model message shorter than this many chars counts as a short sentence (loop signal). */
@@ -84,6 +84,8 @@ export interface AutoContinueSettings {
84
84
  notify?: boolean;
85
85
  /** Globally pause auto-continue: no live or scan send, queued pending sends cancelled. */
86
86
  paused?: boolean;
87
+ /** Show the global auto-continue switch in the conversation composer. */
88
+ showComposerToggle?: boolean;
87
89
  /** Loop guard: detect a running turn spinning in place (short talk without tools, or the same tool repeating) and restart it. */
88
90
  loopGuard?: boolean;
89
91
  /** A model message shorter than this many chars counts as a "short sentence" (loop signal). */
@@ -124,6 +126,7 @@ export const DEFAULT_CONFIG: AutoContinueConfig = {
124
126
  backoffMaxMs: 300000,
125
127
  notify: false,
126
128
  paused: false,
129
+ showComposerToggle: true,
127
130
  loopGuard: true,
128
131
  loopShortChars: 40,
129
132
  loopWindowMs: 30000,
@@ -196,6 +199,7 @@ export function resolveConfig(section: AutoContinueSettings | undefined): AutoCo
196
199
  backoffMaxMs: numberOr(value.backoffMaxMs, DEFAULT_CONFIG.backoffMaxMs),
197
200
  notify: booleanOr(value.notify, DEFAULT_CONFIG.notify),
198
201
  paused: booleanOr(value.paused, DEFAULT_CONFIG.paused),
202
+ showComposerToggle: booleanOr(value.showComposerToggle, DEFAULT_CONFIG.showComposerToggle),
199
203
  loopGuard: booleanOr(value.loopGuard, DEFAULT_CONFIG.loopGuard),
200
204
  loopShortChars: Math.max(1, numberOr(value.loopShortChars, DEFAULT_CONFIG.loopShortChars)),
201
205
  loopWindowMs: Math.max(1000, numberOr(value.loopWindowMs, DEFAULT_CONFIG.loopWindowMs)),