@restregular/dsh-powerup 0.19.9 → 0.19.11

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 stacked buttons above the copy/like actions of the last assistant message. 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
@@ -67,6 +67,19 @@
67
67
  return createPortal !== null && body !== null ? createPortal(node, body) : node;
68
68
  }
69
69
 
70
+ /**
71
+ * Safe stand-ins for the host's standard hooks on older hosts. DSH 0.2.3
72
+ * added `useMobile` / `useDocumentPortal` to every slot's standard props,
73
+ * and the host ModelSelect now calls both while rendering. We re-render
74
+ * that component inside the progress panel, so a missing hook used to
75
+ * throw a TypeError, crash the whole header-utilities slot entry and
76
+ * silently hide the progress entry button. Forward the real hooks from
77
+ * the slot props; fall back to these when they are absent.
78
+ */
79
+ const BodyPortal = ({ children }) => renderInBody(children);
80
+ const fallbackUseMobile = () => false;
81
+ const fallbackUseDocumentPortal = () => BodyPortal;
82
+
70
83
  const NS = 'dsh-powerup';
71
84
  const SETTINGS_KEY = 'dsh-powerup:settings:v1';
72
85
  /**
@@ -85,7 +98,7 @@
85
98
  const requirementCreateDraft = { workspaceId: null, title: '', text: '', scope: 'current' };
86
99
  /** Fallback bucket when the hero cannot resolve an owning workspace yet. */
87
100
  const UNSCOPED_WORKSPACE = '__unscoped__';
88
- const VERSION = '0.19.9';
101
+ const VERSION = '0.19.11';
89
102
  const MENU_GAP = 8;
90
103
  const MENU_WIDTH = 248;
91
104
  /** Reference scheme understood by the Host's `powerup_step_read` tool. */
@@ -11551,10 +11564,20 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11551
11564
  }
11552
11565
 
11553
11566
  /** Render the host's exact composer model dropdown inside the progress header. */
11554
- function ProgressModelSelect({ sessionId, ctx, t: translate }) {
11567
+ function ProgressModelSelect({ sessionId, ctx, t: translate, useMobile, useDocumentPortal }) {
11555
11568
  const slots = ctx?.get?.('slots');
11556
11569
  const seatRef = useRef(null);
11557
11570
  const [entry, setEntry] = useState(() => findModelSelectEntry(slots));
11571
+ // Keep hook identity stable across renders; the host component calls
11572
+ // these itself, so choose once from the forwarded props or fallback.
11573
+ const mobileHook = useMemo(
11574
+ () => (typeof useMobile === 'function' ? useMobile : fallbackUseMobile),
11575
+ [useMobile],
11576
+ );
11577
+ const portalHook = useMemo(
11578
+ () => (typeof useDocumentPortal === 'function' ? useDocumentPortal : fallbackUseDocumentPortal),
11579
+ [useDocumentPortal],
11580
+ );
11558
11581
  useEffect(() => {
11559
11582
  if (entry !== null || slots === undefined) return undefined;
11560
11583
  const update = () => {
@@ -11628,11 +11651,20 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11628
11651
  }, '…');
11629
11652
  }
11630
11653
  return h('span', { className: 'dsh-powerup-progress-model-seat', ref: seatRef },
11631
- h(entry.component, { ...face, t: seatT, renderSlot: seatRenderSlot, locked: false }),
11654
+ h(entry.component, {
11655
+ ...face,
11656
+ t: seatT,
11657
+ renderSlot: seatRenderSlot,
11658
+ locked: false,
11659
+ // DSH 0.2.3 ModelSelect requires these standard props. Omitting
11660
+ // them crashes the component and hides the progress entry button.
11661
+ useMobile: mobileHook,
11662
+ useDocumentPortal: portalHook,
11663
+ }),
11632
11664
  );
11633
11665
  }
11634
11666
 
11635
- function ProgressControl({ sessionId, useWorkspaces }) {
11667
+ function ProgressControl({ sessionId, useWorkspaces, useMobile, useDocumentPortal }) {
11636
11668
  const settings = useSettings();
11637
11669
  const [open, setOpen] = useState(false);
11638
11670
  const [view, setView] = useState(null);
@@ -12028,7 +12060,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
12028
12060
  t('progress.subtitle'),
12029
12061
  ),
12030
12062
  ),
12031
- h(ProgressModelSelect, { sessionId, ctx: ctxRef.current, t }),
12063
+ h(ProgressModelSelect, { sessionId, ctx: ctxRef.current, t, useMobile, useDocumentPortal }),
12032
12064
  h('button', {
12033
12065
  type: 'button', className: 'dsh-powerup-progress-close',
12034
12066
  'aria-label': t('progress.close'), onClick: close,
@@ -12135,6 +12167,11 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
12135
12167
  // scoped hook; forward it so the requirement modal can resolve the
12136
12168
  // owning workspace (ctx.get('workspaces').list is Host-only).
12137
12169
  useWorkspaces: props?.useWorkspaces,
12170
+ // DSH 0.2.3 standard hooks, forwarded to the host ModelSelect we
12171
+ // render inside the panel. Without them the slot entry crashes and
12172
+ // this very button disappears once the panel is opened.
12173
+ useMobile: props?.useMobile,
12174
+ useDocumentPortal: props?.useDocumentPortal,
12138
12175
  }), 'dsh-powerup: task progress');
12139
12176
 
12140
12177
  register('conversation.hero.options', {
package/index.js CHANGED
@@ -255,6 +255,7 @@ function appendSelfUpdateLog(line) {
255
255
  */
256
256
  const QUICK_REPLIES_PROMPT_SECTION = [
257
257
  '## Quick reply options (dsh-powerup)',
258
+ 'At the end of your turn, if you need to ask the user anything — a confirmation, a choice, a missing detail, or how to proceed — actively call the `powerup_quick_replies` tool to offer tappable buttons under your reply instead of leaving a plain open-ended question.',
258
259
  'When your answer leaves a few obvious next steps, call the `powerup_quick_replies` tool to offer tappable buttons under your reply.',
259
260
  '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
261
  'Offer at most 8 concise, mutually exclusive choices; prefer 2-4. Use this after answering, not instead of answering.',
@@ -25,6 +25,7 @@ export const QUICK_REPLIES_TOOL_NAME = 'powerup_quick_replies';
25
25
 
26
26
  export const QUICK_REPLIES_DESCRIPTION = [
27
27
  'Offer the user a short list of tappable reply options in the current conversation.',
28
+ 'At the end of your turn, whenever you need to ask the user anything — a confirmation, a choice, a missing detail, or how to proceed — call this tool to offer tappable reply options instead of leaving a plain open-ended question.',
28
29
  'Use this after answering when the next step has a few obvious choices (for example confirm, reject, or a follow-up question).',
29
30
  'Each option has a short button label and the full message that is sent when it is tapped.',
30
31
  'The options are shown under the last assistant message and are removed automatically once the user sends any message.',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restregular/dsh-powerup",
3
- "version": "0.19.9",
3
+ "version": "0.19.11",
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",
@@ -104,4 +104,4 @@
104
104
  "license": "MIT",
105
105
  "author": "RestRegular"
106
106
  }
107
-
107
+