@restregular/dsh-powerup 0.18.0 → 0.19.1
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/README.md +36 -25
- package/client.js +487 -194
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -457,34 +457,45 @@ freely modify, and generation/refresh uses the full box text verbatim. The panel
|
|
|
457
457
|
also has a **New requirement** entry with a modal: pick the workspace (or "all
|
|
458
458
|
workspaces") there, and clicks inside the modal no longer close the progress
|
|
459
459
|
panel.
|
|
460
|
-
The panel uses **tabs** below the header: **Progress**, **
|
|
461
|
-
**Raw output** — requirements and the raw AI text are
|
|
462
|
-
progress body.
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
460
|
+
The panel uses **tabs** below the header: **Progress**, **Refresh progress**
|
|
461
|
+
(the requirements box) and **Raw output** — requirements and the raw AI text are
|
|
462
|
+
no longer embedded in the progress body. The header also carries the **same
|
|
463
|
+
model selector as the composer**: changing the model here changes the one used
|
|
464
|
+
for the next progress call. Stage cards (checklist steps, phases, milestones
|
|
465
|
+
and tree nodes) are **collapsible** by clicking anywhere on their row. The panel
|
|
466
|
+
is wider by default, resizable from its bottom-right corner (size persisted),
|
|
467
|
+
and its header tint shifts from blue toward warning red as the report ages.
|
|
468
|
+
Every refresh adds a new report to a per-session history stored on disk; older
|
|
469
|
+
reports stay browsable and are never discarded. The panel can clear the history
|
|
470
|
+
explicitly. The **Refresh** button lives in the "Refresh progress" tab beside
|
|
471
|
+
"New requirement"; while a call runs it becomes **Cancel**, and the panel
|
|
472
|
+
returns to the Progress tab when it settles. A configurable **cooldown**
|
|
473
|
+
(default 5 seconds, set on the Power-Up page) prevents accidental repeat
|
|
474
|
+
refreshes.
|
|
469
475
|
|
|
470
476
|
### Direct ask (no Agent)
|
|
471
477
|
|
|
472
|
-
An **icon-only** lightning button in the composer
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
478
|
+
An **icon-only** lightning button in the composer toggles a fixed, DSH-styled
|
|
479
|
+
light Q&A panel. The panel is pinned directly above the **real composer** — same
|
|
480
|
+
width, centred on the same vertical axis — and is **not draggable or resizable**:
|
|
481
|
+
as the composer grows while typing, only the panel height changes, so it never
|
|
482
|
+
drifts out of alignment. While it is open, other plugins' composer controls are
|
|
483
|
+
hidden and the rest of the conversation is covered: you see only the light Q&A
|
|
484
|
+
panel and the original input box. That box is **reused in full** — text drafting,
|
|
485
|
+
the file "+" picker, command insertion, permission dropdown, model selector and
|
|
486
|
+
the send button all work as usual, but their effects are scoped to the Q&A only:
|
|
487
|
+
sending answers here (never writes to the session), picked files become Q&A
|
|
488
|
+
context, permissions are inert, and the chosen model drives the answer. The
|
|
489
|
+
composer is snapshotted on open and **restored exactly** on close, including its
|
|
490
|
+
draft and attachments. It supports **continuous multi-turn Q&A** with **Chat**
|
|
491
|
+
and **History** tabs. History is stored per **conversation**, each with an
|
|
492
|
+
inline-editable title; a settings toggle can generate that title from the first
|
|
493
|
+
message via one tiny, token-capped request. Messages appear immediately as
|
|
494
|
+
pending bubbles; answers are **rendered as Markdown**; failures render inline.
|
|
495
|
+
Prior turns are flattened into a single user message per call, avoiding the
|
|
496
|
+
"LLM_FAILED" error on the second message. "+" starts a new chat. This is
|
|
497
|
+
deliberately **not an Agent**: it uses a single `llm.prepareCall` + stream call
|
|
498
|
+
per turn with a short
|
|
488
499
|
instruction, so no system prompt sections, tools, skills, memory or background
|
|
489
500
|
jobs are involved, and nothing is written to the session log. Toggle it off on
|
|
490
501
|
the Power-Up page if you don't want the button.
|
package/client.js
CHANGED
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
const requirementCreateDraft = { workspaceId: null, title: '', text: '', scope: 'current' };
|
|
86
86
|
/** Fallback bucket when the hero cannot resolve an owning workspace yet. */
|
|
87
87
|
const UNSCOPED_WORKSPACE = '__unscoped__';
|
|
88
|
-
const VERSION = '0.
|
|
88
|
+
const VERSION = '0.19.1';
|
|
89
89
|
const MENU_GAP = 8;
|
|
90
90
|
const MENU_WIDTH = 248;
|
|
91
91
|
/** Reference scheme understood by the Host's `powerup_step_read` tool. */
|
|
@@ -361,14 +361,19 @@
|
|
|
361
361
|
'update.unsupportedTitle': '无法自动安装',
|
|
362
362
|
'page.taskProgressTitle': '任务进度速览',
|
|
363
363
|
'page.taskProgressDesc': '在会话顶部加一个「进度」按钮,点击后用当前会话的模型在后台分析会话记录,生成结构化的任务进度并用浮层展示。调用在旁路进行,不写入会话、不打断正在运行的任务;模型会按任务类型选择清单、阶段、里程碑或任务树,并可补充一段直接渲染给用户看的内容。',
|
|
364
|
-
'page.taskProgressHow': '
|
|
364
|
+
'page.taskProgressHow': '在任意会话顶部点击「进度」按钮,面板会显示最近一次结果;首次使用切到「刷新进度」标签页点「刷新进度」。生成期间可继续正常操作会话。',
|
|
365
|
+
'page.taskProgressCooldown': '刷新冷却(秒)',
|
|
366
|
+
'page.taskProgressCooldownHint': '两次刷新之间的最短间隔,防止误触;设为 0 表示不限制。',
|
|
365
367
|
'progress.title': '任务进度',
|
|
366
368
|
'progress.label': '进度',
|
|
367
369
|
'progress.subtitle': '由当前会话模型在后台生成',
|
|
368
|
-
'progress.
|
|
370
|
+
'progress.modelChanging': '正在切换模型…',
|
|
371
|
+
'progress.hint': '还没有进度报告,切到「刷新进度」标签页开始分析。',
|
|
369
372
|
'progress.empty': '还没有生成过进度报告。',
|
|
370
|
-
'progress.generate': '生成进度',
|
|
371
373
|
'progress.refresh': '刷新进度',
|
|
374
|
+
'progress.tabRefresh': '刷新进度',
|
|
375
|
+
'progress.cancel': '取消',
|
|
376
|
+
'progress.refreshCooldown': '请等待 {seconds} 秒后再刷新',
|
|
372
377
|
'progress.retry': '重试',
|
|
373
378
|
'progress.loading': '正在后台分析会话进度…',
|
|
374
379
|
'progress.close': '关闭',
|
|
@@ -429,7 +434,7 @@
|
|
|
429
434
|
'directAsk.copied': '已复制',
|
|
430
435
|
'directAsk.close': '关闭',
|
|
431
436
|
'directAsk.hide': '隐藏弹窗',
|
|
432
|
-
'directAsk.showHint': '
|
|
437
|
+
'directAsk.showHint': '在下方原始输入框中直接输入问题并发送;可继续追问,点「+」开启新对话,点「◷」查看历史。发送只作用于轻量问答,不会写入当前会话。',
|
|
433
438
|
'directAsk.newChat': '新对话',
|
|
434
439
|
'directAsk.tabChat': '问答',
|
|
435
440
|
'directAsk.noAnswer': '(无回答)',
|
|
@@ -761,13 +766,18 @@
|
|
|
761
766
|
'page.taskProgressTitle': 'Task progress snapshot',
|
|
762
767
|
'page.taskProgressDesc': 'Adds a Progress button to the session header. Clicking it asks the current session model to analyze the session in the background and produce a structured progress report shown in a floating panel. The call is off to the side: nothing is written to the session and the running task is never interrupted. The model picks a checklist, phases, milestones, or task tree to fit the work, and may add content rendered directly in the panel.',
|
|
763
768
|
'page.taskProgressHow': 'Click Progress in any session header to see the last report; on first use press Generate. You can keep working in the session while it runs.',
|
|
769
|
+
'page.taskProgressCooldown': 'Refresh cooldown (seconds)',
|
|
770
|
+
'page.taskProgressCooldownHint': 'Minimum gap between refreshes to avoid accidental clicks; 0 disables the limit.',
|
|
764
771
|
'progress.title': 'Task progress',
|
|
765
772
|
'progress.label': 'Progress',
|
|
766
773
|
'progress.subtitle': 'Generated in the background by this session model',
|
|
767
|
-
'progress.
|
|
774
|
+
'progress.modelChanging': 'Switching model…',
|
|
775
|
+
'progress.hint': 'No progress report yet. Open the Refresh progress tab to analyze the session.',
|
|
768
776
|
'progress.empty': 'No progress report generated yet.',
|
|
769
|
-
'progress.generate': 'Generate progress',
|
|
770
777
|
'progress.refresh': 'Refresh progress',
|
|
778
|
+
'progress.tabRefresh': 'Refresh progress',
|
|
779
|
+
'progress.cancel': 'Cancel',
|
|
780
|
+
'progress.refreshCooldown': 'Please wait {seconds} seconds before refreshing again',
|
|
771
781
|
'progress.retry': 'Retry',
|
|
772
782
|
'progress.loading': 'Analyzing session progress in the background…',
|
|
773
783
|
'progress.close': 'Close',
|
|
@@ -828,7 +838,7 @@
|
|
|
828
838
|
'directAsk.copied': 'Copied',
|
|
829
839
|
'directAsk.close': 'Close',
|
|
830
840
|
'directAsk.hide': 'Hide dialog',
|
|
831
|
-
'directAsk.showHint': 'Type
|
|
841
|
+
'directAsk.showHint': 'Type in the composer below and send; follow up anytime, "+" starts a new chat, "◷" shows history. Sending answers here only — it never writes to the session.',
|
|
832
842
|
'directAsk.newChat': 'New chat',
|
|
833
843
|
'directAsk.tabChat': 'Chat',
|
|
834
844
|
'directAsk.noAnswer': '(no answer)',
|
|
@@ -936,6 +946,7 @@
|
|
|
936
946
|
dualSend: false,
|
|
937
947
|
workspacePrompts: true,
|
|
938
948
|
taskProgress: true,
|
|
949
|
+
taskProgressCooldown: 5,
|
|
939
950
|
directAsk: true,
|
|
940
951
|
directAskAutoTitle: false,
|
|
941
952
|
oneClickEnable: true,
|
|
@@ -961,6 +972,10 @@
|
|
|
961
972
|
dualSend: parsed.dualSend === true,
|
|
962
973
|
workspacePrompts: parsed.workspacePrompts !== false,
|
|
963
974
|
taskProgress: parsed.taskProgress !== false,
|
|
975
|
+
taskProgressCooldown: (() => {
|
|
976
|
+
const value = Number(parsed.taskProgressCooldown);
|
|
977
|
+
return Number.isFinite(value) && value >= 0 ? Math.min(300, Math.max(0, Math.floor(value))) : DEFAULT_SETTINGS.taskProgressCooldown;
|
|
978
|
+
})(),
|
|
964
979
|
directAsk: parsed.directAsk !== false,
|
|
965
980
|
directAskAutoTitle: parsed.directAskAutoTitle === true,
|
|
966
981
|
oneClickEnable: parsed.oneClickEnable !== false,
|
|
@@ -4180,6 +4195,7 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
|
|
|
4180
4195
|
.dsh-powerup-setting-label{color:var(--dsw-alias-label-primary);font-size:12.5px;line-height:18px}
|
|
4181
4196
|
.dsh-powerup-setting-hint{color:var(--dsw-alias-label-tertiary);font-size:10.5px;line-height:15px}
|
|
4182
4197
|
.dsh-powerup-setting .dsh-powerup-switch{margin-left:auto}
|
|
4198
|
+
.dsh-powerup-number-input{flex:none;width:64px;height:28px;margin-left:auto;padding:0 8px;border:.5px solid var(--dsw-alias-border-l2);border-radius:6px;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;text-align:center}
|
|
4183
4199
|
.dsh-powerup-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin:0;padding:0;list-style:none}
|
|
4184
4200
|
.dsh-powerup-action{display:flex;align-items:flex-start;gap:8px;min-width:0;padding:7px 8px;border-radius:8px}
|
|
4185
4201
|
.dsh-powerup-action-icon{flex:none;display:flex;align-items:center;justify-content:center;width:20px;height:20px;margin-top:1px;color:var(--dsw-alias-label-tertiary)}
|
|
@@ -4586,6 +4602,12 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
4586
4602
|
.dsh-powerup-progress-heading{display:flex;flex:1 1 auto;flex-direction:column;gap:2px;min-width:0}
|
|
4587
4603
|
.dsh-powerup-progress-title{font-size:14px;font-weight:600;line-height:1.35;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
4588
4604
|
.dsh-powerup-progress-sub{color:var(--dsw-alias-label-tertiary);font-size:10.5px;line-height:1.4}
|
|
4605
|
+
.dsh-powerup-progress-model-seat{flex:none;display:inline-flex;align-items:center;max-width:150px;overflow:hidden}
|
|
4606
|
+
/* Host model menus portal to body at z-index 1100; lift the one anchored in the
|
|
4607
|
+
progress panel above the panel (1500) so it is not covered. Uses the data
|
|
4608
|
+
attribute (React does not manage it) so re-renders cannot drop the lift. */
|
|
4609
|
+
.dsh-powerup-model-menu-raise,[data-powerup-model-menu]{z-index:1601 !important}
|
|
4610
|
+
.dsh-powerup-progress-model-loading{flex:none;display:inline-flex;align-items:center;justify-content:center;min-width:18px;color:var(--dsw-alias-label-tertiary);font-size:13px}
|
|
4589
4611
|
.dsh-powerup-progress-close{flex:none;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;margin:-2px -2px 0 0;padding:0;border:0;border-radius:var(--dsw-radius-sm);background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:17px;line-height:1;cursor:pointer}
|
|
4590
4612
|
.dsh-powerup-progress-close:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
|
|
4591
4613
|
.dsh-powerup-progress-body{flex:1 1 auto;min-height:0;overflow-y:auto;padding:12px 16px 16px}
|
|
@@ -4602,6 +4624,9 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
4602
4624
|
.dsh-powerup-progress-items{display:flex;flex-direction:column;gap:6px;margin:0;padding:0;list-style:none}
|
|
4603
4625
|
.dsh-powerup-progress-item{display:flex;flex-direction:column;gap:4px;padding:6px 8px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-1)}
|
|
4604
4626
|
.dsh-powerup-progress-item-head{display:flex;align-items:center;gap:7px;min-width:0}
|
|
4627
|
+
.dsh-powerup-progress-item-head.is-clickable{cursor:pointer;border-radius:6px;outline:none}
|
|
4628
|
+
.dsh-powerup-progress-item-head.is-clickable:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
4629
|
+
.dsh-powerup-progress-item-head.is-clickable:focus-visible{box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary))}
|
|
4605
4630
|
.dsh-powerup-progress-item-toggle{flex:none;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:0;border-radius:4px;background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer;transition:transform .12s ease}
|
|
4606
4631
|
.dsh-powerup-progress-item-toggle svg{transform:rotate(-90deg);transition:transform .12s ease}
|
|
4607
4632
|
.dsh-powerup-progress-item:not(.is-collapsed) .dsh-powerup-progress-item-toggle svg{transform:none}
|
|
@@ -4613,6 +4638,8 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
4613
4638
|
.dsh-powerup-progress-tab.on{color:var(--dsw-alias-brand-primary);font-weight:600}
|
|
4614
4639
|
.dsh-powerup-progress-tab.on:after{content:"";position:absolute;left:8px;right:8px;bottom:-1px;height:2px;border-radius:2px;background:var(--dsw-alias-brand-primary)}
|
|
4615
4640
|
.dsh-powerup-progress-req-tab{display:flex;flex-direction:column;gap:6px}
|
|
4641
|
+
.dsh-powerup-progress-req-actions{display:flex;justify-content:flex-end;align-items:center;gap:8px;margin-top:8px}
|
|
4642
|
+
.dsh-powerup-progress-req-actions .dsh-powerup-req-create{margin-top:0}
|
|
4616
4643
|
.dsh-powerup-progress-badge{flex:none;display:inline-flex;align-items:center;justify-content:center;min-width:16px;height:16px;padding:0 5px;border-radius:8px;font-size:9.5px;font-weight:700;letter-spacing:.02em}
|
|
4617
4644
|
.dsh-powerup-progress-badge[data-status=pending]{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-tertiary)}
|
|
4618
4645
|
.dsh-powerup-progress-badge[data-status=in-progress]{background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 14%,transparent);color:var(--dsw-alias-state-business-primary)}
|
|
@@ -4673,8 +4700,11 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
4673
4700
|
/* Direct-ask button + dialog */
|
|
4674
4701
|
.dsh-powerup-directask-btn{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:.5px solid var(--dsw-alias-border-l2);border-radius:7px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font:inherit;line-height:1;cursor:pointer}
|
|
4675
4702
|
.dsh-powerup-directask-btn:hover,.dsh-powerup-directask-btn.on{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}
|
|
4676
|
-
.dsh-powerup-directask-window{position:fixed;z-index:1600;box-sizing:border-box;display:flex;flex-direction:column;
|
|
4677
|
-
.dsh-powerup-directask-titlebar{display:flex;align-items:center;gap:8px;flex:none;padding:10px 12px;border-bottom:.5px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-3);
|
|
4703
|
+
.dsh-powerup-directask-window{position:fixed;z-index:1600;box-sizing:border-box;display:flex;flex-direction:column;border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-panel,14px);background:var(--dsw-alias-bg-layer-2);box-shadow:var(--dsw-elevation-prominent);--dsw-elevation-stroke-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary);font-size:13px;line-height:1.6;overflow:hidden;animation:dsh-powerup-progress-in .15s ease-out}
|
|
4704
|
+
.dsh-powerup-directask-titlebar{display:flex;align-items:center;gap:8px;flex:none;padding:10px 12px;border-bottom:.5px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-3);user-select:none}
|
|
4705
|
+
/* Direct Ask takeover: hide other plugins' composer controls, keep host ones. */
|
|
4706
|
+
.dsh-powerup-da-takeover [data-powerup-da-hidden]{display:none!important}
|
|
4707
|
+
.dsh-powerup-da-takeover [data-composer-permission],.dsh-powerup-da-takeover [data-powerup-da-permission]{pointer-events:none;opacity:.55}
|
|
4678
4708
|
.dsh-powerup-directask-title{font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:240px}
|
|
4679
4709
|
.dsh-powerup-directask-title-input{flex:1 1 auto;min-width:0;height:24px;padding:0 8px;border:.5px solid var(--dsw-alias-brand-primary);border-radius:6px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;outline:0}
|
|
4680
4710
|
.dsh-powerup-directask-history-list button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;padding:6px 8px;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11.5px;text-align:left;cursor:pointer}
|
|
@@ -4718,18 +4748,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
4718
4748
|
.dsh-powerup-directask-files{display:flex;flex-wrap:wrap;gap:6px;padding:0 14px 6px}
|
|
4719
4749
|
.dsh-powerup-directask-file{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;border-radius:999px;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary);font-size:11px}
|
|
4720
4750
|
.dsh-powerup-directask-file button{border:0;background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer;font-size:13px;line-height:1}
|
|
4721
|
-
.dsh-powerup-directask-
|
|
4722
|
-
.dsh-powerup-directask-inputrow{display:flex;align-items:flex-end;gap:8px;padding:6px 6px 6px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:14px;background:var(--dsw-alias-bg-layer-3)}
|
|
4723
|
-
.dsh-powerup-directask-inputrow:focus-within{border-color:var(--dsw-alias-brand-primary)}
|
|
4724
|
-
/* Native file input is hidden; only the custom '+' chip is shown. */
|
|
4725
|
-
.dsh-powerup-directask-attach{position:relative;display:inline-flex;align-items:center;justify-content:center;flex:none;width:26px;height:26px;border-radius:7px;color:var(--dsw-alias-label-secondary);font-size:18px;line-height:1;cursor:pointer;overflow:hidden}
|
|
4726
|
-
.dsh-powerup-directask-attach:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
|
|
4727
|
-
.dsh-powerup-directask-attach input[type=file]{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}
|
|
4728
|
-
.dsh-powerup-directask-input{flex:1 1 auto;min-width:0;max-height:140px;border:0;outline:0;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:12.5px;line-height:1.6;resize:none}
|
|
4729
|
-
.dsh-powerup-directask-input::placeholder{color:var(--dsw-alias-label-tertiary)}
|
|
4730
|
-
.dsh-powerup-directask-send{flex:none;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:0;border-radius:8px;background:var(--dsw-alias-brand-primary);color:var(--dsw-alias-label-primary-foreground,var(--dsw-alias-bg-layer-1));cursor:pointer}
|
|
4731
|
-
.dsh-powerup-directask-send:disabled{opacity:.4;cursor:not-allowed}
|
|
4732
|
-
.dsh-powerup-directask-resizer{position:absolute;right:0;bottom:0;width:16px;height:16px;cursor:nwse-resize;background:linear-gradient(135deg,transparent 50%,var(--dsw-alias-border-l3) 50%,transparent 62%,var(--dsw-alias-border-l3) 62%,var(--dsw-alias-border-l3) 72%,transparent 72%)}
|
|
4751
|
+
.dsh-powerup-directask-btn.on{box-shadow:0 0 0 2px color-mix(in srgb,var(--dsw-alias-brand-primary) 30%,transparent)}
|
|
4733
4752
|
`;
|
|
4734
4753
|
|
|
4735
4754
|
/** Max display length of a session option, in Unicode code points. */
|
|
@@ -9370,11 +9389,70 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9370
9389
|
* model — no Agent, system prompt, tools or skills. Supports continuous
|
|
9371
9390
|
* multi-turn Q&A and a browsable/clearable history of past exchanges.
|
|
9372
9391
|
*/
|
|
9373
|
-
|
|
9392
|
+
/** Find the composer seat DOM node for a session (stable DSH data attributes). */
|
|
9393
|
+
function findComposerSeat(sessionId) {
|
|
9394
|
+
if (typeof document === 'undefined' || document === null) return null;
|
|
9395
|
+
const seats = Array.from(document.querySelectorAll('[data-composer-seat]'));
|
|
9396
|
+
if (sessionId !== undefined && sessionId !== '') {
|
|
9397
|
+
const own = seats.find((seat) => {
|
|
9398
|
+
const body = seat.closest('[data-conversation-session]');
|
|
9399
|
+
return body !== null && body.getAttribute('data-conversation-session') === sessionId;
|
|
9400
|
+
});
|
|
9401
|
+
if (own !== undefined) return own;
|
|
9402
|
+
}
|
|
9403
|
+
return seats[seats.length - 1] ?? null;
|
|
9404
|
+
}
|
|
9405
|
+
|
|
9406
|
+
/** The host primary button is the only composer button carrying aria-busy. */
|
|
9407
|
+
function findComposerSend(seat) {
|
|
9408
|
+
if (seat === null) return null;
|
|
9409
|
+
const buttons = Array.from(seat.querySelectorAll('button[aria-busy]'));
|
|
9410
|
+
return buttons[buttons.length - 1] ?? null;
|
|
9411
|
+
}
|
|
9412
|
+
|
|
9413
|
+
/**
|
|
9414
|
+
* Hide every other plugin's controls in the composer while Direct Ask is
|
|
9415
|
+
* open, and put them back byte-for-byte on close. Host controls (add file
|
|
9416
|
+
* / command, permission, model, send) and our lightning button are kept.
|
|
9417
|
+
*/
|
|
9418
|
+
function createComposerTakeover(seat) {
|
|
9419
|
+
const lightning = seat.querySelector('.dsh-powerup-directask-btn');
|
|
9420
|
+
// Each contribution to the `conversation.input.right` list slot is one
|
|
9421
|
+
// child of the slot anchor. Hide the siblings of our lightning button;
|
|
9422
|
+
// the host's file/command/permission/model/send controls live in OTHER
|
|
9423
|
+
// slots and in the InputBar itself, so they stay visible and usable.
|
|
9424
|
+
const rightAnchor = lightning?.parentElement ?? null;
|
|
9425
|
+
const hidden = [];
|
|
9426
|
+
const hideIn = (anchor) => {
|
|
9427
|
+
if (anchor === null || anchor === undefined) return;
|
|
9428
|
+
for (const child of Array.from(anchor.children)) {
|
|
9429
|
+
if (!(child instanceof HTMLElement)) continue;
|
|
9430
|
+
if (child === lightning || child.contains(lightning)) continue;
|
|
9431
|
+
hidden.push([child, child.style.display]);
|
|
9432
|
+
child.style.setProperty('display', 'none', 'important');
|
|
9433
|
+
child.setAttribute('data-powerup-da-hidden', '1');
|
|
9434
|
+
}
|
|
9435
|
+
};
|
|
9436
|
+
return {
|
|
9437
|
+
take() {
|
|
9438
|
+
seat.classList.add('dsh-powerup-da-takeover');
|
|
9439
|
+
hideIn(rightAnchor);
|
|
9440
|
+
},
|
|
9441
|
+
release() {
|
|
9442
|
+
seat.classList.remove('dsh-powerup-da-takeover');
|
|
9443
|
+
for (const [el, prev] of hidden) {
|
|
9444
|
+
if (prev === '' || prev === null) el.style.removeProperty('display');
|
|
9445
|
+
else el.style.setProperty('display', prev);
|
|
9446
|
+
el.removeAttribute('data-powerup-da-hidden');
|
|
9447
|
+
}
|
|
9448
|
+
hidden.length = 0;
|
|
9449
|
+
},
|
|
9450
|
+
};
|
|
9451
|
+
}
|
|
9452
|
+
|
|
9453
|
+
function DirectAskButton({ sessionId, useInput, inputActions, ctx }) {
|
|
9374
9454
|
const settings = useSettings();
|
|
9375
9455
|
const [open, setOpen] = useState(false);
|
|
9376
|
-
const [question, setQuestion] = useState('');
|
|
9377
|
-
const [files, setFiles] = useState([]);
|
|
9378
9456
|
const [busy, setBusy] = useState(false);
|
|
9379
9457
|
const [error, setError] = useState('');
|
|
9380
9458
|
const [copied, setCopied] = useState(false);
|
|
@@ -9401,27 +9479,35 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9401
9479
|
const [titleDraft, setTitleDraft] = useState('');
|
|
9402
9480
|
const turns = conversation.turns;
|
|
9403
9481
|
const [activeTab, setActiveTab] = useState('chat');
|
|
9404
|
-
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
|
|
9410
|
-
|
|
9411
|
-
const [
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9482
|
+
|
|
9483
|
+
// The real composer is the input surface now. `useInput` comes from the
|
|
9484
|
+
// host slot; a no-op keeps this component renderable on older hosts.
|
|
9485
|
+
const inputState = typeof useInput === 'function' ? useInput((s) => s) : null;
|
|
9486
|
+
const draft = String(inputState?.draft ?? '');
|
|
9487
|
+
const attachmentIds = Array.isArray(inputState?.attachmentIds) ? inputState.attachmentIds : [];
|
|
9488
|
+
const [seat, setSeat] = useState(null);
|
|
9489
|
+
const [geo, setGeo] = useState(null);
|
|
9490
|
+
const takeoverRef = useRef(null);
|
|
9491
|
+
const snapshotRef = useRef(null);
|
|
9492
|
+
const filesRef = useRef([]);
|
|
9493
|
+
const attachmentIdsRef = useRef(attachmentIds);
|
|
9494
|
+
attachmentIdsRef.current = attachmentIds;
|
|
9495
|
+
const attachSnapshotRef = useRef([]);
|
|
9496
|
+
/** Drop attachments added while Direct Ask was open (keep the pre-existing set). */
|
|
9497
|
+
const pruneAddedAttachments = useCallback(() => {
|
|
9498
|
+
const before = attachSnapshotRef.current;
|
|
9499
|
+
if (typeof inputActions?.removeAttachment !== 'function') return;
|
|
9500
|
+
for (const id of attachmentIdsRef.current) {
|
|
9501
|
+
if (!before.includes(id)) inputActions.removeAttachment(id);
|
|
9502
|
+
}
|
|
9503
|
+
}, [inputActions]);
|
|
9422
9504
|
const bottomRef = useRef(null);
|
|
9423
9505
|
const sessionRef = useRef(sessionId);
|
|
9424
9506
|
sessionRef.current = sessionId;
|
|
9507
|
+
const draftRef = useRef(draft);
|
|
9508
|
+
draftRef.current = draft;
|
|
9509
|
+
const busyRef = useRef(false);
|
|
9510
|
+
busyRef.current = busy;
|
|
9425
9511
|
const t = useCallback((key, params) => translateCurrent(key, params), []);
|
|
9426
9512
|
|
|
9427
9513
|
const persistHistory = useCallback((next) => {
|
|
@@ -9433,58 +9519,95 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9433
9519
|
setConversation((cur) => ({ ...cur, turns: typeof fn === 'function' ? fn(cur.turns) : fn }));
|
|
9434
9520
|
}, []);
|
|
9435
9521
|
|
|
9522
|
+
// Resolve and pin the composer seat while open.
|
|
9436
9523
|
useEffect(() => {
|
|
9437
|
-
if (!open) return undefined;
|
|
9438
|
-
const
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9524
|
+
if (!open) { setSeat(null); return undefined; }
|
|
9525
|
+
const found = findComposerSeat(sessionRef.current);
|
|
9526
|
+
setSeat(found);
|
|
9527
|
+
if (found === null) return undefined;
|
|
9528
|
+
const update = () => setSeat((cur) => (cur === null ? findComposerSeat(sessionRef.current) : cur));
|
|
9529
|
+
const timer = window.setInterval(update, 600);
|
|
9530
|
+
return () => window.clearInterval(timer);
|
|
9443
9531
|
}, [open]);
|
|
9444
9532
|
|
|
9445
|
-
//
|
|
9533
|
+
// Geometry: fixed to the composer's width, bottom just above it, and a
|
|
9534
|
+
// height that fills the space above. Resizing the composer changes the
|
|
9535
|
+
// HEIGHT only — the dialog never slides sideways or loses its bottom.
|
|
9446
9536
|
useEffect(() => {
|
|
9447
|
-
if (!open) return undefined;
|
|
9448
|
-
const
|
|
9449
|
-
const
|
|
9450
|
-
|
|
9451
|
-
|
|
9452
|
-
|
|
9453
|
-
|
|
9454
|
-
|
|
9455
|
-
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
h: Math.max(280, Math.min(900, drag.h + event.clientY - drag.y)),
|
|
9460
|
-
});
|
|
9461
|
-
}
|
|
9537
|
+
if (!open || seat === null) { setGeo(null); return undefined; }
|
|
9538
|
+
const update = () => {
|
|
9539
|
+
const rect = seat.getBoundingClientRect();
|
|
9540
|
+
const gap = 8;
|
|
9541
|
+
const top = 8;
|
|
9542
|
+
const bottom = Math.max(top + 160, rect.top - gap);
|
|
9543
|
+
setGeo({
|
|
9544
|
+
left: Math.round(rect.left),
|
|
9545
|
+
width: Math.round(rect.width),
|
|
9546
|
+
top,
|
|
9547
|
+
height: Math.round(bottom - top),
|
|
9548
|
+
});
|
|
9462
9549
|
};
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9550
|
+
update();
|
|
9551
|
+
const observer = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(update) : null;
|
|
9552
|
+
observer?.observe(seat);
|
|
9553
|
+
window.addEventListener('resize', update);
|
|
9554
|
+
return () => {
|
|
9555
|
+
observer?.disconnect();
|
|
9556
|
+
window.removeEventListener('resize', update);
|
|
9470
9557
|
};
|
|
9471
|
-
|
|
9472
|
-
|
|
9558
|
+
}, [open, seat]);
|
|
9559
|
+
|
|
9560
|
+
// Snapshot the composer on open; restore it verbatim on close. Also read
|
|
9561
|
+
// files the user picks through the real composer's file input.
|
|
9562
|
+
useEffect(() => {
|
|
9563
|
+
if (!open || seat === null) return undefined;
|
|
9564
|
+
snapshotRef.current = { draft: draftRef.current };
|
|
9565
|
+
attachSnapshotRef.current = attachmentIdsRef.current.slice();
|
|
9566
|
+
filesRef.current = [];
|
|
9567
|
+
const takeover = createComposerTakeover(seat);
|
|
9568
|
+
takeoverRef.current = takeover;
|
|
9569
|
+
takeover.take();
|
|
9570
|
+
const fileInput = seat.querySelector('input[type="file"]');
|
|
9571
|
+
const onFiles = (event) => {
|
|
9572
|
+
const picked = Array.from(event?.target?.files ?? []);
|
|
9573
|
+
for (const file of picked) {
|
|
9574
|
+
if (file === null || typeof file.text !== 'function') continue;
|
|
9575
|
+
filesRef.current = [...filesRef.current, { name: file.name, text: '' }];
|
|
9576
|
+
void file.text().then((text) => {
|
|
9577
|
+
filesRef.current = filesRef.current.map((f) => (f.name === file.name && f.text === '' ? { ...f, text: String(text).slice(0, 40_000) } : f));
|
|
9578
|
+
}).catch(() => { /* skip unreadable files */ });
|
|
9579
|
+
}
|
|
9580
|
+
};
|
|
9581
|
+
// Read the picked file in the capture phase. The file stays attached
|
|
9582
|
+
// to the real composer UI so the user sees it, but it is only sent to
|
|
9583
|
+
// the light Q&A API — never to the session.
|
|
9584
|
+
fileInput?.addEventListener('change', onFiles, true);
|
|
9473
9585
|
return () => {
|
|
9474
|
-
|
|
9475
|
-
|
|
9586
|
+
fileInput?.removeEventListener('change', onFiles, true);
|
|
9587
|
+
takeover.release();
|
|
9588
|
+
takeoverRef.current = null;
|
|
9589
|
+
const snap = snapshotRef.current;
|
|
9590
|
+
snapshotRef.current = null;
|
|
9591
|
+
filesRef.current = [];
|
|
9592
|
+
if (snap !== null && typeof inputActions?.setDraft === 'function') {
|
|
9593
|
+
inputActions.setDraft(snap.draft);
|
|
9594
|
+
}
|
|
9595
|
+
pruneAddedAttachments();
|
|
9596
|
+
attachSnapshotRef.current = [];
|
|
9476
9597
|
};
|
|
9477
|
-
}, [open,
|
|
9598
|
+
}, [open, seat, inputActions, pruneAddedAttachments]);
|
|
9478
9599
|
|
|
9479
9600
|
useEffect(() => {
|
|
9480
9601
|
if (bottomRef.current !== null) bottomRef.current.scrollIntoView?.({ block: 'nearest' });
|
|
9481
9602
|
}, [turns, busy]);
|
|
9482
9603
|
|
|
9483
|
-
|
|
9484
|
-
|
|
9604
|
+
// Read the host draft plus the files the user attached through the real
|
|
9605
|
+
// composer, then answer through the dedicated, session-free API.
|
|
9606
|
+
const sendToAsk = useCallback(async () => {
|
|
9607
|
+
if (busyRef.current) return;
|
|
9608
|
+
const q = draftRef.current.trim();
|
|
9485
9609
|
if (q === '') { setError(t('directAsk.empty')); return; }
|
|
9486
|
-
const priorContext =
|
|
9487
|
-
// Continuous Q&A: prior completed turns, in order, as user/assistant pairs.
|
|
9610
|
+
const priorContext = filesRef.current.slice();
|
|
9488
9611
|
const historyMsgs = [];
|
|
9489
9612
|
for (const turn of turns) {
|
|
9490
9613
|
if (turn.pending || !turn.answer || turn.error) continue;
|
|
@@ -9492,18 +9615,16 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9492
9615
|
historyMsgs.push({ role: 'assistant', text: turn.answer });
|
|
9493
9616
|
}
|
|
9494
9617
|
const pendingId = `p-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
9495
|
-
|
|
9618
|
+
updateTurns((cur) => [...cur, {
|
|
9496
9619
|
id: pendingId, question: q, answer: '', context: priorContext, at: Date.now(), pending: true,
|
|
9497
|
-
};
|
|
9620
|
+
}]);
|
|
9498
9621
|
setBusy(true);
|
|
9499
9622
|
setError('');
|
|
9500
|
-
setQuestion('');
|
|
9501
|
-
setFiles([]);
|
|
9502
9623
|
setCopied(false);
|
|
9503
|
-
updateTurns((cur) => [...cur, pending]);
|
|
9504
9624
|
setActiveTab('chat');
|
|
9505
|
-
|
|
9506
|
-
|
|
9625
|
+
if (typeof inputActions?.setDraft === 'function') inputActions.setDraft('');
|
|
9626
|
+
filesRef.current = [];
|
|
9627
|
+
pruneAddedAttachments();
|
|
9507
9628
|
if (!conversation.title) {
|
|
9508
9629
|
const fallback = q.slice(0, 40);
|
|
9509
9630
|
setConversation((cur) => ({ ...cur, title: fallback }));
|
|
@@ -9531,18 +9652,63 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9531
9652
|
});
|
|
9532
9653
|
const body = await response.json();
|
|
9533
9654
|
if (!body?.ok) throw new Error(body?.error ?? `HTTP ${response.status}`);
|
|
9534
|
-
updateTurns((cur) => cur.map((
|
|
9535
|
-
? { ...
|
|
9536
|
-
:
|
|
9655
|
+
updateTurns((cur) => cur.map((turn) => (turn.id === pendingId
|
|
9656
|
+
? { ...turn, answer: typeof body.answer === 'string' ? body.answer : '', pending: false }
|
|
9657
|
+
: turn)));
|
|
9537
9658
|
} catch (err) {
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
: t)));
|
|
9659
|
+
updateTurns((cur) => cur.map((turn) => (turn.id === pendingId
|
|
9660
|
+
? { ...turn, answer: String(err?.message ?? err), pending: false, error: true }
|
|
9661
|
+
: turn)));
|
|
9542
9662
|
} finally {
|
|
9543
9663
|
setBusy(false);
|
|
9544
9664
|
}
|
|
9545
|
-
}, [
|
|
9665
|
+
}, [turns, t, conversation.title, settings.directAskAutoTitle, inputActions, updateTurns, pruneAddedAttachments]);
|
|
9666
|
+
|
|
9667
|
+
// Intercept the host Send button and plain Enter while Direct Ask is open.
|
|
9668
|
+
// Capture phase runs before React's bubble handler, so the message never
|
|
9669
|
+
// reaches the session controller.
|
|
9670
|
+
useEffect(() => {
|
|
9671
|
+
if (!open || seat === null) return undefined;
|
|
9672
|
+
const onPointer = (event) => {
|
|
9673
|
+
const send = findComposerSend(seat);
|
|
9674
|
+
if (send === null || send === undefined) return;
|
|
9675
|
+
const target = event.target;
|
|
9676
|
+
if (target !== send && !(target instanceof Node && send.contains(target))) return;
|
|
9677
|
+
event.preventDefault();
|
|
9678
|
+
event.stopPropagation();
|
|
9679
|
+
void sendToAsk();
|
|
9680
|
+
};
|
|
9681
|
+
const onKey = (event) => {
|
|
9682
|
+
if (event.key !== 'Enter' || event.shiftKey || event.isComposing === true || event.repeat === true) return;
|
|
9683
|
+
const target = event.target;
|
|
9684
|
+
const editor = target instanceof Element ? target.closest('[data-composer-input]') : null;
|
|
9685
|
+
if (editor === null || !seat.contains(editor)) return;
|
|
9686
|
+
if (editor.hasAttribute('data-composer-composing') || editor.hasAttribute('data-composer-chip-selected')) return;
|
|
9687
|
+
const openMenu = document.querySelector?.(
|
|
9688
|
+
'[aria-haspopup="listbox"][aria-expanded="true"], [aria-haspopup="menu"][aria-expanded="true"], [role="listbox"]:not([hidden]), [role="menu"]:not([hidden])',
|
|
9689
|
+
);
|
|
9690
|
+
if (openMenu !== null && openMenu !== undefined) return;
|
|
9691
|
+
event.preventDefault();
|
|
9692
|
+
event.stopPropagation();
|
|
9693
|
+
void sendToAsk();
|
|
9694
|
+
};
|
|
9695
|
+
seat.addEventListener('click', onPointer, true);
|
|
9696
|
+
document.addEventListener('keydown', onKey, true);
|
|
9697
|
+
return () => {
|
|
9698
|
+
seat.removeEventListener('click', onPointer, true);
|
|
9699
|
+
document.removeEventListener('keydown', onKey, true);
|
|
9700
|
+
};
|
|
9701
|
+
}, [open, seat, sendToAsk]);
|
|
9702
|
+
|
|
9703
|
+
// Escape closes the overlay.
|
|
9704
|
+
useEffect(() => {
|
|
9705
|
+
if (!open) return undefined;
|
|
9706
|
+
const onKey = (event) => {
|
|
9707
|
+
if (event.key === 'Escape') { event.stopPropagation(); setOpen(false); }
|
|
9708
|
+
};
|
|
9709
|
+
document.addEventListener('keydown', onKey, true);
|
|
9710
|
+
return () => document.removeEventListener('keydown', onKey, true);
|
|
9711
|
+
}, [open]);
|
|
9546
9712
|
|
|
9547
9713
|
const archiveCurrent = useCallback(() => {
|
|
9548
9714
|
if (conversation.turns.length === 0) return history;
|
|
@@ -9579,7 +9745,6 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9579
9745
|
const next = titleDraft.trim().slice(0, 60);
|
|
9580
9746
|
if (next !== '') {
|
|
9581
9747
|
setConversation((cur) => ({ ...cur, title: next }));
|
|
9582
|
-
// Also update the archived copy if this conversation is in history.
|
|
9583
9748
|
setHistory((cur) => cur.map((h) => (h.id === conversation.id ? { ...h, title: next } : h)));
|
|
9584
9749
|
try { localStorage.setItem('dsh-powerup:directask:history:v1', JSON.stringify(history.map((h) => (h.id === conversation.id ? { ...h, title: next } : h)).slice(0, 30))); } catch { /* ignore */ }
|
|
9585
9750
|
}
|
|
@@ -9592,28 +9757,13 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9592
9757
|
persistHistory([]);
|
|
9593
9758
|
}, [t, persistHistory]);
|
|
9594
9759
|
|
|
9595
|
-
const pickFiles = useCallback(async (event) => {
|
|
9596
|
-
const picked = Array.from(event?.target?.files ?? []);
|
|
9597
|
-
const loaded = [];
|
|
9598
|
-
for (const file of picked) {
|
|
9599
|
-
try {
|
|
9600
|
-
const text = await file.text();
|
|
9601
|
-
loaded.push({ name: file.name, text: String(text).slice(0, 40_000) });
|
|
9602
|
-
} catch {
|
|
9603
|
-
/* skip unreadable files */
|
|
9604
|
-
}
|
|
9605
|
-
}
|
|
9606
|
-
setFiles((current) => [...current, ...loaded]);
|
|
9607
|
-
if (event?.target) event.target.value = '';
|
|
9608
|
-
}, []);
|
|
9609
|
-
|
|
9610
9760
|
if (settings.directAsk === false) return null;
|
|
9611
9761
|
|
|
9612
9762
|
const lightning = h('svg', { viewBox: '0 0 16 16', width: 16, height: 16, 'aria-hidden': 'true' },
|
|
9613
9763
|
h('path', { d: 'M9 1.5 3.5 9H7l-1 5.5L12.5 7H9l1-5.5Z', fill: 'currentColor' }),
|
|
9614
9764
|
);
|
|
9615
9765
|
|
|
9616
|
-
// Icon-only composer button.
|
|
9766
|
+
// Icon-only composer button — deliberately kept inside the real input.
|
|
9617
9767
|
const button = h('button', {
|
|
9618
9768
|
type: 'button',
|
|
9619
9769
|
className: 'dsh-powerup-directask-btn' + (open ? ' on' : ''),
|
|
@@ -9622,18 +9772,14 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9622
9772
|
onClick: () => setOpen((v) => !v),
|
|
9623
9773
|
}, lightning);
|
|
9624
9774
|
|
|
9625
|
-
const dialog = !open ? null : h('div', {
|
|
9775
|
+
const dialog = !open || geo === null ? null : h('div', {
|
|
9626
9776
|
className: 'dsh-powerup-directask-window',
|
|
9627
|
-
style: {
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
className: 'dsh-powerup-directask-titlebar',
|
|
9631
|
-
onPointerDown: (event) => {
|
|
9632
|
-
const target = event.target;
|
|
9633
|
-
if (target instanceof Element && target.closest('button')) return;
|
|
9634
|
-
dragRef.current = { kind: 'move', x: event.clientX, y: event.clientY, px: pos.x, py: pos.y };
|
|
9635
|
-
},
|
|
9777
|
+
style: {
|
|
9778
|
+
left: `${geo.left}px`, width: `${geo.width}px`,
|
|
9779
|
+
top: `${geo.top}px`, height: `${geo.height}px`,
|
|
9636
9780
|
},
|
|
9781
|
+
},
|
|
9782
|
+
h('div', { className: 'dsh-powerup-directask-titlebar' },
|
|
9637
9783
|
editingTitle
|
|
9638
9784
|
? h('input', {
|
|
9639
9785
|
className: 'dsh-powerup-directask-title-input',
|
|
@@ -9646,7 +9792,6 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9646
9792
|
else if (event.key === 'Escape') { event.preventDefault(); setEditingTitle(false); }
|
|
9647
9793
|
},
|
|
9648
9794
|
onBlur: saveTitle,
|
|
9649
|
-
onPointerDown: (event) => event.stopPropagation(),
|
|
9650
9795
|
})
|
|
9651
9796
|
: h('span', { className: 'dsh-powerup-directask-title', title: conversation.title || t('directAsk.title') },
|
|
9652
9797
|
conversation.title || t('directAsk.title')),
|
|
@@ -9726,55 +9871,10 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9726
9871
|
h('div', { ref: bottomRef }),
|
|
9727
9872
|
),
|
|
9728
9873
|
error ? h('p', { className: 'dsh-powerup-progress-error' }, error) : null,
|
|
9729
|
-
activeTab === 'chat' ? h('div', { className: 'dsh-powerup-directask-composer' },
|
|
9730
|
-
files.length > 0 ? h('div', { className: 'dsh-powerup-directask-files' },
|
|
9731
|
-
files.map((f, i) => h('span', { key: i, className: 'dsh-powerup-directask-file' },
|
|
9732
|
-
f.name,
|
|
9733
|
-
h('button', {
|
|
9734
|
-
type: 'button', 'aria-label': t('directAsk.removeFile'),
|
|
9735
|
-
onClick: () => setFiles((cur) => cur.filter((_, j) => j !== i)),
|
|
9736
|
-
}, '×'),
|
|
9737
|
-
)),
|
|
9738
|
-
) : null,
|
|
9739
|
-
h('div', { className: 'dsh-powerup-directask-inputrow' },
|
|
9740
|
-
h('label', { className: 'dsh-powerup-directask-attach', title: t('directAsk.attachHint') },
|
|
9741
|
-
h('input', { type: 'file', multiple: true, onChange: (e) => void pickFiles(e) }),
|
|
9742
|
-
h('span', null, '+'),
|
|
9743
|
-
),
|
|
9744
|
-
h('textarea', {
|
|
9745
|
-
className: 'dsh-powerup-directask-input',
|
|
9746
|
-
value: question,
|
|
9747
|
-
placeholder: t('directAsk.placeholder'),
|
|
9748
|
-
disabled: busy,
|
|
9749
|
-
rows: 1,
|
|
9750
|
-
onChange: (event) => setQuestion(event.target.value),
|
|
9751
|
-
onKeyDown: (event) => {
|
|
9752
|
-
if (event.key === 'Enter' && !event.shiftKey && !event.isComposing) {
|
|
9753
|
-
event.preventDefault();
|
|
9754
|
-
void send();
|
|
9755
|
-
}
|
|
9756
|
-
},
|
|
9757
|
-
}),
|
|
9758
|
-
h('button', {
|
|
9759
|
-
type: 'button', className: 'dsh-powerup-directask-send',
|
|
9760
|
-
disabled: busy || question.trim() === '', onClick: () => void send(),
|
|
9761
|
-
title: t('directAsk.send'),
|
|
9762
|
-
}, h('svg', { viewBox: '0 0 16 16', width: 16, height: 16, 'aria-hidden': 'true' },
|
|
9763
|
-
h('path', { d: 'M3 8h9M8.5 4.5 12 8l-3.5 3.5', fill: 'none', stroke: 'currentColor', strokeWidth: 1.4, strokeLinecap: 'round', strokeLinejoin: 'round' }))),
|
|
9764
|
-
),
|
|
9765
|
-
) : null,
|
|
9766
|
-
h('div', {
|
|
9767
|
-
className: 'dsh-powerup-directask-resizer',
|
|
9768
|
-
onPointerDown: (event) => {
|
|
9769
|
-
event.preventDefault();
|
|
9770
|
-
dragRef.current = { kind: 'resize', x: event.clientX, y: event.clientY, w: size.w, h: size.h };
|
|
9771
|
-
},
|
|
9772
|
-
}),
|
|
9773
9874
|
);
|
|
9774
9875
|
|
|
9775
9876
|
return h(React.Fragment, null, button, renderInBody(dialog));
|
|
9776
9877
|
}
|
|
9777
|
-
|
|
9778
9878
|
function DualSendButtons({ sessionId, useInput, inputActions, ctx, t }) {
|
|
9779
9879
|
const settings = useSettings();
|
|
9780
9880
|
const draft = typeof useInput === 'function' ? useInput((s) => s.draft) : '';
|
|
@@ -10431,6 +10531,26 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
10431
10531
|
toggle(key, label),
|
|
10432
10532
|
);
|
|
10433
10533
|
|
|
10534
|
+
/** A numeric sub-row inside a card (clamped, persisted on change). */
|
|
10535
|
+
const numberRow = (key, value, label, hint, min = 0, max = 300) => h('div', { key, className: 'dsh-powerup-setting' },
|
|
10536
|
+
h('div', { className: 'dsh-powerup-setting-copy' },
|
|
10537
|
+
h('span', { className: 'dsh-powerup-setting-label' }, label),
|
|
10538
|
+
h('span', { className: 'dsh-powerup-setting-hint' }, hint),
|
|
10539
|
+
),
|
|
10540
|
+
h('input', {
|
|
10541
|
+
type: 'number',
|
|
10542
|
+
className: 'dsh-powerup-number-input',
|
|
10543
|
+
min, max, step: 1,
|
|
10544
|
+
value: value,
|
|
10545
|
+
'aria-label': label,
|
|
10546
|
+
onChange: (event) => {
|
|
10547
|
+
const parsed = Number(event.target.value);
|
|
10548
|
+
const next = Number.isFinite(parsed) ? Math.min(max, Math.max(min, Math.floor(parsed))) : min;
|
|
10549
|
+
setSettings({ [key]: next });
|
|
10550
|
+
},
|
|
10551
|
+
}),
|
|
10552
|
+
);
|
|
10553
|
+
|
|
10434
10554
|
const actionsDetail = h('div', { className: 'dsh-powerup-card-detail' },
|
|
10435
10555
|
h('h3', { className: 'dsh-powerup-section-title' }, t('page.actions')),
|
|
10436
10556
|
h('ul', { className: 'dsh-powerup-actions' },
|
|
@@ -10498,7 +10618,11 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
10498
10618
|
featureCard('scrollToTop', ScrollTopIcon, 'page.scrollToTopTitle', 'page.scrollToTopDesc', 'page.scrollToTopHow'),
|
|
10499
10619
|
featureCard('contentRendering', PowerUpLineIcon, 'page.renderingTitle', 'page.renderingDesc', 'page.renderingHow'),
|
|
10500
10620
|
featureCard('dualSend', LauncherIcon, 'page.dualSendTitle', 'page.dualSendDesc', 'page.dualSendHow'),
|
|
10501
|
-
featureCard('taskProgress', ProgressIcon, 'page.taskProgressTitle', 'page.taskProgressDesc', 'page.taskProgressHow'
|
|
10621
|
+
featureCard('taskProgress', ProgressIcon, 'page.taskProgressTitle', 'page.taskProgressDesc', 'page.taskProgressHow',
|
|
10622
|
+
h('div', { className: 'dsh-powerup-card-detail' },
|
|
10623
|
+
numberRow('taskProgressCooldown', settings.taskProgressCooldown, t('page.taskProgressCooldown'), t('page.taskProgressCooldownHint')),
|
|
10624
|
+
),
|
|
10625
|
+
),
|
|
10502
10626
|
featureCard('directAsk', TagIcon, 'page.directAskTitle', 'page.directAskDesc', 'page.directAskHow',
|
|
10503
10627
|
h('div', { className: 'dsh-powerup-card-detail' },
|
|
10504
10628
|
settingRow('directAsk', settings.directAsk !== false, t('page.directAskToggle'), t('page.directAskToggleHint')),
|
|
@@ -10930,17 +11054,25 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
10930
11054
|
function ProgressItem({ title, status, detail, children, nodeKey, t: translate }) {
|
|
10931
11055
|
const [collapsed, setCollapsed] = useState(false);
|
|
10932
11056
|
const hasBody = Boolean(detail) || (Array.isArray(children) && children.length > 0);
|
|
11057
|
+
const toggle = () => { if (hasBody) setCollapsed((v) => !v); };
|
|
10933
11058
|
return h('li', { key: nodeKey, className: 'dsh-powerup-progress-item' + (collapsed ? ' is-collapsed' : '') },
|
|
10934
|
-
h('div', {
|
|
11059
|
+
h('div', {
|
|
11060
|
+
className: 'dsh-powerup-progress-item-head' + (hasBody ? ' is-clickable' : ''),
|
|
11061
|
+
...(hasBody ? {
|
|
11062
|
+
role: 'button',
|
|
11063
|
+
tabIndex: 0,
|
|
11064
|
+
'aria-expanded': collapsed ? 'false' : 'true',
|
|
11065
|
+
'aria-label': collapsed ? (translate?.('progress.expand') ?? 'Expand') : (translate?.('progress.collapse') ?? 'Collapse'),
|
|
11066
|
+
onClick: toggle,
|
|
11067
|
+
onKeyDown: (event) => {
|
|
11068
|
+
if (event?.key === 'Enter' || event?.key === ' ') { event.preventDefault?.(); toggle(); }
|
|
11069
|
+
},
|
|
11070
|
+
} : {}),
|
|
11071
|
+
},
|
|
10935
11072
|
hasBody
|
|
10936
|
-
? h('
|
|
10937
|
-
|
|
10938
|
-
|
|
10939
|
-
'aria-expanded': collapsed ? 'false' : 'true',
|
|
10940
|
-
'aria-label': collapsed ? (translate?.('progress.expand') ?? 'Expand') : (translate?.('progress.collapse') ?? 'Collapse'),
|
|
10941
|
-
onClick: () => setCollapsed((v) => !v),
|
|
10942
|
-
}, h('svg', { width: 10, height: 10, viewBox: '0 0 16 16', fill: 'none', 'aria-hidden': 'true' },
|
|
10943
|
-
h('path', { d: 'm4 6 4 4 4-4', stroke: 'currentColor', strokeWidth: 1.4, strokeLinecap: 'round', strokeLinejoin: 'round' })))
|
|
11073
|
+
? h('span', { className: 'dsh-powerup-progress-item-toggle', 'aria-hidden': 'true' },
|
|
11074
|
+
h('svg', { width: 10, height: 10, viewBox: '0 0 16 16', fill: 'none', 'aria-hidden': 'true' },
|
|
11075
|
+
h('path', { d: 'm4 6 4 4 4-4', stroke: 'currentColor', strokeWidth: 1.4, strokeLinecap: 'round', strokeLinejoin: 'round' })))
|
|
10944
11076
|
: h('span', { className: 'dsh-powerup-progress-item-toggle-spacer' }),
|
|
10945
11077
|
ProgressBadge(status),
|
|
10946
11078
|
h('span', { className: 'dsh-powerup-progress-item-title' }, title),
|
|
@@ -11061,6 +11193,110 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11061
11193
|
* - the raw AI text is viewable and copyable;
|
|
11062
11194
|
* - one-off requirements can be added in the panel for the next refresh.
|
|
11063
11195
|
*/
|
|
11196
|
+
/**
|
|
11197
|
+
* Find the host's composer model-seat entry. `conversation.input.model`
|
|
11198
|
+
* is a `single` session slot whose occupant is the built-in ModelSelect
|
|
11199
|
+
* component; the entry carries both the component and the injected face
|
|
11200
|
+
* (directory / load / select / resolveText) that the composer uses.
|
|
11201
|
+
* Reading it (never registering a competitor) lets the progress header
|
|
11202
|
+
* render the very same dropdown, and both seats stay in lockstep because
|
|
11203
|
+
* they share the per-session ModelDirectory.
|
|
11204
|
+
*/
|
|
11205
|
+
function findModelSelectEntry(slots) {
|
|
11206
|
+
try {
|
|
11207
|
+
if (slots === undefined || typeof slots.entriesOfSlot !== 'function') return null;
|
|
11208
|
+
const entries = slots.entriesOfSlot('conversation.input.model');
|
|
11209
|
+
if (!Array.isArray(entries)) return null;
|
|
11210
|
+
for (const entry of entries) {
|
|
11211
|
+
if (entry !== null && typeof entry === 'object'
|
|
11212
|
+
&& typeof entry.component === 'function' && typeof entry.inject === 'function') return entry;
|
|
11213
|
+
}
|
|
11214
|
+
} catch { /* older host without this slot */ }
|
|
11215
|
+
return null;
|
|
11216
|
+
}
|
|
11217
|
+
|
|
11218
|
+
/** Render the host's exact composer model dropdown inside the progress header. */
|
|
11219
|
+
function ProgressModelSelect({ sessionId, ctx, t: translate }) {
|
|
11220
|
+
const slots = ctx?.get?.('slots');
|
|
11221
|
+
const seatRef = useRef(null);
|
|
11222
|
+
const [entry, setEntry] = useState(() => findModelSelectEntry(slots));
|
|
11223
|
+
useEffect(() => {
|
|
11224
|
+
if (entry !== null || slots === undefined) return undefined;
|
|
11225
|
+
const update = () => {
|
|
11226
|
+
const found = findModelSelectEntry(slots);
|
|
11227
|
+
if (found !== null) setEntry(() => found);
|
|
11228
|
+
};
|
|
11229
|
+
update();
|
|
11230
|
+
const off = typeof ctx?.on === 'function'
|
|
11231
|
+
? ctx.on('slots/changed', (key) => { if (key === 'conversation.input.model') update(); })
|
|
11232
|
+
: null;
|
|
11233
|
+
const timer = window.setInterval(update, 800);
|
|
11234
|
+
return () => { if (typeof off === 'function') off(); window.clearInterval(timer); };
|
|
11235
|
+
}, [entry, slots, ctx]);
|
|
11236
|
+
|
|
11237
|
+
// The injected face is cached per [entry, session] so the directory
|
|
11238
|
+
// store identity stays stable across re-renders (ModelSelect subscribes
|
|
11239
|
+
// to it with useSyncExternalStore).
|
|
11240
|
+
const face = useMemo(() => {
|
|
11241
|
+
if (entry === null || typeof sessionId !== 'string' || sessionId === '') return null;
|
|
11242
|
+
try { return entry.inject(sessionId, {}) ?? null; } catch { return null; }
|
|
11243
|
+
}, [entry, sessionId]);
|
|
11244
|
+
const seatT = useMemo(() => {
|
|
11245
|
+
try {
|
|
11246
|
+
const bound = ctx?.locale?.bind?.('model');
|
|
11247
|
+
return typeof bound === 'function' ? (key, params) => bound(key, params) : null;
|
|
11248
|
+
} catch { return null; }
|
|
11249
|
+
}, [ctx]);
|
|
11250
|
+
// ModelSelect renders two child slots (label + options) with fallbacks;
|
|
11251
|
+
// the label fallback is everything we need here, and options are empty
|
|
11252
|
+
// because no other plugin contributes extra model actions.
|
|
11253
|
+
const seatRenderSlot = useCallback((key, owner, opts) => opts?.fallback ?? null, []);
|
|
11254
|
+
|
|
11255
|
+
// The host ModelSelect portals its menu to document.body at z-index 1100,
|
|
11256
|
+
// below our progress panel (1500). Both the trigger inside this seat and
|
|
11257
|
+
// the portaled menu carry the same inline --dsh-model-anchor variable, so
|
|
11258
|
+
// match on it, lift the menu above the panel, and tag it. The tag lets
|
|
11259
|
+
// the panel's outside-click handler ignore clicks inside that menu.
|
|
11260
|
+
useEffect(() => {
|
|
11261
|
+
if (entry === null || face === null) return undefined;
|
|
11262
|
+
const syncMenu = () => {
|
|
11263
|
+
const seat = seatRef.current;
|
|
11264
|
+
if (!(seat instanceof Element)) return;
|
|
11265
|
+
const trigger = seat.querySelector('[style*="--dsh-model-anchor"]');
|
|
11266
|
+
if (!(trigger instanceof HTMLElement)) return;
|
|
11267
|
+
const anchor = trigger.style.getPropertyValue('--dsh-model-anchor').trim();
|
|
11268
|
+
if (anchor === '') return;
|
|
11269
|
+
const menus = document.querySelectorAll('body > [style*="--dsh-model-anchor"]');
|
|
11270
|
+
for (const menu of menus) {
|
|
11271
|
+
if (!(menu instanceof HTMLElement)) continue;
|
|
11272
|
+
if (menu.style.getPropertyValue('--dsh-model-anchor').trim() !== anchor) continue;
|
|
11273
|
+
menu.classList.add('dsh-powerup-model-menu-raise');
|
|
11274
|
+
menu.setAttribute('data-powerup-model-menu', '');
|
|
11275
|
+
}
|
|
11276
|
+
};
|
|
11277
|
+
syncMenu();
|
|
11278
|
+
const observer = typeof MutationObserver === 'function'
|
|
11279
|
+
? new MutationObserver(syncMenu)
|
|
11280
|
+
: null;
|
|
11281
|
+
if (observer !== null) observer.observe(document.body, { childList: true });
|
|
11282
|
+
const timer = window.setInterval(syncMenu, 400);
|
|
11283
|
+
return () => {
|
|
11284
|
+
if (observer !== null) observer.disconnect();
|
|
11285
|
+
window.clearInterval(timer);
|
|
11286
|
+
};
|
|
11287
|
+
}, [entry, face]);
|
|
11288
|
+
|
|
11289
|
+
if (entry === null || face === null || seatT === null) {
|
|
11290
|
+
return h('span', {
|
|
11291
|
+
className: 'dsh-powerup-progress-model-loading',
|
|
11292
|
+
title: translate?.('progress.modelChanging') ?? '',
|
|
11293
|
+
}, '…');
|
|
11294
|
+
}
|
|
11295
|
+
return h('span', { className: 'dsh-powerup-progress-model-seat', ref: seatRef },
|
|
11296
|
+
h(entry.component, { ...face, t: seatT, renderSlot: seatRenderSlot, locked: false }),
|
|
11297
|
+
);
|
|
11298
|
+
}
|
|
11299
|
+
|
|
11064
11300
|
function ProgressControl({ sessionId }) {
|
|
11065
11301
|
const settings = useSettings();
|
|
11066
11302
|
const [open, setOpen] = useState(false);
|
|
@@ -11068,6 +11304,9 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11068
11304
|
const [busy, setBusy] = useState(false);
|
|
11069
11305
|
const [historyIndex, setHistoryIndex] = useState(0);
|
|
11070
11306
|
const [activeTab, setActiveTab] = useState('progress');
|
|
11307
|
+
// Cooldown state: last refresh timestamp + a ticking clock for the label.
|
|
11308
|
+
const lastRefreshRef = useRef(0);
|
|
11309
|
+
const [cooldownLeft, setCooldownLeft] = useState(0);
|
|
11071
11310
|
// Selected requirement ids + the free-editable combined text.
|
|
11072
11311
|
const [selectedReqIds, setSelectedReqIds] = useState([]);
|
|
11073
11312
|
const [reqText, setReqText] = useState('');
|
|
@@ -11132,6 +11371,28 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11132
11371
|
}
|
|
11133
11372
|
}, []);
|
|
11134
11373
|
|
|
11374
|
+
// Cooldown clock: decrement the remaining seconds once a second while open.
|
|
11375
|
+
useEffect(() => {
|
|
11376
|
+
if (!open || cooldownLeft <= 0) return undefined;
|
|
11377
|
+
const timer = window.setTimeout(() => setCooldownLeft((n) => Math.max(0, n - 1)), 1000);
|
|
11378
|
+
return () => window.clearTimeout(timer);
|
|
11379
|
+
}, [open, cooldownLeft]);
|
|
11380
|
+
|
|
11381
|
+
/** Cancel the in-flight side call, then refresh the settled view. */
|
|
11382
|
+
const cancel = useCallback(async () => {
|
|
11383
|
+
const id = sessionRef.current;
|
|
11384
|
+
if (typeof id !== 'string' || id === '') return;
|
|
11385
|
+
setBusy(true);
|
|
11386
|
+
try {
|
|
11387
|
+
const body = await progressRequest(id, 'cancel');
|
|
11388
|
+
setView(body);
|
|
11389
|
+
setHistoryIndex(0);
|
|
11390
|
+
} catch { /* keep the current view */ } finally {
|
|
11391
|
+
setBusy(false);
|
|
11392
|
+
setActiveTab('progress');
|
|
11393
|
+
}
|
|
11394
|
+
}, []);
|
|
11395
|
+
|
|
11135
11396
|
// While the panel is open, keep polling until the side call settles.
|
|
11136
11397
|
useEffect(() => {
|
|
11137
11398
|
if (!open) return undefined;
|
|
@@ -11156,6 +11417,15 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11156
11417
|
const run = useCallback(async () => {
|
|
11157
11418
|
const id = sessionRef.current;
|
|
11158
11419
|
if (typeof id !== 'string' || id === '') return;
|
|
11420
|
+
// Cooldown guard: refuse a refresh started too soon after the last one.
|
|
11421
|
+
const cooldown = Math.max(0, Math.floor(Number(settings.taskProgressCooldown) || 0));
|
|
11422
|
+
const elapsed = Date.now() - lastRefreshRef.current;
|
|
11423
|
+
if (lastRefreshRef.current > 0 && elapsed < cooldown * 1000) {
|
|
11424
|
+
setCooldownLeft(Math.ceil((cooldown * 1000 - elapsed) / 1000));
|
|
11425
|
+
return;
|
|
11426
|
+
}
|
|
11427
|
+
lastRefreshRef.current = Date.now();
|
|
11428
|
+
if (cooldown > 0) setCooldownLeft(cooldown);
|
|
11159
11429
|
setBusy(true);
|
|
11160
11430
|
try {
|
|
11161
11431
|
// Send the full, possibly user-edited text verbatim.
|
|
@@ -11166,9 +11436,11 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11166
11436
|
setView({ status: 'error', error: error?.message ?? String(error) });
|
|
11167
11437
|
} finally {
|
|
11168
11438
|
setBusy(false);
|
|
11439
|
+
// Once the refresh settles, show the result on the progress tab.
|
|
11440
|
+
setActiveTab('progress');
|
|
11169
11441
|
if (!open) setOpen(true);
|
|
11170
11442
|
}
|
|
11171
|
-
}, [open, reqText]);
|
|
11443
|
+
}, [open, reqText, settings.taskProgressCooldown]);
|
|
11172
11444
|
|
|
11173
11445
|
const clearHistory = useCallback(async () => {
|
|
11174
11446
|
const id = sessionRef.current;
|
|
@@ -11197,6 +11469,9 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11197
11469
|
if (panel !== null && event.target instanceof Node && panel.contains(event.target)) return;
|
|
11198
11470
|
if (button !== null && event.target instanceof Node && button.contains(event.target)) return;
|
|
11199
11471
|
if (creatingReq && event.target instanceof Element && event.target.closest('[data-powerup-req-modal]')) return;
|
|
11472
|
+
// The host model dropdown portals its menu to document.body. Clicks
|
|
11473
|
+
// there are outside the panel node but must not dismiss it.
|
|
11474
|
+
if (event.target instanceof Element && event.target.closest('[data-powerup-model-menu]')) return;
|
|
11200
11475
|
close();
|
|
11201
11476
|
};
|
|
11202
11477
|
document.addEventListener('keydown', onKey, true);
|
|
@@ -11286,9 +11561,12 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11286
11561
|
})();
|
|
11287
11562
|
|
|
11288
11563
|
// Three tabs below the header: progress / requirements / raw output.
|
|
11564
|
+
// The requirements tab is labelled "刷新进度": it holds the generation
|
|
11565
|
+
// requirements and the refresh action that consumes them. The refresh
|
|
11566
|
+
// button lives here only (not in the footer), to the right of "新建要求".
|
|
11289
11567
|
const tabs = [
|
|
11290
11568
|
{ id: 'progress', label: t('progress.tabProgress') },
|
|
11291
|
-
{ id: 'requirements', label: t('progress.
|
|
11569
|
+
{ id: 'requirements', label: t('progress.tabRefresh') },
|
|
11292
11570
|
{ id: 'raw', label: t('progress.viewRaw') },
|
|
11293
11571
|
];
|
|
11294
11572
|
const tabBar = h('div', { className: 'dsh-powerup-progress-tabs', role: 'tablist' },
|
|
@@ -11314,10 +11592,6 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11314
11592
|
if (report === null || report === undefined) {
|
|
11315
11593
|
return h('div', null,
|
|
11316
11594
|
h('p', { className: 'dsh-powerup-progress-empty' }, t('progress.empty')),
|
|
11317
|
-
h('button', {
|
|
11318
|
-
type: 'button', className: 'dsh-powerup-progress-refresh',
|
|
11319
|
-
disabled: busy, onClick: () => void run(),
|
|
11320
|
-
}, t('progress.generate')),
|
|
11321
11595
|
);
|
|
11322
11596
|
}
|
|
11323
11597
|
return h('div', null,
|
|
@@ -11340,6 +11614,10 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11340
11614
|
);
|
|
11341
11615
|
})();
|
|
11342
11616
|
|
|
11617
|
+
const cooldownActive = cooldownLeft > 0 && !running;
|
|
11618
|
+
const refreshLabel = cooldownActive
|
|
11619
|
+
? t('progress.refreshCooldown', { seconds: cooldownLeft })
|
|
11620
|
+
: t('progress.refresh');
|
|
11343
11621
|
const requirementsBody = h('div', { className: 'dsh-powerup-progress-req-tab' },
|
|
11344
11622
|
h(RequirementPicker, {
|
|
11345
11623
|
reqs: visibleReqs,
|
|
@@ -11349,10 +11627,22 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11349
11627
|
onToggle: toggleReq,
|
|
11350
11628
|
onTextChange: setReqText,
|
|
11351
11629
|
}),
|
|
11352
|
-
h('
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11630
|
+
h('div', { className: 'dsh-powerup-progress-req-actions' },
|
|
11631
|
+
h('button', {
|
|
11632
|
+
type: 'button', className: 'dsh-powerup-prompt-new dsh-powerup-req-create',
|
|
11633
|
+
onClick: () => setCreatingReq(true),
|
|
11634
|
+
}, t('progress.reqNew')),
|
|
11635
|
+
running
|
|
11636
|
+
? h('button', {
|
|
11637
|
+
type: 'button', className: 'dsh-powerup-progress-refresh',
|
|
11638
|
+
onClick: () => void cancel(),
|
|
11639
|
+
}, t('progress.cancel'))
|
|
11640
|
+
: h('button', {
|
|
11641
|
+
type: 'button', className: 'dsh-powerup-progress-refresh',
|
|
11642
|
+
disabled: busy || cooldownActive, title: cooldownActive ? refreshLabel : undefined,
|
|
11643
|
+
onClick: () => void run(),
|
|
11644
|
+
}, refreshLabel),
|
|
11645
|
+
),
|
|
11356
11646
|
);
|
|
11357
11647
|
|
|
11358
11648
|
const rawBody = h('div', null,
|
|
@@ -11396,6 +11686,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11396
11686
|
t('progress.subtitle'),
|
|
11397
11687
|
),
|
|
11398
11688
|
),
|
|
11689
|
+
h(ProgressModelSelect, { sessionId, ctx: ctxRef.current, t }),
|
|
11399
11690
|
h('button', {
|
|
11400
11691
|
type: 'button', className: 'dsh-powerup-progress-close',
|
|
11401
11692
|
'aria-label': t('progress.close'), onClick: close,
|
|
@@ -11411,10 +11702,6 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11411
11702
|
type: 'button', className: 'dsh-powerup-progress-mini',
|
|
11412
11703
|
onClick: () => void clearHistory(),
|
|
11413
11704
|
}, t('progress.clearHistory')) : null,
|
|
11414
|
-
h('button', {
|
|
11415
|
-
type: 'button', className: 'dsh-powerup-progress-refresh',
|
|
11416
|
-
disabled: busy || running, onClick: () => void run(),
|
|
11417
|
-
}, t('progress.refresh')),
|
|
11418
11705
|
),
|
|
11419
11706
|
h('div', {
|
|
11420
11707
|
className: 'dsh-powerup-progress-resizer',
|
|
@@ -11520,7 +11807,11 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11520
11807
|
register('conversation.input.right', {
|
|
11521
11808
|
id: 'powerup-direct-ask',
|
|
11522
11809
|
order: 82,
|
|
11523
|
-
}, (props) => h(DirectAskButton, {
|
|
11810
|
+
}, (props) => h(DirectAskButton, {
|
|
11811
|
+
...props,
|
|
11812
|
+
ctx,
|
|
11813
|
+
t: (key, params) => translateCurrent(key, params),
|
|
11814
|
+
}), 'dsh-powerup: direct ask');
|
|
11524
11815
|
|
|
11525
11816
|
// In an ongoing session, place the prompt picker in the bottom tool row
|
|
11526
11817
|
// just after the host's permission / plan dropdowns; its popover opens
|
|
@@ -11605,6 +11896,8 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11605
11896
|
PROGRESS_CSS,
|
|
11606
11897
|
ProgressControl,
|
|
11607
11898
|
ProgressItem,
|
|
11899
|
+
ProgressModelSelect,
|
|
11900
|
+
findModelSelectEntry,
|
|
11608
11901
|
ProgressStructure,
|
|
11609
11902
|
ProgressDisplay,
|
|
11610
11903
|
RequirementManager,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@restregular/dsh-powerup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "为 DeepSeek Harness 提供一组可选的小型增强:轨迹右键菜单与步骤引用、后台任务停止原因、插件一键安装、侧边栏图标网格、会话切换、定位当前会话、工作区提示词、旁路模型生成的结构化任务进度;所有功能均可在 Power-Up 页面独立开关。 · Opt-in upgrades for DeepSeek Harness: Trajectory context menu and step references, job stop reasons, one-click plugin install, an adaptive sidebar launcher, session switching, locating the current session, workspace prompts, and non-blocking model-generated structured task progress — each toggled independently on the Power-Up page.",
|
|
5
5
|
"icon": "./icon.svg",
|
|
6
6
|
"type": "module",
|