@restregular/dsh-powerup 0.19.10 → 0.19.12

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/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.10';
101
+ const VERSION = '0.19.12';
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. */
@@ -105,6 +118,8 @@
105
118
  'page.featureDesc': '在轨迹页面右键任意记录,快速复制、引用、查看详情、复制步骤引用,或从该记录 Fork 出一个新会话。',
106
119
  'page.enabled': '已启用',
107
120
  'page.disabled': '已停用',
121
+ 'page.details': '详情',
122
+ 'page.collapse': '收起',
108
123
  'page.actions': '可用操作',
109
124
  'page.howTitle': '怎么用',
110
125
  'page.how1': '打开任意会话,切到顶部的「轨迹」视图。',
@@ -514,6 +529,8 @@
514
529
  'page.featureDesc': 'Right-click any trajectory record to copy it, quote it, open its inspector, copy a step reference, or fork the session at that point.',
515
530
  'page.enabled': 'Enabled',
516
531
  'page.disabled': 'Disabled',
532
+ 'page.details': 'Details',
533
+ 'page.collapse': 'Hide',
517
534
  'page.actions': 'What you can do',
518
535
  'page.howTitle': 'How to use it',
519
536
  'page.how1': 'Open a session and switch to the Trajectory view.',
@@ -4187,9 +4204,14 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
4187
4204
  .dsh-powerup-card{margin:0 0 14px;padding:16px;border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-alias-bg-layer-1);transition:opacity .14s ease}
4188
4205
  .dsh-powerup-card.is-off .dsh-powerup-card-icon,.dsh-powerup-card.is-off .dsh-powerup-card-copy{opacity:.55}
4189
4206
  .dsh-powerup-card-head{display:flex;align-items:flex-start;gap:12px}
4190
- .dsh-powerup-card-how{margin:12px 0 0;padding:10px 12px;border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.55;overflow-wrap:anywhere}
4207
+ .dsh-powerup-card-body{margin-top:12px}
4208
+ .dsh-powerup-card-how{margin:0 0 0;padding:10px 12px;border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.55;overflow-wrap:anywhere}
4191
4209
  .dsh-powerup-card-detail{margin-top:12px;padding-top:4px}
4192
4210
  .dsh-powerup-how-card .dsh-powerup-section-title{margin-bottom:10px}
4211
+ .dsh-powerup-detail-btn{flex:none;padding:3px 9px;border:.5px solid var(--dsw-alias-border-l2);border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;line-height:18px;cursor:pointer;white-space:nowrap}
4212
+ .dsh-powerup-detail-btn:hover{background:var(--dsw-alias-interactive-bg-hover,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-primary)}
4213
+ .dsh-powerup-detail-btn.on{color:var(--dsw-alias-brand-primary);border-color:var(--dsw-alias-brand-primary)}
4214
+ .dsh-powerup-detail-btn:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
4193
4215
  .dsh-powerup-card-icon{flex:none;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:9px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary)}
4194
4216
  .dsh-powerup-card-copy{min-width:0;flex:1 1 auto}
4195
4217
  .dsh-powerup-card-copy h2{margin:0;font-size:14px;line-height:1.35;font-weight:650}
@@ -4386,7 +4408,7 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
4386
4408
  .dsh-powerup-update-quick-note-title{display:flex;align-items:center;gap:6px;color:var(--dsw-alias-state-warn-label);font-size:12px;line-height:17px;font-weight:500}
4387
4409
  .dsh-powerup-update-quick-note .dsh-powerup-update-note{color:var(--dsw-alias-label-secondary)}
4388
4410
  .dsh-powerup-update-close:focus-visible,.dsh-powerup-update-toggle:focus-visible,.dsh-powerup-update-version:focus-visible,.dsh-powerup-update-select-trigger:focus-visible,.dsh-powerup-update-option:focus-visible,.dsh-powerup-update-primary:focus-visible,.dsh-powerup-update-ghost:focus-visible,.dsh-powerup-update-quick:focus-visible,.dsh-powerup-update-button:focus-visible,.dsh-powerup-restart-action:focus-visible,.dsh-powerup-update-default:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
4389
- @media (max-width:680px){.dsh-powerup-page{padding:20px 16px 42px}.dsh-powerup-actions{grid-template-columns:minmax(0,1fr)}.dsh-powerup-hero-art{width:54px;height:54px}.dsh-powerup-hero h1{font-size:19px}.dsh-powerup-card-head{flex-wrap:wrap}.dsh-powerup-switch{margin-left:auto}.dsh-powerup-update-mask{padding:12px}.dsh-powerup-update-dialog{max-height:calc(100dvh - 24px)}.dsh-powerup-update-head{padding:18px 12px 10px 18px}.dsh-powerup-update-body{padding:0 18px 4px}.dsh-powerup-update-foot{padding:14px 18px 18px}}
4411
+ @media (max-width:680px){.dsh-powerup-page{padding:20px 16px 42px}.dsh-powerup-actions{grid-template-columns:minmax(0,1fr)}.dsh-powerup-hero-art{width:54px;height:54px}.dsh-powerup-hero h1{font-size:19px}.dsh-powerup-card-head{flex-wrap:wrap}.dsh-powerup-detail-btn{margin-left:auto}.dsh-powerup-update-mask{padding:12px}.dsh-powerup-update-dialog{max-height:calc(100dvh - 24px)}.dsh-powerup-update-head{padding:18px 12px 10px 18px}.dsh-powerup-update-body{padding:0 18px 4px}.dsh-powerup-update-foot{padding:14px 18px 18px}}
4390
4412
  `;
4391
4413
 
4392
4414
  const SESSION_SWITCH_CSS = `
@@ -10798,6 +10820,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
10798
10820
  const settings = useSettings();
10799
10821
  const [, forceLocale] = useState(0);
10800
10822
  const [tab, setTab] = useState('features');
10823
+ const [expandedCards, setExpandedCards] = useState(() => new Set());
10801
10824
  useEffect(() => {
10802
10825
  const locale = ctx.get('locale');
10803
10826
  if (locale === undefined || typeof locale.subscribe !== 'function') return undefined;
@@ -10840,22 +10863,44 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
10840
10863
  );
10841
10864
  };
10842
10865
 
10843
- /** One uniform feature card: icon + title + description + toggle, with optional detail rows. */
10844
- const featureCard = (key, iconComp, titleKey, descKey, howKey, detail) => h('section', {
10845
- key,
10846
- className: 'dsh-powerup-card' + (settings[key] === false ? ' is-off' : ''),
10847
- },
10848
- h('div', { className: 'dsh-powerup-card-head' },
10849
- h('div', { className: 'dsh-powerup-card-icon' }, h(iconComp, { size: 18 })),
10850
- h('div', { className: 'dsh-powerup-card-copy' },
10851
- h('h2', null, t(titleKey)),
10852
- h('p', null, t(descKey)),
10866
+ /** One uniform feature card: icon + title + description, a details button that folds the body, and an enable/disable switch. */
10867
+ const featureCard = (key, iconComp, titleKey, descKey, howKey, detail) => {
10868
+ const hasDetail = howKey !== undefined || detail !== undefined;
10869
+ const expanded = expandedCards.has(key);
10870
+ const toggleExpanded = () => {
10871
+ const next = new Set(expandedCards);
10872
+ if (next.has(key)) next.delete(key);
10873
+ else next.add(key);
10874
+ setExpandedCards(next);
10875
+ };
10876
+ return h('section', {
10877
+ key,
10878
+ className: 'dsh-powerup-card' + (settings[key] === false ? ' is-off' : ''),
10879
+ },
10880
+ h('div', { className: 'dsh-powerup-card-head' },
10881
+ h('div', { className: 'dsh-powerup-card-icon' }, h(iconComp, { size: 18 })),
10882
+ h('div', { className: 'dsh-powerup-card-copy' },
10883
+ h('h2', null, t(titleKey)),
10884
+ h('p', null, t(descKey)),
10885
+ ),
10886
+ hasDetail
10887
+ ? h('button', {
10888
+ type: 'button',
10889
+ className: 'dsh-powerup-detail-btn' + (expanded ? ' on' : ''),
10890
+ 'aria-expanded': expanded ? 'true' : 'false',
10891
+ onClick: toggleExpanded,
10892
+ }, t(expanded ? 'page.collapse' : 'page.details'))
10893
+ : null,
10894
+ toggle(key, t(titleKey)),
10853
10895
  ),
10854
- toggle(key, t(titleKey)),
10855
- ),
10856
- howKey !== undefined ? h('p', { className: 'dsh-powerup-card-how' }, t(howKey)) : null,
10857
- detail ?? null,
10858
- );
10896
+ hasDetail && expanded
10897
+ ? h('div', { className: 'dsh-powerup-card-body' },
10898
+ howKey !== undefined ? h('p', { className: 'dsh-powerup-card-how' }, t(howKey)) : null,
10899
+ detail ?? null,
10900
+ )
10901
+ : null,
10902
+ );
10903
+ };
10859
10904
 
10860
10905
  /** A label/hint sub-row inside a card (for secondary options). */
10861
10906
  const settingRow = (key, checked, label, hint) => h('div', { key, className: 'dsh-powerup-setting' },
@@ -11551,10 +11596,20 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11551
11596
  }
11552
11597
 
11553
11598
  /** Render the host's exact composer model dropdown inside the progress header. */
11554
- function ProgressModelSelect({ sessionId, ctx, t: translate }) {
11599
+ function ProgressModelSelect({ sessionId, ctx, t: translate, useMobile, useDocumentPortal }) {
11555
11600
  const slots = ctx?.get?.('slots');
11556
11601
  const seatRef = useRef(null);
11557
11602
  const [entry, setEntry] = useState(() => findModelSelectEntry(slots));
11603
+ // Keep hook identity stable across renders; the host component calls
11604
+ // these itself, so choose once from the forwarded props or fallback.
11605
+ const mobileHook = useMemo(
11606
+ () => (typeof useMobile === 'function' ? useMobile : fallbackUseMobile),
11607
+ [useMobile],
11608
+ );
11609
+ const portalHook = useMemo(
11610
+ () => (typeof useDocumentPortal === 'function' ? useDocumentPortal : fallbackUseDocumentPortal),
11611
+ [useDocumentPortal],
11612
+ );
11558
11613
  useEffect(() => {
11559
11614
  if (entry !== null || slots === undefined) return undefined;
11560
11615
  const update = () => {
@@ -11628,11 +11683,20 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11628
11683
  }, '…');
11629
11684
  }
11630
11685
  return h('span', { className: 'dsh-powerup-progress-model-seat', ref: seatRef },
11631
- h(entry.component, { ...face, t: seatT, renderSlot: seatRenderSlot, locked: false }),
11686
+ h(entry.component, {
11687
+ ...face,
11688
+ t: seatT,
11689
+ renderSlot: seatRenderSlot,
11690
+ locked: false,
11691
+ // DSH 0.2.3 ModelSelect requires these standard props. Omitting
11692
+ // them crashes the component and hides the progress entry button.
11693
+ useMobile: mobileHook,
11694
+ useDocumentPortal: portalHook,
11695
+ }),
11632
11696
  );
11633
11697
  }
11634
11698
 
11635
- function ProgressControl({ sessionId, useWorkspaces }) {
11699
+ function ProgressControl({ sessionId, useWorkspaces, useMobile, useDocumentPortal }) {
11636
11700
  const settings = useSettings();
11637
11701
  const [open, setOpen] = useState(false);
11638
11702
  const [view, setView] = useState(null);
@@ -12028,7 +12092,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
12028
12092
  t('progress.subtitle'),
12029
12093
  ),
12030
12094
  ),
12031
- h(ProgressModelSelect, { sessionId, ctx: ctxRef.current, t }),
12095
+ h(ProgressModelSelect, { sessionId, ctx: ctxRef.current, t, useMobile, useDocumentPortal }),
12032
12096
  h('button', {
12033
12097
  type: 'button', className: 'dsh-powerup-progress-close',
12034
12098
  'aria-label': t('progress.close'), onClick: close,
@@ -12135,6 +12199,11 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
12135
12199
  // scoped hook; forward it so the requirement modal can resolve the
12136
12200
  // owning workspace (ctx.get('workspaces').list is Host-only).
12137
12201
  useWorkspaces: props?.useWorkspaces,
12202
+ // DSH 0.2.3 standard hooks, forwarded to the host ModelSelect we
12203
+ // render inside the panel. Without them the slot entry crashes and
12204
+ // this very button disappears once the panel is opened.
12205
+ useMobile: props?.useMobile,
12206
+ useDocumentPortal: props?.useDocumentPortal,
12138
12207
  }), 'dsh-powerup: task progress');
12139
12208
 
12140
12209
  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.10",
3
+ "version": "0.19.12",
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",