@restregular/dsh-powerup 0.19.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.
Files changed (3) hide show
  1. package/README.md +21 -16
  2. package/client.js +295 -182
  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.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,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,11 @@ 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
+ .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}
4703
4708
  .dsh-powerup-directask-title{font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:240px}
4704
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}
4705
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}
@@ -4743,18 +4748,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
4743
4748
  .dsh-powerup-directask-files{display:flex;flex-wrap:wrap;gap:6px;padding:0 14px 6px}
4744
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}
4745
4750
  .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%)}
4751
+ .dsh-powerup-directask-btn.on{box-shadow:0 0 0 2px color-mix(in srgb,var(--dsw-alias-brand-primary) 30%,transparent)}
4758
4752
  `;
4759
4753
 
4760
4754
  /** Max display length of a session option, in Unicode code points. */
@@ -9395,11 +9389,70 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9395
9389
  * model — no Agent, system prompt, tools or skills. Supports continuous
9396
9390
  * multi-turn Q&A and a browsable/clearable history of past exchanges.
9397
9391
  */
9398
- function DirectAskButton({ sessionId }) {
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 }) {
9399
9454
  const settings = useSettings();
9400
9455
  const [open, setOpen] = useState(false);
9401
- const [question, setQuestion] = useState('');
9402
- const [files, setFiles] = useState([]);
9403
9456
  const [busy, setBusy] = useState(false);
9404
9457
  const [error, setError] = useState('');
9405
9458
  const [copied, setCopied] = useState(false);
@@ -9426,27 +9479,35 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9426
9479
  const [titleDraft, setTitleDraft] = useState('');
9427
9480
  const turns = conversation.turns;
9428
9481
  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);
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]);
9447
9504
  const bottomRef = useRef(null);
9448
9505
  const sessionRef = useRef(sessionId);
9449
9506
  sessionRef.current = sessionId;
9507
+ const draftRef = useRef(draft);
9508
+ draftRef.current = draft;
9509
+ const busyRef = useRef(false);
9510
+ busyRef.current = busy;
9450
9511
  const t = useCallback((key, params) => translateCurrent(key, params), []);
9451
9512
 
9452
9513
  const persistHistory = useCallback((next) => {
@@ -9458,58 +9519,95 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9458
9519
  setConversation((cur) => ({ ...cur, turns: typeof fn === 'function' ? fn(cur.turns) : fn }));
9459
9520
  }, []);
9460
9521
 
9522
+ // Resolve and pin the composer seat while open.
9461
9523
  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);
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);
9468
9531
  }, [open]);
9469
9532
 
9470
- // Drag (title bar) and resize (bottom-right handle) with native pointers.
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.
9471
9536
  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
- }
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
+ });
9487
9549
  };
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 */ }
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);
9495
9557
  };
9496
- document.addEventListener('pointermove', onMove);
9497
- document.addEventListener('pointerup', onUp);
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);
9498
9585
  return () => {
9499
- document.removeEventListener('pointermove', onMove);
9500
- document.removeEventListener('pointerup', onUp);
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 = [];
9501
9597
  };
9502
- }, [open, pos, size]);
9598
+ }, [open, seat, inputActions, pruneAddedAttachments]);
9503
9599
 
9504
9600
  useEffect(() => {
9505
9601
  if (bottomRef.current !== null) bottomRef.current.scrollIntoView?.({ block: 'nearest' });
9506
9602
  }, [turns, busy]);
9507
9603
 
9508
- const send = useCallback(async () => {
9509
- const q = question.trim();
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();
9510
9609
  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.
9610
+ const priorContext = filesRef.current.slice();
9513
9611
  const historyMsgs = [];
9514
9612
  for (const turn of turns) {
9515
9613
  if (turn.pending || !turn.answer || turn.error) continue;
@@ -9517,18 +9615,16 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9517
9615
  historyMsgs.push({ role: 'assistant', text: turn.answer });
9518
9616
  }
9519
9617
  const pendingId = `p-${Date.now()}-${Math.random().toString(36).slice(2)}`;
9520
- const pending = {
9618
+ updateTurns((cur) => [...cur, {
9521
9619
  id: pendingId, question: q, answer: '', context: priorContext, at: Date.now(), pending: true,
9522
- };
9620
+ }]);
9523
9621
  setBusy(true);
9524
9622
  setError('');
9525
- setQuestion('');
9526
- setFiles([]);
9527
9623
  setCopied(false);
9528
- updateTurns((cur) => [...cur, pending]);
9529
9624
  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.
9625
+ if (typeof inputActions?.setDraft === 'function') inputActions.setDraft('');
9626
+ filesRef.current = [];
9627
+ pruneAddedAttachments();
9532
9628
  if (!conversation.title) {
9533
9629
  const fallback = q.slice(0, 40);
9534
9630
  setConversation((cur) => ({ ...cur, title: fallback }));
@@ -9556,18 +9652,63 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9556
9652
  });
9557
9653
  const body = await response.json();
9558
9654
  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)));
9655
+ updateTurns((cur) => cur.map((turn) => (turn.id === pendingId
9656
+ ? { ...turn, answer: typeof body.answer === 'string' ? body.answer : '', pending: false }
9657
+ : turn)));
9562
9658
  } 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)));
9659
+ updateTurns((cur) => cur.map((turn) => (turn.id === pendingId
9660
+ ? { ...turn, answer: String(err?.message ?? err), pending: false, error: true }
9661
+ : turn)));
9567
9662
  } finally {
9568
9663
  setBusy(false);
9569
9664
  }
9570
- }, [question, files, turns, t, conversation.title, settings.directAskAutoTitle, updateTurns]);
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]);
9571
9712
 
9572
9713
  const archiveCurrent = useCallback(() => {
9573
9714
  if (conversation.turns.length === 0) return history;
@@ -9604,7 +9745,6 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9604
9745
  const next = titleDraft.trim().slice(0, 60);
9605
9746
  if (next !== '') {
9606
9747
  setConversation((cur) => ({ ...cur, title: next }));
9607
- // Also update the archived copy if this conversation is in history.
9608
9748
  setHistory((cur) => cur.map((h) => (h.id === conversation.id ? { ...h, title: next } : h)));
9609
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 */ }
9610
9750
  }
@@ -9617,28 +9757,13 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9617
9757
  persistHistory([]);
9618
9758
  }, [t, persistHistory]);
9619
9759
 
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
9760
  if (settings.directAsk === false) return null;
9636
9761
 
9637
9762
  const lightning = h('svg', { viewBox: '0 0 16 16', width: 16, height: 16, 'aria-hidden': 'true' },
9638
9763
  h('path', { d: 'M9 1.5 3.5 9H7l-1 5.5L12.5 7H9l1-5.5Z', fill: 'currentColor' }),
9639
9764
  );
9640
9765
 
9641
- // Icon-only composer button.
9766
+ // Icon-only composer button — deliberately kept inside the real input.
9642
9767
  const button = h('button', {
9643
9768
  type: 'button',
9644
9769
  className: 'dsh-powerup-directask-btn' + (open ? ' on' : ''),
@@ -9647,18 +9772,14 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9647
9772
  onClick: () => setOpen((v) => !v),
9648
9773
  }, lightning);
9649
9774
 
9650
- const dialog = !open ? null : h('div', {
9775
+ const dialog = !open || geo === null ? null : h('div', {
9651
9776
  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
- },
9777
+ style: {
9778
+ left: `${geo.left}px`, width: `${geo.width}px`,
9779
+ top: `${geo.top}px`, height: `${geo.height}px`,
9661
9780
  },
9781
+ },
9782
+ h('div', { className: 'dsh-powerup-directask-titlebar' },
9662
9783
  editingTitle
9663
9784
  ? h('input', {
9664
9785
  className: 'dsh-powerup-directask-title-input',
@@ -9671,7 +9792,6 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9671
9792
  else if (event.key === 'Escape') { event.preventDefault(); setEditingTitle(false); }
9672
9793
  },
9673
9794
  onBlur: saveTitle,
9674
- onPointerDown: (event) => event.stopPropagation(),
9675
9795
  })
9676
9796
  : h('span', { className: 'dsh-powerup-directask-title', title: conversation.title || t('directAsk.title') },
9677
9797
  conversation.title || t('directAsk.title')),
@@ -9751,55 +9871,10 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9751
9871
  h('div', { ref: bottomRef }),
9752
9872
  ),
9753
9873
  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
9874
  );
9799
9875
 
9800
9876
  return h(React.Fragment, null, button, renderInBody(dialog));
9801
9877
  }
9802
-
9803
9878
  function DualSendButtons({ sessionId, useInput, inputActions, ctx, t }) {
9804
9879
  const settings = useSettings();
9805
9880
  const draft = typeof useInput === 'function' ? useInput((s) => s.draft) : '';
@@ -11143,6 +11218,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11143
11218
  /** Render the host's exact composer model dropdown inside the progress header. */
11144
11219
  function ProgressModelSelect({ sessionId, ctx, t: translate }) {
11145
11220
  const slots = ctx?.get?.('slots');
11221
+ const seatRef = useRef(null);
11146
11222
  const [entry, setEntry] = useState(() => findModelSelectEntry(slots));
11147
11223
  useEffect(() => {
11148
11224
  if (entry !== null || slots === undefined) return undefined;
@@ -11176,13 +11252,47 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11176
11252
  // because no other plugin contributes extra model actions.
11177
11253
  const seatRenderSlot = useCallback((key, owner, opts) => opts?.fallback ?? null, []);
11178
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
+
11179
11289
  if (entry === null || face === null || seatT === null) {
11180
11290
  return h('span', {
11181
11291
  className: 'dsh-powerup-progress-model-loading',
11182
11292
  title: translate?.('progress.modelChanging') ?? '',
11183
11293
  }, '…');
11184
11294
  }
11185
- return h('span', { className: 'dsh-powerup-progress-model-seat' },
11295
+ return h('span', { className: 'dsh-powerup-progress-model-seat', ref: seatRef },
11186
11296
  h(entry.component, { ...face, t: seatT, renderSlot: seatRenderSlot, locked: false }),
11187
11297
  );
11188
11298
  }
@@ -11359,6 +11469,9 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11359
11469
  if (panel !== null && event.target instanceof Node && panel.contains(event.target)) return;
11360
11470
  if (button !== null && event.target instanceof Node && button.contains(event.target)) return;
11361
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;
11362
11475
  close();
11363
11476
  };
11364
11477
  document.addEventListener('keydown', onKey, true);
@@ -11450,7 +11563,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11450
11563
  // Three tabs below the header: progress / requirements / raw output.
11451
11564
  // The requirements tab is labelled "刷新进度": it holds the generation
11452
11565
  // requirements and the refresh action that consumes them. The refresh
11453
- // button lives here only (not in the footer), beside "新建要求".
11566
+ // button lives here only (not in the footer), to the right of "新建要求".
11454
11567
  const tabs = [
11455
11568
  { id: 'progress', label: t('progress.tabProgress') },
11456
11569
  { id: 'requirements', label: t('progress.tabRefresh') },
@@ -11479,10 +11592,6 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11479
11592
  if (report === null || report === undefined) {
11480
11593
  return h('div', null,
11481
11594
  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
11595
  );
11487
11596
  }
11488
11597
  return h('div', null,
@@ -11519,6 +11628,10 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11519
11628
  onTextChange: setReqText,
11520
11629
  }),
11521
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')),
11522
11635
  running
11523
11636
  ? h('button', {
11524
11637
  type: 'button', className: 'dsh-powerup-progress-refresh',
@@ -11529,10 +11642,6 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11529
11642
  disabled: busy || cooldownActive, title: cooldownActive ? refreshLabel : undefined,
11530
11643
  onClick: () => void run(),
11531
11644
  }, 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
11645
  ),
11537
11646
  );
11538
11647
 
@@ -11698,7 +11807,11 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11698
11807
  register('conversation.input.right', {
11699
11808
  id: 'powerup-direct-ask',
11700
11809
  order: 82,
11701
- }, (props) => h(DirectAskButton, { sessionId: props?.sessionId }), 'dsh-powerup: direct ask');
11810
+ }, (props) => h(DirectAskButton, {
11811
+ ...props,
11812
+ ctx,
11813
+ t: (key, params) => translateCurrent(key, params),
11814
+ }), 'dsh-powerup: direct ask');
11702
11815
 
11703
11816
  // In an ongoing session, place the prompt picker in the bottom tool row
11704
11817
  // 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.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",