@restregular/dsh-powerup 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -10
- package/client.js +175 -93
- package/lib/direct-ask.js +14 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -456,21 +456,28 @@ requirements you want** — checked ones fill an editable text box that you may
|
|
|
456
456
|
freely modify, and generation/refresh uses the full box text verbatim. The panel
|
|
457
457
|
also has a **New requirement** entry with a modal pinned to the session's
|
|
458
458
|
workspace (like the prompt picker).
|
|
459
|
-
The panel
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
459
|
+
The panel uses **tabs** below the header: **Progress**, **Requirements** and
|
|
460
|
+
**Raw output** — requirements and the raw AI text are no longer embedded in the
|
|
461
|
+
progress body. Stage cards (checklist steps, phases, milestones and tree nodes)
|
|
462
|
+
are **collapsible**. The panel is wider by default, resizable from its
|
|
463
|
+
bottom-right corner (size persisted), and its header tint shifts from blue
|
|
464
|
+
toward warning red as the report ages. Every refresh adds a new report to a
|
|
465
|
+
per-session history stored on disk; older reports stay browsable and are never
|
|
466
|
+
discarded. The panel can clear the history explicitly. "Refresh progress"
|
|
467
|
+
generates a new report without dropping the old ones.
|
|
466
468
|
|
|
467
469
|
### Direct ask (no Agent)
|
|
468
470
|
|
|
469
471
|
An **icon-only** lightning button in the composer opens a floating DSH-styled
|
|
470
472
|
chat window. Drag the title bar to move it and the bottom-right corner to
|
|
471
|
-
resize it (position and size persist). It supports **continuous multi-turn Q&A
|
|
472
|
-
|
|
473
|
-
|
|
473
|
+
resize it (position and size persist). It supports **continuous multi-turn Q&A**.
|
|
474
|
+
The chat window uses two **tabs** — **Chat** and **History** — instead of
|
|
475
|
+
embedding the history over the conversation. Your message appears in the thread
|
|
476
|
+
immediately as a pending bubble; the answer replaces the pending state in place
|
|
477
|
+
(and failures render there too). Continuous Q&A flattens prior turns into a
|
|
478
|
+
single user message before each call, so no hand-built assistant message ever
|
|
479
|
+
reaches the model adapter — this fixes the "LLM_FAILED" error on the second
|
|
480
|
+
message. "+" starts a new chat. Attach text files with the "+" chip in the
|
|
474
481
|
composer — the native file picker stays hidden. This is deliberately **not an
|
|
475
482
|
Agent**: it uses a single `llm.prepareCall` + stream call per turn with a short
|
|
476
483
|
instruction, so no system prompt sections, tools, skills, memory or background
|
package/client.js
CHANGED
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
const requirementCreateDraft = { workspaceId: null, title: '', text: '', scope: 'current' };
|
|
86
86
|
/** Fallback bucket when the hero cannot resolve an owning workspace yet. */
|
|
87
87
|
const UNSCOPED_WORKSPACE = '__unscoped__';
|
|
88
|
-
const VERSION = '0.
|
|
88
|
+
const VERSION = '0.17.0';
|
|
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. */
|
|
@@ -377,7 +377,11 @@
|
|
|
377
377
|
'progress.updated': '更新于 {time}',
|
|
378
378
|
'progress.history': '历史进度',
|
|
379
379
|
'progress.historyEmpty': '暂无历史记录',
|
|
380
|
-
'progress.viewRaw': '
|
|
380
|
+
'progress.viewRaw': '原始内容',
|
|
381
|
+
'progress.tabProgress': '进度',
|
|
382
|
+
'progress.rawEmpty': '本次报告没有原始文本。',
|
|
383
|
+
'progress.expand': '展开',
|
|
384
|
+
'progress.collapse': '折叠',
|
|
381
385
|
'progress.rawTitle': 'AI 原始生成内容',
|
|
382
386
|
'progress.rawHint': '这是模型返回的原始文本,未经解析处理。',
|
|
383
387
|
'progress.copyRaw': '复制原文',
|
|
@@ -426,6 +430,8 @@
|
|
|
426
430
|
'directAsk.hide': '隐藏弹窗',
|
|
427
431
|
'directAsk.showHint': '输入问题开始对话;可继续追问,点「+」开启新对话,点「◷」查看历史。拖动标题栏移动窗口。',
|
|
428
432
|
'directAsk.newChat': '新对话',
|
|
433
|
+
'directAsk.tabChat': '问答',
|
|
434
|
+
'directAsk.noAnswer': '(无回答)',
|
|
429
435
|
'directAsk.history': '历史记录',
|
|
430
436
|
'directAsk.historyEmpty': '还没有历史对话',
|
|
431
437
|
'directAsk.clearHistory': '清空历史',
|
|
@@ -767,7 +773,11 @@
|
|
|
767
773
|
'progress.updated': 'Updated at {time}',
|
|
768
774
|
'progress.history': 'History',
|
|
769
775
|
'progress.historyEmpty': 'No history yet',
|
|
770
|
-
'progress.viewRaw': '
|
|
776
|
+
'progress.viewRaw': 'Raw output',
|
|
777
|
+
'progress.tabProgress': 'Progress',
|
|
778
|
+
'progress.rawEmpty': 'No raw text for this report.',
|
|
779
|
+
'progress.expand': 'Expand',
|
|
780
|
+
'progress.collapse': 'Collapse',
|
|
771
781
|
'progress.rawTitle': 'Raw AI output',
|
|
772
782
|
'progress.rawHint': 'This is the exact text returned by the model, before parsing.',
|
|
773
783
|
'progress.copyRaw': 'Copy raw',
|
|
@@ -816,6 +826,8 @@
|
|
|
816
826
|
'directAsk.hide': 'Hide dialog',
|
|
817
827
|
'directAsk.showHint': 'Type a question to start; follow up anytime, "+" starts a new chat, "◷" shows history. Drag the title bar to move.',
|
|
818
828
|
'directAsk.newChat': 'New chat',
|
|
829
|
+
'directAsk.tabChat': 'Chat',
|
|
830
|
+
'directAsk.noAnswer': '(no answer)',
|
|
819
831
|
'directAsk.history': 'History',
|
|
820
832
|
'directAsk.historyEmpty': 'No saved conversations yet',
|
|
821
833
|
'directAsk.clearHistory': 'Clear history',
|
|
@@ -4459,11 +4471,12 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
4459
4471
|
.dsh-powerup-tab.on{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-brand-primary);font-weight:600;box-shadow:0 1px 2px rgba(0,0,0,.10)}
|
|
4460
4472
|
.dsh-powerup-tab:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}
|
|
4461
4473
|
/* Prompt management: head + cards + fields, styled after dsh-memory setcard/hook-card. */
|
|
4462
|
-
.dsh-powerup-prompt-head{display:flex;align-items:
|
|
4474
|
+
.dsh-powerup-prompt-head{display:flex;align-items:center;gap:12px;padding:0 2px 2px}
|
|
4475
|
+
.dsh-powerup-prompt-head>div:first-child{flex:1 1 auto;min-width:0}
|
|
4463
4476
|
.dsh-powerup-prompt-head-title{font-size:14px;font-weight:600;line-height:1.35}
|
|
4464
4477
|
.dsh-powerup-prompt-head-sub{font-size:11.5px;color:var(--dsw-alias-label-secondary);line-height:1.5;margin-top:2px}
|
|
4465
4478
|
.dsh-powerup-prompt-head .dsh-powerup-prompt-new{margin-left:auto}
|
|
4466
|
-
.dsh-powerup-prompt-new{height:30px;padding:0 12px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;font-size:12.5px;line-height:1.5;cursor:pointer;transition:border-color .12s ease,color .12s ease}
|
|
4479
|
+
.dsh-powerup-prompt-new{flex:none;white-space:nowrap;height:30px;padding:0 12px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;font-size:12.5px;line-height:1.5;cursor:pointer;transition:border-color .12s ease,color .12s ease}
|
|
4467
4480
|
.dsh-powerup-prompt-new:hover{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}
|
|
4468
4481
|
.dsh-powerup-prompt-new:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}
|
|
4469
4482
|
.dsh-powerup-prompt-scopes{display:flex;flex-direction:column;gap:16px;margin-top:14px}
|
|
@@ -4579,7 +4592,19 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
4579
4592
|
.dsh-powerup-progress-fill{height:100%;border-radius:999px;background:var(--dsw-alias-brand-primary);transition:width .3s ease}
|
|
4580
4593
|
.dsh-powerup-progress-section{margin:12px 0 6px;color:var(--dsw-alias-label-tertiary);font-size:10.5px;font-weight:600;letter-spacing:.04em;text-transform:uppercase}
|
|
4581
4594
|
.dsh-powerup-progress-items{display:flex;flex-direction:column;gap:6px;margin:0;padding:0;list-style:none}
|
|
4582
|
-
.dsh-powerup-progress-item{display:flex;
|
|
4595
|
+
.dsh-powerup-progress-item{display:flex;flex-direction:column;gap:4px;padding:6px 8px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-1)}
|
|
4596
|
+
.dsh-powerup-progress-item-head{display:flex;align-items:center;gap:7px;min-width:0}
|
|
4597
|
+
.dsh-powerup-progress-item-toggle{flex:none;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:0;border-radius:4px;background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer;transition:transform .12s ease}
|
|
4598
|
+
.dsh-powerup-progress-item-toggle svg{transform:rotate(-90deg);transition:transform .12s ease}
|
|
4599
|
+
.dsh-powerup-progress-item:not(.is-collapsed) .dsh-powerup-progress-item-toggle svg{transform:none}
|
|
4600
|
+
.dsh-powerup-progress-item-toggle-spacer{flex:none;width:16px;height:16px}
|
|
4601
|
+
.dsh-powerup-progress-item-detail{margin-left:23px;color:var(--dsw-alias-label-tertiary);font-size:10.5px;line-height:1.5;overflow-wrap:anywhere}
|
|
4602
|
+
.dsh-powerup-progress-tabs{display:flex;flex:none;gap:2px;padding:0 12px;border-bottom:.5px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1)}
|
|
4603
|
+
.dsh-powerup-progress-tab{position:relative;padding:8px 12px;border:0;background:transparent;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:11.5px;line-height:1.5;cursor:pointer}
|
|
4604
|
+
.dsh-powerup-progress-tab:hover{color:var(--dsw-alias-label-primary)}
|
|
4605
|
+
.dsh-powerup-progress-tab.on{color:var(--dsw-alias-brand-primary);font-weight:600}
|
|
4606
|
+
.dsh-powerup-progress-tab.on:after{content:"";position:absolute;left:8px;right:8px;bottom:-1px;height:2px;border-radius:2px;background:var(--dsw-alias-brand-primary)}
|
|
4607
|
+
.dsh-powerup-progress-req-tab{display:flex;flex-direction:column;gap:6px}
|
|
4583
4608
|
.dsh-powerup-progress-badge{flex:none;display:inline-flex;align-items:center;justify-content:center;min-width:16px;height:16px;padding:0 5px;border-radius:8px;font-size:9.5px;font-weight:700;letter-spacing:.02em}
|
|
4584
4609
|
.dsh-powerup-progress-badge[data-status=pending]{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-tertiary)}
|
|
4585
4610
|
.dsh-powerup-progress-badge[data-status=in-progress]{background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 14%,transparent);color:var(--dsw-alias-state-business-primary)}
|
|
@@ -4646,6 +4671,11 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
4646
4671
|
.dsh-powerup-directask-subtitle{flex:1 1 auto;min-width:0;color:var(--dsw-alias-label-tertiary);font-size:10.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
4647
4672
|
.dsh-powerup-directask-titlebtn,.dsh-powerup-directask-close{flex:none;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:var(--dsw-radius-sm,6px);background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:15px;line-height:1;cursor:pointer}
|
|
4648
4673
|
.dsh-powerup-directask-titlebtn:hover,.dsh-powerup-directask-titlebtn.on,.dsh-powerup-directask-close:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
|
|
4674
|
+
.dsh-powerup-directask-tabs{display:flex;flex:none;gap:2px;padding:0 12px;border-bottom:.5px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1)}
|
|
4675
|
+
.dsh-powerup-directask-tab{position:relative;padding:8px 12px;border:0;background:transparent;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:11.5px;cursor:pointer}
|
|
4676
|
+
.dsh-powerup-directask-tab:hover{color:var(--dsw-alias-label-primary)}
|
|
4677
|
+
.dsh-powerup-directask-tab.on{color:var(--dsw-alias-brand-primary);font-weight:600}
|
|
4678
|
+
.dsh-powerup-directask-tab.on:after{content:"";position:absolute;left:8px;right:8px;bottom:-1px;height:2px;border-radius:2px;background:var(--dsw-alias-brand-primary)}
|
|
4649
4679
|
.dsh-powerup-directask-history{flex:none;max-height:180px;overflow-y:auto;padding:10px 14px;border-bottom:.5px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1)}
|
|
4650
4680
|
.dsh-powerup-directask-history-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px;font-size:11.5px}
|
|
4651
4681
|
.dsh-powerup-directask-history-list{margin:0;padding:0;list-style:none}
|
|
@@ -4660,6 +4690,8 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
4660
4690
|
.dsh-powerup-directask-msg-body{padding:8px 12px;border-radius:12px;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);font-size:12.5px;line-height:1.7;white-space:pre-wrap;overflow-wrap:anywhere}
|
|
4661
4691
|
.dsh-powerup-directask-msg.user .dsh-powerup-directask-msg-body{background:var(--dsw-alias-brand-primary);color:var(--dsw-alias-label-primary-foreground,var(--dsw-alias-bg-layer-1));border-bottom-right-radius:3px}
|
|
4662
4692
|
.dsh-powerup-directask-msg.assistant .dsh-powerup-directask-msg-body{border-bottom-left-radius:3px}
|
|
4693
|
+
.dsh-powerup-directask-msg.assistant.is-pending .dsh-powerup-directask-msg-body{color:var(--dsw-alias-label-tertiary);font-style:italic}
|
|
4694
|
+
.dsh-powerup-directask-msg.assistant.is-error .dsh-powerup-directask-msg-body{border:1px solid color-mix(in srgb,var(--dsw-alias-state-error-primary) 40%,transparent);color:var(--dsw-alias-state-error-primary)}
|
|
4663
4695
|
.dsh-powerup-directask-ctx{display:flex;flex-wrap:wrap;gap:4px;align-self:flex-end}
|
|
4664
4696
|
.dsh-powerup-directask-ctx span{padding:2px 7px;border-radius:999px;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-tertiary);font-size:10px}
|
|
4665
4697
|
.dsh-powerup-directask-files{display:flex;flex-wrap:wrap;gap:6px;padding:0 14px 6px}
|
|
@@ -9199,7 +9231,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9199
9231
|
try { return JSON.parse(localStorage.getItem('dsh-powerup:directask:history:v1') || '[]'); }
|
|
9200
9232
|
catch { return []; }
|
|
9201
9233
|
});
|
|
9202
|
-
const [
|
|
9234
|
+
const [activeTab, setActiveTab] = useState('chat');
|
|
9203
9235
|
const [pos, setPos] = useState(() => {
|
|
9204
9236
|
try {
|
|
9205
9237
|
const saved = JSON.parse(localStorage.getItem('dsh-powerup:directask:pos:v1') || 'null');
|
|
@@ -9279,17 +9311,24 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9279
9311
|
const q = question.trim();
|
|
9280
9312
|
if (q === '') { setError(t('directAsk.empty')); return; }
|
|
9281
9313
|
const priorContext = files.map((f) => ({ name: f.name, text: f.text }));
|
|
9282
|
-
// Continuous Q&A:
|
|
9314
|
+
// Continuous Q&A: prior completed turns, in order, as user/assistant pairs.
|
|
9283
9315
|
const historyMsgs = [];
|
|
9284
9316
|
for (const turn of turns) {
|
|
9317
|
+
if (turn.pending || !turn.answer || turn.error) continue;
|
|
9285
9318
|
historyMsgs.push({ role: 'user', text: turn.question });
|
|
9286
|
-
|
|
9319
|
+
historyMsgs.push({ role: 'assistant', text: turn.answer });
|
|
9287
9320
|
}
|
|
9321
|
+
const pendingId = `p-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
9322
|
+
const pending = {
|
|
9323
|
+
id: pendingId, question: q, answer: '', context: priorContext, at: Date.now(), pending: true,
|
|
9324
|
+
};
|
|
9288
9325
|
setBusy(true);
|
|
9289
9326
|
setError('');
|
|
9290
9327
|
setQuestion('');
|
|
9291
9328
|
setFiles([]);
|
|
9292
9329
|
setCopied(false);
|
|
9330
|
+
setTurns((cur) => [...cur, pending]);
|
|
9331
|
+
setActiveTab('chat');
|
|
9293
9332
|
try {
|
|
9294
9333
|
const response = await fetch(DIRECT_ASK_API, {
|
|
9295
9334
|
method: 'POST',
|
|
@@ -9303,13 +9342,14 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9303
9342
|
});
|
|
9304
9343
|
const body = await response.json();
|
|
9305
9344
|
if (!body?.ok) throw new Error(body?.error ?? `HTTP ${response.status}`);
|
|
9306
|
-
setTurns((cur) =>
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
}]);
|
|
9345
|
+
setTurns((cur) => cur.map((t) => (t.id === pendingId
|
|
9346
|
+
? { ...t, answer: typeof body.answer === 'string' ? body.answer : '', pending: false }
|
|
9347
|
+
: t)));
|
|
9310
9348
|
} catch (err) {
|
|
9311
|
-
|
|
9312
|
-
|
|
9349
|
+
// Render the failure in the thread like a normal assistant reply.
|
|
9350
|
+
setTurns((cur) => cur.map((t) => (t.id === pendingId
|
|
9351
|
+
? { ...t, answer: String(err?.message ?? err), pending: false, error: true }
|
|
9352
|
+
: t)));
|
|
9313
9353
|
} finally {
|
|
9314
9354
|
setBusy(false);
|
|
9315
9355
|
}
|
|
@@ -9319,14 +9359,14 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9319
9359
|
if (turns.length > 0) persistHistory([{ id: String(Date.now()), at: Date.now(), turns }, ...history]);
|
|
9320
9360
|
setTurns([]);
|
|
9321
9361
|
setError('');
|
|
9322
|
-
|
|
9362
|
+
setActiveTab('chat');
|
|
9323
9363
|
}, [turns, history, persistHistory]);
|
|
9324
9364
|
|
|
9325
9365
|
const openArchived = useCallback((entry) => {
|
|
9326
9366
|
if (turns.length > 0) persistHistory([{ id: String(Date.now()), at: Date.now(), turns }, ...history.filter((h) => h.id !== entry.id)]);
|
|
9327
9367
|
else persistHistory(history.filter((h) => h.id !== entry.id));
|
|
9328
9368
|
setTurns(Array.isArray(entry.turns) ? entry.turns : []);
|
|
9329
|
-
|
|
9369
|
+
setActiveTab('chat');
|
|
9330
9370
|
}, [turns, history, persistHistory]);
|
|
9331
9371
|
|
|
9332
9372
|
const clearHistory = useCallback(() => {
|
|
@@ -9383,18 +9423,27 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9383
9423
|
type: 'button', className: 'dsh-powerup-directask-titlebtn',
|
|
9384
9424
|
title: t('directAsk.newChat'), onClick: newChat,
|
|
9385
9425
|
}, '+'),
|
|
9386
|
-
h('button', {
|
|
9387
|
-
type: 'button', className: 'dsh-powerup-directask-titlebtn' + (showHistory ? ' on' : ''),
|
|
9388
|
-
title: t('directAsk.history'), onClick: () => setShowHistory((v) => !v),
|
|
9389
|
-
}, '◷'),
|
|
9390
9426
|
h('button', {
|
|
9391
9427
|
type: 'button', className: 'dsh-powerup-directask-close',
|
|
9392
9428
|
'aria-label': t('directAsk.close'), onClick: () => setOpen(false),
|
|
9393
9429
|
}, '×'),
|
|
9394
9430
|
),
|
|
9395
|
-
|
|
9431
|
+
h('div', { className: 'dsh-powerup-directask-tabs', role: 'tablist' },
|
|
9432
|
+
h('button', {
|
|
9433
|
+
type: 'button', role: 'tab',
|
|
9434
|
+
'aria-selected': activeTab === 'chat' ? 'true' : 'false',
|
|
9435
|
+
className: 'dsh-powerup-directask-tab' + (activeTab === 'chat' ? ' on' : ''),
|
|
9436
|
+
onClick: () => setActiveTab('chat'),
|
|
9437
|
+
}, t('directAsk.tabChat')),
|
|
9438
|
+
h('button', {
|
|
9439
|
+
type: 'button', role: 'tab',
|
|
9440
|
+
'aria-selected': activeTab === 'history' ? 'true' : 'false',
|
|
9441
|
+
className: 'dsh-powerup-directask-tab' + (activeTab === 'history' ? ' on' : ''),
|
|
9442
|
+
onClick: () => setActiveTab('history'),
|
|
9443
|
+
}, t('directAsk.history')),
|
|
9444
|
+
),
|
|
9445
|
+
activeTab === 'history' ? h('div', { className: 'dsh-powerup-directask-history' },
|
|
9396
9446
|
h('div', { className: 'dsh-powerup-directask-history-head' },
|
|
9397
|
-
h('strong', null, t('directAsk.history')),
|
|
9398
9447
|
h('button', { type: 'button', className: 'dsh-powerup-progress-mini', onClick: clearHistory }, t('directAsk.clearHistory')),
|
|
9399
9448
|
),
|
|
9400
9449
|
history.length === 0
|
|
@@ -9407,32 +9456,33 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9407
9456
|
),
|
|
9408
9457
|
)),
|
|
9409
9458
|
),
|
|
9410
|
-
) :
|
|
9411
|
-
h('div', { className: 'dsh-powerup-directask-thread' },
|
|
9459
|
+
) : h('div', { className: 'dsh-powerup-directask-thread' },
|
|
9412
9460
|
turns.length === 0 && !busy
|
|
9413
9461
|
? h('p', { className: 'dsh-powerup-directask-welcome' }, t('directAsk.showHint'))
|
|
9414
9462
|
: null,
|
|
9415
|
-
turns.map((turn
|
|
9463
|
+
turns.map((turn) => h('div', { key: turn.id, className: 'dsh-powerup-directask-turn' },
|
|
9416
9464
|
h('div', { className: 'dsh-powerup-directask-msg user' },
|
|
9417
9465
|
h('div', { className: 'dsh-powerup-directask-msg-body' }, turn.question),
|
|
9418
9466
|
),
|
|
9419
9467
|
turn.context?.length ? h('div', { className: 'dsh-powerup-directask-ctx' },
|
|
9420
9468
|
turn.context.map((f, j) => h('span', { key: j }, f.name)),
|
|
9421
9469
|
) : null,
|
|
9422
|
-
h('div', {
|
|
9423
|
-
|
|
9424
|
-
|
|
9470
|
+
h('div', {
|
|
9471
|
+
className: 'dsh-powerup-directask-msg assistant'
|
|
9472
|
+
+ (turn.pending ? ' is-pending' : '') + (turn.error ? ' is-error' : ''),
|
|
9473
|
+
},
|
|
9474
|
+
h('div', { className: 'dsh-powerup-directask-msg-body' },
|
|
9475
|
+
turn.pending ? t('directAsk.sending') : (turn.answer || t('directAsk.noAnswer')),
|
|
9476
|
+
),
|
|
9477
|
+
!turn.pending && turn.answer ? h('button', {
|
|
9425
9478
|
type: 'button', className: 'dsh-powerup-progress-mini',
|
|
9426
9479
|
onClick: async () => {
|
|
9427
9480
|
const ok = await copyText(turn.answer);
|
|
9428
9481
|
if (ok) { setCopied(true); setTimeout(() => setCopied(false), 1500); }
|
|
9429
9482
|
},
|
|
9430
|
-
}, copied ? t('directAsk.copied') : t('directAsk.copy')),
|
|
9483
|
+
}, copied ? t('directAsk.copied') : t('directAsk.copy')) : null,
|
|
9431
9484
|
),
|
|
9432
9485
|
)),
|
|
9433
|
-
busy ? h('div', { className: 'dsh-powerup-directask-msg assistant' },
|
|
9434
|
-
h('div', { className: 'dsh-powerup-directask-msg-body' }, t('directAsk.sending')),
|
|
9435
|
-
) : null,
|
|
9436
9486
|
h('div', { ref: bottomRef }),
|
|
9437
9487
|
),
|
|
9438
9488
|
error ? h('p', { className: 'dsh-powerup-progress-error' }, error) : null,
|
|
@@ -10545,7 +10595,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
10545
10595
|
h('div', { className: 'dsh-powerup-prompt-modal-head' },
|
|
10546
10596
|
h('div', null,
|
|
10547
10597
|
h('div', { className: 'dsh-powerup-prompt-modal-heading' }, t('progress.reqNew')),
|
|
10548
|
-
h('p', { className: 'dsh-powerup-prompt-modal-sub' }, t('prompts.createScopeHint')),
|
|
10598
|
+
h('p', { className: 'dsh-powerup-prompt-modal-sub' }, fixedScope ? t('prompts.workspaceNone') : t('prompts.createScopeHint')),
|
|
10549
10599
|
),
|
|
10550
10600
|
h('button', { type: 'button', className: 'dsh-powerup-prompt-modal-close', 'aria-label': t('prompts.cancel'), onClick: requestClose }, '×'),
|
|
10551
10601
|
),
|
|
@@ -10554,19 +10604,20 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
10554
10604
|
h('span', { className: 'dsh-powerup-prompt-field-label' }, t('prompts.titleLabel')),
|
|
10555
10605
|
h('input', { className: 'dsh-powerup-prompt-input', type: 'text', value: title, placeholder: t('prompts.titlePlaceholder'), onChange: (e) => setTitle(e.target.value) }),
|
|
10556
10606
|
),
|
|
10557
|
-
|
|
10558
|
-
h('
|
|
10559
|
-
|
|
10560
|
-
h(
|
|
10561
|
-
|
|
10562
|
-
|
|
10563
|
-
|
|
10564
|
-
|
|
10565
|
-
|
|
10566
|
-
|
|
10567
|
-
|
|
10568
|
-
|
|
10569
|
-
|
|
10607
|
+
!fixedScope
|
|
10608
|
+
? h('label', { className: 'dsh-powerup-prompt-field' },
|
|
10609
|
+
h('span', { className: 'dsh-powerup-prompt-field-label' }, t('prompts.workspaceLabel')),
|
|
10610
|
+
h(WorkspaceSelect, {
|
|
10611
|
+
value: scope,
|
|
10612
|
+
options: [
|
|
10613
|
+
{ value: 'current', label: t('prompts.workspaceCurrent'), hint: workspaceTitle },
|
|
10614
|
+
{ value: 'all', label: t('prompts.anyWorkspace') },
|
|
10615
|
+
],
|
|
10616
|
+
onChange: setScope,
|
|
10617
|
+
t,
|
|
10618
|
+
}),
|
|
10619
|
+
)
|
|
10620
|
+
: null,
|
|
10570
10621
|
h('label', { className: 'dsh-powerup-prompt-field' },
|
|
10571
10622
|
h('span', { className: 'dsh-powerup-prompt-field-label' }, t('progress.reqTextLabel')),
|
|
10572
10623
|
h('textarea', { className: 'dsh-powerup-prompt-input dsh-powerup-prompt-textarea', value: text, placeholder: t('progress.reqPlaceholder'), onChange: (e) => setText(e.target.value) }),
|
|
@@ -10627,32 +10678,50 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
10627
10678
|
}, STATUS_LABEL[status] ?? status);
|
|
10628
10679
|
}
|
|
10629
10680
|
|
|
10630
|
-
/**
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10681
|
+
/**
|
|
10682
|
+
* One collapsible node (checklist step / phase / milestone / tree node).
|
|
10683
|
+
* Rendered via h(ProgressItem, …) so each card owns its own collapse state.
|
|
10684
|
+
*/
|
|
10685
|
+
function ProgressItem({ title, status, detail, children, nodeKey, t: translate }) {
|
|
10686
|
+
const [collapsed, setCollapsed] = useState(false);
|
|
10687
|
+
const hasBody = Boolean(detail) || (Array.isArray(children) && children.length > 0);
|
|
10688
|
+
return h('li', { key: nodeKey, className: 'dsh-powerup-progress-item' + (collapsed ? ' is-collapsed' : '') },
|
|
10689
|
+
h('div', { className: 'dsh-powerup-progress-item-head' },
|
|
10690
|
+
hasBody
|
|
10691
|
+
? h('button', {
|
|
10692
|
+
type: 'button',
|
|
10693
|
+
className: 'dsh-powerup-progress-item-toggle',
|
|
10694
|
+
'aria-expanded': collapsed ? 'false' : 'true',
|
|
10695
|
+
'aria-label': collapsed ? (translate?.('progress.expand') ?? 'Expand') : (translate?.('progress.collapse') ?? 'Collapse'),
|
|
10696
|
+
onClick: () => setCollapsed((v) => !v),
|
|
10697
|
+
}, h('svg', { width: 10, height: 10, viewBox: '0 0 16 16', fill: 'none', 'aria-hidden': 'true' },
|
|
10698
|
+
h('path', { d: 'm4 6 4 4 4-4', stroke: 'currentColor', strokeWidth: 1.4, strokeLinecap: 'round', strokeLinejoin: 'round' })))
|
|
10699
|
+
: h('span', { className: 'dsh-powerup-progress-item-toggle-spacer' }),
|
|
10700
|
+
ProgressBadge(status),
|
|
10635
10701
|
h('span', { className: 'dsh-powerup-progress-item-title' }, title),
|
|
10636
|
-
detail ? h('span', { className: 'dsh-powerup-progress-item-detail' }, detail) : null,
|
|
10637
|
-
Array.isArray(children) && children.length > 0
|
|
10638
|
-
? h('ul', { className: 'dsh-powerup-progress-children' }, children)
|
|
10639
|
-
: null,
|
|
10640
10702
|
),
|
|
10703
|
+
!collapsed && detail ? h('span', { className: 'dsh-powerup-progress-item-detail' }, detail) : null,
|
|
10704
|
+
!collapsed && Array.isArray(children) && children.length > 0
|
|
10705
|
+
? h('ul', { className: 'dsh-powerup-progress-children' }, children)
|
|
10706
|
+
: null,
|
|
10641
10707
|
);
|
|
10642
10708
|
}
|
|
10643
10709
|
|
|
10644
10710
|
/** Render the model-chosen structured body. */
|
|
10645
|
-
function ProgressStructure(report) {
|
|
10711
|
+
function ProgressStructure(report, t) {
|
|
10646
10712
|
if (report === null || typeof report !== 'object') return null;
|
|
10647
10713
|
const sections = [];
|
|
10714
|
+
const item = (title, status, detail, children, nodeKey) => h(ProgressItem, {
|
|
10715
|
+
key: nodeKey, title, status, detail, children, nodeKey, t,
|
|
10716
|
+
});
|
|
10648
10717
|
const mode = report.mode ?? 'checklist';
|
|
10649
10718
|
if (mode === 'phases' && Array.isArray(report.phases) && report.phases.length > 0) {
|
|
10650
10719
|
sections.push(h('div', { key: 'phases' },
|
|
10651
10720
|
h('div', { className: 'dsh-powerup-progress-section' }, MODE_LABEL.phases),
|
|
10652
|
-
h('ul', { className: 'dsh-powerup-progress-items' }, report.phases.map((phase, i) =>
|
|
10721
|
+
h('ul', { className: 'dsh-powerup-progress-items' }, report.phases.map((phase, i) => item(
|
|
10653
10722
|
phase.name, phase.status, phase.detail,
|
|
10654
10723
|
Array.isArray(phase.steps) && phase.steps.length > 0
|
|
10655
|
-
? phase.steps.map((s, j) =>
|
|
10724
|
+
? phase.steps.map((s, j) => item(s.title, s.status, '', null, `p${i}-s${j}`))
|
|
10656
10725
|
: null,
|
|
10657
10726
|
`phase-${i}`,
|
|
10658
10727
|
))),
|
|
@@ -10660,13 +10729,13 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
10660
10729
|
} else if (mode === 'milestones' && Array.isArray(report.milestones) && report.milestones.length > 0) {
|
|
10661
10730
|
sections.push(h('div', { key: 'milestones' },
|
|
10662
10731
|
h('div', { className: 'dsh-powerup-progress-section' }, MODE_LABEL.milestones),
|
|
10663
|
-
h('ul', { className: 'dsh-powerup-progress-items' }, report.milestones.map((m, i) =>
|
|
10732
|
+
h('ul', { className: 'dsh-powerup-progress-items' }, report.milestones.map((m, i) => item(
|
|
10664
10733
|
m.name, m.status, m.criteria ? `${m.detail ?? ''} · ${m.criteria}`.trim() : m.detail,
|
|
10665
10734
|
null, `m-${i}`,
|
|
10666
10735
|
))),
|
|
10667
10736
|
));
|
|
10668
10737
|
} else if (mode === 'tree' && report.tree !== null && report.tree !== undefined) {
|
|
10669
|
-
const node = (n, key) =>
|
|
10738
|
+
const node = (n, key) => item(
|
|
10670
10739
|
n.title, n.status, n.detail,
|
|
10671
10740
|
Array.isArray(n.children) && n.children.length > 0 ? n.children.map((c, i) => node(c, `${key}-${i}`)) : null,
|
|
10672
10741
|
key,
|
|
@@ -10678,7 +10747,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
10678
10747
|
} else if (Array.isArray(report.steps) && report.steps.length > 0) {
|
|
10679
10748
|
sections.push(h('div', { key: 'steps' },
|
|
10680
10749
|
h('div', { className: 'dsh-powerup-progress-section' }, MODE_LABEL.checklist),
|
|
10681
|
-
h('ul', { className: 'dsh-powerup-progress-items' }, report.steps.map((s, i) =>
|
|
10750
|
+
h('ul', { className: 'dsh-powerup-progress-items' }, report.steps.map((s, i) => item(
|
|
10682
10751
|
s.title, s.status, s.detail, null, `step-${i}`,
|
|
10683
10752
|
))),
|
|
10684
10753
|
));
|
|
@@ -10753,8 +10822,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
10753
10822
|
const [view, setView] = useState(null);
|
|
10754
10823
|
const [busy, setBusy] = useState(false);
|
|
10755
10824
|
const [historyIndex, setHistoryIndex] = useState(0);
|
|
10756
|
-
const [
|
|
10757
|
-
const [showReq, setShowReq] = useState(false);
|
|
10825
|
+
const [activeTab, setActiveTab] = useState('progress');
|
|
10758
10826
|
// Selected requirement ids + the free-editable combined text.
|
|
10759
10827
|
const [selectedReqIds, setSelectedReqIds] = useState([]);
|
|
10760
10828
|
const [reqText, setReqText] = useState('');
|
|
@@ -10964,12 +11032,29 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
10964
11032
|
h('div', { className: 'dsh-powerup-progress-fill', style: { width: `${report.percent}%` } }),
|
|
10965
11033
|
),
|
|
10966
11034
|
),
|
|
10967
|
-
ProgressStructure(report),
|
|
11035
|
+
ProgressStructure(report, t),
|
|
10968
11036
|
ProgressDisplay(report),
|
|
10969
11037
|
);
|
|
10970
11038
|
})();
|
|
10971
11039
|
|
|
10972
|
-
|
|
11040
|
+
// Three tabs below the header: progress / requirements / raw output.
|
|
11041
|
+
const tabs = [
|
|
11042
|
+
{ id: 'progress', label: t('progress.tabProgress') },
|
|
11043
|
+
{ id: 'requirements', label: t('progress.requirements') },
|
|
11044
|
+
{ id: 'raw', label: t('progress.viewRaw') },
|
|
11045
|
+
];
|
|
11046
|
+
const tabBar = h('div', { className: 'dsh-powerup-progress-tabs', role: 'tablist' },
|
|
11047
|
+
tabs.map((tab) => h('button', {
|
|
11048
|
+
key: tab.id,
|
|
11049
|
+
type: 'button',
|
|
11050
|
+
role: 'tab',
|
|
11051
|
+
'aria-selected': activeTab === tab.id ? 'true' : 'false',
|
|
11052
|
+
className: 'dsh-powerup-progress-tab' + (activeTab === tab.id ? ' on' : ''),
|
|
11053
|
+
onClick: () => setActiveTab(tab.id),
|
|
11054
|
+
}, tab.label)),
|
|
11055
|
+
);
|
|
11056
|
+
|
|
11057
|
+
const progressBody = (() => {
|
|
10973
11058
|
if (view === null) return h('div', { className: 'dsh-powerup-progress-empty' }, t('progress.hint'));
|
|
10974
11059
|
if (view.status === 'error') return h('p', { className: 'dsh-powerup-progress-error' }, view.error ?? t('progress.failed'));
|
|
10975
11060
|
if (running) {
|
|
@@ -10978,18 +11063,6 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
10978
11063
|
reportBody,
|
|
10979
11064
|
);
|
|
10980
11065
|
}
|
|
10981
|
-
if (showRaw) {
|
|
10982
|
-
const raw = typeof report?.raw === 'string' ? report.raw : '';
|
|
10983
|
-
return h('div', null,
|
|
10984
|
-
h('h4', { className: 'dsh-powerup-progress-section' }, t('progress.rawTitle')),
|
|
10985
|
-
h('p', { className: 'dsh-powerup-progress-empty' }, t('progress.rawHint')),
|
|
10986
|
-
h('pre', { className: 'dsh-powerup-progress-code' }, raw || '(empty)'),
|
|
10987
|
-
h('button', {
|
|
10988
|
-
type: 'button', className: 'dsh-powerup-progress-refresh',
|
|
10989
|
-
onClick: () => void copyText(raw),
|
|
10990
|
-
}, t('progress.copyRaw')),
|
|
10991
|
-
);
|
|
10992
|
-
}
|
|
10993
11066
|
if (report === null || report === undefined) {
|
|
10994
11067
|
return h('div', null,
|
|
10995
11068
|
h('p', { className: 'dsh-powerup-progress-empty' }, t('progress.empty')),
|
|
@@ -11019,8 +11092,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11019
11092
|
);
|
|
11020
11093
|
})();
|
|
11021
11094
|
|
|
11022
|
-
const
|
|
11023
|
-
h('span', { className: 'dsh-powerup-prompt-field-label' }, t('progress.reqSelect')),
|
|
11095
|
+
const requirementsBody = h('div', { className: 'dsh-powerup-progress-req-tab' },
|
|
11024
11096
|
h('p', { className: 'dsh-powerup-setting-hint' }, t('progress.reqSelectHint')),
|
|
11025
11097
|
h(RequirementPicker, {
|
|
11026
11098
|
reqs: visibleReqs,
|
|
@@ -11034,7 +11106,24 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11034
11106
|
type: 'button', className: 'dsh-powerup-prompt-new dsh-powerup-req-create',
|
|
11035
11107
|
onClick: () => setCreatingReq(true),
|
|
11036
11108
|
}, t('progress.reqNew')),
|
|
11037
|
-
)
|
|
11109
|
+
);
|
|
11110
|
+
|
|
11111
|
+
const rawBody = h('div', null,
|
|
11112
|
+
h('p', { className: 'dsh-powerup-progress-empty' }, t('progress.rawHint')),
|
|
11113
|
+
h('pre', { className: 'dsh-powerup-progress-code' },
|
|
11114
|
+
(typeof report?.raw === 'string' ? report.raw : '') || t('progress.rawEmpty')),
|
|
11115
|
+
h('button', {
|
|
11116
|
+
type: 'button', className: 'dsh-powerup-progress-refresh',
|
|
11117
|
+
disabled: typeof report?.raw !== 'string' || report.raw === '',
|
|
11118
|
+
onClick: () => void copyText(typeof report?.raw === 'string' ? report.raw : ''),
|
|
11119
|
+
}, t('progress.copyRaw')),
|
|
11120
|
+
);
|
|
11121
|
+
|
|
11122
|
+
const activeBody = activeTab === 'requirements'
|
|
11123
|
+
? requirementsBody
|
|
11124
|
+
: activeTab === 'raw'
|
|
11125
|
+
? rawBody
|
|
11126
|
+
: progressBody;
|
|
11038
11127
|
|
|
11039
11128
|
const panel = !open ? null : h('div', {
|
|
11040
11129
|
ref: panelRef,
|
|
@@ -11065,20 +11154,12 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11065
11154
|
'aria-label': t('progress.close'), onClick: close,
|
|
11066
11155
|
}, '×'),
|
|
11067
11156
|
),
|
|
11068
|
-
|
|
11069
|
-
h('div', { className: 'dsh-powerup-progress-body' },
|
|
11157
|
+
tabBar,
|
|
11158
|
+
h('div', { className: 'dsh-powerup-progress-body' }, activeBody),
|
|
11070
11159
|
h('div', { className: 'dsh-powerup-progress-foot' },
|
|
11071
11160
|
h('span', { className: 'dsh-powerup-progress-time' },
|
|
11072
11161
|
view?.updatedAt ? format(t('progress.updated'), { time: new Date(view.updatedAt).toLocaleTimeString() }) : '',
|
|
11073
11162
|
),
|
|
11074
|
-
h('button', {
|
|
11075
|
-
type: 'button', className: 'dsh-powerup-progress-mini',
|
|
11076
|
-
onClick: () => setShowReq((v) => !v),
|
|
11077
|
-
}, t('progress.requirements')),
|
|
11078
|
-
report?.raw ? h('button', {
|
|
11079
|
-
type: 'button', className: 'dsh-powerup-progress-mini',
|
|
11080
|
-
onClick: () => setShowRaw((v) => !v),
|
|
11081
|
-
}, t('progress.viewRaw')) : null,
|
|
11082
11163
|
history.length > 0 ? h('button', {
|
|
11083
11164
|
type: 'button', className: 'dsh-powerup-progress-mini',
|
|
11084
11165
|
onClick: () => void clearHistory(),
|
|
@@ -11276,14 +11357,15 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
11276
11357
|
PROMPTS_CSS,
|
|
11277
11358
|
PROGRESS_CSS,
|
|
11278
11359
|
ProgressControl,
|
|
11360
|
+
ProgressItem,
|
|
11361
|
+
ProgressStructure,
|
|
11362
|
+
ProgressDisplay,
|
|
11279
11363
|
RequirementManager,
|
|
11280
11364
|
RequirementCreateModal,
|
|
11281
11365
|
RequirementForm,
|
|
11282
11366
|
RequirementPicker,
|
|
11283
11367
|
requirementForWorkspace: requirementsForWorkspace,
|
|
11284
11368
|
DirectAskButton,
|
|
11285
|
-
ProgressStructure,
|
|
11286
|
-
ProgressDisplay,
|
|
11287
11369
|
progressRequest,
|
|
11288
11370
|
PROMPTS_LAST_KEY,
|
|
11289
11371
|
promptCreateDraft,
|
package/lib/direct-ask.js
CHANGED
|
@@ -91,19 +91,27 @@ export async function directAsk({ llm, route, prompt, history, signal, maxTokens
|
|
|
91
91
|
maxTokens: Number.isFinite(maxTokens) ? maxTokens : DIRECT_ASK_MAX_TOKENS,
|
|
92
92
|
};
|
|
93
93
|
const call = await llm.prepareCall(config, signal);
|
|
94
|
-
|
|
94
|
+
// Flatten the whole conversation into ONE user message. DSH's message
|
|
95
|
+
// pipeline requires a full `id`/`role`/`content`/`source` shape on every
|
|
96
|
+
// message; hand-built assistant messages (without a valid model source) are
|
|
97
|
+
// rejected by the adapter on the second turn ("LLM_FAILED"). Sending a single
|
|
98
|
+
// user message with the prior turns as text keeps every call stateless and
|
|
99
|
+
// robust — the same approach the proven progress side-call uses.
|
|
100
|
+
const sections = [];
|
|
95
101
|
for (const turn of Array.isArray(history) ? history : []) {
|
|
96
102
|
if (turn === null || typeof turn !== 'object') continue;
|
|
97
|
-
const
|
|
98
|
-
if (
|
|
103
|
+
const label = turn.role === 'assistant' ? 'Assistant' : turn.role === 'user' ? 'User' : null;
|
|
104
|
+
if (label === null) continue;
|
|
99
105
|
const text = cleanAskText(turn.text);
|
|
100
106
|
if (text === '') continue;
|
|
101
|
-
|
|
107
|
+
sections.push(`${label}: ${text}`);
|
|
102
108
|
}
|
|
103
|
-
|
|
109
|
+
const combined = sections.length > 0
|
|
110
|
+
? `${sections.join('\n\n')}\n\nUser: ${question}`
|
|
111
|
+
: question;
|
|
104
112
|
const options = {
|
|
105
113
|
...call.config,
|
|
106
|
-
messages,
|
|
114
|
+
messages: [{ role: 'user', content: [{ type: 'text', text: combined }] }],
|
|
107
115
|
system: DIRECT_ASK_SYSTEM_PROMPT,
|
|
108
116
|
purpose: 'powerup-direct-ask',
|
|
109
117
|
...(signal === undefined ? {} : { signal }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@restregular/dsh-powerup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
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",
|