@restregular/dsh-powerup 0.19.1 → 0.19.3

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 (2) hide show
  1. package/client.js +67 -37
  2. package/package.json +1 -1
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.1';
88
+ const VERSION = '0.19.3';
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. */
@@ -4700,7 +4700,10 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
4700
4700
  /* Direct-ask button + dialog */
4701
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}
4702
4702
  .dsh-powerup-directask-btn:hover,.dsh-powerup-directask-btn.on{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}
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}
4703
+ /* Keep the takeover BELOW every host composer popover (file-drop overlay is
4704
+ z-index 1000, model menu / file picker portals are 1100) so they stay
4705
+ clickable, yet above all chat content (AppFrame chrome tops out at 71). */
4706
+ .dsh-powerup-directask-window{position:fixed;z-index:900;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
4707
  .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
4708
  /* Direct Ask takeover: hide other plugins' composer controls, keep host ones. */
4706
4709
  .dsh-powerup-da-takeover [data-powerup-da-hidden]{display:none!important}
@@ -9041,6 +9044,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9041
9044
  ref: menuRef,
9042
9045
  className: 'dsh-powerup-ws-menu',
9043
9046
  role: 'listbox',
9047
+ 'data-powerup-ws-menu': '',
9044
9048
  }, options.map((option) => h('button', {
9045
9049
  type: 'button',
9046
9050
  key: option.value,
@@ -9530,20 +9534,36 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
9530
9534
  return () => window.clearInterval(timer);
9531
9535
  }, [open]);
9532
9536
 
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.
9537
+ // Geometry: cover ONLY the conversation's content area — from just under
9538
+ // the session title bar down to the top of the input card, including the
9539
+ // task/plan dock that lives above the card inside the composer seat. The
9540
+ // width matches the input card (not the full-width seat). Resizing changes
9541
+ // only the height/top; the dialog never slides sideways.
9536
9542
  useEffect(() => {
9537
9543
  if (!open || seat === null) { setGeo(null); return undefined; }
9538
9544
  const update = () => {
9539
9545
  const rect = seat.getBoundingClientRect();
9540
- const gap = 8;
9541
- const top = 8;
9542
- const bottom = Math.max(top + 160, rect.top - gap);
9546
+ const card = seat.querySelector('[data-composer-card]');
9547
+ const cardRect = card === null ? null : card.getBoundingClientRect();
9548
+ const content = seat.closest('[data-conversation-content]');
9549
+ const contentRect = content === null ? null : content.getBoundingClientRect();
9550
+ const header = content?.querySelector('header[data-window-drag]') ?? document.querySelector('header[data-window-drag]');
9551
+ const headerRect = header == null ? null : header.getBoundingClientRect();
9552
+ const left = cardRect !== null ? cardRect.left : rect.left;
9553
+ const width = cardRect !== null ? cardRect.width : rect.width;
9554
+ // Anchor the top to the content region (or the header's bottom) so
9555
+ // the session title bar is never covered.
9556
+ const top = contentRect !== null ? contentRect.top
9557
+ : (headerRect !== null ? headerRect.bottom : 0);
9558
+ // Bottom edge: the top of the visible input card. Anything docked
9559
+ // above the card (task/plan/queue/todo) sits inside this range, so
9560
+ // it is covered too.
9561
+ const bottomEdge = cardRect !== null ? cardRect.top : rect.top;
9562
+ const bottom = Math.max(top + 160, bottomEdge - 8);
9543
9563
  setGeo({
9544
- left: Math.round(rect.left),
9545
- width: Math.round(rect.width),
9546
- top,
9564
+ left: Math.round(left),
9565
+ width: Math.round(width),
9566
+ top: Math.round(top),
9547
9567
  height: Math.round(bottom - top),
9548
9568
  });
9549
9569
  };
@@ -10918,12 +10938,14 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
10918
10938
  const [targetWorkspace, setTargetWorkspace] = useState(requirementCreateDraft.workspaceId ?? key);
10919
10939
  const [closing, setClosing] = useState(false);
10920
10940
  const closingRef = useRef(false);
10921
- const workspaces = (() => {
10922
- try {
10923
- const snapshot = ctxRef.current?.get?.('workspaces')?.list?.getSnapshot?.();
10924
- return Array.isArray(snapshot?.items) ? snapshot.items : [];
10925
- } catch { return []; }
10926
- })();
10941
+ // Like PromptCreateModal, the requirement can only belong to the
10942
+ // session's own workspace or to all workspaces — never an arbitrary one.
10943
+ const scopeOptions = fixedScope
10944
+ ? [{ value: '', label: t('prompts.anyWorkspace') }]
10945
+ : [
10946
+ { value: key, label: t('prompts.workspaceCurrent'), hint: workspaceTitle || key },
10947
+ { value: '', label: t('prompts.anyWorkspace') },
10948
+ ];
10927
10949
  const requestClose = () => {
10928
10950
  if (closingRef.current) return;
10929
10951
  closingRef.current = true;
@@ -10979,10 +11001,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
10979
11001
  h('span', { className: 'dsh-powerup-prompt-field-label' }, t('prompts.workspaceLabel')),
10980
11002
  h(WorkspaceSelect, {
10981
11003
  value: targetWorkspace,
10982
- options: [
10983
- { value: '', label: t('prompts.anyWorkspace') },
10984
- ...workspaces.map((ws) => ({ value: ws.workspaceId, label: ws.title || ws.workspaceId, hint: ws.title ? ws.workspaceId : undefined })),
10985
- ],
11004
+ options: scopeOptions,
10986
11005
  onChange: setTargetWorkspace,
10987
11006
  t,
10988
11007
  }),
@@ -11297,7 +11316,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11297
11316
  );
11298
11317
  }
11299
11318
 
11300
- function ProgressControl({ sessionId }) {
11319
+ function ProgressControl({ sessionId, useWorkspaces }) {
11301
11320
  const settings = useSettings();
11302
11321
  const [open, setOpen] = useState(false);
11303
11322
  const [view, setView] = useState(null);
@@ -11313,19 +11332,23 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11313
11332
  const [creatingReq, setCreatingReq] = useState(false);
11314
11333
  const reqs = useRequirements();
11315
11334
  // Resolve the owning workspace for requirement filtering + create modal.
11316
- const workspaceId = useMemo(() => {
11317
- try {
11318
- const snapshot = ctxRef.current?.get?.('workspaces')?.list?.getSnapshot?.();
11319
- return resolveWorkspaceIdFromSnapshot(snapshot, sessionRef.current) ?? '';
11320
- } catch { return ''; }
11321
- }, [sessionId, open]);
11322
- const workspaceTitle = useMemo(() => {
11323
- try {
11324
- const items = ctxRef.current?.get?.('workspaces')?.list?.getSnapshot?.()?.items ?? [];
11335
+ // Prefer the slot-provided scoped `useWorkspaces` hook (the client-side
11336
+ // `workspaces` service has no `.list`; that is Host-only). Fall back to
11337
+ // the live DOM session id if the hook is absent on an older host.
11338
+ const workspaceSelector = useMemo(
11339
+ () => (snapshot) => resolveWorkspaceIdFromSnapshot(snapshot, sessionRef.current),
11340
+ [sessionId],
11341
+ );
11342
+ const workspaceId = typeof useWorkspaces === 'function'
11343
+ ? useWorkspaces(workspaceSelector) ?? ''
11344
+ : '';
11345
+ const workspaceTitle = typeof useWorkspaces === 'function'
11346
+ ? (useWorkspaces((snapshot) => {
11347
+ const items = snapshot !== null && typeof snapshot === 'object' && Array.isArray(snapshot.items) ? snapshot.items : [];
11325
11348
  const found = items.find((ws) => ws?.workspaceId === workspaceId);
11326
11349
  return found?.title ?? '';
11327
- } catch { return ''; }
11328
- }, [workspaceId, open]);
11350
+ }) ?? '')
11351
+ : '';
11329
11352
  const visibleReqs = requirementsForWorkspace(reqs, workspaceId);
11330
11353
  /** Concatenate the enabled+selected requirements into editable text. */
11331
11354
  const composeReqText = useCallback((ids) => {
@@ -11469,9 +11492,10 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11469
11492
  if (panel !== null && event.target instanceof Node && panel.contains(event.target)) return;
11470
11493
  if (button !== null && event.target instanceof Node && button.contains(event.target)) return;
11471
11494
  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;
11495
+ // Both the host model dropdown and our own WorkspaceSelect portal
11496
+ // their menus to document.body. Clicks there are outside the panel
11497
+ // node but must not dismiss it.
11498
+ if (event.target instanceof Element && event.target.closest('[data-powerup-model-menu], [data-powerup-ws-menu]')) return;
11475
11499
  close();
11476
11500
  };
11477
11501
  document.addEventListener('keydown', onKey, true);
@@ -11785,7 +11809,13 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11785
11809
  register('conversation.session.header.utilities', {
11786
11810
  id: 'powerup-progress',
11787
11811
  order: 52,
11788
- }, (props) => h(ProgressControl, { sessionId: props?.sessionId }), 'dsh-powerup: task progress');
11812
+ }, (props) => h(ProgressControl, {
11813
+ sessionId: props?.sessionId,
11814
+ // The header utilities slot provides useWorkspaces as a standard
11815
+ // scoped hook; forward it so the requirement modal can resolve the
11816
+ // owning workspace (ctx.get('workspaces').list is Host-only).
11817
+ useWorkspaces: props?.useWorkspaces,
11818
+ }), 'dsh-powerup: task progress');
11789
11819
 
11790
11820
  register('conversation.hero.options', {
11791
11821
  id: 'powerup-prompts',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restregular/dsh-powerup",
3
- "version": "0.19.1",
3
+ "version": "0.19.3",
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",