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/client.js CHANGED
@@ -76,6 +76,7 @@ var DEFAULT_CONFIG = {
76
76
  backoffMaxMs: 3e5,
77
77
  notify: false,
78
78
  paused: false,
79
+ showComposerToggle: true,
79
80
  loopGuard: true,
80
81
  loopShortChars: 40,
81
82
  loopWindowMs: 3e4,
@@ -89,26 +90,42 @@ var ECHO_WINDOW_MS = 10 * 60 * 1e3;
89
90
  // src/client/locales.ts
90
91
  var zh = {
91
92
  "card.title": "自动继续",
92
- "card.description": "接住意外中断的请求,等现场稳定下来,再把对话交还给 Agent。",
93
- "flow.interrupted": "检测中断",
94
- "flow.grace": "安全等待",
95
- "flow.continue": "发送继续",
96
- "repo.star": "去 GitHub 点 Star",
97
- "repo.aria": "打开 dsh-auto-continue 的 GitHub 开源地址并点 Star",
98
- "section.handoff.title": "接力方式",
99
- "section.handoff.description": "决定中断后说什么,以及什么时候暂时停手。",
100
- "section.autoloop.title": "自主循环",
101
- "section.autoloop.description": "每个回合结束后自动把对话交还给 Agent,直到手动停止。",
102
- "section.safety.title": "安全节奏",
103
- "section.safety.description": "先确认上一步,再控制等待与连续续跑的边界。",
104
- "section.recovery.title": "恢复雷达",
105
- "section.recovery.description": "扫描掉线会话,识别可恢复错误并逐步退避。",
106
- "section.loop.title": "循环断路器",
107
- "section.loop.description": "发现空转时及时换路,而不是让 Agent 原地消耗。",
108
- "section.live.title": "现场状态",
109
- "section.live.description": "看看今天接住了多少次,以及哪些会话还在暂停。",
110
- "field.paused": "暂停自动继续",
111
- "field.pausedHint": "全局暂停: 实时与扫描都不会再自动发送, 已排队的待发送也会取消。",
93
+ "card.description": "恢复意外中断的会话,按你的节奏继续。",
94
+ "repo.star": "觉得好用的话,点个 Star 吧",
95
+ "repo.note": "HsiangNianian 的开源插件,也欢迎反馈和 PR。",
96
+ "repo.link": "GitHub 仓库",
97
+ "repo.aria": "在新标签页打开 HsiangNianian/dsh-auto-continue 的 GitHub 仓库",
98
+ "chrome.enabled": "已启用",
99
+ "chrome.paused": "已暂停",
100
+ "chrome.saved": "所有更改已保存",
101
+ "notification.title": "自动继续设置",
102
+ "notification.enabled": "设置已保存,浏览器通知已开启。",
103
+ "notification.disabled": "设置已保存,浏览器通知已关闭。",
104
+ "notification.saved": "自动继续的设置已保存。",
105
+ "notification.blocked": "设置已保存,但浏览器尚未允许通知。请在此网站的权限设置中允许通知。",
106
+ "notification.unsupported": "设置已保存,当前浏览器不支持通知。",
107
+ "notification.failed": "设置已保存,但浏览器通知未能发出。请检查网站和系统的通知权限。",
108
+ "chrome.categories": "设置类别",
109
+ "category.general.title": "常规",
110
+ "category.general.description": "控制自动继续的启停、显示和通知。",
111
+ "category.recovery.title": "重试策略",
112
+ "category.recovery.description": "设置等待时间、次数上限和错误分类。",
113
+ "category.startup.title": "启动恢复",
114
+ "category.startup.description": "DSH 重启后,找回最近中断的会话。",
115
+ "category.prompts.title": "继续文本",
116
+ "category.prompts.description": "留空使用内置文案,跟随 DSH 的界面语言。",
117
+ "category.safety.title": "安全保护",
118
+ "category.safety.description": "避免重复执行工具,识别并打断无效循环。",
119
+ "category.status.title": "状态与日志",
120
+ "category.status.description": "查看活动记录与暂停的会话。",
121
+ "field.paused": "自动继续",
122
+ "field.showComposerToggle": "在会话区显示自动继续开关",
123
+ "field.showComposerToggleHint": "默认显示。隐藏开关不会暂停自动继续;点击保存后生效。",
124
+ "composer.label": "自动继续",
125
+ "composer.scope": "控制当前配置下所有会话的自动继续,修改立即保存。",
126
+ "composer.saving": "正在保存自动继续设置…",
127
+ "composer.saveFailed": "保存失败,请重试",
128
+ "field.pausedHint": "恢复意外中断的会话。关闭并保存后,全局暂停恢复并取消已排队的继续。",
112
129
  "field.continueText": "继续文本",
113
130
  "field.continueTextHint": "中断后自动发送的消息内容。",
114
131
  "default.continueText": LOCALIZED_TEXT_DEFAULTS.zh.continueText,
@@ -157,7 +174,7 @@ var zh = {
157
174
  "field.backoffMaxMs": "最大退避间隔 (ms)",
158
175
  "field.backoffMaxMsHint": "自适应退避的上限, 防止等待过久。",
159
176
  "field.notify": "浏览器通知",
160
- "field.notifyHint": "自动继续成功/放弃/遇到永久性错误时弹出浏览器通知, 通知带「立即续跑」与「暂停该会话 1 小时」按钮。",
177
+ "field.notifyHint": "开启后,自动继续事件和配置保存成功时会通知。切换此选项并保存后也会确认状态;首次开启需允许浏览器通知。",
161
178
  "stats.title": "今日统计",
162
179
  "stats.sent": "自动继续",
163
180
  "stats.skipped": "跳过(永久错误)",
@@ -205,26 +222,42 @@ var zh = {
205
222
  };
206
223
  var en = {
207
224
  "card.title": "Auto continue",
208
- "card.description": "Catches an interrupted request, waits for things to settle, then hands the thread back to the agent.",
209
- "flow.interrupted": "Interrupted",
210
- "flow.grace": "Safe pause",
211
- "flow.continue": "Continue",
212
- "repo.star": "Star on GitHub",
213
- "repo.aria": "Open the dsh-auto-continue repository on GitHub and star it",
214
- "section.handoff.title": "The handoff",
215
- "section.handoff.description": "Choose what gets sent after an interruption and when the relay should stand down.",
216
- "section.autoloop.title": "Autonomous loop",
217
- "section.autoloop.description": "Hand the thread back after every completed turn until manually stopped.",
218
- "section.safety.title": "Safety rhythm",
219
- "section.safety.description": "Confirm the previous step, then set the boundaries for waiting and repeated resumes.",
220
- "section.recovery.title": "Recovery radar",
221
- "section.recovery.description": "Find dropped sessions, recognize recoverable errors, and back off gracefully.",
222
- "section.loop.title": "Loop breaker",
223
- "section.loop.description": "Spot a spinning agent and route it forward before it burns time in place.",
224
- "section.live.title": "Live signal",
225
- "section.live.description": "See what the relay caught today and which sessions are still paused.",
226
- "field.paused": "Pause auto-continue",
227
- "field.pausedHint": "Globally pause: no live or scan auto-send fires, and queued pending sends are cancelled.",
225
+ "card.description": "Resume interrupted sessions, at your pace.",
226
+ "repo.star": "Finding it useful? Leave a Star",
227
+ "repo.note": "By HsiangNianian. Feedback and PRs welcome.",
228
+ "repo.link": "GitHub repo",
229
+ "repo.aria": "Open HsiangNianian/dsh-auto-continue on GitHub in a new tab",
230
+ "chrome.enabled": "Enabled",
231
+ "chrome.paused": "Paused",
232
+ "chrome.saved": "All changes saved",
233
+ "notification.title": "Auto-continue settings",
234
+ "notification.enabled": "Settings saved. Browser notifications are on.",
235
+ "notification.disabled": "Settings saved. Browser notifications are off.",
236
+ "notification.saved": "Your auto-continue settings have been saved.",
237
+ "notification.blocked": "Settings saved, but browser notifications are not allowed. Allow notifications in this site’s permissions.",
238
+ "notification.unsupported": "Settings saved. This browser does not support notifications.",
239
+ "notification.failed": "Settings saved, but the notification could not be sent. Check notification permissions for this site and your system.",
240
+ "chrome.categories": "Settings categories",
241
+ "category.general.title": "General",
242
+ "category.general.description": "Control automatic recovery, visibility, and notifications.",
243
+ "category.recovery.title": "Retry strategy",
244
+ "category.recovery.description": "Set wait times, retry limits, and error classification.",
245
+ "category.startup.title": "Startup recovery",
246
+ "category.startup.description": "Find recently interrupted sessions when DSH restarts.",
247
+ "category.prompts.title": "Continue text",
248
+ "category.prompts.description": "Leave blank for built-in text in the current DSH language.",
249
+ "category.safety.title": "Safety",
250
+ "category.safety.description": "Avoid duplicate tool actions and break unproductive loops.",
251
+ "category.status.title": "Status and logs",
252
+ "category.status.description": "View activity and paused sessions.",
253
+ "field.paused": "Auto-continue",
254
+ "field.showComposerToggle": "Show auto-continue switch in the composer",
255
+ "field.showComposerToggleHint": "Shown by default. Hiding the switch does not pause auto-continue. Click Save to apply.",
256
+ "composer.label": "Auto-continue",
257
+ "composer.scope": "Controls auto-continue for all sessions in this profile. Changes save immediately.",
258
+ "composer.saving": "Saving auto-continue setting…",
259
+ "composer.saveFailed": "Could not save. Try again.",
260
+ "field.pausedHint": "Resume interrupted sessions. Turn off and save to pause recovery globally and cancel queued continuations.",
228
261
  "field.continueText": "Continue text",
229
262
  "field.continueTextHint": "Message automatically sent after an interruption.",
230
263
  "default.continueText": LOCALIZED_TEXT_DEFAULTS.en.continueText,
@@ -273,7 +306,7 @@ var en = {
273
306
  "field.backoffMaxMs": "Max backoff (ms)",
274
307
  "field.backoffMaxMsHint": "Cap on the adaptive backoff interval.",
275
308
  "field.notify": "Browser notifications",
276
- "field.notifyHint": 'Notify when auto-continue fires, gives up, or hits a permanent error; notifications carry "Resume now" and "Pause this session 1h" buttons.',
309
+ "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.",
277
310
  "stats.title": "Today's stats",
278
311
  "stats.sent": "Auto-continued",
279
312
  "stats.skipped": "Skipped (permanent)",
@@ -323,6 +356,34 @@ var en = {
323
356
  // src/client/settings-card.tsx
324
357
  var import_react = require("react");
325
358
 
359
+ // src/client/native-switch.tsx
360
+ var import_jsx_runtime = require("react/jsx-runtime");
361
+ function legacySwitch(props) {
362
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
363
+ "button",
364
+ {
365
+ type: "button",
366
+ role: "switch",
367
+ className: "dshAcSwitch",
368
+ "aria-checked": props.checked,
369
+ "aria-label": props.label,
370
+ disabled: props.disabled,
371
+ title: props.title,
372
+ onClick: () => props.onChange(!props.checked),
373
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {})
374
+ }
375
+ );
376
+ }
377
+ function resolveSwitch() {
378
+ try {
379
+ const { Switch } = require("@deepseek-ai/dsh-client-ui-primitives");
380
+ if (typeof Switch === "function") return Switch;
381
+ } catch {
382
+ }
383
+ return legacySwitch;
384
+ }
385
+ var NativeSwitch = resolveSwitch();
386
+
326
387
  // src/client/dsh-store-compat.ts
327
388
  function resolveSnapshotStore() {
328
389
  const current = ["@deepseek-ai/dsh-client", "-store"].join("");
@@ -574,19 +635,24 @@ var CardForm = class {
574
635
  }
575
636
  /**
576
637
  * Write every staged edit, then re-seed from what the Host accepted.
577
- * @returns settlement after every write and the read-back.
638
+ * @returns true only when a non-empty save was accepted and read back.
578
639
  */
579
640
  async save() {
580
641
  const plan = this.plan();
581
642
  const writes = plan.flatMap((item) => item.run === void 0 ? [] : [item.run]);
582
- if (plan.length === 0 || this.saving || writes.length !== plan.length) return;
643
+ const snapshot = this.scope.getSnapshot();
644
+ if (plan.length === 0 || this.saving || writes.length !== plan.length || snapshot.status !== "ready" || !snapshot.writable || snapshot.mode !== "host") return false;
583
645
  const edits = plan.map(({ field, staged }) => ({ field, staged }));
584
646
  this.saving = true;
585
647
  this.failed = false;
586
648
  this.publish();
587
649
  let landed = true;
588
- for (const write of writes) {
589
- landed = await write() && landed;
650
+ try {
651
+ for (const write of writes) {
652
+ landed = await write() && landed;
653
+ }
654
+ } catch {
655
+ landed = false;
590
656
  }
591
657
  if (landed) {
592
658
  for (const { field, staged } of edits) {
@@ -596,6 +662,7 @@ var CardForm = class {
596
662
  this.saving = false;
597
663
  this.failed = !landed;
598
664
  this.publish();
665
+ return landed;
599
666
  }
600
667
  /**
601
668
  * Every staged edit a save would write. An entry whose draft is not a value
@@ -620,12 +687,12 @@ var CardForm = class {
620
687
  return plan;
621
688
  }
622
689
  async clear(field) {
623
- await this.scope.unset(field);
624
- return !this.stored(field);
690
+ const accepted = await this.scope.unset(field);
691
+ return accepted !== false && !this.stored(field);
625
692
  }
626
693
  async store(field, value) {
627
- await this.scope.set(field, value);
628
- return this.userLayer()?.[field] === value;
694
+ const accepted = await this.scope.set(field, value);
695
+ return accepted !== false && this.userLayer()?.[field] === value;
629
696
  }
630
697
  stage(field, edit) {
631
698
  this.staged.set(field, edit);
@@ -657,394 +724,136 @@ var CardForm = class {
657
724
 
658
725
  // src/client/styles.ts
659
726
  var css = `
727
+ .dshAcComposer { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; flex: 0 0 auto; font: inherit; }
728
+ .dshAcComposerLabel { color: var(--dsw-alias-label-secondary); font-size: 12px; white-space: nowrap; }
729
+ .dshAcSwitchTarget { display: inline-flex; align-items: center; min-height: 32px; }
730
+ .dshAcSwitchTarget > button { position: relative; }
731
+ .dshAcSwitchTarget > button::before { content: ''; position: absolute; inset: -6px -3px; }
732
+ .dshAcComposerError { color: var(--dsw-alias-state-error-primary, var(--dsw-alias-label-secondary)); font-size: 12px; max-width: 160px; }
733
+ .dshAcComposerError:empty { display: none; }
734
+ .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; }
735
+ .dshAcSwitch[aria-checked='true'] { background: var(--dsw-alias-brand-primary); }
736
+ .dshAcSwitch > span { display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--dsw-alias-label-primary-foreground); }
737
+ .dshAcSwitch[aria-checked='true'] > span { transform: translateX(16px); }
738
+ .dshAcSwitch[aria-checked='false'] > span { background: var(--dsw-alias-switch-thumb, var(--dsw-alias-label-primary-foreground)); }
739
+ .dshAcSwitch:disabled { opacity: .5; cursor: default; }
740
+ .dshAcSwitch:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }
660
741
  .dshAcCard {
661
- --dsh-ac-violet: #8b7cff;
662
- --dsh-ac-cyan: #45cce5;
663
- --dsh-ac-mint: #46d69d;
664
- --dsh-ac-red: #e5484d;
665
- --dsh-ac-amber: #f1b95c;
666
- isolation: isolate;
667
- position: relative;
668
- overflow: hidden;
669
- border: 1px solid var(--dsw-alias-border-l2);
670
- background: var(--dsw-alias-bg-layer-3);
671
- border-radius: 16px;
672
- list-style: none;
673
- box-shadow: 0 10px 34px rgb(0 0 0 / 8%);
674
- transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
675
- }
676
- .dshAcCard::before {
677
- content: "";
678
- z-index: 2;
679
- position: absolute;
680
- inset: 0 0 auto;
681
- height: 2px;
682
- pointer-events: none;
683
- opacity: .72;
684
- background: linear-gradient(90deg, transparent 1%, var(--dsh-ac-violet) 22%, var(--dsh-ac-cyan) 52%, var(--dsh-ac-mint) 80%, transparent 99%);
685
- }
686
- .dshAcCard::after {
687
- content: "";
688
- z-index: -1;
689
- position: absolute;
690
- width: 190px;
691
- height: 190px;
692
- top: -104px;
693
- left: -76px;
694
- pointer-events: none;
695
- border-radius: 999px;
696
- background: radial-gradient(circle, rgb(139 124 255 / 14%) 0, transparent 68%);
697
- }
698
- .dshAcCard:hover {
699
- border-color: color-mix(in srgb, var(--dsh-ac-violet) 48%, var(--dsw-alias-border-l2));
700
- box-shadow: 0 14px 42px rgb(0 0 0 / 12%);
701
- transform: translateY(-1px);
702
- }
703
- .dshAcCardOpen {
704
- background: var(--dsw-alias-bg-layer-2);
705
- border-color: color-mix(in srgb, var(--dsh-ac-violet) 42%, var(--dsw-alias-border-l2));
706
- box-shadow: 0 18px 54px rgb(0 0 0 / 14%);
707
- transform: none;
708
- }
709
- .dshAcHeaderFrame {
710
- align-items: stretch;
711
- flex-direction: column;
712
- display: flex;
713
- }
714
- .dshAcHeader {
715
- appearance: none;
716
- min-width: 0;
717
- flex: 1;
718
- font: inherit;
719
- color: inherit;
720
- text-align: left;
721
- cursor: pointer;
722
- background: none;
723
- border: 0;
724
- border-radius: 16px;
725
- align-items: center;
726
- gap: 14px;
727
- padding: 18px 18px 12px;
728
- display: flex;
729
- }
730
- .dshAcHeader:focus-visible { outline: 2px solid var(--dsh-ac-violet); outline-offset: -3px; }
731
- .dshAcRelayMark {
732
- width: 54px;
733
- height: 54px;
734
- flex: none;
735
- place-items: center;
736
- display: grid;
737
- color: var(--dsh-ac-cyan);
738
- border: 1px solid color-mix(in srgb, var(--dsh-ac-violet) 42%, var(--dsw-alias-border-l2));
739
- border-radius: 17px;
740
- background: color-mix(in srgb, var(--dsw-alias-bg-layer-2) 84%, var(--dsh-ac-violet) 16%);
741
- box-shadow: inset 0 0 0 1px rgb(255 255 255 / 4%), 0 8px 24px rgb(62 51 153 / 16%);
742
- }
743
- .dshAcRelayMark svg { width: 44px; height: 44px; overflow: visible; }
744
- .dshAcRelayArc { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
745
- .dshAcRelayArcEcho { opacity: .42; }
746
- .dshAcRelayNode { stroke: var(--dsw-alias-bg-layer-3); stroke-width: 1.5; }
747
- .dshAcRelayNodeStart { fill: var(--dsh-ac-amber); }
748
- .dshAcRelayNodeEnd { fill: var(--dsh-ac-mint); }
749
- .dshAcRelayPulse { fill: var(--dsh-ac-violet); opacity: .85; }
750
- .dshAcCard:hover .dshAcRelayPulse, .dshAcCardOpen .dshAcRelayPulse {
751
- animation: dshAcRelayTravel 1.8s cubic-bezier(.4, 0, .2, 1) infinite;
752
- }
753
- .dshAcHeadText { flex-direction: column; flex: 1; gap: 3px; min-width: 0; display: flex; }
754
- .dshAcName {
755
- color: var(--dsw-alias-label-primary);
756
- font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", sans-serif;
757
- font-size: 18px;
758
- font-weight: 680;
759
- letter-spacing: -.015em;
760
- line-height: 1.35;
761
- }
762
- .dshAcDescription { max-width: 660px; color: var(--dsw-alias-label-tertiary); font-size: 13px; line-height: 1.5; }
763
- .dshAcJourney { flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 4px; display: flex; }
764
- .dshAcJourneyStep {
765
- align-items: center;
766
- gap: 5px;
767
- color: var(--dsw-alias-label-secondary);
768
- font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
769
- font-size: 10px;
770
- font-weight: 600;
771
- line-height: 1.4;
772
- letter-spacing: .02em;
773
- display: inline-flex;
774
- }
775
- .dshAcJourneyDot { width: 5px; height: 5px; flex: none; border-radius: 999px; background: currentColor; box-shadow: 0 0 0 3px rgb(255 255 255 / 3%); }
776
- .dshAcJourneyInterrupted .dshAcJourneyDot { color: var(--dsh-ac-amber); }
777
- .dshAcJourneyGrace .dshAcJourneyDot { color: var(--dsh-ac-cyan); }
778
- .dshAcJourneyContinue .dshAcJourneyDot { color: var(--dsh-ac-mint); }
779
- .dshAcJourneyLine {
780
- width: 25px;
781
- height: 1px;
782
- flex: none;
783
- opacity: .7;
784
- background: linear-gradient(90deg, var(--dsh-ac-violet), var(--dsh-ac-cyan), var(--dsh-ac-mint));
785
- background-size: 220% 100%;
786
- }
787
- .dshAcCard:hover .dshAcJourneyLine, .dshAcCardOpen .dshAcJourneyLine { animation: dshAcSignalSweep 1.8s linear infinite; }
788
- .dshAcChevron {
789
- width: 30px;
790
- height: 30px;
791
- color: var(--dsw-alias-label-tertiary);
792
- border: 1px solid var(--dsw-alias-border-l2);
793
- border-radius: 999px;
794
- flex: none;
795
- place-items: center;
796
- display: grid;
797
- transition: color .18s ease, border-color .18s ease, transform .18s ease;
798
- }
799
- .dshAcChevron svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
800
- .dshAcHeader:hover .dshAcChevron { color: var(--dsh-ac-violet); border-color: color-mix(in srgb, var(--dsh-ac-violet) 48%, var(--dsw-alias-border-l2)); }
801
- .dshAcChevronOpen { transform: rotate(180deg); }
802
- .dshAcGithub {
803
- min-width: 0;
804
- max-width: none;
805
- align-self: stretch;
806
- align-items: center;
807
- gap: 10px;
808
- margin: 0 18px 16px;
809
- padding: 9px 11px;
810
- color: var(--dsw-alias-label-primary);
811
- text-decoration: none;
812
- border: 1px solid var(--dsw-alias-border-l2);
813
- border-radius: 13px;
814
- background: color-mix(in srgb, var(--dsw-alias-bg-layer-2) 90%, var(--dsh-ac-violet) 10%);
815
- display: flex;
816
- transition: border-color .18s ease, background .18s ease, transform .18s ease;
817
- }
818
- .dshAcGithub:hover {
819
- border-color: color-mix(in srgb, var(--dsh-ac-violet) 58%, var(--dsw-alias-border-l2));
820
- background: color-mix(in srgb, var(--dsw-alias-bg-layer-2) 82%, var(--dsh-ac-violet) 18%);
821
- transform: translateY(-1px);
822
- }
823
- .dshAcGithub:focus-visible { outline: 2px solid var(--dsh-ac-violet); outline-offset: 2px; }
824
- .dshAcGithubIcon { width: 23px; height: 23px; flex: none; color: var(--dsw-alias-label-primary); }
825
- .dshAcGithubIcon svg { width: 100%; height: 100%; fill: currentColor; }
826
- .dshAcGithubText { min-width: 0; flex: 1; flex-direction: column; gap: 1px; display: flex; }
827
- .dshAcGithubAction { font-size: 12px; font-weight: 680; line-height: 1.4; }
828
- .dshAcGithubAction::before { content: "★"; color: var(--dsh-ac-amber); margin-right: 5px; }
829
- .dshAcGithubSlug {
830
- overflow: hidden;
831
- color: var(--dsw-alias-label-tertiary);
832
- font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
833
- font-size: 9.5px;
834
- line-height: 1.4;
835
- text-overflow: ellipsis;
836
- white-space: nowrap;
837
- }
838
- .dshAcExternal { width: 15px; height: 15px; flex: none; color: var(--dsw-alias-label-tertiary); }
839
- .dshAcExternal svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
840
- .dshAcBody { border-top: 1px solid var(--dsw-alias-border-l2); margin: 0 18px 12px; padding: 4px 0 0; }
841
- .dshAcReadOnly { color: var(--dsw-alias-label-tertiary); margin: 12px 0 0; font-size: 12px; line-height: 1.5; }
842
- .dshAcPending {
843
- white-space: nowrap;
844
- background: var(--dsw-alias-bg-module-platform);
845
- color: var(--dsw-alias-label-secondary);
846
- border-radius: 999px;
847
- flex: none;
848
- padding: 1px 8px;
849
- font-size: 11px;
850
- font-weight: 500;
851
- line-height: 17px;
852
- }
853
- .dshAcFooter {
854
- border-top: 1px solid var(--dsw-alias-border-l2);
855
- justify-content: flex-end;
856
- align-items: center;
857
- gap: 8px;
858
- padding: 12px 0 4px;
859
- display: flex;
860
- }
861
- .dshAcFailed { min-width: 0; color: var(--dsw-alias-label-error); flex: 1; margin: 0; font-size: 12px; line-height: 1.5; }
862
- .dshAcDiscard, .dshAcSave {
863
- appearance: none;
742
+ --dsh-ac-bg: var(--dsw-alias-bg-base, var(--dsw-alias-bg-layer-2));
743
+ --dsh-ac-line: var(--dsw-alias-border-l2);
744
+ --dsh-ac-text: var(--dsw-alias-label-primary);
745
+ --dsh-ac-muted: var(--dsw-alias-label-tertiary);
746
+ container: auto-continue-settings / inline-size;
747
+ color: var(--dsh-ac-text);
864
748
  font: inherit;
865
- cursor: pointer;
866
- border: 1px solid transparent;
867
- border-radius: 8px;
868
- padding: 5px 14px;
869
749
  font-size: 13px;
870
750
  line-height: 1.5;
871
- }
872
- .dshAcDiscard { border-color: var(--dsw-alias-border-l2); color: var(--dsw-alias-label-secondary); background: none; }
873
- .dshAcDiscard:hover:not(:disabled) { color: var(--dsw-alias-label-primary); border-color: var(--dsw-alias-label-dimmed); }
874
- .dshAcSave { background: var(--dsw-alias-label-primary); color: var(--dsw-alias-bg-layer-3); }
875
- .dshAcDiscard:disabled, .dshAcSave:disabled { opacity: .4; cursor: default; }
876
- .dshAcDiscard:focus-visible, .dshAcSave:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
877
- .dshAcFormCanvas { flex-direction: column; gap: 14px; padding: 12px 0 8px; display: flex; }
878
- .dshAcFormSection {
879
- --dsh-ac-section: var(--dsh-ac-violet);
880
- overflow: hidden;
881
- border: 1px solid var(--dsw-alias-border-l2);
882
- border-radius: 14px;
883
- background: var(--dsw-alias-bg-layer-3);
884
- background: color-mix(in srgb, var(--dsw-alias-bg-layer-3) 95%, var(--dsh-ac-section) 5%);
885
- }
886
- .dshAcFormSection-handoff { --dsh-ac-section: var(--dsh-ac-mint); }
887
- .dshAcFormSection-autoloop { --dsh-ac-section: var(--dsh-ac-red); }
888
- .dshAcFormSection-safety { --dsh-ac-section: var(--dsh-ac-amber); }
889
- .dshAcFormSection-recovery { --dsh-ac-section: var(--dsh-ac-cyan); }
890
- .dshAcFormSection-loop { --dsh-ac-section: var(--dsh-ac-violet); }
891
- .dshAcFormSection-live { --dsh-ac-section: color-mix(in srgb, var(--dsh-ac-violet) 60%, var(--dsh-ac-cyan)); }
892
- .dshAcSectionHead {
893
- align-items: center;
894
- gap: 11px;
895
- padding: 13px 14px 11px;
896
- border-bottom: 1px solid var(--dsw-alias-border-l2);
897
- display: flex;
898
- }
899
- .dshAcSectionSignal {
900
- width: 4px;
901
- height: 34px;
902
- flex: none;
903
- border-radius: 999px;
904
- background: var(--dsh-ac-section);
905
- box-shadow: 0 0 18px color-mix(in srgb, var(--dsh-ac-section) 55%, transparent);
906
- }
907
- .dshAcSectionCopy { min-width: 0; flex-direction: column; gap: 2px; display: flex; }
908
- .dshAcSectionTitle {
909
- color: var(--dsw-alias-label-primary);
910
- font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", sans-serif;
911
- font-size: 14px;
912
- font-weight: 680;
913
- line-height: 1.4;
914
- }
915
- .dshAcSectionDescription { color: var(--dsw-alias-label-tertiary); font-size: 11.5px; line-height: 1.45; }
916
- .dshAcSectionGrid {
917
- grid-template-columns: repeat(2, minmax(0, 1fr));
918
- column-gap: 22px;
919
- padding: 0 14px 4px;
920
- display: grid;
921
- }
922
- .dshAcField { min-width: 0; flex-direction: column; gap: 6px; padding: 12px 0; border-top: 1px solid var(--dsw-alias-border-l2); display: flex; }
923
- .dshAcSectionGrid > .dshAcField:first-child { border-top: 0; }
924
- .dshAcFieldWide { grid-column: 1 / -1; }
925
- .dshAcHead { align-items: center; gap: 8px; display: flex; }
926
- .dshAcLabel { min-width: 0; color: var(--dsw-alias-label-primary); flex: 1; font-size: 13px; font-weight: 500; line-height: 1.5; }
927
- .dshAcBadges { align-items: center; gap: 8px; display: inline-flex; }
928
- .dshAcBadge {
929
- white-space: nowrap;
930
- background: var(--dsw-alias-bg-module-platform);
931
- color: var(--dsw-alias-label-secondary);
932
- border-radius: 999px;
933
- padding: 1px 8px;
934
- font-size: 11px;
935
- font-weight: 500;
936
- line-height: 17px;
937
- }
938
- .dshAcReset {
939
- font: inherit;
940
- color: var(--dsw-alias-label-secondary);
941
- cursor: pointer;
942
- background: none;
943
- border: none;
751
+ list-style: none;
944
752
  padding: 0;
945
- font-size: 12px;
946
- line-height: 1.5;
947
753
  }
948
- .dshAcReset:hover:not(:disabled) { color: var(--dsw-alias-label-primary); }
949
- .dshAcReset:disabled { cursor: default; }
950
- .dshAcInput {
951
- box-sizing: border-box;
952
- width: 100%;
953
- border: 1px solid var(--dsw-alias-border-l2);
954
- background: var(--dsw-alias-bg-layer-3);
955
- height: 34px;
956
- font: inherit;
957
- color: var(--dsw-alias-label-primary);
958
- border-radius: 8px;
959
- padding: 0 12px;
960
- font-size: 13px;
961
- line-height: 1.5;
754
+ .dshAcCard *, .dshAcCard *::before, .dshAcCard *::after { box-sizing: border-box; }
755
+ .dshAcCard :is(h2,h3,p) { margin: 0; }
756
+ .dshAcCard :is(button,input,textarea) { font: inherit; }
757
+ .dshAcCard button { cursor: pointer; }
758
+ .dshAcCard button:disabled { opacity: .4; cursor: default; }
759
+ .dshAcCard :is(a,button,input,textarea):focus-visible { outline: 2px solid var(--dsh-ac-text); outline-offset: 3px; }
760
+ .dshAcHeaderFrame { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); align-items: center; gap: 24px; margin: 20px 0; padding: 16px 18px; border-radius: 9px; color: #f9fafb; background: #23262c; }
761
+ .dshAcIntroduction { min-width: 0; }
762
+ .dshAcTitleLine { display: flex; align-items: center; gap: 10px; }
763
+ .dshAcTitleLine h2 { font-size: 17px; font-weight: 620; line-height: 1.4; white-space: nowrap; }
764
+ .dshAcStatus { white-space: nowrap; font-size: 11px; color: #dce0e6; background: #ffffff14; border-radius: 5px; padding: 2px 7px; }
765
+ .dshAcIntroduction p { margin-top: 5px; color: #b9bec8; font-size: 12px; line-height: 1.6; }
766
+ .dshAcRepository { display: flex; align-items: center; gap: 12px; min-width: 0; }
767
+ .dshAcStar { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border: 1px solid #625032; border-radius: 50%; background: #302c25; color: #e9be6d; }
768
+ .dshAcStar svg { width: 18px; height: 18px; fill: #e9be6d12; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
769
+ .dshAcRepositoryCopy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 5px; }
770
+ .dshAcRepositoryCopy strong { font-size: 13px; font-weight: 560; line-height: 1.5; }
771
+ .dshAcRepositoryCopy > span { color: #b9bec8; font-size: 10px; line-height: 1.6; }
772
+ .dshAcRepositoryCopy > * { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
773
+ .dshAcCard a.dshAcGithub { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: none; min-height: 38px; padding: 9px 11px; border: 1px solid transparent; border-radius: 6px; color: #202329; background: #f4f5f7; text-decoration: none; font-size: 12px; font-weight: 550; white-space: nowrap; transition: background-color 140ms ease, box-shadow 140ms ease; }
774
+ .dshAcCard a.dshAcGithub:hover { background: #fff; box-shadow: 0 0 0 3px #ffffff18; }
775
+ .dshAcCard a.dshAcGithub:focus-visible { outline-color: #e9be6d; }
776
+ .dshAcGithub > svg { flex: none; width: 17px; height: 17px; fill: currentColor; }
777
+ .dshAcGithub > svg.dshAcExternal { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; margin-left: 2px; }
778
+ .dshAcGithubShort { display: none; }
779
+ .dshAcReadOnly { padding: 10px 0; color: var(--dsh-ac-muted); }
780
+ .dshAcLayout { display: grid; grid-template-columns: 164px minmax(0, 1fr); border-top: 1px solid var(--dsh-ac-line); min-height: 462px; }
781
+ .dshAcNav { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px 16px 0; position: sticky; top: 16px; align-self: start; }
782
+ .dshAcNav > button { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 37px; padding: 8px 11px; border: 0; border-radius: 6px; text-align: left; background: none; color: var(--dsw-alias-label-secondary); }
783
+ .dshAcNav > button:hover, .dshAcNav > button[aria-selected=true] { color: var(--dsh-ac-text); background: var(--dsw-alias-interactive-bg-hover); }
784
+ .dshAcNav > button[aria-selected=true] { font-weight: 600; }
785
+ .dshAcInvalidMark { color: var(--dsw-alias-state-error-primary); font-weight: 600; }
786
+ .dshAcCategory { min-width: 0; padding: 20px 0 16px 26px; border-left: 1px solid var(--dsh-ac-line); }
787
+ .dshAcCategoryHeading { padding-bottom: 14px; }
788
+ .dshAcCategoryHeading h3 { font-size: 15px; font-weight: 620; }
789
+ .dshAcCategoryHeading p { color: var(--dsh-ac-muted); font-size: 12px; margin-top: 3px; }
790
+ .dshAcField { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 24px; padding: 18px 0; border-bottom: 1px solid var(--dsh-ac-line); }
791
+ .dshAcField:last-child { border-bottom: 0; }
792
+ .dshAcFieldCopy { min-width: 0; }
793
+ .dshAcLabel { display: block; font-size: 14px; font-weight: 480; color: var(--dsh-ac-text); }
794
+ .dshAcHint { color: var(--dsh-ac-muted); font-size: 12px; line-height: 1.6; }
795
+ .dshAcFieldCopy p { margin-top: 4px; }
796
+ .dshAcFieldControl { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
797
+ .dshAcReset { padding: 0; border: 0; background: none; color: var(--dsh-ac-muted); font-size: 11px !important; white-space: nowrap; }
798
+ .dshAcReset:hover:not(:disabled) { color: var(--dsh-ac-text); text-decoration: underline; }
799
+ .dshAcInput { border: 1px solid var(--dsh-ac-line); border-radius: 6px; background: var(--dsh-ac-bg); color: var(--dsh-ac-text); padding: 8px 11px; }
800
+ .dshAcInput::placeholder { color: var(--dsh-ac-muted); opacity: .7; }
801
+ .dshAcInput[aria-invalid=true] { border-color: var(--dsw-alias-state-error-primary); }
802
+ .dshAcNumber { width: 132px; min-width: 0; font-variant-numeric: tabular-nums; }
803
+ .dshAcFieldText { display: block; }
804
+ .dshAcFieldText .dshAcFieldControl { margin-top: 10px; flex-direction: column-reverse; align-items: flex-end; gap: 6px; }
805
+ .dshAcTextArea { display: block; width: 100%; min-height: 66px; resize: vertical; line-height: 1.6; }
806
+ .dshAcInvalid, .dshAcFailed { color: var(--dsw-alias-state-error-primary); font-size: 12px; }
807
+ .dshAcFooter { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 24px; padding: 13px 0; border-top: 1px solid var(--dsh-ac-line); background: var(--dsh-ac-bg); }
808
+ .dshAcFooter[data-dirty=true] { position: sticky; z-index: 8; bottom: 0; }
809
+ .dshAcFooter > div { display: flex; align-items: center; gap: 8px; }
810
+ .dshAcDiscard, .dshAcSave { padding: 7px 13px; border: 1px solid var(--dsh-ac-line); border-radius: 6px; font-size: 12px !important; background: var(--dsh-ac-bg); color: var(--dsh-ac-text); white-space: nowrap; }
811
+ .dshAcSave { background: var(--dsh-ac-text); color: var(--dsh-ac-bg); border-color: var(--dsh-ac-text); }
812
+ .dshAcDiscard:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }
813
+ .dshAcSave:hover:not(:disabled) { opacity: .85; }
814
+ .dshAcPanel { padding: 20px 0; border-top: 1px solid var(--dsh-ac-line); }
815
+ .dshAcPanelHead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
816
+ .dshAcPanelTitle { font-weight: 550; }
817
+ .dshAcStats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
818
+ .dshAcStats dt { font-size: 11px; color: var(--dsh-ac-muted); }
819
+ .dshAcStats dd { margin: 4px 0 0; font-size: 19px; font-weight: 550; font-variant-numeric: tabular-nums; }
820
+ .dshAcCodes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
821
+ .dshAcCode { font: 11px ui-monospace, SFMono-Regular, monospace; border: 1px solid var(--dsh-ac-line); border-radius: 4px; padding: 3px 6px; }
822
+ .dshAcPauseList { list-style: none; margin: 0; padding: 0; }
823
+ .dshAcPauseList li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
824
+ .dshAcPauseId { flex: 1; font: 12px ui-monospace, SFMono-Regular, monospace; }
825
+ @container auto-continue-settings (max-width: 760px) {
826
+ .dshAcHeaderFrame { grid-template-columns: minmax(0, 1fr) auto; gap: 16px; }
827
+ .dshAcRepositoryCopy { display: none; }
828
+ .dshAcRepository { gap: 10px; }
829
+ .dshAcLayout { grid-template-columns: 136px minmax(0, 1fr); }
830
+ .dshAcCategory { padding-left: 20px; }
831
+ .dshAcFieldControl { flex-direction: column-reverse; align-items: flex-end; gap: 6px; }
962
832
  }
963
- .dshAcInput:focus-visible { border-color: var(--dsw-alias-brand-primary); outline: none; }
964
- .dshAcInput:disabled { color: var(--dsw-alias-label-tertiary); cursor: default; }
965
- .dshAcInputInvalid { border-color: var(--dsw-alias-label-error); }
966
- .dshAcTextArea { box-sizing: border-box; height: auto; min-height: 84px; padding: 8px 12px; resize: vertical; }
967
- .dshAcSelect {
968
- box-sizing: border-box;
969
- width: 100%;
970
- border: 1px solid var(--dsw-alias-border-l2);
971
- background: var(--dsw-alias-bg-layer-3);
972
- height: 34px;
973
- font: inherit;
974
- color: var(--dsw-alias-label-primary);
975
- border-radius: 8px;
976
- padding: 0 8px;
977
- font-size: 13px;
978
- line-height: 1.5;
833
+ @container auto-continue-settings (max-width: 560px) {
834
+ .dshAcLayout { display: block; min-height: 0; }
835
+ .dshAcNav { flex-direction: row; overflow-x: auto; position: static; padding: 12px 0; border-bottom: 1px solid var(--dsh-ac-line); }
836
+ .dshAcNav > button { flex: none; font-size: 12px; min-height: 34px; padding: 7px 10px; }
837
+ .dshAcCategory { border-left: 0; padding: 20px 0; }
838
+ .dshAcField { gap: 8px 14px; }
839
+ .dshAcLabel { font-size: 13px; }
840
+ .dshAcNumber { width: 98px; }
841
+ .dshAcFooter { align-items: flex-start; flex-direction: column; gap: 10px; }
842
+ .dshAcFooter > div { width: 100%; justify-content: flex-end; }
979
843
  }
980
- .dshAcSelect:focus-visible { border-color: var(--dsw-alias-brand-primary); outline: none; }
981
- .dshAcSelect:disabled { color: var(--dsw-alias-label-tertiary); cursor: default; }
982
- .dshAcInvalid { color: var(--dsw-alias-label-error); margin: 0; font-size: 12px; line-height: 1.5; }
983
- .dshAcHint { color: var(--dsw-alias-label-tertiary); margin: 0; font-size: 12px; line-height: 1.5; }
984
- .dshAcPanel { min-width: 0; flex-direction: column; gap: 8px; padding: 12px 0 14px; display: flex; }
985
- .dshAcPanel + .dshAcPanel { border-left: 1px solid var(--dsw-alias-border-l2); padding-left: 20px; }
986
- .dshAcPanelHead { align-items: center; gap: 8px; display: flex; }
987
- .dshAcPanelTitle { color: var(--dsw-alias-label-primary); flex: 1; font-size: 13px; font-weight: 600; line-height: 1.5; }
988
- .dshAcStats { gap: 4px 16px; margin: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); display: grid; }
989
- .dshAcStats > div { justify-content: space-between; gap: 8px; display: flex; }
990
- .dshAcStats dt { color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 1.5; }
991
- .dshAcStats dd { color: var(--dsw-alias-label-primary); margin: 0; font-size: 12px; font-weight: 600; line-height: 1.5; }
992
- .dshAcCodes { flex-wrap: wrap; align-items: center; gap: 6px; display: flex; }
993
- .dshAcCode {
994
- white-space: nowrap;
995
- background: var(--dsw-alias-bg-module-platform);
996
- color: var(--dsw-alias-label-secondary);
997
- border-radius: 999px;
998
- padding: 1px 8px;
999
- font-size: 11px;
1000
- font-weight: 500;
1001
- line-height: 17px;
1002
- }
1003
- .dshAcPauseList { flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; display: flex; }
1004
- .dshAcPauseList li { align-items: center; gap: 8px; display: flex; }
1005
- .dshAcPauseId {
1006
- font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
1007
- color: var(--dsw-alias-label-primary);
1008
- font-size: 12px;
1009
- line-height: 1.5;
1010
- }
1011
- @keyframes dshAcRelayTravel {
1012
- 0% { opacity: 0; transform: translate(-19px, 18px) scale(.7); }
1013
- 18% { opacity: 1; }
1014
- 82% { opacity: 1; }
1015
- 100% { opacity: 0; transform: translate(12px, 6px) scale(1.15); }
1016
- }
1017
- @keyframes dshAcSignalSweep {
1018
- from { background-position: 100% 0; }
1019
- to { background-position: -120% 0; }
1020
- }
1021
- @media (max-width: 820px) {
1022
- .dshAcSectionGrid { grid-template-columns: minmax(0, 1fr); }
1023
- .dshAcFieldWide { grid-column: auto; }
1024
- .dshAcPanel + .dshAcPanel {
1025
- border-top: 1px solid var(--dsw-alias-border-l2);
1026
- border-left: 0;
1027
- padding-left: 0;
1028
- }
1029
- }
1030
- @media (max-width: 560px) {
1031
- .dshAcHeader { align-items: flex-start; gap: 11px; padding: 15px 13px 10px; }
1032
- .dshAcRelayMark { width: 46px; height: 46px; border-radius: 14px; }
1033
- .dshAcRelayMark svg { width: 38px; height: 38px; }
1034
- .dshAcName { font-size: 16px; }
1035
- .dshAcDescription { font-size: 12px; }
1036
- .dshAcJourney { gap: 5px; }
1037
- .dshAcJourneyLine { width: 13px; }
1038
- .dshAcChevron { width: 27px; height: 27px; }
1039
- .dshAcPending { display: none; }
1040
- .dshAcGithub { margin: 0 13px 13px; }
1041
- .dshAcBody { margin-right: 13px; margin-left: 13px; }
1042
- }
1043
- @media (prefers-reduced-motion: reduce) {
1044
- .dshAcCard, .dshAcGithub, .dshAcChevron { transition: none; }
1045
- .dshAcCard:hover, .dshAcGithub:hover { transform: none; }
1046
- .dshAcRelayPulse, .dshAcJourneyLine { animation: none !important; }
844
+ @container auto-continue-settings (max-width: 440px) {
845
+ .dshAcHeaderFrame { gap: 12px; padding: 14px; }
846
+ .dshAcTitleLine { gap: 6px; }
847
+ .dshAcTitleLine h2 { font-size: 15px; white-space: normal; }
848
+ .dshAcStatus { padding: 2px 5px; font-size: 10px; }
849
+ .dshAcIntroduction p { font-size: 11px; }
850
+ .dshAcStar, .dshAcGithubLong { display: none; }
851
+ .dshAcGithubShort { display: inline; }
852
+ .dshAcCard a.dshAcGithub { gap: 6px; padding: 8px; font-size: 11px; }
853
+ .dshAcGithub > svg.dshAcExternal { display: none; }
1047
854
  }
855
+ @media (prefers-reduced-motion: reduce) { .dshAcCard a.dshAcGithub { transition: none; } }
856
+
1048
857
  `;
1049
858
  function injectStyles() {
1050
859
  if (typeof document === "undefined") return;
@@ -1056,16 +865,60 @@ function injectStyles() {
1056
865
  document.head.appendChild(tag);
1057
866
  }
1058
867
 
868
+ // src/client/settings-notifications.ts
869
+ var pendingPermission;
870
+ function prepareSettingsNotification(enabled) {
871
+ try {
872
+ if (typeof Notification === "undefined") return Promise.resolve("unsupported");
873
+ if (!enabled || Notification.permission !== "default") return Promise.resolve(Notification.permission);
874
+ if (!pendingPermission) {
875
+ pendingPermission = Notification.requestPermission().catch(() => "failed").finally(() => {
876
+ pendingPermission = void 0;
877
+ });
878
+ }
879
+ return pendingPermission;
880
+ } catch {
881
+ return Promise.resolve("failed");
882
+ }
883
+ }
884
+ function showSettingsNotification(notice, locale, permission) {
885
+ const message = `notification.${notice}`;
886
+ if (permission !== "granted") {
887
+ if (notice === "disabled") return message;
888
+ return permission === "unsupported" ? "notification.unsupported" : permission === "failed" ? "notification.failed" : "notification.blocked";
889
+ }
890
+ try {
891
+ const copy = locale.startsWith("en") ? en : zh;
892
+ const notification = new Notification(copy["notification.title"], { body: copy[message] });
893
+ notification.onclick = () => {
894
+ try {
895
+ globalThis.focus?.();
896
+ } catch {
897
+ }
898
+ };
899
+ return message;
900
+ } catch {
901
+ return notice === "disabled" ? message : "notification.failed";
902
+ }
903
+ }
904
+
1059
905
  // src/client/settings-card.tsx
1060
- var import_jsx_runtime = require("react/jsx-runtime");
906
+ var import_jsx_runtime2 = require("react/jsx-runtime");
1061
907
  injectStyles();
1062
908
  var AutoContinueSettingsCardController = class {
1063
909
  /**
1064
910
  * @param scope - the bound settings scope for the `auto-continue` namespace.
1065
911
  */
1066
- constructor(scope) {
912
+ constructor(scope, getLocale) {
913
+ this.scope = scope;
914
+ this.getLocale = getLocale;
915
+ this.composerSaving = false;
916
+ this.composerFailed = false;
917
+ this.disposed = false;
918
+ this.saveSequence = 0;
1067
919
  this.form = new CardForm(scope, [
1068
920
  booleanField("paused"),
921
+ booleanField("showComposerToggle"),
1069
922
  textField("continueText"),
1070
923
  textField("continueTextMaxTokens"),
1071
924
  booleanField("resumeSilentTurns"),
@@ -1096,11 +949,15 @@ var AutoContinueSettingsCardController = class {
1096
949
  textField("loopText")
1097
950
  ]);
1098
951
  this.store = this.form.bind(() => this.projection(), createSnapshotStore);
952
+ this.composer = this.form.bind(() => this.composerProjection(), createSnapshotStore);
1099
953
  }
1100
954
  projection() {
1101
955
  return {
1102
956
  ...this.form.shell(),
957
+ enabled: !(this.scope.getSnapshot().value?.paused ?? DEFAULT_CONFIG.paused),
958
+ notificationFeedback: this.notificationFeedback,
1103
959
  paused: this.form.field("paused"),
960
+ showComposerToggle: this.form.field("showComposerToggle"),
1104
961
  continueText: this.form.field("continueText"),
1105
962
  continueTextMaxTokens: this.form.field("continueTextMaxTokens"),
1106
963
  resumeSilentTurns: this.form.field("resumeSilentTurns"),
@@ -1136,201 +993,125 @@ var AutoContinueSettingsCardController = class {
1136
993
  * @returns the card's snapshot and its form actions.
1137
994
  */
1138
995
  inject() {
1139
- return { hooks: { autoContinueSettingsCard: this.store }, ...this.form.actions() };
996
+ return { hooks: { autoContinueSettingsCard: this.store }, ...this.form.actions(), save: () => void this.save() };
997
+ }
998
+ async save() {
999
+ const state2 = this.form.shell();
1000
+ const snapshot = this.scope.getSnapshot();
1001
+ if (this.disposed || !state2.available || !state2.writable || !state2.dirty || state2.invalid || state2.saving || snapshot.mode !== "host") return;
1002
+ const sequence = ++this.saveSequence;
1003
+ const before = snapshot.value?.notify ?? DEFAULT_CONFIG.notify;
1004
+ const target = this.form.field("notify").text;
1005
+ const permission = prepareSettingsNotification(target === "" ? DEFAULT_CONFIG.notify : target === "true");
1006
+ this.notificationFeedback = void 0;
1007
+ if (!await this.form.save() || this.disposed) return;
1008
+ const after = this.scope.getSnapshot().value?.notify ?? DEFAULT_CONFIG.notify;
1009
+ if (!before && !after) return;
1010
+ const result = await permission;
1011
+ if (this.disposed || sequence !== this.saveSequence || (this.scope.getSnapshot().value?.notify ?? DEFAULT_CONFIG.notify) !== after) return;
1012
+ this.notificationFeedback = showSettingsNotification(before === after ? "saved" : after ? "enabled" : "disabled", this.getLocale(), result);
1013
+ this.store.set(this.projection());
1014
+ }
1015
+ injectComposer() {
1016
+ return { hooks: { autoContinueComposer: this.composer }, setEnabled: (enabled) => void this.setEnabled(enabled) };
1017
+ }
1018
+ composerProjection() {
1019
+ const snapshot = this.scope.getSnapshot();
1020
+ return {
1021
+ visible: snapshot.status === "ready" && (snapshot.value?.showComposerToggle ?? DEFAULT_CONFIG.showComposerToggle),
1022
+ enabled: !(snapshot.value?.paused ?? DEFAULT_CONFIG.paused),
1023
+ writable: snapshot.status === "ready" && snapshot.writable && snapshot.mode === "host",
1024
+ saving: this.composerSaving,
1025
+ failed: this.composerFailed
1026
+ };
1027
+ }
1028
+ async setEnabled(enabled) {
1029
+ if (this.disposed || this.composerSaving || !this.composerProjection().writable) return;
1030
+ this.composerSaving = true;
1031
+ this.composerFailed = false;
1032
+ this.composer.set(this.composerProjection());
1033
+ try {
1034
+ const result = await this.scope.set("paused", !enabled);
1035
+ this.composerFailed = result === false || this.composerProjection().enabled !== enabled;
1036
+ } catch {
1037
+ this.composerFailed = true;
1038
+ } finally {
1039
+ this.composerSaving = false;
1040
+ if (!this.disposed) this.composer.set(this.composerProjection());
1041
+ }
1140
1042
  }
1141
1043
  /** Release this card's subscription to the provider-owned settings form. */
1142
1044
  dispose() {
1045
+ this.disposed = true;
1143
1046
  this.form.dispose();
1144
1047
  }
1145
1048
  };
1146
1049
  function AutoContinueSettingsPage(props) {
1147
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { style: { listStyle: "none", margin: 0, padding: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutoContinueSettingsCard, { ...props }) });
1050
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { style: { listStyle: "none", margin: 0, padding: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AutoContinueSettingsCard, { ...props }) });
1148
1051
  }
1149
1052
  var REPOSITORY_URL = "https://github.com/HsiangNianian/dsh-auto-continue";
1150
- var REPOSITORY_SLUG = "HsiangNianian/dsh-auto-continue";
1151
- function RelayMark() {
1152
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { viewBox: "0 0 48 48", "aria-hidden": "true", focusable: "false", children: [
1153
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { className: "dshAcRelayArc", d: "M9 30c4-12 10-18 19-18 5 0 9 2 12 6" }),
1154
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { className: "dshAcRelayArc dshAcRelayArcEcho", d: "M8 35c6 3 12 3 17 0 5-3 8-8 15-9" }),
1155
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { className: "dshAcRelayNode dshAcRelayNodeStart", cx: "9", cy: "30", r: "3" }),
1156
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { className: "dshAcRelayNode dshAcRelayNodeEnd", cx: "40", cy: "18", r: "3" }),
1157
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { className: "dshAcRelayPulse", cx: "28", cy: "12", r: "2.5" })
1158
- ] });
1159
- }
1160
- function ChevronMark() {
1161
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m3.5 6 4.5 4 4.5-4" }) });
1162
- }
1053
+ var groups = [
1054
+ { id: "general", fields: ["paused", "showComposerToggle", "resumeSilentTurns", "resumeCompletedTurns", "notify"] },
1055
+ { id: "recovery", fields: ["graceMs", "cooldownMs", "maxConsecutive", "classify", "retryableErrorPatterns", "backoffFactor", "backoffMaxMs"] },
1056
+ { id: "startup", fields: ["scanOnBoot", "scanLimit", "freshMs"] },
1057
+ { id: "prompts", fields: ["continueText", "continueTextMaxTokens", "continueTextSilent", "continueTextLoop", "guardPendingText", "guardDoneText", "loopText"] },
1058
+ { id: "safety", fields: ["guardTools", "loopGuard", "loopShortChars", "loopWindowMs", "loopShortCount", "loopRepeatText", "loopToolRepeat"] },
1059
+ { id: "status", fields: ["verbose"] }
1060
+ ];
1061
+ var textDefaults = {
1062
+ continueText: "default.continueText",
1063
+ continueTextMaxTokens: "default.continueTextMaxTokens",
1064
+ continueTextSilent: "default.continueTextSilent",
1065
+ continueTextLoop: "default.continueTextLoop",
1066
+ guardPendingText: "default.guardPendingText",
1067
+ guardDoneText: "default.guardDoneText",
1068
+ loopText: "default.loopText"
1069
+ };
1163
1070
  function GitHubMark() {
1164
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 2.4a9.8 9.8 0 0 0-3.1 19.1c.5.1.7-.2.7-.5v-1.9c-2.8.6-3.4-1.2-3.4-1.2-.5-1.1-1.1-1.4-1.1-1.4-.9-.6.1-.6.1-.6 1 0 1.5 1 1.5 1 .9 1.5 2.3 1.1 2.9.8.1-.6.4-1.1.6-1.3-2.2-.3-4.6-1.1-4.6-4.9 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .8-.3 2.8 1a9.5 9.5 0 0 1 5 0c1.9-1.3 2.8-1 2.8-1 .5 1.4.2 2.4.1 2.7.6.7 1 1.6 1 2.7 0 3.8-2.3 4.6-4.6 4.9.4.3.7.9.7 1.8V21c0 .3.2.6.7.5A9.8 9.8 0 0 0 12 2.4Z" }) });
1071
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 2.4a9.8 9.8 0 0 0-3.1 19.1c.5.1.7-.2.7-.5v-1.9c-2.8.6-3.4-1.2-3.4-1.2-.5-1.1-1.1-1.4-1.1-1.4-.9-.6.1-.6.1-.6 1 0 1.5 1 1.5 1 .9 1.5 2.3 1.1 2.9.8.1-.6.4-1.1.6-1.3-2.2-.3-4.6-1.1-4.6-4.9 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .8-.3 2.8 1a9.5 9.5 0 0 1 5 0c1.9-1.3 2.8-1 2.8-1 .5 1.4.2 2.4.1 2.7.6.7 1 1.6 1 2.7 0 3.8-2.3 4.6-4.6 4.9.4.3.7.9.7 1.8V21c0 .3.2.6.7.5A9.8 9.8 0 0 0 12 2.4Z" }) });
1165
1072
  }
1166
- function ExternalMark() {
1167
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", children: [
1168
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6 3h7v7M13 3 7 9" }),
1169
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M11 9v3a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h3" })
1170
- ] });
1171
- }
1172
- function RelayJourney(props) {
1173
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dshAcJourney", children: [
1174
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dshAcJourneyStep dshAcJourneyInterrupted", children: [
1175
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcJourneyDot", "aria-hidden": "true" }),
1176
- props.t("flow.interrupted")
1177
- ] }),
1178
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcJourneyLine", "aria-hidden": "true" }),
1179
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dshAcJourneyStep dshAcJourneyGrace", children: [
1180
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcJourneyDot", "aria-hidden": "true" }),
1181
- props.t("flow.grace")
1073
+ function RepositoryInvite({ t }) {
1074
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("aside", { className: "dshAcRepository", children: [
1075
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcStar", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m12 3 2.78 5.63L21 9.53l-4.5 4.39 1.06 6.2L12 17.2l-5.56 2.92 1.06-6.2L3 9.53l6.22-.9L12 3Z" }) }) }),
1076
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dshAcRepositoryCopy", children: [
1077
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: t("repo.star") }),
1078
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("repo.note") })
1182
1079
  ] }),
1183
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcJourneyLine", "aria-hidden": "true" }),
1184
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dshAcJourneyStep dshAcJourneyContinue", children: [
1185
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcJourneyDot", "aria-hidden": "true" }),
1186
- props.t("flow.continue")
1080
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("a", { className: "dshAcGithub", href: REPOSITORY_URL, target: "_blank", rel: "noopener noreferrer", "aria-label": t("repo.aria"), children: [
1081
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(GitHubMark, {}),
1082
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcGithubLong", children: t("repo.link") }),
1083
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcGithubShort", children: "GitHub" }),
1084
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { className: "dshAcExternal", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M6 3h7v7M13 3 7 9M11 9v3a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h3" }) })
1187
1085
  ] })
1188
1086
  ] });
1189
1087
  }
1190
- function SettingsCard(props) {
1191
- const [open, setOpen] = (0, import_react.useState)(false);
1192
- const { state: state2 } = props;
1193
- if (!state2.available) return null;
1194
- const title = props.t(props.titleKey);
1195
- const blocked = !state2.dirty || state2.invalid || state2.saving;
1196
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: open ? "dshAcCard dshAcCardOpen" : "dshAcCard", children: [
1197
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dshAcHeaderFrame", children: [
1198
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1199
- "button",
1200
- {
1201
- type: "button",
1202
- className: "dshAcHeader",
1203
- "aria-expanded": open,
1204
- "aria-label": `${props.t(open ? "chrome.collapse" : "chrome.expand")}: ${title}`,
1205
- title: props.t(props.descriptionKey),
1206
- onClick: () => setOpen(!open),
1207
- children: [
1208
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcRelayMark", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RelayMark, {}) }),
1209
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dshAcHeadText", children: [
1210
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcName", children: title }),
1211
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcDescription", children: props.t(props.descriptionKey) }),
1212
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RelayJourney, { t: props.t })
1213
- ] }),
1214
- state2.dirty ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcPending", title: props.t("chrome.unsaved"), children: props.t("chrome.unsaved") }) : null,
1215
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: open ? "dshAcChevron dshAcChevronOpen" : "dshAcChevron", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronMark, {}) })
1216
- ]
1217
- }
1218
- ),
1219
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1220
- "a",
1088
+ function SettingField({ name, id, state: state2, actions, disabled, t }) {
1089
+ const boolean = typeof DEFAULT_CONFIG[name] === "boolean";
1090
+ const numeric = typeof DEFAULT_CONFIG[name] === "number";
1091
+ const label = t(`field.${name}`);
1092
+ const hint = t(`field.${name}Hint`);
1093
+ const value = state2.text === "" ? DEFAULT_CONFIG[name] : state2.text === "true";
1094
+ const placeholderKey = textDefaults[name];
1095
+ const placeholder = placeholderKey ? t(placeholderKey) : name === "retryableErrorPatterns" ? t("field.retryableErrorPatternsPlaceholder") : String(DEFAULT_CONFIG[name]);
1096
+ const common = { id, disabled, "aria-describedby": `${id}-hint`, "aria-invalid": state2.invalid || void 0, value: state2.text, onChange: (event) => actions.edit(name, event.target.value) };
1097
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `dshAcField${!boolean && !numeric ? " dshAcFieldText" : ""}`, "data-field": name, children: [
1098
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcFieldCopy", children: [
1099
+ boolean ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcLabel", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: "dshAcLabel", htmlFor: id, children: label }),
1100
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: state2.invalid ? "dshAcInvalid" : "dshAcHint", id: `${id}-hint`, children: state2.invalid ? t("chrome.invalidNumber") : hint })
1101
+ ] }),
1102
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcFieldControl", children: [
1103
+ state2.overridden && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "dshAcReset", disabled, "aria-label": `${t("chrome.reset")}: ${label}`, onClick: () => actions.resetField(name), children: t("chrome.reset") }),
1104
+ boolean ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcSwitchTarget", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1105
+ NativeSwitch,
1221
1106
  {
1222
- className: "dshAcGithub",
1223
- href: REPOSITORY_URL,
1224
- target: "_blank",
1225
- rel: "noreferrer",
1226
- "aria-label": props.t("repo.aria"),
1227
- children: [
1228
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcGithubIcon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GitHubMark, {}) }),
1229
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dshAcGithubText", children: [
1230
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcGithubAction", children: props.t("repo.star") }),
1231
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcGithubSlug", children: REPOSITORY_SLUG })
1232
- ] }),
1233
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcExternal", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExternalMark, {}) })
1234
- ]
1107
+ label,
1108
+ title: hint,
1109
+ disabled,
1110
+ checked: name === "paused" ? !value : Boolean(value),
1111
+ onChange: (checked) => actions.edit(name, String(name === "paused" ? !checked : checked))
1235
1112
  }
1236
- )
1237
- ] }),
1238
- open ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dshAcBody", children: [
1239
- !state2.writable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dshAcReadOnly", role: "status", children: props.t("chrome.readOnly") }) : null,
1240
- props.children,
1241
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dshAcFooter", children: [
1242
- state2.failed ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dshAcFailed", role: "status", children: props.t("chrome.saveFailed") }) : null,
1243
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1244
- "button",
1245
- {
1246
- type: "button",
1247
- className: "dshAcDiscard",
1248
- disabled: !state2.dirty || state2.saving,
1249
- onClick: props.onDiscard,
1250
- children: props.t("chrome.discard")
1251
- }
1252
- ),
1253
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dshAcSave", disabled: blocked, onClick: props.onSave, children: props.t(!state2.saving ? "chrome.save" : "chrome.saving") })
1254
- ] })
1255
- ] }) : null
1256
- ] });
1257
- }
1258
- function ValueField(props) {
1259
- const className = props.invalid ? "dshAcInput dshAcInputInvalid" : "dshAcInput";
1260
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: props.wide === true ? "dshAcField dshAcFieldWide" : "dshAcField", children: [
1261
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dshAcHead", children: [
1262
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "dshAcLabel", htmlFor: props.id, children: props.label }),
1263
- props.overridden ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dshAcBadges", children: [
1264
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcBadge", children: props.t("chrome.overridden") }),
1265
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dshAcReset", disabled: props.disabled, onClick: props.onReset, children: props.t("chrome.reset") })
1266
- ] }) : null
1267
- ] }),
1268
- props.multiline === true ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1269
- "textarea",
1270
- {
1271
- id: props.id,
1272
- className: `${className} dshAcTextArea`,
1273
- "aria-invalid": props.invalid || void 0,
1274
- value: props.text,
1275
- placeholder: props.placeholder ?? "",
1276
- disabled: props.disabled,
1277
- rows: 4,
1278
- onChange: (event) => props.onEdit(event.target.value)
1279
- }
1280
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1281
- "input",
1282
- {
1283
- id: props.id,
1284
- className,
1285
- type: "text",
1286
- inputMode: props.numeric === true ? "numeric" : void 0,
1287
- "aria-invalid": props.invalid || void 0,
1288
- value: props.text,
1289
- placeholder: props.placeholder ?? "",
1290
- disabled: props.disabled,
1291
- onChange: (event) => props.onEdit(event.target.value)
1292
- }
1293
- ),
1294
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: props.invalid ? "dshAcInvalid" : "dshAcHint", children: props.invalid ? props.t("chrome.invalidNumber") : props.hint })
1295
- ] });
1296
- }
1297
- function BooleanField(props) {
1298
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: props.wide === true ? "dshAcField dshAcFieldWide" : "dshAcField", children: [
1299
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dshAcHead", children: [
1300
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "dshAcLabel", htmlFor: props.id, children: props.label }),
1301
- props.overridden ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dshAcBadges", children: [
1302
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcBadge", children: props.t("chrome.overridden") }),
1303
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dshAcReset", disabled: props.disabled, onClick: props.onReset, children: props.t("chrome.reset") })
1304
- ] }) : null
1305
- ] }),
1306
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1307
- "select",
1308
- {
1309
- id: props.id,
1310
- className: "dshAcSelect",
1311
- value: props.text,
1312
- disabled: props.disabled,
1313
- onChange: (event) => props.onEdit(event.target.value),
1314
- children: [
1315
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", children: props.t("chrome.inherit") }),
1316
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "true", children: props.t("chrome.on") }),
1317
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "false", children: props.t("chrome.off") })
1318
- ]
1319
- }
1320
- ),
1321
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dshAcHint", children: props.hint })
1322
- ] });
1323
- }
1324
- function SettingsSection(props) {
1325
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: `dshAcFormSection dshAcFormSection-${props.tone}`, children: [
1326
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { className: "dshAcSectionHead", children: [
1327
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcSectionSignal", "aria-hidden": "true" }),
1328
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dshAcSectionCopy", children: [
1329
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcSectionTitle", children: props.t(props.titleKey) }),
1330
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcSectionDescription", children: props.t(props.descriptionKey) })
1331
- ] })
1332
- ] }),
1333
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dshAcSectionGrid", children: props.children })
1113
+ ) }) : numeric ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { ...common, className: "dshAcInput dshAcNumber", type: "text", inputMode: "numeric", placeholder }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("textarea", { ...common, className: "dshAcInput dshAcTextArea", rows: name === "retryableErrorPatterns" ? 3 : 2, placeholder })
1114
+ ] })
1334
1115
  ] });
1335
1116
  }
1336
1117
  function LivePanels(props) {
@@ -1348,11 +1129,11 @@ function LivePanels(props) {
1348
1129
  const hasStats = stats.sent + stats.skipped + stats.recovered + stats.failed + stats.gaveUp + stats.looped > 0;
1349
1130
  const codes = Object.entries(stats.byCode).sort((a, b) => b[1] - a[1]).slice(0, 5);
1350
1131
  const paused = pausedSessions();
1351
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1352
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dshAcPanel", children: [
1353
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dshAcPanelHead", children: [
1354
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcPanelTitle", children: t("stats.title") }),
1355
- hasStats ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1132
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1133
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "dshAcPanel", children: [
1134
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcPanelHead", children: [
1135
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcPanelTitle", children: t("stats.title") }),
1136
+ hasStats ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1356
1137
  "button",
1357
1138
  {
1358
1139
  type: "button",
@@ -1365,39 +1146,39 @@ function LivePanels(props) {
1365
1146
  }
1366
1147
  ) : null
1367
1148
  ] }),
1368
- !hasStats ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dshAcHint", children: t("stats.empty") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1369
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("dl", { className: "dshAcStats", children: [
1370
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
1371
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: t("stats.sent") }),
1372
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: stats.sent })
1149
+ !hasStats ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dshAcHint", children: t("stats.empty") }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1150
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("dl", { className: "dshAcStats", children: [
1151
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
1152
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: t("stats.sent") }),
1153
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: stats.sent })
1373
1154
  ] }),
1374
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
1375
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: t("stats.recovered") }),
1376
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: stats.recovered })
1155
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
1156
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: t("stats.recovered") }),
1157
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: stats.recovered })
1377
1158
  ] }),
1378
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
1379
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: t("stats.failed") }),
1380
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: stats.failed })
1159
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
1160
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: t("stats.failed") }),
1161
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: stats.failed })
1381
1162
  ] }),
1382
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
1383
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: t("stats.skipped") }),
1384
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: stats.skipped })
1163
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
1164
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: t("stats.skipped") }),
1165
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: stats.skipped })
1385
1166
  ] }),
1386
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
1387
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: t("stats.gaveUp") }),
1388
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: stats.gaveUp })
1167
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
1168
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: t("stats.gaveUp") }),
1169
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: stats.gaveUp })
1389
1170
  ] }),
1390
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
1391
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: t("stats.looped") }),
1392
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: stats.looped })
1171
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
1172
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: t("stats.looped") }),
1173
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: stats.looped })
1393
1174
  ] })
1394
1175
  ] }),
1395
- codes.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dshAcCodes", children: [
1396
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dshAcHint", children: [
1176
+ codes.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcCodes", children: [
1177
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dshAcHint", children: [
1397
1178
  t("stats.byCode"),
1398
1179
  ":"
1399
1180
  ] }),
1400
- codes.map(([code, count]) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dshAcCode", children: [
1181
+ codes.map(([code, count]) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dshAcCode", children: [
1401
1182
  code,
1402
1183
  " ×",
1403
1184
  count
@@ -1405,10 +1186,10 @@ function LivePanels(props) {
1405
1186
  ] }) : null
1406
1187
  ] })
1407
1188
  ] }),
1408
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dshAcPanel", children: [
1409
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dshAcPanelHead", children: [
1410
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dshAcPanelTitle", children: t("pause.title") }),
1411
- paused.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1189
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "dshAcPanel", children: [
1190
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcPanelHead", children: [
1191
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcPanelTitle", children: t("pause.title") }),
1192
+ paused.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1412
1193
  "button",
1413
1194
  {
1414
1195
  type: "button",
@@ -1421,17 +1202,17 @@ function LivePanels(props) {
1421
1202
  }
1422
1203
  ) : null
1423
1204
  ] }),
1424
- paused.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dshAcHint", children: t("pause.none") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "dshAcPauseList", children: paused.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
1425
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dshAcPauseId", children: [
1205
+ paused.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dshAcHint", children: t("pause.none") }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { className: "dshAcPauseList", children: paused.map((item) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("li", { children: [
1206
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dshAcPauseId", children: [
1426
1207
  item.sessionId.slice(0, 8),
1427
1208
  "…"
1428
1209
  ] }),
1429
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dshAcHint", children: [
1210
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dshAcHint", children: [
1430
1211
  Math.max(1, Math.ceil((item.until - Date.now()) / 6e4)),
1431
1212
  " ",
1432
1213
  t("pause.minutes")
1433
1214
  ] }),
1434
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1215
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1435
1216
  "button",
1436
1217
  {
1437
1218
  type: "button",
@@ -1450,466 +1231,95 @@ function LivePanels(props) {
1450
1231
  function AutoContinueSettingsCard(props) {
1451
1232
  const { t } = props;
1452
1233
  const state2 = props.useAutoContinueSettingsCard((snapshot) => snapshot);
1453
- const disabled = !state2.writable;
1454
- const shared = { t, disabled };
1455
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1456
- SettingsCard,
1457
- {
1458
- t,
1459
- titleKey: "card.title",
1460
- descriptionKey: "card.description",
1461
- state: state2,
1462
- onSave: props.save,
1463
- onDiscard: props.discard,
1464
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dshAcFormCanvas", children: [
1465
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1466
- SettingsSection,
1467
- {
1468
- t,
1469
- titleKey: "section.handoff.title",
1470
- descriptionKey: "section.handoff.description",
1471
- tone: "handoff",
1472
- children: [
1473
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1474
- BooleanField,
1475
- {
1476
- wide: true,
1477
- id: "auto-continue-paused",
1478
- label: t("field.paused"),
1479
- hint: t("field.pausedHint"),
1480
- ...shared,
1481
- ...state2.paused,
1482
- onEdit: (text) => props.edit("paused", text),
1483
- onReset: () => props.resetField("paused")
1484
- }
1485
- ),
1486
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1487
- ValueField,
1488
- {
1489
- id: "auto-continue-continue-text",
1490
- label: t("field.continueText"),
1491
- hint: t("field.continueTextHint"),
1492
- ...shared,
1493
- ...state2.continueText,
1494
- onEdit: (text) => props.edit("continueText", text),
1495
- placeholder: t("default.continueText"),
1496
- onReset: () => props.resetField("continueText")
1497
- }
1498
- ),
1499
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1500
- ValueField,
1501
- {
1502
- id: "auto-continue-continue-text-max-tokens",
1503
- label: t("field.continueTextMaxTokens"),
1504
- hint: t("field.continueTextMaxTokensHint"),
1505
- ...shared,
1506
- ...state2.continueTextMaxTokens,
1507
- onEdit: (text) => props.edit("continueTextMaxTokens", text),
1508
- placeholder: t("default.continueTextMaxTokens"),
1509
- onReset: () => props.resetField("continueTextMaxTokens")
1510
- }
1511
- ),
1512
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1513
- BooleanField,
1514
- {
1515
- wide: true,
1516
- id: "auto-continue-resume-silent-turns",
1517
- label: t("field.resumeSilentTurns"),
1518
- hint: t("field.resumeSilentTurnsHint"),
1519
- ...shared,
1520
- ...state2.resumeSilentTurns,
1521
- onEdit: (text) => props.edit("resumeSilentTurns", text),
1522
- onReset: () => props.resetField("resumeSilentTurns")
1523
- }
1524
- ),
1525
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1526
- ValueField,
1527
- {
1528
- wide: true,
1529
- id: "auto-continue-continue-text-silent",
1530
- label: t("field.continueTextSilent"),
1531
- hint: t("field.continueTextSilentHint"),
1532
- ...shared,
1533
- ...state2.continueTextSilent,
1534
- onEdit: (text) => props.edit("continueTextSilent", text),
1535
- placeholder: t("default.continueTextSilent"),
1536
- onReset: () => props.resetField("continueTextSilent")
1537
- }
1538
- )
1539
- ]
1540
- }
1541
- ),
1542
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1543
- SettingsSection,
1544
- {
1545
- t,
1546
- titleKey: "section.autoloop.title",
1547
- descriptionKey: "section.autoloop.description",
1548
- tone: "autoloop",
1549
- children: [
1550
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1551
- BooleanField,
1552
- {
1553
- wide: true,
1554
- id: "auto-continue-resume-completed-turns",
1555
- label: t("field.resumeCompletedTurns"),
1556
- hint: t("field.resumeCompletedTurnsHint"),
1557
- ...shared,
1558
- ...state2.resumeCompletedTurns,
1559
- onEdit: (text) => props.edit("resumeCompletedTurns", text),
1560
- onReset: () => props.resetField("resumeCompletedTurns")
1561
- }
1562
- ),
1563
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1564
- ValueField,
1565
- {
1566
- wide: true,
1567
- id: "auto-continue-continue-text-loop",
1568
- label: t("field.continueTextLoop"),
1569
- hint: t("field.continueTextLoopHint"),
1570
- ...shared,
1571
- ...state2.continueTextLoop,
1572
- onEdit: (text) => props.edit("continueTextLoop", text),
1573
- placeholder: t("default.continueTextLoop"),
1574
- onReset: () => props.resetField("continueTextLoop")
1575
- }
1576
- )
1577
- ]
1578
- }
1579
- ),
1580
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1581
- SettingsSection,
1582
- {
1583
- t,
1584
- titleKey: "section.safety.title",
1585
- descriptionKey: "section.safety.description",
1586
- tone: "safety",
1587
- children: [
1588
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1589
- BooleanField,
1590
- {
1591
- wide: true,
1592
- id: "auto-continue-guard-tools",
1593
- label: t("field.guardTools"),
1594
- hint: t("field.guardToolsHint"),
1595
- ...shared,
1596
- ...state2.guardTools,
1597
- onEdit: (text) => props.edit("guardTools", text),
1598
- onReset: () => props.resetField("guardTools")
1599
- }
1600
- ),
1601
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1602
- ValueField,
1603
- {
1604
- wide: true,
1605
- id: "auto-continue-guard-pending-text",
1606
- label: t("field.guardPendingText"),
1607
- hint: t("field.guardPendingTextHint"),
1608
- ...shared,
1609
- ...state2.guardPendingText,
1610
- onEdit: (text) => props.edit("guardPendingText", text),
1611
- placeholder: t("default.guardPendingText"),
1612
- onReset: () => props.resetField("guardPendingText")
1613
- }
1614
- ),
1615
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1616
- ValueField,
1617
- {
1618
- wide: true,
1619
- id: "auto-continue-guard-done-text",
1620
- label: t("field.guardDoneText"),
1621
- hint: t("field.guardDoneTextHint"),
1622
- ...shared,
1623
- ...state2.guardDoneText,
1624
- onEdit: (text) => props.edit("guardDoneText", text),
1625
- placeholder: t("default.guardDoneText"),
1626
- onReset: () => props.resetField("guardDoneText")
1627
- }
1628
- ),
1629
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1630
- ValueField,
1631
- {
1632
- id: "auto-continue-grace-ms",
1633
- label: t("field.graceMs"),
1634
- hint: t("field.graceMsHint"),
1635
- numeric: true,
1636
- ...shared,
1637
- ...state2.graceMs,
1638
- onEdit: (text) => props.edit("graceMs", text),
1639
- onReset: () => props.resetField("graceMs")
1640
- }
1641
- ),
1642
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1643
- ValueField,
1644
- {
1645
- id: "auto-continue-cooldown-ms",
1646
- label: t("field.cooldownMs"),
1647
- hint: t("field.cooldownMsHint"),
1648
- numeric: true,
1649
- ...shared,
1650
- ...state2.cooldownMs,
1651
- onEdit: (text) => props.edit("cooldownMs", text),
1652
- onReset: () => props.resetField("cooldownMs")
1653
- }
1654
- ),
1655
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1656
- ValueField,
1657
- {
1658
- id: "auto-continue-max-consecutive",
1659
- label: t("field.maxConsecutive"),
1660
- hint: t("field.maxConsecutiveHint"),
1661
- numeric: true,
1662
- ...shared,
1663
- ...state2.maxConsecutive,
1664
- onEdit: (text) => props.edit("maxConsecutive", text),
1665
- onReset: () => props.resetField("maxConsecutive")
1666
- }
1667
- )
1668
- ]
1669
- }
1670
- ),
1671
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1672
- SettingsSection,
1673
- {
1674
- t,
1675
- titleKey: "section.recovery.title",
1676
- descriptionKey: "section.recovery.description",
1677
- tone: "recovery",
1678
- children: [
1679
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1680
- BooleanField,
1681
- {
1682
- id: "auto-continue-scan-on-boot",
1683
- label: t("field.scanOnBoot"),
1684
- hint: t("field.scanOnBootHint"),
1685
- ...shared,
1686
- ...state2.scanOnBoot,
1687
- onEdit: (text) => props.edit("scanOnBoot", text),
1688
- onReset: () => props.resetField("scanOnBoot")
1689
- }
1690
- ),
1691
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1692
- BooleanField,
1693
- {
1694
- id: "auto-continue-classify",
1695
- label: t("field.classify"),
1696
- hint: t("field.classifyHint"),
1697
- ...shared,
1698
- ...state2.classify,
1699
- onEdit: (text) => props.edit("classify", text),
1700
- onReset: () => props.resetField("classify")
1701
- }
1702
- ),
1703
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1704
- ValueField,
1705
- {
1706
- id: "auto-continue-scan-limit",
1707
- label: t("field.scanLimit"),
1708
- hint: t("field.scanLimitHint"),
1709
- numeric: true,
1710
- ...shared,
1711
- ...state2.scanLimit,
1712
- onEdit: (text) => props.edit("scanLimit", text),
1713
- onReset: () => props.resetField("scanLimit")
1714
- }
1715
- ),
1716
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1717
- ValueField,
1718
- {
1719
- id: "auto-continue-fresh-ms",
1720
- label: t("field.freshMs"),
1721
- hint: t("field.freshMsHint"),
1722
- numeric: true,
1723
- ...shared,
1724
- ...state2.freshMs,
1725
- onEdit: (text) => props.edit("freshMs", text),
1726
- onReset: () => props.resetField("freshMs")
1727
- }
1728
- ),
1729
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1730
- ValueField,
1731
- {
1732
- wide: true,
1733
- id: "auto-continue-retryable-error-patterns",
1734
- label: t("field.retryableErrorPatterns"),
1735
- hint: t("field.retryableErrorPatternsHint"),
1736
- multiline: true,
1737
- ...shared,
1738
- ...state2.retryableErrorPatterns,
1739
- onEdit: (text) => props.edit("retryableErrorPatterns", text),
1740
- placeholder: t("field.retryableErrorPatternsPlaceholder"),
1741
- onReset: () => props.resetField("retryableErrorPatterns")
1742
- }
1743
- ),
1744
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1745
- ValueField,
1746
- {
1747
- id: "auto-continue-backoff-factor",
1748
- label: t("field.backoffFactor"),
1749
- hint: t("field.backoffFactorHint"),
1750
- numeric: true,
1751
- ...shared,
1752
- ...state2.backoffFactor,
1753
- onEdit: (text) => props.edit("backoffFactor", text),
1754
- onReset: () => props.resetField("backoffFactor")
1755
- }
1756
- ),
1757
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1758
- ValueField,
1759
- {
1760
- id: "auto-continue-backoff-max",
1761
- label: t("field.backoffMaxMs"),
1762
- hint: t("field.backoffMaxMsHint"),
1763
- numeric: true,
1764
- ...shared,
1765
- ...state2.backoffMaxMs,
1766
- onEdit: (text) => props.edit("backoffMaxMs", text),
1767
- onReset: () => props.resetField("backoffMaxMs")
1768
- }
1769
- ),
1770
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1771
- BooleanField,
1772
- {
1773
- id: "auto-continue-notify",
1774
- label: t("field.notify"),
1775
- hint: t("field.notifyHint"),
1776
- ...shared,
1777
- ...state2.notify,
1778
- onEdit: (text) => props.edit("notify", text),
1779
- onReset: () => props.resetField("notify")
1780
- }
1781
- ),
1782
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1783
- BooleanField,
1784
- {
1785
- id: "auto-continue-verbose",
1786
- label: t("field.verbose"),
1787
- hint: t("field.verboseHint"),
1788
- ...shared,
1789
- ...state2.verbose,
1790
- onEdit: (text) => props.edit("verbose", text),
1791
- onReset: () => props.resetField("verbose")
1792
- }
1793
- )
1794
- ]
1795
- }
1796
- ),
1797
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1798
- SettingsSection,
1234
+ const [active, setActive] = (0, import_react.useState)("general");
1235
+ const prefix = (0, import_react.useId)();
1236
+ const group = groups.find((item) => item.id === active);
1237
+ if (!state2.available) return null;
1238
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("li", { className: "dshAcCard", children: [
1239
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("header", { className: "dshAcHeaderFrame", children: [
1240
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcIntroduction", children: [
1241
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcTitleLine", children: [
1242
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: t("card.title") }),
1243
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcStatus", children: t(state2.enabled ? "chrome.enabled" : "chrome.paused") })
1244
+ ] }),
1245
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: t("card.description") })
1246
+ ] }),
1247
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RepositoryInvite, { t })
1248
+ ] }),
1249
+ !state2.writable && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dshAcReadOnly", role: "status", children: t("chrome.readOnly") }),
1250
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcLayout", children: [
1251
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dshAcNav", role: "tablist", "aria-label": t("chrome.categories"), children: groups.map((item, index) => {
1252
+ const invalid = item.fields.some((name) => state2[name].invalid);
1253
+ const title = t(`category.${item.id}.title`);
1254
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1255
+ "button",
1799
1256
  {
1800
- t,
1801
- titleKey: "section.loop.title",
1802
- descriptionKey: "section.loop.description",
1803
- tone: "loop",
1257
+ type: "button",
1258
+ role: "tab",
1259
+ id: `${prefix}-tab-${item.id}`,
1260
+ "data-category": item.id,
1261
+ "aria-controls": `${prefix}-panel-${item.id}`,
1262
+ "aria-selected": active === item.id,
1263
+ tabIndex: active === item.id ? 0 : -1,
1264
+ "aria-label": invalid ? `${title}: ${t("chrome.invalidNumber")}` : title,
1265
+ onClick: () => setActive(item.id),
1266
+ onKeyDown: (event) => {
1267
+ const offset = ["ArrowRight", "ArrowDown"].includes(event.key) ? 1 : ["ArrowLeft", "ArrowUp"].includes(event.key) ? -1 : 0;
1268
+ if (!offset && event.key !== "Home" && event.key !== "End") return;
1269
+ event.preventDefault();
1270
+ const next = event.key === "Home" ? 0 : event.key === "End" ? groups.length - 1 : (index + offset + groups.length) % groups.length;
1271
+ setActive(groups[next].id);
1272
+ const button = event.currentTarget.parentElement?.querySelectorAll('[role="tab"]')[next];
1273
+ button?.focus();
1274
+ button?.scrollIntoView({ block: "nearest", inline: "nearest" });
1275
+ },
1804
1276
  children: [
1805
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1806
- BooleanField,
1807
- {
1808
- wide: true,
1809
- id: "auto-continue-loop-guard",
1810
- label: t("field.loopGuard"),
1811
- hint: t("field.loopGuardHint"),
1812
- ...shared,
1813
- ...state2.loopGuard,
1814
- onEdit: (text) => props.edit("loopGuard", text),
1815
- onReset: () => props.resetField("loopGuard")
1816
- }
1817
- ),
1818
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1819
- ValueField,
1820
- {
1821
- id: "auto-continue-loop-short-chars",
1822
- label: t("field.loopShortChars"),
1823
- hint: t("field.loopShortCharsHint"),
1824
- numeric: true,
1825
- ...shared,
1826
- ...state2.loopShortChars,
1827
- onEdit: (text) => props.edit("loopShortChars", text),
1828
- onReset: () => props.resetField("loopShortChars")
1829
- }
1830
- ),
1831
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1832
- ValueField,
1833
- {
1834
- id: "auto-continue-loop-window-ms",
1835
- label: t("field.loopWindowMs"),
1836
- hint: t("field.loopWindowMsHint"),
1837
- numeric: true,
1838
- ...shared,
1839
- ...state2.loopWindowMs,
1840
- onEdit: (text) => props.edit("loopWindowMs", text),
1841
- onReset: () => props.resetField("loopWindowMs")
1842
- }
1843
- ),
1844
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1845
- ValueField,
1846
- {
1847
- id: "auto-continue-loop-short-count",
1848
- label: t("field.loopShortCount"),
1849
- hint: t("field.loopShortCountHint"),
1850
- numeric: true,
1851
- ...shared,
1852
- ...state2.loopShortCount,
1853
- onEdit: (text) => props.edit("loopShortCount", text),
1854
- onReset: () => props.resetField("loopShortCount")
1855
- }
1856
- ),
1857
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1858
- ValueField,
1859
- {
1860
- id: "auto-continue-loop-repeat-text",
1861
- label: t("field.loopRepeatText"),
1862
- hint: t("field.loopRepeatTextHint"),
1863
- numeric: true,
1864
- ...shared,
1865
- ...state2.loopRepeatText,
1866
- onEdit: (text) => props.edit("loopRepeatText", text),
1867
- onReset: () => props.resetField("loopRepeatText")
1868
- }
1869
- ),
1870
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1871
- ValueField,
1872
- {
1873
- id: "auto-continue-loop-tool-repeat",
1874
- label: t("field.loopToolRepeat"),
1875
- hint: t("field.loopToolRepeatHint"),
1876
- numeric: true,
1877
- ...shared,
1878
- ...state2.loopToolRepeat,
1879
- onEdit: (text) => props.edit("loopToolRepeat", text),
1880
- onReset: () => props.resetField("loopToolRepeat")
1881
- }
1882
- ),
1883
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1884
- ValueField,
1885
- {
1886
- wide: true,
1887
- id: "auto-continue-loop-text",
1888
- label: t("field.loopText"),
1889
- hint: t("field.loopTextHint"),
1890
- ...shared,
1891
- ...state2.loopText,
1892
- onEdit: (text) => props.edit("loopText", text),
1893
- placeholder: t("default.loopText"),
1894
- onReset: () => props.resetField("loopText")
1895
- }
1896
- )
1277
+ title,
1278
+ invalid && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcInvalidMark", "aria-hidden": "true", children: "!" })
1897
1279
  ]
1898
- }
1899
- ),
1900
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1901
- SettingsSection,
1902
- {
1903
- t,
1904
- titleKey: "section.live.title",
1905
- descriptionKey: "section.live.description",
1906
- tone: "live",
1907
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LivePanels, { t })
1908
- }
1909
- )
1280
+ },
1281
+ item.id
1282
+ );
1283
+ }) }),
1284
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "dshAcCategory", role: "tabpanel", id: `${prefix}-panel-${active}`, "aria-labelledby": `${prefix}-tab-${active}`, children: [
1285
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcCategoryHeading", children: [
1286
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: t(`category.${active}.title`) }),
1287
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: t(`category.${active}.description`) })
1288
+ ] }),
1289
+ group.fields.map((name) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SettingField, { name, id: `${prefix}-${name}`, state: state2[name], actions: props, disabled: !state2.writable, t }, name)),
1290
+ active === "status" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LivePanels, { t })
1910
1291
  ] })
1911
- }
1912
- );
1292
+ ] }),
1293
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("footer", { className: "dshAcFooter", "data-dirty": state2.dirty, children: [
1294
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: state2.failed || state2.invalid ? "dshAcInvalid" : "dshAcHint", role: "status", children: t(state2.failed ? "chrome.saveFailed" : state2.invalid ? "chrome.invalidNumber" : state2.saving ? "chrome.saving" : state2.dirty ? "chrome.unsaved" : state2.notificationFeedback ?? "chrome.saved") }),
1295
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
1296
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "dshAcDiscard", disabled: !state2.dirty || state2.saving, onClick: props.discard, children: t("chrome.discard") }),
1297
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "dshAcSave", disabled: !state2.dirty || state2.invalid || state2.saving || !state2.writable, onClick: props.save, children: t(state2.saving ? "chrome.saving" : "chrome.save") })
1298
+ ] })
1299
+ ] })
1300
+ ] });
1301
+ }
1302
+
1303
+ // src/client/composer-toggle.tsx
1304
+ var import_jsx_runtime3 = require("react/jsx-runtime");
1305
+ function AutoContinueComposerToggle(props) {
1306
+ const state2 = props.useAutoContinueComposer((snapshot) => snapshot);
1307
+ if (!state2.visible) return null;
1308
+ const title = props.t(!state2.writable ? "chrome.readOnly" : state2.saving ? "composer.saving" : "composer.scope");
1309
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dshAcComposer", title, children: [
1310
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dshAcComposerLabel", children: props.t("composer.label") }),
1311
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dshAcSwitchTarget", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1312
+ NativeSwitch,
1313
+ {
1314
+ checked: state2.enabled,
1315
+ onChange: props.setEnabled,
1316
+ disabled: !state2.writable || state2.saving,
1317
+ label: props.t("composer.label"),
1318
+ title
1319
+ }
1320
+ ) }),
1321
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dshAcComposerError", role: "status", children: state2.failed ? props.t("composer.saveFailed") : null })
1322
+ ] });
1913
1323
  }
1914
1324
 
1915
1325
  // src/client/index.ts
@@ -1947,8 +1357,20 @@ function mountSettings(ctx, scope) {
1947
1357
  ctx.effect(() => scope.subscribe(syncLocale), "auto-continue: locale settings sync");
1948
1358
  ctx.on("locale/change", syncLocale);
1949
1359
  syncLocale();
1950
- const controller = new AutoContinueSettingsCardController(scope);
1360
+ const controller = new AutoContinueSettingsCardController(scope, () => ctx.locale.getLocale().active);
1951
1361
  ctx.effect(() => () => controller.dispose(), "auto-continue: settings form");
1362
+ ctx.slots.inject(
1363
+ "conversation.input.left",
1364
+ () => ctx.slots.register(
1365
+ {
1366
+ name: "conversation.input.left",
1367
+ id: "auto-continue",
1368
+ locale: NS,
1369
+ inject: () => controller.injectComposer()
1370
+ },
1371
+ AutoContinueComposerToggle
1372
+ )
1373
+ );
1952
1374
  ctx.slots.inject(
1953
1375
  "settings.plugin.item",
1954
1376
  () => ctx.slots.register(