@restregular/dsh-powerup 0.19.8 → 0.19.10

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 CHANGED
@@ -9,8 +9,8 @@ panel list into an adaptive icon grid with drag sorting, folders, a
9
9
  back-to-conversation tile, and restart/close tiles. It also adds a
10
10
  **task-progress panel** with three-layer requirements and browsable history, a
11
11
  **direct-ask button** for one-shot model answers without an Agent, and
12
- **quick-reply options** that let the Agent offer tappable text buttons above the
13
- composer.
12
+ **quick-reply options** that let the Agent offer tappable text buttons under its
13
+ last reply.
14
14
 
15
15
  ## Install
16
16
 
@@ -123,11 +123,29 @@ of tappable options for the current session:
123
123
  ] }
124
124
  ```
125
125
 
126
- Up to 8 options appear as pills above the composer. Tapping one sends its
127
- `message` as a normal user message. The options disappear as soon as the user
128
- sends any message — tapping an option, pressing Enter, or clicking the host's
129
- Send button. The Agent can also pass an empty `options` array to clear them
130
- immediately.
126
+ Each entry has a `label` (the short button text) and a `message` (the full text
127
+ sent when it is tapped). A short instruction for this tool is injected into the
128
+ system prompt, so the Agent knows when and how to offer options without extra
129
+ setup.
130
+
131
+ - **Where they appear.** Up to 8 options render as stacked buttons directly
132
+ above the copy / like / dislike / branch actions of the **last assistant
133
+ message** — visually attached to the reply they follow. The buttons follow
134
+ the newest message as the conversation advances.
135
+ - **What a tap does.** Tapping an option sends its `message` as a normal user
136
+ message through the session controller. It is a real message: it enters the
137
+ transcript and the Agent responds to it.
138
+ - **When they clear.** The options disappear as soon as the user sends *any*
139
+ message — tapping an option, pressing Enter in the composer, or clicking the
140
+ host's Send button. The Agent can also pass an empty `options` array to clear
141
+ them immediately, without waiting for a message.
142
+ - **Scoped and safe.** Options are keyed by session id, so one conversation's
143
+ buttons never leak into another. A version guard prevents a stale clear from
144
+ erasing a newer set of options.
145
+ - **Toggle.** The **Quick reply options** switch on the Power-Up page controls
146
+ both halves: turning it off removes the tool from the Agent and withdraws the
147
+ injected system-prompt section; turning it back on restores both. The switch
148
+ is kept in sync between the browser and the Host and persists across restarts.
131
149
 
132
150
  ### Sidebar launcher
133
151
 
@@ -533,6 +551,30 @@ system "busy Enter" preference:
533
551
  Plain Shift+Enter still inserts a newline, IME composition and slash/mention
534
552
  menus are left to the host, and an empty draft keeps the host's retry behavior.
535
553
 
554
+ ### Quick replies implementation notes
555
+
556
+ The Agent publishes options through a Host tool; the browser only renders them.
557
+ `powerup_quick_replies` writes a bounded, session-keyed record to
558
+ `~/.dsh/dsh-powerup/quick-replies.json` (at most 8 options) and derives the
559
+ calling session from `exec.agent.id`. A short how-to section is registered with
560
+ `ctx.systemPrompt.section` so the tool is discoverable without a setup step.
561
+
562
+ On the Client side, a `conversation.input.right` contribution polls the
563
+ `/dsh-powerup/api/quick-replies` route and portals a mount node into the host's
564
+ last `[data-turn-tail]` — the container around the assistant message's
565
+ `IconActions` row — inserted before its first child so the options sit above
566
+ the copy/like buttons. The mount re-elects the tail as new turns arrive. A
567
+ capture-phase click listener on the host Send button and a capture-phase keydown
568
+ listener on Enter clear the options through the Host (version-guarded), so any
569
+ user message retires them; tapping an option sends it via `session.prompt` and
570
+ clears them the same way.
571
+
572
+ Disabling the feature is a real teardown, not just visual hiding: the Client
573
+ POSTs the switch to the Host, whose controller unregisters the tool and disposes
574
+ the prompt section together; re-enabling re-registers both. The effects follow
575
+ the host's `ctx.effect` contract (registration in the effect body, disposal
576
+ returned as the cleanup), so a toggle cannot leave stale registrations behind.
577
+
536
578
  ## Development
537
579
 
538
580
  ```bash
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.8';
88
+ const VERSION = '0.19.10';
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. */
@@ -145,7 +145,7 @@
145
145
  'page.dualSendHow': '启用后输入框里会出现两个按钮,鼠标悬停可看到各自说明;输入文字后按 Enter 排队发送,按 Ctrl+Shift+Enter 立即插话发送。',
146
146
  'page.quickRepliesTitle': '快捷回复选项',
147
147
  'page.quickRepliesDesc': '允许 Agent 在回复后提供一组带文本的按钮选项。点击选项会立即把对应文本作为新消息发送,用户发出任意新消息(包括点击选项)后,这些选项会自动移除。',
148
- 'page.quickRepliesHow': 'Agent 通过 powerup_quick_replies 工具发布选项;选项出现于输入框上方,点击即可快速回复。',
148
+ 'page.quickRepliesHow': 'Agent 通过 powerup_quick_replies 工具发布选项;选项竖向排列在最后一条助手消息的复制/点赞按钮上方,点击即可快速回复。',
149
149
  'quickReplies.title': '快捷回复',
150
150
  'quickReplies.hint': '选择一个选项快速发送',
151
151
  'mask.tab': '内容屏蔽',
@@ -775,7 +775,7 @@
775
775
  'page.taskProgressCooldownHint': 'Minimum gap between refreshes to avoid accidental clicks; 0 disables the limit.',
776
776
  'page.quickRepliesTitle': 'Quick reply options',
777
777
  'page.quickRepliesDesc': 'Let the Agent offer a short list of text buttons after its reply. Tapping one sends its text as a new message immediately; the options are removed automatically once the user sends any message (including tapping an option).',
778
- 'page.quickRepliesHow': 'The Agent publishes options through the powerup_quick_replies tool; they appear above the composer and can be tapped to reply quickly.',
778
+ 'page.quickRepliesHow': 'The Agent publishes options through the powerup_quick_replies tool; they stack vertically above the copy/like buttons of the last assistant message.',
779
779
  'quickReplies.title': 'Quick replies',
780
780
  'quickReplies.hint': 'Pick an option to send it right away',
781
781
  'progress.title': 'Task progress',
@@ -4460,11 +4460,12 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
4460
4460
  `;
4461
4461
 
4462
4462
  const QUICK_REPLIES_CSS = `
4463
- /* Quick-reply options rendered just above the composer card. */
4464
- .dsh-powerup-quick-replies{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:6px 2px 2px}
4465
- .dsh-powerup-quick-replies-label{font-size:11px;line-height:18px;color:var(--dsw-alias-label-caption);margin-right:2px}
4466
- .dsh-powerup-quick-reply{display:inline-flex;align-items:center;max-width:100%;padding:5px 11px;border:.5px solid var(--dsw-alias-border-l2);border-radius:999px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-brand-primary,var(--dsw-alias-label-primary));font:inherit;font-size:12px;line-height:18px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;transition:background .12s ease,border-color .12s ease,transform .12s ease}
4467
- .dsh-powerup-quick-reply:hover{background:var(--dsw-alias-interactive-bg-hover);border-color:var(--dsw-alias-brand-primary,var(--dsw-alias-border-l3));transform:translateY(-1px)}
4463
+ /* Quick-reply options rendered above the assistant message's action row. */
4464
+ .dsh-powerup-quick-replies-mount{display:block;width:100%}
4465
+ .dsh-powerup-quick-replies{display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:4px 0 8px;max-width:100%}
4466
+ .dsh-powerup-quick-replies-label{font-size:11px;line-height:16px;color:var(--dsw-alias-label-caption)}
4467
+ .dsh-powerup-quick-reply{display:block;max-width:100%;padding:6px 12px;border:.5px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-brand-primary,var(--dsw-alias-label-primary));font:inherit;font-size:12px;line-height:18px;text-align:left;white-space:normal;overflow-wrap:anywhere;cursor:pointer;transition:background .12s ease,border-color .12s ease,transform .12s ease}
4468
+ .dsh-powerup-quick-reply:hover{background:var(--dsw-alias-interactive-bg-hover);border-color:var(--dsw-alias-brand-primary,var(--dsw-alias-border-l3));transform:translateX(2px)}
4468
4469
  .dsh-powerup-quick-reply:disabled{opacity:.5;cursor:not-allowed;transform:none}
4469
4470
  .dsh-powerup-quick-reply:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
4470
4471
  `;
@@ -9446,6 +9447,25 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9446
9447
  return seats[seats.length - 1] ?? null;
9447
9448
  }
9448
9449
 
9450
+ /**
9451
+ * Find the last assistant turn-tail in the conversation for a session.
9452
+ * The host renders `[data-turn-tail]` around the assistant message's
9453
+ * IconActions row (copy / like / dislike / branch). Quick-reply options
9454
+ * mount at the top of that tail, directly above the action buttons.
9455
+ */
9456
+ function findLastTurnTail(sessionId) {
9457
+ if (typeof document === 'undefined' || document === null) return null;
9458
+ const tails = Array.from(document.querySelectorAll('[data-turn-tail]'));
9459
+ if (sessionId !== undefined && sessionId !== '') {
9460
+ const own = tails.filter((tail) => {
9461
+ const body = tail.closest('[data-conversation-session]');
9462
+ return body !== null && body.getAttribute('data-conversation-session') === sessionId;
9463
+ });
9464
+ if (own.length > 0) return own[own.length - 1];
9465
+ }
9466
+ return tails[tails.length - 1] ?? null;
9467
+ }
9468
+
9449
9469
  /** The host primary button is the only composer button carrying aria-busy. */
9450
9470
  function findComposerSend(seat) {
9451
9471
  if (seat === null) return null;
@@ -10195,19 +10215,23 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
10195
10215
  return () => { alive = false; window.clearInterval(timer); };
10196
10216
  }, [settings.quickReplies, ownerId, applyState]);
10197
10217
 
10198
- // Mount a small container as the first child of the composer seat, so
10199
- // the options sit above the input card in normal layout.
10218
+ // Mount a small container inside the last assistant turn-tail, just
10219
+ // above its IconActions row (copy / like / branch). The tail is
10220
+ // re-elected periodically because new turns replace the last one.
10200
10221
  useEffect(() => {
10201
10222
  if (!settings.quickReplies || ownerId === '') { setContainer(null); return undefined; }
10202
10223
  let node = null;
10224
+ let host = null;
10203
10225
  const locate = () => {
10204
- const seat = findComposerSeat(ownerRef.current);
10205
- if (seat === null || seat.contains(node)) return;
10226
+ const tail = findLastTurnTail(ownerRef.current);
10227
+ if (tail === null) return;
10228
+ if (tail === host && node !== null && node.isConnected) return;
10206
10229
  if (node !== null) node.remove();
10207
10230
  node = document.createElement('div');
10208
10231
  node.setAttribute('data-powerup-quick-replies', '');
10209
10232
  node.className = 'dsh-powerup-quick-replies-mount';
10210
- seat.insertBefore(node, seat.firstChild);
10233
+ tail.insertBefore(node, tail.firstChild);
10234
+ host = tail;
10211
10235
  setContainer(node);
10212
10236
  };
10213
10237
  locate();
@@ -12233,6 +12257,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
12233
12257
  QuickReplies,
12234
12258
  quickRepliesRequest,
12235
12259
  quickOwnerId,
12260
+ findLastTurnTail,
12236
12261
  ProgressControl,
12237
12262
  ProgressItem,
12238
12263
  ProgressModelSelect,
package/index.js CHANGED
@@ -255,7 +255,7 @@ function appendSelfUpdateLog(line) {
255
255
  */
256
256
  const QUICK_REPLIES_PROMPT_SECTION = [
257
257
  '## Quick reply options (dsh-powerup)',
258
- 'When your answer leaves a few obvious next steps, call the `powerup_quick_replies` tool to offer tappable buttons above the composer.',
258
+ 'When your answer leaves a few obvious next steps, call the `powerup_quick_replies` tool to offer tappable buttons under your reply.',
259
259
  'Pass `options` as a list of objects with `label` and `message`: `label` is the short button text, `message` is the full text sent when the user taps it.',
260
260
  'Offer at most 8 concise, mutually exclusive choices; prefer 2-4. Use this after answering, not instead of answering.',
261
261
  'The options vanish as soon as the user sends any message, so do not repeat them in your reply text.',
@@ -4,7 +4,7 @@
4
4
  * The Agent calls `powerup_quick_replies` to publish a small set of tappable
5
5
  * message options for the current session. The options are stored in the
6
6
  * central Power-Up state file; the Client polls a matching Host route and
7
- * renders them above the composer. The options disappear once the user sends
7
+ * renders them under the last assistant message. The options disappear once the user sends
8
8
  * any message (clicking an option is itself a message send).
9
9
  *
10
10
  * This module holds the pure normalization/storage logic so offline tests can
@@ -27,7 +27,7 @@ export const QUICK_REPLIES_DESCRIPTION = [
27
27
  'Offer the user a short list of tappable reply options in the current conversation.',
28
28
  'Use this after answering when the next step has a few obvious choices (for example confirm, reject, or a follow-up question).',
29
29
  'Each option has a short button label and the full message that is sent when it is tapped.',
30
- 'The options are shown above the composer and are removed automatically once the user sends any message.',
30
+ 'The options are shown under the last assistant message and are removed automatically once the user sends any message.',
31
31
  'Pass an empty options list to clear the current options without waiting for a message.',
32
32
  ].join(' ');
33
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restregular/dsh-powerup",
3
- "version": "0.19.8",
3
+ "version": "0.19.10",
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",