dsh-client-auto-continue 0.12.2 → 0.14.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.
Files changed (34) hide show
  1. package/README.md +37 -21
  2. package/README.zh.md +37 -21
  3. package/docs/screenshots/01-settings-section.png +0 -0
  4. package/docs/screenshots/01-settings-section.zh.png +0 -0
  5. package/docs/screenshots/02-settings-card.png +0 -0
  6. package/docs/screenshots/02-settings-card.zh.png +0 -0
  7. package/docs/screenshots/07-card-panels.png +0 -0
  8. package/docs/screenshots/07-card-panels.zh.png +0 -0
  9. package/docs/screenshots/08-composer-toggle.png +0 -0
  10. package/docs/screenshots/08-composer-toggle.zh.png +0 -0
  11. package/docs/screenshots/README.md +27 -23
  12. package/lib/client.js +524 -1102
  13. package/lib/client.js.map +4 -4
  14. package/lib/index.js +4 -0
  15. package/lib/types/client/composer-toggle.d.ts +16 -0
  16. package/lib/types/client/index.d.ts +6 -0
  17. package/lib/types/client/locales.d.ts +31 -15
  18. package/lib/types/client/native-switch.d.ts +10 -0
  19. package/lib/types/client/settings-card.d.ts +22 -7
  20. package/lib/types/client/settings-form.d.ts +2 -2
  21. package/lib/types/client/settings-notifications.d.ts +8 -0
  22. package/lib/types/index.d.ts +8 -0
  23. package/lib/types/shared/core.d.ts +2 -0
  24. package/package.json +3 -3
  25. package/src/client/composer-toggle.tsx +34 -0
  26. package/src/client/index.ts +20 -1
  27. package/src/client/locales.ts +74 -42
  28. package/src/client/native-switch.tsx +33 -0
  29. package/src/client/settings-card.tsx +167 -614
  30. package/src/client/settings-form.ts +15 -9
  31. package/src/client/settings-notifications.ts +42 -0
  32. package/src/client/styles.ts +124 -382
  33. package/src/index.ts +2 -0
  34. package/src/shared/core.ts +4 -0
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';
@@ -2,24 +2,40 @@
2
2
  export declare const zh: {
3
3
  'card.title': string;
4
4
  'card.description': string;
5
- 'flow.interrupted': string;
6
- 'flow.grace': string;
7
- 'flow.continue': string;
8
5
  'repo.star': string;
6
+ 'repo.note': string;
7
+ 'repo.link': string;
9
8
  'repo.aria': string;
10
- 'section.handoff.title': string;
11
- 'section.handoff.description': string;
12
- 'section.autoloop.title': string;
13
- 'section.autoloop.description': string;
14
- 'section.safety.title': string;
15
- 'section.safety.description': string;
16
- 'section.recovery.title': string;
17
- 'section.recovery.description': string;
18
- 'section.loop.title': string;
19
- 'section.loop.description': string;
20
- 'section.live.title': string;
21
- 'section.live.description': string;
9
+ 'chrome.enabled': string;
10
+ 'chrome.paused': string;
11
+ 'chrome.saved': string;
12
+ 'notification.title': string;
13
+ 'notification.enabled': string;
14
+ 'notification.disabled': string;
15
+ 'notification.saved': string;
16
+ 'notification.blocked': string;
17
+ 'notification.unsupported': string;
18
+ 'notification.failed': string;
19
+ 'chrome.categories': string;
20
+ 'category.general.title': string;
21
+ 'category.general.description': string;
22
+ 'category.recovery.title': string;
23
+ 'category.recovery.description': string;
24
+ 'category.startup.title': string;
25
+ 'category.startup.description': string;
26
+ 'category.prompts.title': string;
27
+ 'category.prompts.description': string;
28
+ 'category.safety.title': string;
29
+ 'category.safety.description': string;
30
+ 'category.status.title': string;
31
+ 'category.status.description': string;
22
32
  'field.paused': string;
33
+ 'field.showComposerToggle': string;
34
+ 'field.showComposerToggleHint': string;
35
+ 'composer.label': string;
36
+ 'composer.scope': string;
37
+ 'composer.saving': string;
38
+ 'composer.saveFailed': string;
23
39
  'field.pausedHint': string;
24
40
  'field.continueText': string;
25
41
  '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,17 @@
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';
5
+ import type { SettingsCardKey } from './locales.ts';
4
6
  import { type CardActions, type CardFieldState, type CardShell } from './settings-form.ts';
5
7
  /** What the auto-continue card renders. */
6
8
  export interface AutoContinueSettingsCardState extends CardShell {
9
+ /** Committed global state; a staged edit does not pause the engine yet. */
10
+ enabled: boolean;
11
+ /** Feedback for the last local save, including browser permission problems. */
12
+ notificationFeedback: SettingsCardKey | undefined;
7
13
  paused: CardFieldState;
14
+ showComposerToggle: CardFieldState;
8
15
  continueText: CardFieldState;
9
16
  continueTextMaxTokens: CardFieldState;
10
17
  resumeSilentTurns: CardFieldState;
@@ -43,18 +50,30 @@ export interface AutoContinueSettingsCardFace extends CardActions {
43
50
  }
44
51
  /** Bridges the `auto-continue` scope onto the card's staged form. */
45
52
  export declare class AutoContinueSettingsCardController {
53
+ private readonly scope;
54
+ private readonly getLocale;
46
55
  private readonly form;
47
56
  private readonly store;
57
+ private readonly composer;
58
+ private composerSaving;
59
+ private composerFailed;
60
+ private disposed;
61
+ private saveSequence;
62
+ private notificationFeedback;
48
63
  /**
49
64
  * @param scope - the bound settings scope for the `auto-continue` namespace.
50
65
  */
51
- constructor(scope: SettingsScope<AutoContinueSettings>);
66
+ constructor(scope: SettingsScope<AutoContinueSettings>, getLocale: () => string);
52
67
  private projection;
53
68
  /**
54
69
  * Build the face the card's slot registration injects.
55
70
  * @returns the card's snapshot and its form actions.
56
71
  */
57
72
  inject(): AutoContinueSettingsCardFace;
73
+ private save;
74
+ injectComposer(): ComposerToggleFace;
75
+ private composerProjection;
76
+ private setEnabled;
58
77
  /** Release this card's subscription to the provider-owned settings form. */
59
78
  dispose(): void;
60
79
  }
@@ -62,9 +81,5 @@ export declare class AutoContinueSettingsCardController {
62
81
  export type AutoContinueSettingsCardProps = PropsLocale<'auto-continue'> & InjectFace<AutoContinueSettingsCardFace>;
63
82
  /** The bundle page supplies no list container, unlike the legacy settings slot. */
64
83
  export declare function AutoContinueSettingsPage(props: AutoContinueSettingsCardProps): import("react").JSX.Element;
65
- /**
66
- * Render the auto-continue card.
67
- * @param props - locale copy, the card snapshot, and its form actions.
68
- * @returns the card.
69
- */
70
- export declare function AutoContinueSettingsCard(props: AutoContinueSettingsCardProps): import("react").JSX.Element;
84
+ /** Native category layout, with the selected B3 repository invitation beside the introduction. */
85
+ export declare function AutoContinueSettingsCard(props: AutoContinueSettingsCardProps): import("react").JSX.Element | null;
@@ -104,9 +104,9 @@ export declare class CardForm<T> {
104
104
  actions(): CardActions;
105
105
  /**
106
106
  * Write every staged edit, then re-seed from what the Host accepted.
107
- * @returns settlement after every write and the read-back.
107
+ * @returns true only when a non-empty save was accepted and read back.
108
108
  */
109
- save(): Promise<void>;
109
+ save(): Promise<boolean>;
110
110
  /**
111
111
  * Every staged edit a save would write. An entry whose draft is not a value
112
112
  * its field accepts carries no write: the form is still dirty, and the save
@@ -0,0 +1,8 @@
1
+ import { type SettingsCardKey } from './locales.ts';
2
+ type Permission = NotificationPermission | 'unsupported' | 'failed';
3
+ export type SettingsNotice = 'enabled' | 'disabled' | 'saved';
4
+ /** Called directly by Save, before a network await can consume user activation. */
5
+ export declare function prepareSettingsNotification(enabled: boolean): Promise<Permission>;
6
+ /** The save is already committed. Notification failures must never undo it. */
7
+ export declare function showSettingsNotification(notice: SettingsNotice, locale: string, permission: Permission): SettingsCardKey;
8
+ export {};
@@ -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.14.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/settings-notifications.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';
@@ -134,9 +141,21 @@ function mountSettings(ctx: ClientContext, scope: SettingsScope<AutoContinueSett
134
141
  ctx.on('locale/change', syncLocale);
135
142
  syncLocale();
136
143
 
137
- const controller = new AutoContinueSettingsCardController(scope);
144
+ const controller = new AutoContinueSettingsCardController(scope, () => ctx.locale.getLocale().active);
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', () =>
@@ -8,26 +8,42 @@ import { LOCALIZED_TEXT_DEFAULTS } from '../shared/core.ts';
8
8
  /** 简体中文词典(键集的事实来源)。 */
9
9
  export const zh = {
10
10
  'card.title': '自动继续',
11
- 'card.description': '接住意外中断的请求,等现场稳定下来,再把对话交还给 Agent。',
12
- 'flow.interrupted': '检测中断',
13
- 'flow.grace': '安全等待',
14
- 'flow.continue': '发送继续',
15
- 'repo.star': '去 GitHub 点 Star',
16
- 'repo.aria': '打开 dsh-auto-continue 的 GitHub 开源地址并点 Star',
17
- 'section.handoff.title': '接力方式',
18
- 'section.handoff.description': '决定中断后说什么,以及什么时候暂时停手。',
19
- 'section.autoloop.title': '自主循环',
20
- 'section.autoloop.description': '每个回合结束后自动把对话交还给 Agent,直到手动停止。',
21
- 'section.safety.title': '安全节奏',
22
- 'section.safety.description': '先确认上一步,再控制等待与连续续跑的边界。',
23
- 'section.recovery.title': '恢复雷达',
24
- 'section.recovery.description': '扫描掉线会话,识别可恢复错误并逐步退避。',
25
- 'section.loop.title': '循环断路器',
26
- 'section.loop.description': '发现空转时及时换路,而不是让 Agent 原地消耗。',
27
- 'section.live.title': '现场状态',
28
- 'section.live.description': '看看今天接住了多少次,以及哪些会话还在暂停。',
29
- 'field.paused': '暂停自动继续',
30
- 'field.pausedHint': '全局暂停: 实时与扫描都不会再自动发送, 已排队的待发送也会取消。',
11
+ 'card.description': '恢复意外中断的会话,按你的节奏继续。',
12
+ 'repo.star': '觉得好用的话,点个 Star 吧',
13
+ 'repo.note': 'HsiangNianian 的开源插件,也欢迎反馈和 PR。',
14
+ 'repo.link': 'GitHub 仓库',
15
+ 'repo.aria': '在新标签页打开 HsiangNianian/dsh-auto-continue 的 GitHub 仓库',
16
+ 'chrome.enabled': '已启用',
17
+ 'chrome.paused': '已暂停',
18
+ 'chrome.saved': '所有更改已保存',
19
+ 'notification.title': '自动继续设置',
20
+ 'notification.enabled': '设置已保存,浏览器通知已开启。',
21
+ 'notification.disabled': '设置已保存,浏览器通知已关闭。',
22
+ 'notification.saved': '自动继续的设置已保存。',
23
+ 'notification.blocked': '设置已保存,但浏览器尚未允许通知。请在此网站的权限设置中允许通知。',
24
+ 'notification.unsupported': '设置已保存,当前浏览器不支持通知。',
25
+ 'notification.failed': '设置已保存,但浏览器通知未能发出。请检查网站和系统的通知权限。',
26
+ 'chrome.categories': '设置类别',
27
+ 'category.general.title': '常规',
28
+ 'category.general.description': '控制自动继续的启停、显示和通知。',
29
+ 'category.recovery.title': '重试策略',
30
+ 'category.recovery.description': '设置等待时间、次数上限和错误分类。',
31
+ 'category.startup.title': '启动恢复',
32
+ 'category.startup.description': 'DSH 重启后,找回最近中断的会话。',
33
+ 'category.prompts.title': '继续文本',
34
+ 'category.prompts.description': '留空使用内置文案,跟随 DSH 的界面语言。',
35
+ 'category.safety.title': '安全保护',
36
+ 'category.safety.description': '避免重复执行工具,识别并打断无效循环。',
37
+ 'category.status.title': '状态与日志',
38
+ 'category.status.description': '查看活动记录与暂停的会话。',
39
+ 'field.paused': '自动继续',
40
+ 'field.showComposerToggle': '在会话区显示自动继续开关',
41
+ 'field.showComposerToggleHint': '默认显示。隐藏开关不会暂停自动继续;点击保存后生效。',
42
+ 'composer.label': '自动继续',
43
+ 'composer.scope': '控制当前配置下所有会话的自动继续,修改立即保存。',
44
+ 'composer.saving': '正在保存自动继续设置…',
45
+ 'composer.saveFailed': '保存失败,请重试',
46
+ 'field.pausedHint': '恢复意外中断的会话。关闭并保存后,全局暂停恢复并取消已排队的继续。',
31
47
  'field.continueText': '继续文本',
32
48
  'field.continueTextHint': '中断后自动发送的消息内容。',
33
49
  'default.continueText': LOCALIZED_TEXT_DEFAULTS.zh.continueText,
@@ -76,7 +92,7 @@ export const zh = {
76
92
  'field.backoffMaxMs': '最大退避间隔 (ms)',
77
93
  'field.backoffMaxMsHint': '自适应退避的上限, 防止等待过久。',
78
94
  'field.notify': '浏览器通知',
79
- 'field.notifyHint': '自动继续成功/放弃/遇到永久性错误时弹出浏览器通知, 通知带「立即续跑」与「暂停该会话 1 小时」按钮。',
95
+ 'field.notifyHint': '开启后,自动继续事件和配置保存成功时会通知。切换此选项并保存后也会确认状态;首次开启需允许浏览器通知。',
80
96
  'stats.title': '今日统计',
81
97
  'stats.sent': '自动继续',
82
98
  'stats.skipped': '跳过(永久错误)',
@@ -129,26 +145,42 @@ export type SettingsCardKey = keyof typeof zh;
129
145
  /** English dictionary, checked complete against the zh key set. */
130
146
  export const en: Record<SettingsCardKey, string> = {
131
147
  'card.title': 'Auto continue',
132
- 'card.description': 'Catches an interrupted request, waits for things to settle, then hands the thread back to the agent.',
133
- 'flow.interrupted': 'Interrupted',
134
- 'flow.grace': 'Safe pause',
135
- 'flow.continue': 'Continue',
136
- 'repo.star': 'Star on GitHub',
137
- 'repo.aria': 'Open the dsh-auto-continue repository on GitHub and star it',
138
- 'section.handoff.title': 'The handoff',
139
- 'section.handoff.description': 'Choose what gets sent after an interruption and when the relay should stand down.',
140
- 'section.autoloop.title': 'Autonomous loop',
141
- 'section.autoloop.description': 'Hand the thread back after every completed turn until manually stopped.',
142
- 'section.safety.title': 'Safety rhythm',
143
- 'section.safety.description': 'Confirm the previous step, then set the boundaries for waiting and repeated resumes.',
144
- 'section.recovery.title': 'Recovery radar',
145
- 'section.recovery.description': 'Find dropped sessions, recognize recoverable errors, and back off gracefully.',
146
- 'section.loop.title': 'Loop breaker',
147
- 'section.loop.description': 'Spot a spinning agent and route it forward before it burns time in place.',
148
- 'section.live.title': 'Live signal',
149
- 'section.live.description': 'See what the relay caught today and which sessions are still paused.',
150
- 'field.paused': 'Pause auto-continue',
151
- 'field.pausedHint': 'Globally pause: no live or scan auto-send fires, and queued pending sends are cancelled.',
148
+ 'card.description': 'Resume interrupted sessions, at your pace.',
149
+ 'repo.star': 'Finding it useful? Leave a Star',
150
+ 'repo.note': 'By HsiangNianian. Feedback and PRs welcome.',
151
+ 'repo.link': 'GitHub repo',
152
+ 'repo.aria': 'Open HsiangNianian/dsh-auto-continue on GitHub in a new tab',
153
+ 'chrome.enabled': 'Enabled',
154
+ 'chrome.paused': 'Paused',
155
+ 'chrome.saved': 'All changes saved',
156
+ 'notification.title': 'Auto-continue settings',
157
+ 'notification.enabled': 'Settings saved. Browser notifications are on.',
158
+ 'notification.disabled': 'Settings saved. Browser notifications are off.',
159
+ 'notification.saved': 'Your auto-continue settings have been saved.',
160
+ 'notification.blocked': 'Settings saved, but browser notifications are not allowed. Allow notifications in this site’s permissions.',
161
+ 'notification.unsupported': 'Settings saved. This browser does not support notifications.',
162
+ 'notification.failed': 'Settings saved, but the notification could not be sent. Check notification permissions for this site and your system.',
163
+ 'chrome.categories': 'Settings categories',
164
+ 'category.general.title': 'General',
165
+ 'category.general.description': 'Control automatic recovery, visibility, and notifications.',
166
+ 'category.recovery.title': 'Retry strategy',
167
+ 'category.recovery.description': 'Set wait times, retry limits, and error classification.',
168
+ 'category.startup.title': 'Startup recovery',
169
+ 'category.startup.description': 'Find recently interrupted sessions when DSH restarts.',
170
+ 'category.prompts.title': 'Continue text',
171
+ 'category.prompts.description': 'Leave blank for built-in text in the current DSH language.',
172
+ 'category.safety.title': 'Safety',
173
+ 'category.safety.description': 'Avoid duplicate tool actions and break unproductive loops.',
174
+ 'category.status.title': 'Status and logs',
175
+ 'category.status.description': 'View activity and paused sessions.',
176
+ 'field.paused': 'Auto-continue',
177
+ 'field.showComposerToggle': 'Show auto-continue switch in the composer',
178
+ 'field.showComposerToggleHint': 'Shown by default. Hiding the switch does not pause auto-continue. Click Save to apply.',
179
+ 'composer.label': 'Auto-continue',
180
+ 'composer.scope': 'Controls auto-continue for all sessions in this profile. Changes save immediately.',
181
+ 'composer.saving': 'Saving auto-continue setting…',
182
+ 'composer.saveFailed': 'Could not save. Try again.',
183
+ 'field.pausedHint': 'Resume interrupted sessions. Turn off and save to pause recovery globally and cancel queued continuations.',
152
184
  'field.continueText': 'Continue text',
153
185
  'field.continueTextHint': 'Message automatically sent after an interruption.',
154
186
  'default.continueText': LOCALIZED_TEXT_DEFAULTS.en.continueText,
@@ -197,7 +229,7 @@ export const en: Record<SettingsCardKey, string> = {
197
229
  'field.backoffMaxMs': 'Max backoff (ms)',
198
230
  'field.backoffMaxMsHint': 'Cap on the adaptive backoff interval.',
199
231
  'field.notify': 'Browser notifications',
200
- 'field.notifyHint': 'Notify when auto-continue fires, gives up, or hits a permanent error; notifications carry "Resume now" and "Pause this session 1h" buttons.',
232
+ 'field.notifyHint': 'Notify about auto-continue events and successful settings saves. Saving a change to this option also confirms its state. Allow browser notifications when first enabling it.',
201
233
  'stats.title': "Today's stats",
202
234
  'stats.sent': 'Auto-continued',
203
235
  'stats.skipped': 'Skipped (permanent)',
@@ -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();