@restregular/dsh-powerup 0.19.0 → 0.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +21 -16
  2. package/client.js +325 -192
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -475,22 +475,27 @@ refreshes.
475
475
 
476
476
  ### Direct ask (no Agent)
477
477
 
478
- An **icon-only** lightning button in the composer opens a floating DSH-styled
479
- chat window. Drag the title bar to move it and the bottom-right corner to
480
- resize it (position and size persist). It supports **continuous multi-turn Q&A**.
481
- The chat window uses two **tabs** — **Chat** and **History** — instead of
482
- embedding the history over the conversation. History is stored per **conversation**
483
- (not per message), each with a **title** you can edit inline. A settings toggle
484
- can ask the model to generate the title from the first message — one tiny,
485
- token-capped request; otherwise the first question becomes the title. Your
486
- message appears in the thread immediately as a pending bubble; the answer
487
- replaces the pending state in place and is **rendered as Markdown** (headings,
488
- lists, code blocks, inline formatting); failures render there too. Continuous Q&A flattens prior turns into a
489
- single user message before each call, so no hand-built assistant message ever
490
- reaches the model adapter — this fixes the "LLM_FAILED" error on the second
491
- message. "+" starts a new chat. Attach text files with the "+" chip in the
492
- composer — the native file picker stays hidden. This is deliberately **not an
493
- Agent**: it uses a single `llm.prepareCall` + stream call per turn with a short
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
494
499
  instruction, so no system prompt sections, tools, skills, memory or background
495
500
  jobs are involved, and nothing is written to the session log. Toggle it off on
496
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.19.0';
88
+ const VERSION = '0.19.2';
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,17 +361,16 @@
361
361
  'update.unsupportedTitle': '无法自动安装',
362
362
  'page.taskProgressTitle': '任务进度速览',
363
363
  'page.taskProgressDesc': '在会话顶部加一个「进度」按钮,点击后用当前会话的模型在后台分析会话记录,生成结构化的任务进度并用浮层展示。调用在旁路进行,不写入会话、不打断正在运行的任务;模型会按任务类型选择清单、阶段、里程碑或任务树,并可补充一段直接渲染给用户看的内容。',
364
- 'page.taskProgressHow': '在任意会话顶部点击「进度」按钮,面板会显示最近一次结果;首次使用点「生成进度」。生成期间可继续正常操作会话。',
364
+ 'page.taskProgressHow': '在任意会话顶部点击「进度」按钮,面板会显示最近一次结果;首次使用切到「刷新进度」标签页点「刷新进度」。生成期间可继续正常操作会话。',
365
365
  'page.taskProgressCooldown': '刷新冷却(秒)',
366
366
  'page.taskProgressCooldownHint': '两次刷新之间的最短间隔,防止误触;设为 0 表示不限制。',
367
367
  'progress.title': '任务进度',
368
368
  'progress.label': '进度',
369
369
  'progress.subtitle': '由当前会话模型在后台生成',
370
370
  'progress.modelChanging': '正在切换模型…',
371
- 'progress.hint': '还没有进度报告,点「生成进度」开始分析。',
371
+ 'progress.hint': '还没有进度报告,切到「刷新进度」标签页开始分析。',
372
372
  'progress.empty': '还没有生成过进度报告。',
373
- 'progress.generate': '生成进度',
374
- 'progress.refresh': '刷新',
373
+ 'progress.refresh': '刷新进度',
375
374
  'progress.tabRefresh': '刷新进度',
376
375
  'progress.cancel': '取消',
377
376
  'progress.refreshCooldown': '请等待 {seconds} 秒后再刷新',
@@ -435,7 +434,7 @@
435
434
  'directAsk.copied': '已复制',
436
435
  'directAsk.close': '关闭',
437
436
  'directAsk.hide': '隐藏弹窗',
438
- 'directAsk.showHint': '输入问题开始对话;可继续追问,点「+」开启新对话,点「◷」查看历史。拖动标题栏移动窗口。',
437
+ 'directAsk.showHint': '在下方原始输入框中直接输入问题并发送;可继续追问,点「+」开启新对话,点「◷」查看历史。发送只作用于轻量问答,不会写入当前会话。',
439
438
  'directAsk.newChat': '新对话',
440
439
  'directAsk.tabChat': '问答',
441
440
  'directAsk.noAnswer': '(无回答)',
@@ -773,10 +772,9 @@
773
772
  'progress.label': 'Progress',
774
773
  'progress.subtitle': 'Generated in the background by this session model',
775
774
  'progress.modelChanging': 'Switching model…',
776
- 'progress.hint': 'No progress report yet. Press Generate to analyze the session.',
775
+ 'progress.hint': 'No progress report yet. Open the Refresh progress tab to analyze the session.',
777
776
  'progress.empty': 'No progress report generated yet.',
778
- 'progress.generate': 'Generate progress',
779
- 'progress.refresh': 'Refresh',
777
+ 'progress.refresh': 'Refresh progress',
780
778
  'progress.tabRefresh': 'Refresh progress',
781
779
  'progress.cancel': 'Cancel',
782
780
  'progress.refreshCooldown': 'Please wait {seconds} seconds before refreshing again',
@@ -840,7 +838,7 @@
840
838
  'directAsk.copied': 'Copied',
841
839
  'directAsk.close': 'Close',
842
840
  'directAsk.hide': 'Hide dialog',
843
- 'directAsk.showHint': 'Type a question to start; follow up anytime, "+" starts a new chat, "◷" shows history. Drag the title bar to move.',
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.',
844
842
  'directAsk.newChat': 'New chat',
845
843
  'directAsk.tabChat': 'Chat',
846
844
  'directAsk.noAnswer': '(no answer)',
@@ -4605,6 +4603,10 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
4605
4603
  .dsh-powerup-progress-title{font-size:14px;font-weight:600;line-height:1.35;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
4606
4604
  .dsh-powerup-progress-sub{color:var(--dsw-alias-label-tertiary);font-size:10.5px;line-height:1.4}
4607
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}
4608
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}
4609
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}
4610
4612
  .dsh-powerup-progress-close:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
@@ -4698,8 +4700,14 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
4698
4700
  /* Direct-ask button + dialog */
4699
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}
4700
4702
  .dsh-powerup-directask-btn:hover,.dsh-powerup-directask-btn.on{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}
4701
- .dsh-powerup-directask-window{position:fixed;z-index:1600;box-sizing:border-box;display:flex;flex-direction:column;min-width:360px;min-height:280px;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}
4702
- .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);cursor:move;user-select:none}
4703
+ /* Keep the takeover BELOW every host composer popover (file-drop overlay is
4704
+ z-index 1000, model menu / file picker portals are 1100) so they stay
4705
+ clickable, yet above all chat content (AppFrame chrome tops out at 71). */
4706
+ .dsh-powerup-directask-window{position:fixed;z-index:900;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}
4707
+ .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}
4708
+ /* Direct Ask takeover: hide other plugins' composer controls, keep host ones. */
4709
+ .dsh-powerup-da-takeover [data-powerup-da-hidden]{display:none!important}
4710
+ .dsh-powerup-da-takeover [data-composer-permission],.dsh-powerup-da-takeover [data-powerup-da-permission]{pointer-events:none;opacity:.55}
4703
4711
  .dsh-powerup-directask-title{font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:240px}
4704
4712
  .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}
4705
4713
  .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}
@@ -4743,18 +4751,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
4743
4751
  .dsh-powerup-directask-files{display:flex;flex-wrap:wrap;gap:6px;padding:0 14px 6px}
4744
4752
  .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}
4745
4753
  .dsh-powerup-directask-file button{border:0;background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer;font-size:13px;line-height:1}
4746
- .dsh-powerup-directask-composer{flex:none;padding:10px 14px 12px;border-top:.5px solid var(--dsw-alias-border-l1)}
4747
- .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)}
4748
- .dsh-powerup-directask-inputrow:focus-within{border-color:var(--dsw-alias-brand-primary)}
4749
- /* Native file input is hidden; only the custom '+' chip is shown. */
4750
- .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}
4751
- .dsh-powerup-directask-attach:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
4752
- .dsh-powerup-directask-attach input[type=file]{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}
4753
- .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}
4754
- .dsh-powerup-directask-input::placeholder{color:var(--dsw-alias-label-tertiary)}
4755
- .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}
4756
- .dsh-powerup-directask-send:disabled{opacity:.4;cursor:not-allowed}
4757
- .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%)}
4754
+ .dsh-powerup-directask-btn.on{box-shadow:0 0 0 2px color-mix(in srgb,var(--dsw-alias-brand-primary) 30%,transparent)}
4758
4755
  `;
4759
4756
 
4760
4757
  /** Max display length of a session option, in Unicode code points. */
@@ -9047,6 +9044,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9047
9044
  ref: menuRef,
9048
9045
  className: 'dsh-powerup-ws-menu',
9049
9046
  role: 'listbox',
9047
+ 'data-powerup-ws-menu': '',
9050
9048
  }, options.map((option) => h('button', {
9051
9049
  type: 'button',
9052
9050
  key: option.value,
@@ -9395,11 +9393,70 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9395
9393
  * model — no Agent, system prompt, tools or skills. Supports continuous
9396
9394
  * multi-turn Q&A and a browsable/clearable history of past exchanges.
9397
9395
  */
9398
- function DirectAskButton({ sessionId }) {
9396
+ /** Find the composer seat DOM node for a session (stable DSH data attributes). */
9397
+ function findComposerSeat(sessionId) {
9398
+ if (typeof document === 'undefined' || document === null) return null;
9399
+ const seats = Array.from(document.querySelectorAll('[data-composer-seat]'));
9400
+ if (sessionId !== undefined && sessionId !== '') {
9401
+ const own = seats.find((seat) => {
9402
+ const body = seat.closest('[data-conversation-session]');
9403
+ return body !== null && body.getAttribute('data-conversation-session') === sessionId;
9404
+ });
9405
+ if (own !== undefined) return own;
9406
+ }
9407
+ return seats[seats.length - 1] ?? null;
9408
+ }
9409
+
9410
+ /** The host primary button is the only composer button carrying aria-busy. */
9411
+ function findComposerSend(seat) {
9412
+ if (seat === null) return null;
9413
+ const buttons = Array.from(seat.querySelectorAll('button[aria-busy]'));
9414
+ return buttons[buttons.length - 1] ?? null;
9415
+ }
9416
+
9417
+ /**
9418
+ * Hide every other plugin's controls in the composer while Direct Ask is
9419
+ * open, and put them back byte-for-byte on close. Host controls (add file
9420
+ * / command, permission, model, send) and our lightning button are kept.
9421
+ */
9422
+ function createComposerTakeover(seat) {
9423
+ const lightning = seat.querySelector('.dsh-powerup-directask-btn');
9424
+ // Each contribution to the `conversation.input.right` list slot is one
9425
+ // child of the slot anchor. Hide the siblings of our lightning button;
9426
+ // the host's file/command/permission/model/send controls live in OTHER
9427
+ // slots and in the InputBar itself, so they stay visible and usable.
9428
+ const rightAnchor = lightning?.parentElement ?? null;
9429
+ const hidden = [];
9430
+ const hideIn = (anchor) => {
9431
+ if (anchor === null || anchor === undefined) return;
9432
+ for (const child of Array.from(anchor.children)) {
9433
+ if (!(child instanceof HTMLElement)) continue;
9434
+ if (child === lightning || child.contains(lightning)) continue;
9435
+ hidden.push([child, child.style.display]);
9436
+ child.style.setProperty('display', 'none', 'important');
9437
+ child.setAttribute('data-powerup-da-hidden', '1');
9438
+ }
9439
+ };
9440
+ return {
9441
+ take() {
9442
+ seat.classList.add('dsh-powerup-da-takeover');
9443
+ hideIn(rightAnchor);
9444
+ },
9445
+ release() {
9446
+ seat.classList.remove('dsh-powerup-da-takeover');
9447
+ for (const [el, prev] of hidden) {
9448
+ if (prev === '' || prev === null) el.style.removeProperty('display');
9449
+ else el.style.setProperty('display', prev);
9450
+ el.removeAttribute('data-powerup-da-hidden');
9451
+ }
9452
+ hidden.length = 0;
9453
+ },
9454
+ };
9455
+ }
9456
+
9457
+ function DirectAskButton({ sessionId, useInput, inputActions, ctx }) {
9399
9458
  const settings = useSettings();
9400
9459
  const [open, setOpen] = useState(false);
9401
- const [question, setQuestion] = useState('');
9402
- const [files, setFiles] = useState([]);
9403
9460
  const [busy, setBusy] = useState(false);
9404
9461
  const [error, setError] = useState('');
9405
9462
  const [copied, setCopied] = useState(false);
@@ -9426,27 +9483,35 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9426
9483
  const [titleDraft, setTitleDraft] = useState('');
9427
9484
  const turns = conversation.turns;
9428
9485
  const [activeTab, setActiveTab] = useState('chat');
9429
- const [pos, setPos] = useState(() => {
9430
- try {
9431
- const saved = JSON.parse(localStorage.getItem('dsh-powerup:directask:pos:v1') || 'null');
9432
- if (saved !== null && Number.isFinite(saved.x) && Number.isFinite(saved.y)) return { x: saved.x, y: saved.y };
9433
- } catch { /* fall through */ }
9434
- return { x: 24, y: 96 };
9435
- });
9436
- const [size, setSize] = useState(() => {
9437
- try {
9438
- const saved = JSON.parse(localStorage.getItem('dsh-powerup:directask:size:v1') || 'null');
9439
- if (saved !== null && Number.isFinite(saved.w) && Number.isFinite(saved.h)) {
9440
- return { w: Math.max(360, Math.min(1100, saved.w)), h: Math.max(280, Math.min(900, saved.h)) };
9441
- }
9442
- } catch { /* fall through */ }
9443
- return { w: 620, h: 560 };
9444
- });
9445
- const dialogRef = useRef(null);
9446
- const dragRef = useRef(null);
9486
+
9487
+ // The real composer is the input surface now. `useInput` comes from the
9488
+ // host slot; a no-op keeps this component renderable on older hosts.
9489
+ const inputState = typeof useInput === 'function' ? useInput((s) => s) : null;
9490
+ const draft = String(inputState?.draft ?? '');
9491
+ const attachmentIds = Array.isArray(inputState?.attachmentIds) ? inputState.attachmentIds : [];
9492
+ const [seat, setSeat] = useState(null);
9493
+ const [geo, setGeo] = useState(null);
9494
+ const takeoverRef = useRef(null);
9495
+ const snapshotRef = useRef(null);
9496
+ const filesRef = useRef([]);
9497
+ const attachmentIdsRef = useRef(attachmentIds);
9498
+ attachmentIdsRef.current = attachmentIds;
9499
+ const attachSnapshotRef = useRef([]);
9500
+ /** Drop attachments added while Direct Ask was open (keep the pre-existing set). */
9501
+ const pruneAddedAttachments = useCallback(() => {
9502
+ const before = attachSnapshotRef.current;
9503
+ if (typeof inputActions?.removeAttachment !== 'function') return;
9504
+ for (const id of attachmentIdsRef.current) {
9505
+ if (!before.includes(id)) inputActions.removeAttachment(id);
9506
+ }
9507
+ }, [inputActions]);
9447
9508
  const bottomRef = useRef(null);
9448
9509
  const sessionRef = useRef(sessionId);
9449
9510
  sessionRef.current = sessionId;
9511
+ const draftRef = useRef(draft);
9512
+ draftRef.current = draft;
9513
+ const busyRef = useRef(false);
9514
+ busyRef.current = busy;
9450
9515
  const t = useCallback((key, params) => translateCurrent(key, params), []);
9451
9516
 
9452
9517
  const persistHistory = useCallback((next) => {
@@ -9458,58 +9523,111 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9458
9523
  setConversation((cur) => ({ ...cur, turns: typeof fn === 'function' ? fn(cur.turns) : fn }));
9459
9524
  }, []);
9460
9525
 
9526
+ // Resolve and pin the composer seat while open.
9461
9527
  useEffect(() => {
9462
- if (!open) return undefined;
9463
- const onKey = (event) => {
9464
- if (event.key === 'Escape') { event.stopPropagation(); setOpen(false); }
9465
- };
9466
- document.addEventListener('keydown', onKey, true);
9467
- return () => document.removeEventListener('keydown', onKey, true);
9528
+ if (!open) { setSeat(null); return undefined; }
9529
+ const found = findComposerSeat(sessionRef.current);
9530
+ setSeat(found);
9531
+ if (found === null) return undefined;
9532
+ const update = () => setSeat((cur) => (cur === null ? findComposerSeat(sessionRef.current) : cur));
9533
+ const timer = window.setInterval(update, 600);
9534
+ return () => window.clearInterval(timer);
9468
9535
  }, [open]);
9469
9536
 
9470
- // Drag (title bar) and resize (bottom-right handle) with native pointers.
9537
+ // Geometry: cover ONLY the conversation's content area — from just under
9538
+ // the session title bar down to the top of the input card, including the
9539
+ // task/plan dock that lives above the card inside the composer seat. The
9540
+ // width matches the input card (not the full-width seat). Resizing changes
9541
+ // only the height/top; the dialog never slides sideways.
9471
9542
  useEffect(() => {
9472
- if (!open) return undefined;
9473
- const onMove = (event) => {
9474
- const drag = dragRef.current;
9475
- if (drag === null) return;
9476
- if (drag.kind === 'move') {
9477
- setPos({
9478
- x: Math.max(0, Math.min(window.innerWidth - 120, drag.px + event.clientX - drag.x)),
9479
- y: Math.max(0, Math.min(window.innerHeight - 60, drag.py + event.clientY - drag.y)),
9480
- });
9481
- } else if (drag.kind === 'resize') {
9482
- setSize({
9483
- w: Math.max(360, Math.min(1100, drag.w + event.clientX - drag.x)),
9484
- h: Math.max(280, Math.min(900, drag.h + event.clientY - drag.y)),
9485
- });
9486
- }
9543
+ if (!open || seat === null) { setGeo(null); return undefined; }
9544
+ const update = () => {
9545
+ const rect = seat.getBoundingClientRect();
9546
+ const card = seat.querySelector('[data-composer-card]');
9547
+ const cardRect = card === null ? null : card.getBoundingClientRect();
9548
+ const content = seat.closest('[data-conversation-content]');
9549
+ const contentRect = content === null ? null : content.getBoundingClientRect();
9550
+ const header = content?.querySelector('header[data-window-drag]') ?? document.querySelector('header[data-window-drag]');
9551
+ const headerRect = header == null ? null : header.getBoundingClientRect();
9552
+ const left = cardRect !== null ? cardRect.left : rect.left;
9553
+ const width = cardRect !== null ? cardRect.width : rect.width;
9554
+ // Anchor the top to the content region (or the header's bottom) so
9555
+ // the session title bar is never covered.
9556
+ const top = contentRect !== null ? contentRect.top
9557
+ : (headerRect !== null ? headerRect.bottom : 0);
9558
+ // Bottom edge: the top of the visible input card. Anything docked
9559
+ // above the card (task/plan/queue/todo) sits inside this range, so
9560
+ // it is covered too.
9561
+ const bottomEdge = cardRect !== null ? cardRect.top : rect.top;
9562
+ const bottom = Math.max(top + 160, bottomEdge - 8);
9563
+ setGeo({
9564
+ left: Math.round(left),
9565
+ width: Math.round(width),
9566
+ top: Math.round(top),
9567
+ height: Math.round(bottom - top),
9568
+ });
9487
9569
  };
9488
- const onUp = () => {
9489
- if (dragRef.current === null) return;
9490
- dragRef.current = null;
9491
- try {
9492
- localStorage.setItem('dsh-powerup:directask:pos:v1', JSON.stringify(pos));
9493
- localStorage.setItem('dsh-powerup:directask:size:v1', JSON.stringify(size));
9494
- } catch { /* ignore */ }
9570
+ update();
9571
+ const observer = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(update) : null;
9572
+ observer?.observe(seat);
9573
+ window.addEventListener('resize', update);
9574
+ return () => {
9575
+ observer?.disconnect();
9576
+ window.removeEventListener('resize', update);
9495
9577
  };
9496
- document.addEventListener('pointermove', onMove);
9497
- document.addEventListener('pointerup', onUp);
9578
+ }, [open, seat]);
9579
+
9580
+ // Snapshot the composer on open; restore it verbatim on close. Also read
9581
+ // files the user picks through the real composer's file input.
9582
+ useEffect(() => {
9583
+ if (!open || seat === null) return undefined;
9584
+ snapshotRef.current = { draft: draftRef.current };
9585
+ attachSnapshotRef.current = attachmentIdsRef.current.slice();
9586
+ filesRef.current = [];
9587
+ const takeover = createComposerTakeover(seat);
9588
+ takeoverRef.current = takeover;
9589
+ takeover.take();
9590
+ const fileInput = seat.querySelector('input[type="file"]');
9591
+ const onFiles = (event) => {
9592
+ const picked = Array.from(event?.target?.files ?? []);
9593
+ for (const file of picked) {
9594
+ if (file === null || typeof file.text !== 'function') continue;
9595
+ filesRef.current = [...filesRef.current, { name: file.name, text: '' }];
9596
+ void file.text().then((text) => {
9597
+ filesRef.current = filesRef.current.map((f) => (f.name === file.name && f.text === '' ? { ...f, text: String(text).slice(0, 40_000) } : f));
9598
+ }).catch(() => { /* skip unreadable files */ });
9599
+ }
9600
+ };
9601
+ // Read the picked file in the capture phase. The file stays attached
9602
+ // to the real composer UI so the user sees it, but it is only sent to
9603
+ // the light Q&A API — never to the session.
9604
+ fileInput?.addEventListener('change', onFiles, true);
9498
9605
  return () => {
9499
- document.removeEventListener('pointermove', onMove);
9500
- document.removeEventListener('pointerup', onUp);
9606
+ fileInput?.removeEventListener('change', onFiles, true);
9607
+ takeover.release();
9608
+ takeoverRef.current = null;
9609
+ const snap = snapshotRef.current;
9610
+ snapshotRef.current = null;
9611
+ filesRef.current = [];
9612
+ if (snap !== null && typeof inputActions?.setDraft === 'function') {
9613
+ inputActions.setDraft(snap.draft);
9614
+ }
9615
+ pruneAddedAttachments();
9616
+ attachSnapshotRef.current = [];
9501
9617
  };
9502
- }, [open, pos, size]);
9618
+ }, [open, seat, inputActions, pruneAddedAttachments]);
9503
9619
 
9504
9620
  useEffect(() => {
9505
9621
  if (bottomRef.current !== null) bottomRef.current.scrollIntoView?.({ block: 'nearest' });
9506
9622
  }, [turns, busy]);
9507
9623
 
9508
- const send = useCallback(async () => {
9509
- const q = question.trim();
9624
+ // Read the host draft plus the files the user attached through the real
9625
+ // composer, then answer through the dedicated, session-free API.
9626
+ const sendToAsk = useCallback(async () => {
9627
+ if (busyRef.current) return;
9628
+ const q = draftRef.current.trim();
9510
9629
  if (q === '') { setError(t('directAsk.empty')); return; }
9511
- const priorContext = files.map((f) => ({ name: f.name, text: f.text }));
9512
- // Continuous Q&A: prior completed turns, in order, as user/assistant pairs.
9630
+ const priorContext = filesRef.current.slice();
9513
9631
  const historyMsgs = [];
9514
9632
  for (const turn of turns) {
9515
9633
  if (turn.pending || !turn.answer || turn.error) continue;
@@ -9517,18 +9635,16 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9517
9635
  historyMsgs.push({ role: 'assistant', text: turn.answer });
9518
9636
  }
9519
9637
  const pendingId = `p-${Date.now()}-${Math.random().toString(36).slice(2)}`;
9520
- const pending = {
9638
+ updateTurns((cur) => [...cur, {
9521
9639
  id: pendingId, question: q, answer: '', context: priorContext, at: Date.now(), pending: true,
9522
- };
9640
+ }]);
9523
9641
  setBusy(true);
9524
9642
  setError('');
9525
- setQuestion('');
9526
- setFiles([]);
9527
9643
  setCopied(false);
9528
- updateTurns((cur) => [...cur, pending]);
9529
9644
  setActiveTab('chat');
9530
- // Title: first message wins if empty. Auto-generate via LLM only when
9531
- // the user opted in — one tiny, token-capped request.
9645
+ if (typeof inputActions?.setDraft === 'function') inputActions.setDraft('');
9646
+ filesRef.current = [];
9647
+ pruneAddedAttachments();
9532
9648
  if (!conversation.title) {
9533
9649
  const fallback = q.slice(0, 40);
9534
9650
  setConversation((cur) => ({ ...cur, title: fallback }));
@@ -9556,18 +9672,63 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9556
9672
  });
9557
9673
  const body = await response.json();
9558
9674
  if (!body?.ok) throw new Error(body?.error ?? `HTTP ${response.status}`);
9559
- updateTurns((cur) => cur.map((t) => (t.id === pendingId
9560
- ? { ...t, answer: typeof body.answer === 'string' ? body.answer : '', pending: false }
9561
- : t)));
9675
+ updateTurns((cur) => cur.map((turn) => (turn.id === pendingId
9676
+ ? { ...turn, answer: typeof body.answer === 'string' ? body.answer : '', pending: false }
9677
+ : turn)));
9562
9678
  } catch (err) {
9563
- // Render the failure in the thread like a normal assistant reply.
9564
- updateTurns((cur) => cur.map((t) => (t.id === pendingId
9565
- ? { ...t, answer: String(err?.message ?? err), pending: false, error: true }
9566
- : t)));
9679
+ updateTurns((cur) => cur.map((turn) => (turn.id === pendingId
9680
+ ? { ...turn, answer: String(err?.message ?? err), pending: false, error: true }
9681
+ : turn)));
9567
9682
  } finally {
9568
9683
  setBusy(false);
9569
9684
  }
9570
- }, [question, files, turns, t, conversation.title, settings.directAskAutoTitle, updateTurns]);
9685
+ }, [turns, t, conversation.title, settings.directAskAutoTitle, inputActions, updateTurns, pruneAddedAttachments]);
9686
+
9687
+ // Intercept the host Send button and plain Enter while Direct Ask is open.
9688
+ // Capture phase runs before React's bubble handler, so the message never
9689
+ // reaches the session controller.
9690
+ useEffect(() => {
9691
+ if (!open || seat === null) return undefined;
9692
+ const onPointer = (event) => {
9693
+ const send = findComposerSend(seat);
9694
+ if (send === null || send === undefined) return;
9695
+ const target = event.target;
9696
+ if (target !== send && !(target instanceof Node && send.contains(target))) return;
9697
+ event.preventDefault();
9698
+ event.stopPropagation();
9699
+ void sendToAsk();
9700
+ };
9701
+ const onKey = (event) => {
9702
+ if (event.key !== 'Enter' || event.shiftKey || event.isComposing === true || event.repeat === true) return;
9703
+ const target = event.target;
9704
+ const editor = target instanceof Element ? target.closest('[data-composer-input]') : null;
9705
+ if (editor === null || !seat.contains(editor)) return;
9706
+ if (editor.hasAttribute('data-composer-composing') || editor.hasAttribute('data-composer-chip-selected')) return;
9707
+ const openMenu = document.querySelector?.(
9708
+ '[aria-haspopup="listbox"][aria-expanded="true"], [aria-haspopup="menu"][aria-expanded="true"], [role="listbox"]:not([hidden]), [role="menu"]:not([hidden])',
9709
+ );
9710
+ if (openMenu !== null && openMenu !== undefined) return;
9711
+ event.preventDefault();
9712
+ event.stopPropagation();
9713
+ void sendToAsk();
9714
+ };
9715
+ seat.addEventListener('click', onPointer, true);
9716
+ document.addEventListener('keydown', onKey, true);
9717
+ return () => {
9718
+ seat.removeEventListener('click', onPointer, true);
9719
+ document.removeEventListener('keydown', onKey, true);
9720
+ };
9721
+ }, [open, seat, sendToAsk]);
9722
+
9723
+ // Escape closes the overlay.
9724
+ useEffect(() => {
9725
+ if (!open) return undefined;
9726
+ const onKey = (event) => {
9727
+ if (event.key === 'Escape') { event.stopPropagation(); setOpen(false); }
9728
+ };
9729
+ document.addEventListener('keydown', onKey, true);
9730
+ return () => document.removeEventListener('keydown', onKey, true);
9731
+ }, [open]);
9571
9732
 
9572
9733
  const archiveCurrent = useCallback(() => {
9573
9734
  if (conversation.turns.length === 0) return history;
@@ -9604,7 +9765,6 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9604
9765
  const next = titleDraft.trim().slice(0, 60);
9605
9766
  if (next !== '') {
9606
9767
  setConversation((cur) => ({ ...cur, title: next }));
9607
- // Also update the archived copy if this conversation is in history.
9608
9768
  setHistory((cur) => cur.map((h) => (h.id === conversation.id ? { ...h, title: next } : h)));
9609
9769
  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 */ }
9610
9770
  }
@@ -9617,28 +9777,13 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9617
9777
  persistHistory([]);
9618
9778
  }, [t, persistHistory]);
9619
9779
 
9620
- const pickFiles = useCallback(async (event) => {
9621
- const picked = Array.from(event?.target?.files ?? []);
9622
- const loaded = [];
9623
- for (const file of picked) {
9624
- try {
9625
- const text = await file.text();
9626
- loaded.push({ name: file.name, text: String(text).slice(0, 40_000) });
9627
- } catch {
9628
- /* skip unreadable files */
9629
- }
9630
- }
9631
- setFiles((current) => [...current, ...loaded]);
9632
- if (event?.target) event.target.value = '';
9633
- }, []);
9634
-
9635
9780
  if (settings.directAsk === false) return null;
9636
9781
 
9637
9782
  const lightning = h('svg', { viewBox: '0 0 16 16', width: 16, height: 16, 'aria-hidden': 'true' },
9638
9783
  h('path', { d: 'M9 1.5 3.5 9H7l-1 5.5L12.5 7H9l1-5.5Z', fill: 'currentColor' }),
9639
9784
  );
9640
9785
 
9641
- // Icon-only composer button.
9786
+ // Icon-only composer button — deliberately kept inside the real input.
9642
9787
  const button = h('button', {
9643
9788
  type: 'button',
9644
9789
  className: 'dsh-powerup-directask-btn' + (open ? ' on' : ''),
@@ -9647,18 +9792,14 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9647
9792
  onClick: () => setOpen((v) => !v),
9648
9793
  }, lightning);
9649
9794
 
9650
- const dialog = !open ? null : h('div', {
9795
+ const dialog = !open || geo === null ? null : h('div', {
9651
9796
  className: 'dsh-powerup-directask-window',
9652
- style: { left: `${pos.x}px`, top: `${pos.y}px`, width: `${size.w}px`, height: `${size.h}px` },
9653
- },
9654
- h('div', {
9655
- className: 'dsh-powerup-directask-titlebar',
9656
- onPointerDown: (event) => {
9657
- const target = event.target;
9658
- if (target instanceof Element && target.closest('button')) return;
9659
- dragRef.current = { kind: 'move', x: event.clientX, y: event.clientY, px: pos.x, py: pos.y };
9660
- },
9797
+ style: {
9798
+ left: `${geo.left}px`, width: `${geo.width}px`,
9799
+ top: `${geo.top}px`, height: `${geo.height}px`,
9661
9800
  },
9801
+ },
9802
+ h('div', { className: 'dsh-powerup-directask-titlebar' },
9662
9803
  editingTitle
9663
9804
  ? h('input', {
9664
9805
  className: 'dsh-powerup-directask-title-input',
@@ -9671,7 +9812,6 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9671
9812
  else if (event.key === 'Escape') { event.preventDefault(); setEditingTitle(false); }
9672
9813
  },
9673
9814
  onBlur: saveTitle,
9674
- onPointerDown: (event) => event.stopPropagation(),
9675
9815
  })
9676
9816
  : h('span', { className: 'dsh-powerup-directask-title', title: conversation.title || t('directAsk.title') },
9677
9817
  conversation.title || t('directAsk.title')),
@@ -9751,55 +9891,10 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9751
9891
  h('div', { ref: bottomRef }),
9752
9892
  ),
9753
9893
  error ? h('p', { className: 'dsh-powerup-progress-error' }, error) : null,
9754
- activeTab === 'chat' ? h('div', { className: 'dsh-powerup-directask-composer' },
9755
- files.length > 0 ? h('div', { className: 'dsh-powerup-directask-files' },
9756
- files.map((f, i) => h('span', { key: i, className: 'dsh-powerup-directask-file' },
9757
- f.name,
9758
- h('button', {
9759
- type: 'button', 'aria-label': t('directAsk.removeFile'),
9760
- onClick: () => setFiles((cur) => cur.filter((_, j) => j !== i)),
9761
- }, '×'),
9762
- )),
9763
- ) : null,
9764
- h('div', { className: 'dsh-powerup-directask-inputrow' },
9765
- h('label', { className: 'dsh-powerup-directask-attach', title: t('directAsk.attachHint') },
9766
- h('input', { type: 'file', multiple: true, onChange: (e) => void pickFiles(e) }),
9767
- h('span', null, '+'),
9768
- ),
9769
- h('textarea', {
9770
- className: 'dsh-powerup-directask-input',
9771
- value: question,
9772
- placeholder: t('directAsk.placeholder'),
9773
- disabled: busy,
9774
- rows: 1,
9775
- onChange: (event) => setQuestion(event.target.value),
9776
- onKeyDown: (event) => {
9777
- if (event.key === 'Enter' && !event.shiftKey && !event.isComposing) {
9778
- event.preventDefault();
9779
- void send();
9780
- }
9781
- },
9782
- }),
9783
- h('button', {
9784
- type: 'button', className: 'dsh-powerup-directask-send',
9785
- disabled: busy || question.trim() === '', onClick: () => void send(),
9786
- title: t('directAsk.send'),
9787
- }, h('svg', { viewBox: '0 0 16 16', width: 16, height: 16, 'aria-hidden': 'true' },
9788
- 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' }))),
9789
- ),
9790
- ) : null,
9791
- h('div', {
9792
- className: 'dsh-powerup-directask-resizer',
9793
- onPointerDown: (event) => {
9794
- event.preventDefault();
9795
- dragRef.current = { kind: 'resize', x: event.clientX, y: event.clientY, w: size.w, h: size.h };
9796
- },
9797
- }),
9798
9894
  );
9799
9895
 
9800
9896
  return h(React.Fragment, null, button, renderInBody(dialog));
9801
9897
  }
9802
-
9803
9898
  function DualSendButtons({ sessionId, useInput, inputActions, ctx, t }) {
9804
9899
  const settings = useSettings();
9805
9900
  const draft = typeof useInput === 'function' ? useInput((s) => s.draft) : '';
@@ -10843,12 +10938,14 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
10843
10938
  const [targetWorkspace, setTargetWorkspace] = useState(requirementCreateDraft.workspaceId ?? key);
10844
10939
  const [closing, setClosing] = useState(false);
10845
10940
  const closingRef = useRef(false);
10846
- const workspaces = (() => {
10847
- try {
10848
- const snapshot = ctxRef.current?.get?.('workspaces')?.list?.getSnapshot?.();
10849
- return Array.isArray(snapshot?.items) ? snapshot.items : [];
10850
- } catch { return []; }
10851
- })();
10941
+ // Like PromptCreateModal, the requirement can only belong to the
10942
+ // session's own workspace or to all workspaces — never an arbitrary one.
10943
+ const scopeOptions = fixedScope
10944
+ ? [{ value: '', label: t('prompts.anyWorkspace') }]
10945
+ : [
10946
+ { value: key, label: t('prompts.workspaceCurrent'), hint: workspaceTitle || key },
10947
+ { value: '', label: t('prompts.anyWorkspace') },
10948
+ ];
10852
10949
  const requestClose = () => {
10853
10950
  if (closingRef.current) return;
10854
10951
  closingRef.current = true;
@@ -10904,10 +11001,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
10904
11001
  h('span', { className: 'dsh-powerup-prompt-field-label' }, t('prompts.workspaceLabel')),
10905
11002
  h(WorkspaceSelect, {
10906
11003
  value: targetWorkspace,
10907
- options: [
10908
- { value: '', label: t('prompts.anyWorkspace') },
10909
- ...workspaces.map((ws) => ({ value: ws.workspaceId, label: ws.title || ws.workspaceId, hint: ws.title ? ws.workspaceId : undefined })),
10910
- ],
11004
+ options: scopeOptions,
10911
11005
  onChange: setTargetWorkspace,
10912
11006
  t,
10913
11007
  }),
@@ -11143,6 +11237,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11143
11237
  /** Render the host's exact composer model dropdown inside the progress header. */
11144
11238
  function ProgressModelSelect({ sessionId, ctx, t: translate }) {
11145
11239
  const slots = ctx?.get?.('slots');
11240
+ const seatRef = useRef(null);
11146
11241
  const [entry, setEntry] = useState(() => findModelSelectEntry(slots));
11147
11242
  useEffect(() => {
11148
11243
  if (entry !== null || slots === undefined) return undefined;
@@ -11176,13 +11271,47 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11176
11271
  // because no other plugin contributes extra model actions.
11177
11272
  const seatRenderSlot = useCallback((key, owner, opts) => opts?.fallback ?? null, []);
11178
11273
 
11274
+ // The host ModelSelect portals its menu to document.body at z-index 1100,
11275
+ // below our progress panel (1500). Both the trigger inside this seat and
11276
+ // the portaled menu carry the same inline --dsh-model-anchor variable, so
11277
+ // match on it, lift the menu above the panel, and tag it. The tag lets
11278
+ // the panel's outside-click handler ignore clicks inside that menu.
11279
+ useEffect(() => {
11280
+ if (entry === null || face === null) return undefined;
11281
+ const syncMenu = () => {
11282
+ const seat = seatRef.current;
11283
+ if (!(seat instanceof Element)) return;
11284
+ const trigger = seat.querySelector('[style*="--dsh-model-anchor"]');
11285
+ if (!(trigger instanceof HTMLElement)) return;
11286
+ const anchor = trigger.style.getPropertyValue('--dsh-model-anchor').trim();
11287
+ if (anchor === '') return;
11288
+ const menus = document.querySelectorAll('body > [style*="--dsh-model-anchor"]');
11289
+ for (const menu of menus) {
11290
+ if (!(menu instanceof HTMLElement)) continue;
11291
+ if (menu.style.getPropertyValue('--dsh-model-anchor').trim() !== anchor) continue;
11292
+ menu.classList.add('dsh-powerup-model-menu-raise');
11293
+ menu.setAttribute('data-powerup-model-menu', '');
11294
+ }
11295
+ };
11296
+ syncMenu();
11297
+ const observer = typeof MutationObserver === 'function'
11298
+ ? new MutationObserver(syncMenu)
11299
+ : null;
11300
+ if (observer !== null) observer.observe(document.body, { childList: true });
11301
+ const timer = window.setInterval(syncMenu, 400);
11302
+ return () => {
11303
+ if (observer !== null) observer.disconnect();
11304
+ window.clearInterval(timer);
11305
+ };
11306
+ }, [entry, face]);
11307
+
11179
11308
  if (entry === null || face === null || seatT === null) {
11180
11309
  return h('span', {
11181
11310
  className: 'dsh-powerup-progress-model-loading',
11182
11311
  title: translate?.('progress.modelChanging') ?? '',
11183
11312
  }, '…');
11184
11313
  }
11185
- return h('span', { className: 'dsh-powerup-progress-model-seat' },
11314
+ return h('span', { className: 'dsh-powerup-progress-model-seat', ref: seatRef },
11186
11315
  h(entry.component, { ...face, t: seatT, renderSlot: seatRenderSlot, locked: false }),
11187
11316
  );
11188
11317
  }
@@ -11359,6 +11488,10 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11359
11488
  if (panel !== null && event.target instanceof Node && panel.contains(event.target)) return;
11360
11489
  if (button !== null && event.target instanceof Node && button.contains(event.target)) return;
11361
11490
  if (creatingReq && event.target instanceof Element && event.target.closest('[data-powerup-req-modal]')) return;
11491
+ // Both the host model dropdown and our own WorkspaceSelect portal
11492
+ // their menus to document.body. Clicks there are outside the panel
11493
+ // node but must not dismiss it.
11494
+ if (event.target instanceof Element && event.target.closest('[data-powerup-model-menu], [data-powerup-ws-menu]')) return;
11362
11495
  close();
11363
11496
  };
11364
11497
  document.addEventListener('keydown', onKey, true);
@@ -11450,7 +11583,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11450
11583
  // Three tabs below the header: progress / requirements / raw output.
11451
11584
  // The requirements tab is labelled "刷新进度": it holds the generation
11452
11585
  // requirements and the refresh action that consumes them. The refresh
11453
- // button lives here only (not in the footer), beside "新建要求".
11586
+ // button lives here only (not in the footer), to the right of "新建要求".
11454
11587
  const tabs = [
11455
11588
  { id: 'progress', label: t('progress.tabProgress') },
11456
11589
  { id: 'requirements', label: t('progress.tabRefresh') },
@@ -11479,10 +11612,6 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11479
11612
  if (report === null || report === undefined) {
11480
11613
  return h('div', null,
11481
11614
  h('p', { className: 'dsh-powerup-progress-empty' }, t('progress.empty')),
11482
- h('button', {
11483
- type: 'button', className: 'dsh-powerup-progress-refresh',
11484
- disabled: busy, onClick: () => void run(),
11485
- }, t('progress.generate')),
11486
11615
  );
11487
11616
  }
11488
11617
  return h('div', null,
@@ -11519,6 +11648,10 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11519
11648
  onTextChange: setReqText,
11520
11649
  }),
11521
11650
  h('div', { className: 'dsh-powerup-progress-req-actions' },
11651
+ h('button', {
11652
+ type: 'button', className: 'dsh-powerup-prompt-new dsh-powerup-req-create',
11653
+ onClick: () => setCreatingReq(true),
11654
+ }, t('progress.reqNew')),
11522
11655
  running
11523
11656
  ? h('button', {
11524
11657
  type: 'button', className: 'dsh-powerup-progress-refresh',
@@ -11529,10 +11662,6 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11529
11662
  disabled: busy || cooldownActive, title: cooldownActive ? refreshLabel : undefined,
11530
11663
  onClick: () => void run(),
11531
11664
  }, refreshLabel),
11532
- h('button', {
11533
- type: 'button', className: 'dsh-powerup-prompt-new dsh-powerup-req-create',
11534
- onClick: () => setCreatingReq(true),
11535
- }, t('progress.reqNew')),
11536
11665
  ),
11537
11666
  );
11538
11667
 
@@ -11698,7 +11827,11 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11698
11827
  register('conversation.input.right', {
11699
11828
  id: 'powerup-direct-ask',
11700
11829
  order: 82,
11701
- }, (props) => h(DirectAskButton, { sessionId: props?.sessionId }), 'dsh-powerup: direct ask');
11830
+ }, (props) => h(DirectAskButton, {
11831
+ ...props,
11832
+ ctx,
11833
+ t: (key, params) => translateCurrent(key, params),
11834
+ }), 'dsh-powerup: direct ask');
11702
11835
 
11703
11836
  // In an ongoing session, place the prompt picker in the bottom tool row
11704
11837
  // just after the host's permission / plan dropdowns; its popover opens
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restregular/dsh-powerup",
3
- "version": "0.19.0",
3
+ "version": "0.19.2",
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",