dsh-client-auto-continue 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +14 -11
- package/README.zh.md +10 -10
- package/docs/releases/v0.17.0.md +62 -0
- package/docs/screenshots/01-settings-section.png +0 -0
- package/docs/screenshots/01-settings-section.zh.png +0 -0
- package/docs/screenshots/02-settings-card.png +0 -0
- package/docs/screenshots/02-settings-card.zh.png +0 -0
- package/docs/screenshots/07-card-panels.png +0 -0
- package/docs/screenshots/07-card-panels.zh.png +0 -0
- package/docs/screenshots/08-composer-toggle.png +0 -0
- package/docs/screenshots/08-composer-toggle.zh.png +0 -0
- package/docs/screenshots/README.md +8 -8
- package/lib/client.js +381 -118
- package/lib/client.js.map +4 -4
- package/lib/types/client/auto-continue-icon.d.ts +1 -0
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/locales.d.ts +5 -8
- package/lib/types/client/mode-menu.d.ts +19 -0
- package/lib/types/client/native-toast.d.ts +17 -0
- package/lib/types/client/settings-card.d.ts +1 -1
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +4 -2
- package/src/client/auto-continue-icon.tsx +35 -0
- package/src/client/composer-toggle.tsx +58 -14
- package/src/client/index.ts +1 -1
- package/src/client/locales.ts +12 -18
- package/src/client/mode-menu.tsx +110 -0
- package/src/client/native-toast.tsx +44 -0
- package/src/client/settings-card.tsx +130 -24
- package/src/client/styles.ts +61 -40
package/lib/client.js
CHANGED
|
@@ -97,14 +97,6 @@ var ECHO_WINDOW_MS = 10 * 60 * 1e3;
|
|
|
97
97
|
|
|
98
98
|
// src/client/locales.ts
|
|
99
99
|
var zh = {
|
|
100
|
-
"card.title": "自动继续",
|
|
101
|
-
"card.description": "恢复意外中断的会话,按你的节奏继续。",
|
|
102
|
-
"repo.star": "觉得好用的话,点个 Star 吧",
|
|
103
|
-
"repo.note": "HsiangNianian 的开源插件,也欢迎反馈和 PR。",
|
|
104
|
-
"repo.link": "GitHub 仓库",
|
|
105
|
-
"repo.aria": "在新标签页打开 HsiangNianian/dsh-auto-continue 的 GitHub 仓库",
|
|
106
|
-
"chrome.enabled": "已启用",
|
|
107
|
-
"chrome.paused": "已暂停",
|
|
108
100
|
"chrome.saved": "所有更改已保存",
|
|
109
101
|
"notification.title": "自动继续设置",
|
|
110
102
|
"notification.enabled": "设置已保存,浏览器通知已开启。",
|
|
@@ -114,6 +106,9 @@ var zh = {
|
|
|
114
106
|
"notification.unsupported": "设置已保存,当前浏览器不支持通知。",
|
|
115
107
|
"notification.failed": "设置已保存,但浏览器通知未能发出。请检查网站和系统的通知权限。",
|
|
116
108
|
"chrome.categories": "设置类别",
|
|
109
|
+
"repo.star": "觉得好用的话,点个 Star 吧",
|
|
110
|
+
"repo.link": "GitHub 仓库",
|
|
111
|
+
"repo.aria": "在新标签页打开 HsiangNianian/dsh-auto-continue 的 GitHub 仓库",
|
|
117
112
|
"category.general.title": "常规",
|
|
118
113
|
"category.general.description": "控制自动继续的启停、显示和通知。",
|
|
119
114
|
"category.recovery.title": "重试策略",
|
|
@@ -127,9 +122,10 @@ var zh = {
|
|
|
127
122
|
"category.status.title": "状态与日志",
|
|
128
123
|
"category.status.description": "查看活动记录与暂停的会话。",
|
|
129
124
|
"field.paused": "全局启用自动继续",
|
|
130
|
-
"field.showComposerToggle": "
|
|
125
|
+
"field.showComposerToggle": "在会话区显示自动继续开关",
|
|
131
126
|
"field.showComposerToggleHint": "默认显示。隐藏控件不会改变会话模式;点击保存后生效。",
|
|
132
127
|
"composer.label": "自动继续",
|
|
128
|
+
"composer.mode": "自动继续模式",
|
|
133
129
|
"composer.scope": "只控制当前会话,立即保存并同步到其他标签页。关闭后也不再自动打断循环。",
|
|
134
130
|
"composer.default": "跟随默认",
|
|
135
131
|
"composer.off": "关闭",
|
|
@@ -238,6 +234,7 @@ var zh = {
|
|
|
238
234
|
"chrome.expand": "展开设置",
|
|
239
235
|
"chrome.unsaved": "未保存",
|
|
240
236
|
"chrome.readOnly": "当前部署的设置只读。",
|
|
237
|
+
"chrome.unavailable": "设置暂不可用。",
|
|
241
238
|
"chrome.saveFailed": "部署未接受这些值, 已保留供你修改。",
|
|
242
239
|
"chrome.discard": "放弃",
|
|
243
240
|
"chrome.saving": "保存中…",
|
|
@@ -250,14 +247,6 @@ var zh = {
|
|
|
250
247
|
"chrome.off": "关"
|
|
251
248
|
};
|
|
252
249
|
var en = {
|
|
253
|
-
"card.title": "Auto continue",
|
|
254
|
-
"card.description": "Resume interrupted sessions, at your pace.",
|
|
255
|
-
"repo.star": "Finding it useful? Leave a Star",
|
|
256
|
-
"repo.note": "By HsiangNianian. Feedback and PRs welcome.",
|
|
257
|
-
"repo.link": "GitHub repo",
|
|
258
|
-
"repo.aria": "Open HsiangNianian/dsh-auto-continue on GitHub in a new tab",
|
|
259
|
-
"chrome.enabled": "Enabled",
|
|
260
|
-
"chrome.paused": "Paused",
|
|
261
250
|
"chrome.saved": "All changes saved",
|
|
262
251
|
"notification.title": "Auto-continue settings",
|
|
263
252
|
"notification.enabled": "Settings saved. Browser notifications are on.",
|
|
@@ -267,6 +256,9 @@ var en = {
|
|
|
267
256
|
"notification.unsupported": "Settings saved. This browser does not support notifications.",
|
|
268
257
|
"notification.failed": "Settings saved, but the notification could not be sent. Check notification permissions for this site and your system.",
|
|
269
258
|
"chrome.categories": "Settings categories",
|
|
259
|
+
"repo.star": "Finding it useful? Leave a Star",
|
|
260
|
+
"repo.link": "GitHub repo",
|
|
261
|
+
"repo.aria": "Open HsiangNianian/dsh-auto-continue on GitHub in a new tab",
|
|
270
262
|
"category.general.title": "General",
|
|
271
263
|
"category.general.description": "Control automatic recovery, visibility, and notifications.",
|
|
272
264
|
"category.recovery.title": "Retry strategy",
|
|
@@ -280,9 +272,10 @@ var en = {
|
|
|
280
272
|
"category.status.title": "Status and logs",
|
|
281
273
|
"category.status.description": "View activity and paused sessions.",
|
|
282
274
|
"field.paused": "Enable auto-continue globally",
|
|
283
|
-
"field.showComposerToggle": "Show
|
|
275
|
+
"field.showComposerToggle": "Show auto-continue switch in the composer",
|
|
284
276
|
"field.showComposerToggleHint": "Shown by default. Hiding the control does not change session modes. Click Save to apply.",
|
|
285
277
|
"composer.label": "Auto-continue",
|
|
278
|
+
"composer.mode": "Auto-continue mode",
|
|
286
279
|
"composer.scope": "Only affects this session. Saved immediately and synced across tabs. Off also disables loop-guard interruptions here.",
|
|
287
280
|
"composer.default": "Follow default",
|
|
288
281
|
"composer.off": "Off",
|
|
@@ -391,6 +384,7 @@ var en = {
|
|
|
391
384
|
"chrome.expand": "Show settings",
|
|
392
385
|
"chrome.unsaved": "Unsaved",
|
|
393
386
|
"chrome.readOnly": "This deployment stores settings read-only.",
|
|
387
|
+
"chrome.unavailable": "Settings are unavailable.",
|
|
394
388
|
"chrome.saveFailed": "The deployment did not accept these values; they were left for you to correct.",
|
|
395
389
|
"chrome.discard": "Discard",
|
|
396
390
|
"chrome.saving": "Saving…",
|
|
@@ -807,16 +801,39 @@ var CardForm = class {
|
|
|
807
801
|
|
|
808
802
|
// src/client/styles.ts
|
|
809
803
|
var css = `
|
|
810
|
-
.dshAcComposer { display: inline-flex; align-items: center; flex-wrap: wrap; gap:
|
|
811
|
-
.
|
|
812
|
-
.
|
|
813
|
-
.
|
|
814
|
-
.
|
|
815
|
-
.
|
|
804
|
+
.dshAcComposer { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; min-height: 32px; max-width: 100%; font: inherit; }
|
|
805
|
+
.dshAcComposerCore { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
|
|
806
|
+
.dshAcComposerCore > span { min-width: 0; }
|
|
807
|
+
.dshAcModeTrigger { display: inline-flex; align-items: center; gap: 3px; min-width: 0; max-width: 132px; height: 28px; margin-left: -1px; padding: 0 4px 0 7px; border: 0; border-radius: var(--dsw-radius-sm, 6px); background: none; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; font-weight: 500; line-height: 20px; cursor: pointer; }
|
|
808
|
+
.dshAcModeTrigger:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
|
|
809
|
+
.dshAcModeTrigger:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); }
|
|
810
|
+
.dshAcModeTrigger:disabled { color: var(--dsw-alias-label-dimmed, var(--dsw-alias-label-tertiary)); cursor: default; }
|
|
811
|
+
.dshAcModeTriggerLabel { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
812
|
+
.dshAcModeChevron { display: inline-flex; flex: none; color: var(--dsw-alias-label-caption, var(--dsw-alias-label-tertiary)); transition: transform .12s ease; }
|
|
813
|
+
.dshAcModeChevron > svg { display: block; width: 14px; height: 14px; }
|
|
814
|
+
.dshAcModeChevronFallback { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
|
|
815
|
+
.dshAcModeChevron[data-open=true] { transform: rotate(180deg); }
|
|
816
|
+
.dshAcModeMenu { position: relative; display: inline-flex; align-items: center; gap: 3px; min-width: 0; max-width: 132px; height: 28px; margin-left: -1px; padding: 0 4px 0 7px; border-radius: var(--dsw-radius-sm, 6px); color: var(--dsw-alias-label-secondary); font-size: 13px; font-weight: 500; line-height: 20px; }
|
|
817
|
+
.dshAcModeMenu:hover:not([data-disabled=true]) { color: var(--dsw-alias-label-primary); background: var(--dsw-alias-interactive-bg-hover); }
|
|
818
|
+
.dshAcModeMenu[data-disabled=true] { color: var(--dsw-alias-label-dimmed, var(--dsw-alias-label-tertiary)); }
|
|
819
|
+
.dshAcComposerSelect { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); font: inherit; font-size: 12px; }
|
|
820
|
+
.dshAcComposerSelect:disabled { cursor: default; }
|
|
821
|
+
/* Settings-card select (default session mode); kept scoped so the composer's
|
|
822
|
+
invisible overlay cannot stretch it over the whole app. */
|
|
823
|
+
.dshAcCard .dshAcMode { min-height: 32px; max-width: 100%; padding: 4px 6px; border: 1px solid var(--dsh-ac-line); border-radius: 6px; background: var(--dsh-ac-bg); color: var(--dsh-ac-text); font: inherit; font-size: 12px; }
|
|
824
|
+
.dshAcCard .dshAcMode:disabled { opacity: .5; }
|
|
825
|
+
.dshAcCard .dshAcMode:focus-visible { outline: 2px solid var(--dsh-ac-text); outline-offset: 3px; }
|
|
826
|
+
.dshAcComposerLabel { display: inline-flex; align-items: center; gap: 5px; flex: none; color: var(--dsw-alias-label-secondary); font-size: 12px; white-space: nowrap; }
|
|
827
|
+
.dshAcComposerText { display: inline; }
|
|
828
|
+
.dshAcComposerIcon { display: inline-flex; flex: none; color: var(--dsw-alias-label-secondary); }
|
|
829
|
+
.dshAcComposerIcon > svg { display: block; width: 14px; height: 14px; }
|
|
830
|
+
.dshAcComposerIconFallback { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
|
|
831
|
+
.dshAcSwitchTarget { display: inline-flex; align-items: center; flex: none; min-height: 32px; }
|
|
816
832
|
.dshAcSwitchTarget > button { position: relative; }
|
|
817
833
|
.dshAcSwitchTarget > button::before { content: ''; position: absolute; inset: -6px -3px; }
|
|
818
834
|
.dshAcComposerError { color: var(--dsw-alias-state-error-primary, var(--dsw-alias-label-secondary)); font-size: 12px; max-width: 160px; }
|
|
819
835
|
.dshAcComposerError:empty { display: none; }
|
|
836
|
+
.dshAcToastIcon { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
|
|
820
837
|
.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; }
|
|
821
838
|
.dshAcSwitch[aria-checked='true'] { background: var(--dsw-alias-brand-primary); }
|
|
822
839
|
.dshAcSwitch > span { display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--dsw-alias-label-primary-foreground); }
|
|
@@ -843,27 +860,28 @@ var css = `
|
|
|
843
860
|
.dshAcCard button { cursor: pointer; }
|
|
844
861
|
.dshAcCard button:disabled { opacity: .4; cursor: default; }
|
|
845
862
|
.dshAcCard :is(a,button,input,textarea):focus-visible { outline: 2px solid var(--dsh-ac-text); outline-offset: 3px; }
|
|
846
|
-
.
|
|
847
|
-
.
|
|
848
|
-
.
|
|
849
|
-
.
|
|
850
|
-
.
|
|
851
|
-
.
|
|
852
|
-
.
|
|
853
|
-
.
|
|
854
|
-
.
|
|
855
|
-
.
|
|
856
|
-
.
|
|
857
|
-
.
|
|
858
|
-
.
|
|
859
|
-
.
|
|
860
|
-
.
|
|
861
|
-
.
|
|
862
|
-
.
|
|
863
|
-
.
|
|
864
|
-
.
|
|
863
|
+
.dshAcInvite { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 18px; color: var(--dsh-ac-muted); font-size: 12px; line-height: 1.6; }
|
|
864
|
+
.dshAcInviteStar { color: #e9be6d; font-size: 13px; line-height: 1; }
|
|
865
|
+
.dshAcRepoLink { display: inline-flex; align-items: center; gap: 5px; color: var(--dsh-ac-text); text-decoration: none; }
|
|
866
|
+
.dshAcRepoLink:hover { text-decoration: underline; }
|
|
867
|
+
.dshAcRepoLink > svg:first-child { width: 14px; height: 14px; fill: currentColor; }
|
|
868
|
+
.dshAcRepoLink > svg.dshAcExternal { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
|
|
869
|
+
.dshAcNativeFields { display: flex; flex-direction: column; min-width: 0; }
|
|
870
|
+
.dshAcNativeField { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 12px 0; }
|
|
871
|
+
.dshAcNativeHead { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
|
|
872
|
+
.dshAcNativeLabel { color: var(--dsh-ac-text); font-size: 13px; font-weight: 500; line-height: 19.5px; }
|
|
873
|
+
.dshAcNativeHint { color: var(--dsh-ac-muted); font-size: 12px; line-height: 18px; }
|
|
874
|
+
.dshAcNativeToggleRow { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; }
|
|
875
|
+
.dshAcNativeActions { display: inline-flex; align-items: center; flex: none; gap: 10px; }
|
|
876
|
+
.dshAcNativeReset { padding: 0; border: 0; background: none; color: var(--dsh-ac-muted); font-size: 11px; white-space: nowrap; }
|
|
877
|
+
.dshAcNativeReset:hover:not(:disabled) { color: var(--dsh-ac-text); text-decoration: underline; }
|
|
878
|
+
.dshAcNativeSegment { display: block; min-width: 0; }
|
|
879
|
+
.dshAcNativeSegment[data-disabled=true] { opacity: .5; pointer-events: none; }
|
|
880
|
+
.dshAcNativeTextarea { box-sizing: border-box; width: 100%; min-height: 66px; resize: vertical; padding: 8px 12px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 12px; background: var(--dsw-alias-bg-layer-2, #353638); color: var(--dsh-ac-text); font: inherit; font-size: 13px; line-height: 19.5px; }
|
|
881
|
+
.dshAcNativeTextarea::placeholder { color: var(--dsh-ac-muted); opacity: .7; }
|
|
882
|
+
.dshAcNativeTextarea[aria-invalid=true] { border-color: var(--dsw-alias-state-error-primary); }
|
|
865
883
|
.dshAcReadOnly { padding: 10px 0; color: var(--dsh-ac-muted); }
|
|
866
|
-
.dshAcLayout { display: grid; grid-template-columns: 164px minmax(0, 1fr);
|
|
884
|
+
.dshAcLayout { display: grid; grid-template-columns: 164px minmax(0, 1fr); min-height: 462px; }
|
|
867
885
|
.dshAcNav { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px 16px 0; position: sticky; top: 16px; align-self: start; }
|
|
868
886
|
.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); }
|
|
869
887
|
.dshAcNav > button:hover, .dshAcNav > button[aria-selected=true] { color: var(--dsh-ac-text); background: var(--dsw-alias-interactive-bg-hover); }
|
|
@@ -910,9 +928,6 @@ var css = `
|
|
|
910
928
|
.dshAcPauseId { flex: 1; font: 12px ui-monospace, SFMono-Regular, monospace; }
|
|
911
929
|
.dshAcRecovery { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
|
|
912
930
|
@container auto-continue-settings (max-width: 760px) {
|
|
913
|
-
.dshAcHeaderFrame { grid-template-columns: minmax(0, 1fr) auto; gap: 16px; }
|
|
914
|
-
.dshAcRepositoryCopy { display: none; }
|
|
915
|
-
.dshAcRepository { gap: 10px; }
|
|
916
931
|
.dshAcLayout { grid-template-columns: 136px minmax(0, 1fr); }
|
|
917
932
|
.dshAcCategory { padding-left: 20px; }
|
|
918
933
|
.dshAcFieldControl { flex-direction: column-reverse; align-items: flex-end; gap: 6px; }
|
|
@@ -928,18 +943,18 @@ var css = `
|
|
|
928
943
|
.dshAcFooter { align-items: flex-start; flex-direction: column; gap: 10px; }
|
|
929
944
|
.dshAcFooter > div { width: 100%; justify-content: flex-end; }
|
|
930
945
|
}
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
.
|
|
936
|
-
.
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
.
|
|
940
|
-
.
|
|
946
|
+
/* Match the composer's own pickers (permission/mode) instead of the viewport:
|
|
947
|
+
the nearest query container is the composer row, so the label collapses at
|
|
948
|
+
the same 460px threshold as the native permission picker. */
|
|
949
|
+
@container (width <= 640px) {
|
|
950
|
+
.dshAcComposerCore { gap: 5px; }
|
|
951
|
+
.dshAcModeTrigger, .dshAcModeMenu { max-width: 104px; padding: 0 3px 0 6px; }
|
|
952
|
+
}
|
|
953
|
+
@container (width <= 460px) {
|
|
954
|
+
.dshAcComposerText { display: none; }
|
|
955
|
+
.dshAcModeTrigger, .dshAcModeMenu { max-width: 28px; padding: 0 2px; }
|
|
956
|
+
.dshAcModeTriggerLabel { display: none; }
|
|
941
957
|
}
|
|
942
|
-
@media (prefers-reduced-motion: reduce) { .dshAcCard a.dshAcGithub { transition: none; } }
|
|
943
958
|
|
|
944
959
|
`;
|
|
945
960
|
function injectStyles() {
|
|
@@ -992,6 +1007,17 @@ function showSettingsNotification(notice, locale, permission) {
|
|
|
992
1007
|
// src/client/settings-card.tsx
|
|
993
1008
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
994
1009
|
injectStyles();
|
|
1010
|
+
var nativeSettings = (() => {
|
|
1011
|
+
try {
|
|
1012
|
+
return require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1013
|
+
} catch {
|
|
1014
|
+
return {};
|
|
1015
|
+
}
|
|
1016
|
+
})();
|
|
1017
|
+
var NativeSettingsForm = nativeSettings.SettingsForm;
|
|
1018
|
+
var NativeValueField = nativeSettings.SettingsValueField;
|
|
1019
|
+
var NativeSegmentedControl = nativeSettings.SegmentedControl;
|
|
1020
|
+
var hasNativeSettings = typeof NativeSettingsForm === "function" && typeof NativeValueField === "function";
|
|
995
1021
|
var AutoContinueSettingsCardController = class {
|
|
996
1022
|
/**
|
|
997
1023
|
* @param scope - the bound settings scope for the `auto-continue` namespace.
|
|
@@ -1140,7 +1166,6 @@ var AutoContinueSettingsCardController = class {
|
|
|
1140
1166
|
function AutoContinueSettingsPage(props) {
|
|
1141
1167
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { style: { listStyle: "none", margin: 0, padding: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AutoContinueSettingsCard, { ...props }) });
|
|
1142
1168
|
}
|
|
1143
|
-
var REPOSITORY_URL = "https://github.com/HsiangNianian/dsh-auto-continue";
|
|
1144
1169
|
var groups = [
|
|
1145
1170
|
{ id: "general", fields: ["paused", "showComposerToggle", "resumeSilentTurns", "resumeCompletedTurns", "notify"] },
|
|
1146
1171
|
{ id: "recovery", fields: ["graceMs", "cooldownMs", "maxConsecutive", "classify", "retryableErrorPatterns", "backoffFactor", "backoffMaxMs"] },
|
|
@@ -1159,20 +1184,14 @@ var textDefaults = {
|
|
|
1159
1184
|
guardDoneText: "default.guardDoneText",
|
|
1160
1185
|
loopText: "default.loopText"
|
|
1161
1186
|
};
|
|
1162
|
-
|
|
1163
|
-
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" }) });
|
|
1164
|
-
}
|
|
1187
|
+
var REPOSITORY_URL = "https://github.com/HsiangNianian/dsh-auto-continue";
|
|
1165
1188
|
function RepositoryInvite({ t }) {
|
|
1166
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("
|
|
1167
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "
|
|
1168
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
1169
|
-
|
|
1170
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("
|
|
1171
|
-
|
|
1172
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("a", { className: "dshAcGithub", href: REPOSITORY_URL, target: "_blank", rel: "noopener noreferrer", "aria-label": t("repo.aria"), children: [
|
|
1173
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(GitHubMark, {}),
|
|
1174
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcGithubLong", children: t("repo.link") }),
|
|
1175
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcGithubShort", children: "GitHub" }),
|
|
1189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "dshAcInvite", children: [
|
|
1190
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcInviteStar", "aria-hidden": "true", children: "★" }),
|
|
1191
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("repo.star") }),
|
|
1192
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("a", { className: "dshAcRepoLink", href: REPOSITORY_URL, target: "_blank", rel: "noopener noreferrer", "aria-label": t("repo.aria"), children: [
|
|
1193
|
+
/* @__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" }) }),
|
|
1194
|
+
t("repo.link"),
|
|
1176
1195
|
/* @__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" }) })
|
|
1177
1196
|
] })
|
|
1178
1197
|
] });
|
|
@@ -1221,6 +1240,92 @@ function SettingField({ name, id, state: state2, actions, disabled, t }) {
|
|
|
1221
1240
|
] })
|
|
1222
1241
|
] });
|
|
1223
1242
|
}
|
|
1243
|
+
function NativeSettingField({ name, id, state: state2, actions, disabled, t }) {
|
|
1244
|
+
const boolean = typeof DEFAULT_CONFIG[name] === "boolean";
|
|
1245
|
+
const numeric = typeof DEFAULT_CONFIG[name] === "number";
|
|
1246
|
+
const label = t(`field.${name}`);
|
|
1247
|
+
const hint = t(`field.${name}Hint`);
|
|
1248
|
+
const value = state2.text === "" ? DEFAULT_CONFIG[name] : state2.text === "true";
|
|
1249
|
+
const placeholderKey = textDefaults[name];
|
|
1250
|
+
const placeholder = placeholderKey ? t(placeholderKey) : name === "retryableErrorPatterns" ? t("field.retryableErrorPatternsPlaceholder") : String(DEFAULT_CONFIG[name]);
|
|
1251
|
+
const reset = state2.overridden ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "dshAcNativeReset", disabled, "aria-label": `${t("chrome.reset")}: ${label}`, onClick: () => actions.resetField(name), children: t("chrome.reset") }) : null;
|
|
1252
|
+
if (name === "resumeCompletedTurns") {
|
|
1253
|
+
const items = [{ value: "false", label: t("composer.recover") }, { value: "true", label: t("composer.loop") }];
|
|
1254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcNativeField", "data-field": name, children: [
|
|
1255
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcNativeHead", children: [
|
|
1256
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: "dshAcNativeLabel", htmlFor: id, children: label }),
|
|
1257
|
+
reset
|
|
1258
|
+
] }),
|
|
1259
|
+
NativeSegmentedControl ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NativeSegmentedControl, { id, options: items, value: value ? "true" : "false", onChange: (next) => actions.edit(name, next), label, disabled }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("select", { id, className: "dshAcMode", "aria-label": label, disabled, value: String(value), onChange: (event) => actions.edit(name, event.target.value), children: [
|
|
1260
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "false", children: t("composer.recover") }),
|
|
1261
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "true", children: t("composer.loop") })
|
|
1262
|
+
] }),
|
|
1263
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dshAcNativeHint", id: `${id}-hint`, children: hint })
|
|
1264
|
+
] });
|
|
1265
|
+
}
|
|
1266
|
+
if (boolean) {
|
|
1267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcNativeField", "data-field": name, children: [
|
|
1268
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcNativeToggleRow", children: [
|
|
1269
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: "dshAcNativeLabel", htmlFor: id, children: label }),
|
|
1270
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dshAcNativeActions", children: [
|
|
1271
|
+
reset,
|
|
1272
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1273
|
+
NativeSwitch,
|
|
1274
|
+
{
|
|
1275
|
+
label,
|
|
1276
|
+
title: hint,
|
|
1277
|
+
disabled,
|
|
1278
|
+
checked: name === "paused" ? !value : Boolean(value),
|
|
1279
|
+
onChange: (checked) => actions.edit(name, String(name === "paused" ? !checked : checked))
|
|
1280
|
+
}
|
|
1281
|
+
)
|
|
1282
|
+
] })
|
|
1283
|
+
] }),
|
|
1284
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dshAcNativeHint", id: `${id}-hint`, children: hint })
|
|
1285
|
+
] });
|
|
1286
|
+
}
|
|
1287
|
+
if (numeric) {
|
|
1288
|
+
const ValueField = NativeValueField;
|
|
1289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1290
|
+
ValueField,
|
|
1291
|
+
{
|
|
1292
|
+
id,
|
|
1293
|
+
label,
|
|
1294
|
+
hint,
|
|
1295
|
+
overriddenLabel: t("chrome.overridden"),
|
|
1296
|
+
resetLabel: t("chrome.reset"),
|
|
1297
|
+
invalidLabel: t("chrome.invalidNumber"),
|
|
1298
|
+
disabled,
|
|
1299
|
+
numeric: true,
|
|
1300
|
+
...state2,
|
|
1301
|
+
placeholder,
|
|
1302
|
+
onEdit: (text) => actions.edit(name, text),
|
|
1303
|
+
onReset: () => actions.resetField(name)
|
|
1304
|
+
}
|
|
1305
|
+
);
|
|
1306
|
+
}
|
|
1307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcNativeField", "data-field": name, children: [
|
|
1308
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcNativeHead", children: [
|
|
1309
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: "dshAcNativeLabel", htmlFor: id, children: label }),
|
|
1310
|
+
reset
|
|
1311
|
+
] }),
|
|
1312
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1313
|
+
"textarea",
|
|
1314
|
+
{
|
|
1315
|
+
id,
|
|
1316
|
+
className: "dshAcNativeTextarea",
|
|
1317
|
+
rows: name === "retryableErrorPatterns" ? 3 : 2,
|
|
1318
|
+
disabled,
|
|
1319
|
+
value: state2.text,
|
|
1320
|
+
placeholder,
|
|
1321
|
+
"aria-invalid": state2.invalid || void 0,
|
|
1322
|
+
"aria-describedby": `${id}-hint`,
|
|
1323
|
+
onChange: (event) => actions.edit(name, event.target.value)
|
|
1324
|
+
}
|
|
1325
|
+
),
|
|
1326
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dshAcNativeHint", id: `${id}-hint`, children: state2.invalid ? t("chrome.invalidNumber") : hint })
|
|
1327
|
+
] });
|
|
1328
|
+
}
|
|
1224
1329
|
function LivePanels(props) {
|
|
1225
1330
|
const { t } = props;
|
|
1226
1331
|
const [, refresh] = (0, import_react.useState)(0);
|
|
@@ -1369,19 +1474,11 @@ function AutoContinueSettingsCard(props) {
|
|
|
1369
1474
|
const [active, setActive] = (0, import_react.useState)("general");
|
|
1370
1475
|
const prefix = (0, import_react.useId)();
|
|
1371
1476
|
const group = groups.find((item) => item.id === active);
|
|
1477
|
+
const native = hasNativeSettings;
|
|
1372
1478
|
if (!state2.available) return null;
|
|
1373
1479
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("li", { className: "dshAcCard", children: [
|
|
1374
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
1375
|
-
|
|
1376
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcTitleLine", children: [
|
|
1377
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: t("card.title") }),
|
|
1378
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcStatus", children: t(state2.enabled ? "chrome.enabled" : "chrome.paused") })
|
|
1379
|
-
] }),
|
|
1380
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: t("card.description") })
|
|
1381
|
-
] }),
|
|
1382
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RepositoryInvite, { t })
|
|
1383
|
-
] }),
|
|
1384
|
-
!state2.writable && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dshAcReadOnly", role: "status", children: t("chrome.readOnly") }),
|
|
1480
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RepositoryInvite, { t }),
|
|
1481
|
+
!native && !state2.writable && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dshAcReadOnly", role: "status", children: t("chrome.readOnly") }),
|
|
1385
1482
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcLayout", children: [
|
|
1386
1483
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dshAcNav", role: "tablist", "aria-label": t("chrome.categories"), children: groups.map((item, index) => {
|
|
1387
1484
|
const invalid = item.fields.some((name) => state2[name].invalid);
|
|
@@ -1421,54 +1518,220 @@ function AutoContinueSettingsCard(props) {
|
|
|
1421
1518
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: t(`category.${active}.title`) }),
|
|
1422
1519
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: t(`category.${active}.description`) })
|
|
1423
1520
|
] }),
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1521
|
+
native ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NativeSettingsForm, { labels: {
|
|
1522
|
+
save: t("chrome.save"),
|
|
1523
|
+
saving: t("chrome.saving"),
|
|
1524
|
+
saveFailed: t("chrome.saveFailed"),
|
|
1525
|
+
readOnly: t("chrome.readOnly"),
|
|
1526
|
+
unavailable: t("chrome.unavailable")
|
|
1527
|
+
}, state: state2, onSave: props.save, onDiscard: props.discard, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcNativeFields", children: [
|
|
1528
|
+
group.fields.map((name) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NativeSettingField, { name, id: `${prefix}-${name}`, state: state2[name], actions: props, disabled: !state2.writable, t }, name)),
|
|
1529
|
+
active === "status" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LivePanels, { t })
|
|
1530
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1531
|
+
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)),
|
|
1532
|
+
active === "status" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LivePanels, { t }),
|
|
1533
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("footer", { className: "dshAcFooter", "data-dirty": state2.dirty, children: [
|
|
1534
|
+
/* @__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") }),
|
|
1535
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
1536
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "dshAcDiscard", disabled: !state2.dirty || state2.saving, onClick: props.discard, children: t("chrome.discard") }),
|
|
1537
|
+
/* @__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") })
|
|
1538
|
+
] })
|
|
1539
|
+
] })
|
|
1540
|
+
] })
|
|
1433
1541
|
] })
|
|
1434
1542
|
] })
|
|
1435
1543
|
] });
|
|
1436
1544
|
}
|
|
1437
1545
|
|
|
1438
1546
|
// src/client/composer-toggle.tsx
|
|
1547
|
+
var import_react3 = require("react");
|
|
1548
|
+
|
|
1549
|
+
// src/client/mode-menu.tsx
|
|
1550
|
+
var import_react2 = require("react");
|
|
1439
1551
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1552
|
+
var primitives = (() => {
|
|
1553
|
+
try {
|
|
1554
|
+
return require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1555
|
+
} catch {
|
|
1556
|
+
return {};
|
|
1557
|
+
}
|
|
1558
|
+
})();
|
|
1559
|
+
var HostMenu = primitives.Menu;
|
|
1560
|
+
var HostChevron = primitives.IconChevronDownOutlineRegular;
|
|
1561
|
+
function ChevronDown() {
|
|
1562
|
+
if (HostChevron) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HostChevron, {});
|
|
1563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { className: "dshAcModeChevronFallback", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m4.5 6.25 3.5 3.5 3.5-3.5" }) });
|
|
1564
|
+
}
|
|
1565
|
+
function ModeMenu(props) {
|
|
1566
|
+
const [open, setOpen] = (0, import_react2.useState)(false);
|
|
1567
|
+
const expanded = open && !props.disabled;
|
|
1568
|
+
(0, import_react2.useEffect)(() => {
|
|
1569
|
+
if (props.disabled) setOpen(false);
|
|
1570
|
+
}, [props.disabled]);
|
|
1571
|
+
const choose = (id) => {
|
|
1572
|
+
setOpen(false);
|
|
1573
|
+
if (isSessionMode(id) && id !== props.mode) props.onChange(id);
|
|
1574
|
+
};
|
|
1575
|
+
if (HostMenu) {
|
|
1576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1577
|
+
HostMenu,
|
|
1578
|
+
{
|
|
1579
|
+
open: expanded,
|
|
1580
|
+
side: "top",
|
|
1581
|
+
portal: true,
|
|
1582
|
+
items: props.options,
|
|
1583
|
+
selectedId: props.mode,
|
|
1584
|
+
onSelect: choose,
|
|
1585
|
+
onClose: () => setOpen(false),
|
|
1586
|
+
anchor: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1587
|
+
"button",
|
|
1588
|
+
{
|
|
1589
|
+
type: "button",
|
|
1590
|
+
className: "dshAcModeTrigger",
|
|
1591
|
+
disabled: props.disabled,
|
|
1592
|
+
"aria-label": props.ariaLabel,
|
|
1593
|
+
"aria-haspopup": "menu",
|
|
1594
|
+
"aria-expanded": expanded,
|
|
1595
|
+
title: props.title,
|
|
1596
|
+
onClick: () => setOpen((value) => !value),
|
|
1597
|
+
children: [
|
|
1598
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dshAcModeTriggerLabel", children: props.label }),
|
|
1599
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dshAcModeChevron", "data-open": expanded, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronDown, {}) })
|
|
1600
|
+
]
|
|
1601
|
+
}
|
|
1602
|
+
)
|
|
1603
|
+
}
|
|
1604
|
+
);
|
|
1605
|
+
}
|
|
1606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "dshAcModeMenu", "data-disabled": props.disabled, title: props.title, children: [
|
|
1607
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dshAcModeTriggerLabel", children: props.label }),
|
|
1608
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dshAcModeChevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronDown, {}) }),
|
|
1609
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1610
|
+
"select",
|
|
1611
|
+
{
|
|
1612
|
+
className: "dshAcComposerSelect",
|
|
1613
|
+
"aria-label": props.selectLabel,
|
|
1614
|
+
disabled: props.disabled,
|
|
1615
|
+
value: props.mode,
|
|
1616
|
+
onChange: (event) => {
|
|
1617
|
+
if (isSessionMode(event.target.value)) props.onChange(event.target.value);
|
|
1618
|
+
},
|
|
1619
|
+
children: props.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: option.id, children: option.label }, option.id))
|
|
1620
|
+
}
|
|
1621
|
+
)
|
|
1622
|
+
] });
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
// src/client/auto-continue-icon.tsx
|
|
1626
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1627
|
+
var primitives2 = (() => {
|
|
1628
|
+
try {
|
|
1629
|
+
return require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1630
|
+
} catch {
|
|
1631
|
+
return {};
|
|
1632
|
+
}
|
|
1633
|
+
})();
|
|
1634
|
+
var HostRefresh = primitives2.IconRefreshOutlineRegular;
|
|
1635
|
+
function AutoContinueIcon() {
|
|
1636
|
+
if (HostRefresh) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(HostRefresh, {});
|
|
1637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { className: "dshAcComposerIconFallback", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M13.25 8a5.25 5.25 0 1 1-1.54-3.71" }),
|
|
1639
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M13.25 3.1v3.3h-3.3" })
|
|
1640
|
+
] });
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
// src/client/native-toast.tsx
|
|
1644
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1645
|
+
var primitives3 = (() => {
|
|
1646
|
+
try {
|
|
1647
|
+
return require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1648
|
+
} catch {
|
|
1649
|
+
return {};
|
|
1650
|
+
}
|
|
1651
|
+
})();
|
|
1652
|
+
var NativeToast = primitives3.Toast;
|
|
1653
|
+
var hasNativeToast = typeof NativeToast === "function";
|
|
1654
|
+
function WarningIcon() {
|
|
1655
|
+
const Icon = primitives3.IconWarningOutlineRegular;
|
|
1656
|
+
if (Icon) return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, {});
|
|
1657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("svg", { className: "dshAcToastIcon", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
|
|
1658
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M8 2.3 14.3 13H1.7L8 2.3Z" }),
|
|
1659
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M8 6.2v3.1M8 11.8v.1" })
|
|
1660
|
+
] });
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
// src/client/composer-toggle.tsx
|
|
1664
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1665
|
+
var HOST_UNAVAILABLE_DELAY_MS = 3e3;
|
|
1666
|
+
function HostUnavailableToast({ text }) {
|
|
1667
|
+
const [visible, setVisible] = (0, import_react3.useState)(false);
|
|
1668
|
+
(0, import_react3.useEffect)(() => {
|
|
1669
|
+
const timer = setTimeout(() => setVisible(true), HOST_UNAVAILABLE_DELAY_MS);
|
|
1670
|
+
return () => clearTimeout(timer);
|
|
1671
|
+
}, []);
|
|
1672
|
+
if (!hasNativeToast || !visible) return null;
|
|
1673
|
+
const Toast = NativeToast;
|
|
1674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Toast, { text, icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(WarningIcon, {}), onDone: () => setVisible(false) });
|
|
1675
|
+
}
|
|
1676
|
+
function SaveFailureToast({ text }) {
|
|
1677
|
+
const [visible, setVisible] = (0, import_react3.useState)(true);
|
|
1678
|
+
if (!hasNativeToast || !visible) return null;
|
|
1679
|
+
const Toast = NativeToast;
|
|
1680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Toast, { text, icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(WarningIcon, {}), onDone: () => setVisible(false) });
|
|
1681
|
+
}
|
|
1440
1682
|
function AutoContinueComposerToggle(props) {
|
|
1441
1683
|
const state2 = props.useAutoContinueComposer((snapshot) => snapshot);
|
|
1442
1684
|
if (!state2.visible || !props.sessionId) return null;
|
|
1685
|
+
const failed = state2.failed.has(props.sessionId);
|
|
1443
1686
|
const saving = state2.saving.has(props.sessionId);
|
|
1444
1687
|
const policy = state2.policy;
|
|
1688
|
+
const mode = sessionMode(policy?.modes ?? {}, props.sessionId);
|
|
1689
|
+
const disabled = !policy || !state2.writable || saving;
|
|
1445
1690
|
const title = props.t(!policy ? "composer.unavailable" : !state2.writable ? "chrome.readOnly" : saving ? "composer.saving" : "composer.scope");
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
children:
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1691
|
+
const modeName = props.t(`composer.${mode}`);
|
|
1692
|
+
const defaultName = policy ? `${props.t("composer.default")} (${props.t(`composer.${policy.defaultMode}`)})` : props.t("composer.default");
|
|
1693
|
+
const fullModeLabel = mode === "default" ? defaultName : modeName;
|
|
1694
|
+
const modeTitle = `${props.t("composer.mode")}: ${fullModeLabel}`;
|
|
1695
|
+
const options = [
|
|
1696
|
+
{ id: "default", label: defaultName },
|
|
1697
|
+
{ id: "off", label: props.t("composer.off") },
|
|
1698
|
+
{ id: "recover", label: props.t("composer.recover") },
|
|
1699
|
+
{ id: "loop", label: props.t("composer.loop") }
|
|
1700
|
+
];
|
|
1701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "dshAcComposer", title, "aria-busy": saving || void 0, children: [
|
|
1702
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "dshAcComposerCore", children: [
|
|
1703
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "dshAcComposerLabel", children: [
|
|
1704
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "dshAcComposerIcon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AutoContinueIcon, {}) }),
|
|
1705
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "dshAcComposerText", children: props.t("composer.label") })
|
|
1706
|
+
] }),
|
|
1707
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "dshAcSwitchTarget", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1708
|
+
NativeSwitch,
|
|
1709
|
+
{
|
|
1710
|
+
checked: !!policy && mode !== "off",
|
|
1711
|
+
onChange: (enabled) => props.setMode(enabled ? "default" : "off"),
|
|
1712
|
+
disabled,
|
|
1713
|
+
label: props.t("composer.label"),
|
|
1714
|
+
title
|
|
1715
|
+
}
|
|
1716
|
+
) }),
|
|
1717
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1718
|
+
ModeMenu,
|
|
1719
|
+
{
|
|
1720
|
+
mode,
|
|
1721
|
+
options,
|
|
1722
|
+
label: modeName,
|
|
1723
|
+
ariaLabel: modeTitle,
|
|
1724
|
+
selectLabel: props.t("composer.mode"),
|
|
1725
|
+
title: modeTitle,
|
|
1726
|
+
disabled,
|
|
1727
|
+
onChange: props.setMode
|
|
1728
|
+
}
|
|
1729
|
+
)
|
|
1730
|
+
] }),
|
|
1731
|
+
policy?.paused && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "dshAcComposerLabel", children: props.t("composer.paused") }),
|
|
1732
|
+
!policy && hasNativeToast && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HostUnavailableToast, { text: props.t("composer.unavailable") }),
|
|
1733
|
+
failed && hasNativeToast && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SaveFailureToast, { text: props.t("composer.saveFailed") }),
|
|
1734
|
+
failed && !hasNativeToast && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "dshAcComposerError", role: "status", children: props.t("composer.saveFailed") })
|
|
1472
1735
|
] });
|
|
1473
1736
|
}
|
|
1474
1737
|
|