dsh-ide-window 0.3.8 → 0.3.9

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/AGENTS.md CHANGED
@@ -421,11 +421,12 @@ dsh plugin --profile desktop add link:~/dev/dsh-ide-window
421
421
  | 右键菜单离鼠标很远,飘在面板上方 | 用「条目数 × 28」估高度,估小了就 `y - 估计高度`,真实菜单更高、被夹到面板底边后整体上移 | 高度必须挂载后实测:放不下时让菜单**底边贴在指针**(`top = y - height`),不要用估算值;`useLayoutEffect` 在首帧前算好并保持 `visibility: hidden` 直到定位完成 |
422
422
  | 切到浅色主题后代码看不清(深色语法色仍在用) | 语法高亮是写死的深色配色,没有跟着主题走 | 语法色走 `--iw-syn-*` 变量,每套主题各给一组并按对比度校验(正文类 ≥4.5:1,注释 ≥3.5:1);`test/theme.mjs` 断言每套主题都有这 8 个变量 |
423
423
  | 截图点了没反应,或只给一句「失败」 | `screencapture` 在 macOS 未授权时报 `could not create image from display`;浏览器侧也拿不到屏幕(DSH 把 `setDisplayMediaRequestHandler` 设成 `callback({})` 直接拒绝) | 截图只能由宿主用系统工具做;失败按文案归类成 `no-screen-permission`,弹层给「打开系统设置」深链 + 系统化指引 |
424
- | 截图编辑器画出巨大的实心色块 | 操作对象里 `width` 同时被当成"笔宽"和"矩形宽度",`lineWidth` 变成几百像素 | 笔宽叫 `stroke`、几何叫 `width/height`;`ideShotDrawOp` 只从 `stroke` 取线宽 |
425
424
  | 编辑器里拖拽完全没反应(或选框永远是全屏) | ① `setPointerCapture` 对合成 pointerId 抛错,异常发生在设置拖动状态之前;② 预设了全屏选框,按下点永远"命中选框内部",只能移动不能重画 | ① `setPointerCapture` 包 try/catch,且放在状态设置之后;② **不预设选框**,第一下按下-拖动就是画框;① 的检查同理适用于所有合成指针测试 |
426
- | 截图附件太大(1 MB 以上) | 直接塞原图:Retina 全屏 5120×2880、PNG 1.2 MB | 质量阶梯 80→40 直到 ≤1 MB;仍超标才降分辨率(1 → 1/1.25 → 1/1.5 → 1/2)。**不预设 1080p**:抓屏与导出都保持设备像素 |
427
425
  | 想只加一张图却把草稿弄乱 | 直接改输入框内容会动到用户已有的文字/引用/附件 | 合成 `ClipboardEvent('paste')` + `DataTransfer` + `File` 派发给 Lexical 输入框,让 DSH 自己处理粘贴;**不要**写 editor 的 `innerHTML`/`textContent`(`test/screenshot.mjs` 会断言这一点) |
428
426
  | 想在悬浮框里直接答题 | 宿主 `remote.userQuestions.answer` 需要 `inject: ['remote.userQuestions']` 才拿得到,且对前台问题一律回 `false`(作答权在 DSH 自己的问答卡上,`publishContinuedQuestions` 只接管已延续的批次) | 悬浮框只渲染题目(读 `tool/call` 的 arguments),提交按钮引导回对话,不伪造作答 |
427
+ | 点「×」关掉悬浮框后,⌥+空格再也叫不出来(也不提示) | 关闭写 `floatClosed`,只重置于重启;而 `toggleFloat` 的判断只看 `floatOpen`,于是每次都走「设为可见」但 `floatClosed` 仍是 true | `toggleFloat` 命中 `floatClosed` 时先 `setFloatClosed(false)` 再展开——快捷键就是用来叫回卡片的 |
428
+ | 卡片缩到最小后 `/` 菜单只剩一行;菜单还半透明,代码从底下透出来 | ① 菜单绝对定位在 `.iw-float-input` 里,卡片 `overflow: hidden` 把超出部分裁掉;② 底色用 `--dsw-specific-menu`,那是 `#fcfdfeb3`(DSH 靠背后模糊,卡片没有 backdrop-filter) | 菜单改成 `position: fixed` 并按输入框的 rect 算 `left/width/bottom/max-height`(fixed 不被祖先 overflow 裁),宽度至少 340 保证名称/说明不被挤;底色用不透明的 `--dsw-alias-bg-layer-1` 加细边框 |
429
+ | 设置里关掉悬浮框再打开,卡片再也出不来(快捷键也没用) | `74-float.js` 把 `useState`/`useEffect`(resize 重渲染)写在了 `if (!open) return null` **之后**:关掉时少跑两个 hook,再打开时多跑两个 → 「Rendered more hooks than during the previous render」,`shell.overlay` 把整张卡卸掉 | **所有 hook 必须在 `if (!open) return null` 之前**;`test/harness.mjs` 里有一条源码断言盯着早退之后不许出现 hook |
429
430
  | 悬浮卡整张没了(重启后明显),控制台没报错 | 行渲染里把图片节点也起名 `pictures`,遮住了上层的 `pictures`(附件 id → URL),`pictures[id]` 读到 null → 含图片的消息一渲染就抛错,`shell.overlay` 插槽把整个浮层卸掉 | 行渲染抽成 `ideFloatRow`,变量不重名(图片节点叫 `pics`);**每行 try/catch**,一行坏数据不连坐整张卡 |
430
431
  | 两个插件(代码工作区 + git 窗口)配色不一致 | 各自注入 CSS、各自用 DSH token,主题是本插件私有的 | 把主题做成跨插件约定:`localStorage['dsh-theme']` + `dsh-theme` 事件 + `[data-dsh-theme]` 选择器;对方只读这三样。只在 `.iw-root` 上作用域的选择器无法共享,必须用通用属性 |
431
432
 
package/CHANGELOG.md CHANGED
@@ -6,6 +6,18 @@
6
6
  升级方式:DSH →「插件」→ 打开插件的「版本」区 →「检查更新」,或直接卸载后重新安装。
7
7
  (`link:` 本地安装不参与版本检查,拉取仓库即可。)
8
8
 
9
+ ## [0.3.9] — 2026-11-25
10
+
11
+ ### 修复
12
+
13
+ - **设置里关掉「脱离代码工作区」后,一进代码工作区就报错、悬浮卡消失**:卡片有两个 React hook 写在「不显示就直接返回」之后,关闭状态再显示时 hook 数量变了,React 把整块浮层卸掉(控制台是 `Minified React error #310`)。现在 hook 全部前置,进工作区不再报错。
14
+ - **点「×」关掉悬浮卡后,`⌥`+空格再也叫不回来,也不提示**:快捷键只做了「设为可见」,关闭标记还留着。现在命中关闭状态时先清标记再展开。
15
+ - **卡片缩到最小后,`/`、`@`、`+` 菜单只剩一行,代码还从菜单底下透出来**:菜单原来被卡片裁掉、底色是半透明的。现在按输入框位置浮在窗口上并给出可用高度,底色换成不透明底加细边框,窄卡片上名称与说明也不再挤成三行。
16
+
17
+ ### 改进
18
+
19
+ - **输入区的图片只能看缩略图**:现在点一下铺满预览,与消息里的图片一致。
20
+
9
21
  ## [0.3.8] — 2026-11-24
10
22
 
11
23
  ### 修复 / 改进
package/client.js CHANGED
@@ -2063,9 +2063,12 @@ html.iw-select-code .iw-code .iw-vision {
2063
2063
  max-height: 240px;
2064
2064
  overflow-y: auto;
2065
2065
  padding: 4px;
2066
- border: 0;
2066
+ border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.08));
2067
2067
  border-radius: var(--dsw-radius-lg, 12px);
2068
- background: var(--dsw-specific-menu, var(--dsw-alias-bg-layer-1, #fff));
2068
+ /* --dsw-specific-menu is translucent (#fcfdfeb3) because DSH blurs what is
2069
+ behind it; the card has no backdrop filter, so on its own the menu would
2070
+ let the code show through. Opaque layer + border instead. */
2071
+ background: var(--dsw-alias-bg-layer-1, #fff);
2069
2072
  box-shadow: var(--dsw-elevation-prominent, 0 10px 24px rgba(0, 0, 0, 0.18));
2070
2073
  }
2071
2074
  .iw-float-suggest-item {
@@ -2168,7 +2171,7 @@ html.iw-select-code .iw-code .iw-vision {
2168
2171
  padding: 5px;
2169
2172
  border: 0.5px solid var(--dsw-alias-border-l2, rgba(255, 255, 255, 0.14));
2170
2173
  border-radius: 8px;
2171
- background: var(--dsw-alias-bg-layer-2, rgba(20, 21, 24, 0.98));
2174
+ background: var(--dsw-alias-bg-layer-1, #fff);
2172
2175
  }
2173
2176
  .iw-float-menu-item {
2174
2177
  display: flex;
@@ -14778,6 +14781,10 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
14778
14781
  const permChipRef = useRef(null)
14779
14782
  const modelChipRef = useRef(null)
14780
14783
  const effortChipRef = useRef(null)
14784
+ const inputRef = useRef(null)
14785
+ // Where the `/`, `@` and `+` menu paints. It is fixed to the viewport so a
14786
+ // short card cannot clip it down to a single row.
14787
+ const [suggestPos, setSuggestPos] = useState(null)
14781
14788
  // Where a popup opens: measured from the trigger, so a menu never lands at the
14782
14789
  // top of the card the way a flex child did.
14783
14790
  const [popup, setPopup] = useState(null)
@@ -14982,6 +14989,25 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
14982
14989
  }
14983
14990
  }, [binding])
14984
14991
 
14992
+ useLayoutEffect(() => {
14993
+ const open = suggest !== null || menu === 'attach'
14994
+ const input = inputRef.current
14995
+ if (!open || input === null) { setSuggestPos(null); return }
14996
+ const rect = input.getBoundingClientRect()
14997
+ const viewportHeight = globalThis.innerHeight ?? 0
14998
+ const viewportWidth = globalThis.innerWidth ?? 0
14999
+ // A narrow card would squeeze names and descriptions into three words each;
15000
+ // the menu may grow wider than the composer as long as it stays on screen.
15001
+ const width = Math.round(Math.min(440, Math.max(rect.width, 340)))
15002
+ const left = Math.round(Math.min(Math.max(12, rect.left), Math.max(12, viewportWidth - width - 12)))
15003
+ setSuggestPos({
15004
+ left,
15005
+ width,
15006
+ bottom: Math.round(viewportHeight - rect.top + 4),
15007
+ maxHeight: Math.round(Math.min(320, Math.max(140, rect.top - 16))),
15008
+ })
15009
+ }, [suggest, menu])
15010
+
14985
15011
  // Menus are positioned from their trigger every time one opens: the card is
14986
15012
  // resizable and the chips sit at its bottom, so a static offset drifts.
14987
15013
  useLayoutEffect(() => {
@@ -15327,6 +15353,15 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
15327
15353
  return 0
15328
15354
  })()
15329
15355
 
15356
+ // Maximising the window moves both card and ball: nothing else re-renders
15357
+ // this component on resize, so the coordinates would stay at the old size.
15358
+ const [, setViewportTick] = useState(0)
15359
+ useEffect(() => {
15360
+ const onResize = () => setViewportTick((tick) => tick + 1)
15361
+ globalThis.addEventListener('resize', onResize)
15362
+ return () => globalThis.removeEventListener('resize', onResize)
15363
+ }, [])
15364
+
15330
15365
  if (!open) return null
15331
15366
 
15332
15367
  // The header names the conversation, not the folder: that is what the menu
@@ -15336,14 +15371,6 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
15336
15371
  const workspace = ideBasename(state.rootPath ?? '') || tr('floatNoWorkspace')
15337
15372
  const sessionTitle = currentRow?.title
15338
15373
  ?? (workspace === '' || workspace === tr('floatNoWorkspace') ? tr('floatNoSession') : workspace)
15339
- // Maximising the window moves both card and ball: nothing else re-renders
15340
- // this component on resize, so the coordinates would stay at the old size.
15341
- const [, setViewportTick] = useState(0)
15342
- useEffect(() => {
15343
- const onResize = () => setViewportTick((tick) => tick + 1)
15344
- globalThis.addEventListener('resize', onResize)
15345
- return () => globalThis.removeEventListener('resize', onResize)
15346
- }, [])
15347
15374
 
15348
15375
  const viewportWidth = typeof window === 'undefined' ? 0 : window.innerWidth
15349
15376
  const viewportHeight = typeof window === 'undefined' ? 0 : window.innerHeight
@@ -15750,7 +15777,7 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
15750
15777
  }, tr('floatCloseViewer')),
15751
15778
  ]),
15752
15779
  ]),
15753
- h('div', { key: 'input', className: 'iw-float-input' }, [
15780
+ h('div', { key: 'input', className: 'iw-float-input', ref: inputRef }, [
15754
15781
  refs.length === 0 && images.length === 0 ? null : h('div', { key: 'chips', className: 'iw-float-chips' }, [
15755
15782
  ...refs.map((ref, index) => h('span', { key: `ref:${ref}`, className: 'iw-float-chip-ref' }, [
15756
15783
  h('span', { key: 't', className: 'iw-float-chip-ref-text' }, ref.replace(/^@/, '')),
@@ -15763,7 +15790,13 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
15763
15790
  }, '×'),
15764
15791
  ])),
15765
15792
  ...images.map((image) => h('span', { key: image.key, className: 'iw-float-chip-image', title: image.name ?? '' }, [
15766
- h('img', { key: 'i', src: image.preview, alt: '' }),
15793
+ // Same as an attachment in the conversation: a click shows it full size.
15794
+ h('img', {
15795
+ key: 'i',
15796
+ src: image.preview,
15797
+ alt: '',
15798
+ onClick: () => setViewing({ url: image.preview, name: image.name ?? '' }),
15799
+ }),
15767
15800
  h('button', {
15768
15801
  key: 'x',
15769
15802
  type: 'button',
@@ -15774,7 +15807,12 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
15774
15807
  ])),
15775
15808
  ]),
15776
15809
  menu === 'attach'
15777
- ? h('div', { key: 'attachmenu', className: 'iw-float-suggest', role: 'listbox' },
15810
+ ? h('div', {
15811
+ key: 'attachmenu',
15812
+ className: 'iw-float-suggest',
15813
+ role: 'listbox',
15814
+ style: suggestPos === null ? undefined : { position: 'fixed', left: `${suggestPos.left}px`, width: `${suggestPos.width}px`, bottom: `${suggestPos.bottom}px`, maxHeight: `${suggestPos.maxHeight}px` },
15815
+ },
15778
15816
  [
15779
15817
  // The card's own extra: the file currently open in the workspace.
15780
15818
  h('button', {
@@ -15811,7 +15849,12 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
15811
15849
  : null,
15812
15850
  suggest === null || suggest.items.length === 0
15813
15851
  ? null
15814
- : h('div', { key: 'suggest', className: 'iw-float-suggest', role: 'listbox' },
15852
+ : h('div', {
15853
+ key: 'suggest',
15854
+ className: 'iw-float-suggest',
15855
+ role: 'listbox',
15856
+ style: suggestPos === null ? undefined : { position: 'fixed', left: `${suggestPos.left}px`, width: `${suggestPos.width}px`, bottom: `${suggestPos.bottom}px`, maxHeight: `${suggestPos.maxHeight}px` },
15857
+ },
15815
15858
  suggest.items.map((item, index) => {
15816
15859
  const previous = index === 0 ? '' : (suggest.items[index - 1]?.section ?? '')
15817
15860
  const titleKey = item.section !== previous ? ideFloatSectionKey(item.section) : ''
@@ -17088,6 +17131,15 @@ function apply(ctx) {
17088
17131
  store.setNotice(translate('floatToggleDisabled'))
17089
17132
  return
17090
17133
  }
17134
+ // `×` hides the card until DSH restarts, but this shortcut is the one the
17135
+ // user presses to call it back: reopening has to clear that flag, otherwise
17136
+ // nothing happens and the card looks broken.
17137
+ if (look.floatClosed === true) {
17138
+ store.setFloatClosed(false)
17139
+ store.setFloatOpen(true)
17140
+ store.setFloatCollapsed(false)
17141
+ return
17142
+ }
17091
17143
  const visible = look.floatOpen === true && look.floatClosed !== true
17092
17144
  if (!visible) {
17093
17145
  store.setFloatOpen(true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ide-window",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "IDEA-style code workspace for DeepSeek Harness: a centre panel with a workspace file tree, editor tabs and live-updating source, while the left navigation column hides.",
5
5
  "type": "module",
6
6
  "icon": "icon.svg",