dsh-ris-ide 1.8.1 → 1.8.2
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 +2 -2
- package/lib/client.js +311 -72
- package/lib/debug/vendor/README.md +14 -0
- package/lib/debug/vendor/jdwp/client.js +9 -4
- package/lib/debug/vendor/src/jdwp/client.ts +12 -5
- package/lib/index.js +794 -48
- package/lib/redirector.js +42 -2
- package/lib/risd/lifecycle.js +9 -3
- package/lib/risd/server.js +308 -13
- package/lib/risd/ui.js +149 -112
- package/lib/risd-client.js +4 -1
- package/lib/startup.js +27 -7
- package/package.json +2 -2
- package/test/client-viewer.test.mjs +188 -95
- package/test/clipboard.test.mjs +259 -0
- package/test/debug-engine.test.mjs +3 -1
- package/test/dsh-origin.test.mjs +4 -11
- package/test/dsh-window-refresh.test.mjs +166 -1
- package/test/harness.test.mjs +1 -1
- package/test/helpers/cmd.mjs +29 -0
- package/test/helpers/tgz.mjs +71 -0
- package/test/host-search.test.mjs +18 -11
- package/test/host-tail.test.mjs +119 -24
- package/test/proxy-route.test.mjs +61 -0
- package/test/proxy-window.test.mjs +5 -0
- package/test/proxy.test.mjs +13 -1
- package/test/proxybridge-bundle.test.mjs +1 -59
- package/test/redirector-bundle.test.mjs +21 -67
- package/test/redirector.test.mjs +41 -4
- package/test/risd-api.test.mjs +81 -28
- package/test/risd-bridge-degrade.test.mjs +3 -29
- package/test/risd-engine.test.mjs +13 -50
- package/test/risd-entry.test.mjs +0 -37
- package/test/risd-follow-start.test.mjs +101 -0
- package/test/risd-git.test.mjs +7 -5
- package/test/risd-handoff.test.mjs +6 -50
- package/test/risd-helpers.mjs +150 -3
- package/test/risd-host-p2.test.mjs +2 -30
- package/test/risd-lifecycle.test.mjs +25 -0
- package/test/risd-programs.test.mjs +4 -34
- package/test/risd-review-p2.test.mjs +0 -13
- package/test/risd-shutdown.test.mjs +5 -38
- package/test/risd-teardown.test.mjs +8 -27
- package/test/risd-ui.test.mjs +169 -13
- package/test/risd-write.test.mjs +2 -1
- package/test/startup-reconcile.test.mjs +44 -8
- package/test/proxy-restart.test.mjs +0 -39
package/README.md
CHANGED
|
@@ -66,11 +66,11 @@ DSH(DeepSeek Harness)Web GUI 右侧栏里的 **RIS-IDE 本地开发面板**
|
|
|
66
66
|
- **默认开启**(`daemonMode=auto`,1.8.0 起;`daemonMode=off` 或 `DSH_RISD_MODE=off` 是一词回滚)。插件挂载时会确保 `risd` 在跑(`127.0.0.1:11082`,随机 token,状态在 `~/.dsh-ris-ide/risd.json`),并登记一个租约(owner pid + 心跳,3s 探活)。
|
|
67
67
|
- daemon 接管**引擎**:启动/停止代理、写规则、git 代理、系统层拦截的 reload 都经它串行执行;插件只负责转发。最后一个租约消失后,daemon 按 `session` 策略依次撤销 git → 拦截 → 引擎;随后空闲 10 分钟自动退出,下次需要时再被拉起。
|
|
68
68
|
- daemon 还负责写桥接心跳(不再由 dsh 进程写)并独占 janitor;升级 daemon 时用 `POST /v1/shutdown {handoff:true}` 交接,新 daemon 直接收养既有引擎(pid 不变,隧道不断)。
|
|
69
|
-
- daemon 还托管**程序与 JDWP**:`ris_dev_programs/start/stop/logs/debug` 在 `daemonMode=auto` 时优先问 daemon(失败自动回退本地,`ris_dev_status` 仍读本地 pidfile/日志),所以刷新页面不会丢调试会话;dsh 全部关掉后打开 `http://127.0.0.1:11082/ui` 就能启停程序、看日志、断开调试会话、重启桥接。维护页顶部居中三个页签(顺序 **开发环境 · 代理设置 · 概览**;刷新或快捷键重载后回到上次的页签与工作区,dsh 的 ⧉ 只切换工作区、不抢你正在用的页签):**概览**(守护进程状态、代理运行状态、按工作区分组的运行中程序、调试中的进程,都可停止)、**代理设置**(不依赖 dsh 的**全局**规则编辑器:规则按机器生效、不区分工作区;SOCKS/监听端口/规则行增删改**即自动保存**——700 ms 防抖 +
|
|
69
|
+
- daemon 还托管**程序与 JDWP**:`ris_dev_programs/start/stop/logs/debug` 在 `daemonMode=auto` 时优先问 daemon(失败自动回退本地,`ris_dev_status` 仍读本地 pidfile/日志),所以刷新页面不会丢调试会话;dsh 全部关掉后打开 `http://127.0.0.1:11082/ui` 就能启停程序、看日志、断开调试会话、重启桥接。维护页顶部居中三个页签(顺序 **开发环境 · 代理设置 · 概览**;刷新或快捷键重载后回到上次的页签与工作区,dsh 的 ⧉ 只切换工作区、不抢你正在用的页签):**概览**(守护进程状态、代理运行状态、按工作区分组的运行中程序、调试中的进程,都可停止)、**代理设置**(不依赖 dsh 的**全局**规则编辑器:规则按机器生效、不区分工作区;SOCKS/监听端口/规则行增删改**即自动保存**——700 ms 防抖 + 行校验(**保存只写表,不会启动引擎**:引擎由「启动」按钮或生命周期「代理引擎跟随 dsh」启动),CAS 冲突静默换 revision 重写一次;组件区只有一个「启动/重启系统层拦截(可能提权)」按钮,只在缺拦截或重载失败时出现,鼠标悬停会说明原因)、**开发环境**(整页无留白地嵌入 dsh 的 IDE;左侧是**默认收起**的工作区面板,点 header 左侧的 `‹`/`›` 展开或收起并记住选择;按 **dsh 工作区标题**显示(改名即时生效,路径作身份)、列表镜像 dsh 侧栏的全部工作区,点击即切换;5 分钟没动静的工作区标「未活跃」但仍可点,选中时上方提示该窗口可能已关闭;在 iframe 外任意处点击都会把光标送回 IDE;dsh 不在时该页签自动置灰并显示原因)。
|
|
70
70
|
- **改完不用强刷**:插件把当前 client bundle 的指纹随 SSE `hello` 下发(另有 `GET /dsh-ris-ide/build`),并每 30s 复查一次;发现代码变了只在右下角提示「IDE 界面已更新:刷新页面后生效」(**不自动 reload,避免丢掉未保存的编辑与会话视图**,点提示再刷新)。维护页 `/ui` 同理:daemon 重启成新代码、或源码比进程新、或 token 因 daemon 重启失效,都在顶部显示横幅;**「插件版本已更新」这条点按钮就是「重启并刷新」**——daemon 先交接重启(保留正在跑的代理引擎/桥接),新进程起来后本页自动重新加载,不用自己去命令行重启。**开发环境里有未保存文件时横幅会多一个「保存所有文件」按钮**——点它先把内嵌 IDE 的脏 buffer 全部保存再整页刷新(不会悄悄丢掉编辑);没有未保存内容时直接自动刷新,刷新后回到原来的页签与工作区。代理规则未保存时也会先确认。Node 在启动时 import 的模块不会再读盘,这不是浏览器缓存,强刷也没用。
|
|
71
71
|
- **保存即换新**:保存规则时先把上一份表应用过的机器级副作用收回(git 条目按新表切 host 或清掉;系统层拦截若重载失败就直接停止,而不是留着旧规则继续拦截),再应用新表。若提示「旧规则可能仍在生效 / 需要提权」,提示旁有 **提权重启** 按钮:点一下即「停止 → 重载 → 启动」(Windows 弹一次 UAC;本侧 root 桥接需要 sudo,命令会显示在提示里)。
|
|
72
72
|
- daemon 不可达时视图与会话内动作自动回退到插件本地执行,维护页打不开时可以用 CLI;**`daemonMode=off` 即完全回到旧行为**,此时点 ⧉ 不会拉起 daemon(两个 owner 会抢同一个引擎与 janitor),而是直接打开独立 IDE 窗口。
|
|
73
|
-
- **入口**:dsh 顶部 ⧉ 和面板控制台的 ⧉ 都打开 **risd 维护页**(面板里不再有代理按钮:规则编辑只在这个页面),并且自动选中当前工作区(页签保持你上次的选择);**daemon 已停止或意外退出时,点 ⧉ 会先自动把它拉起**(点一次即可,失败才回退到独立窗口)。维护页「概览 → 守护进程」一行可看状态并停止 daemon;停止会同时停掉它托管的程序、调试会话和代理,页面会先弹确认列出将停止的内容。**概览底部还有「生命周期」设置**:守护进程 / 代理引擎 / 程序 / 调试会话各自可以选择是否「跟随 dsh」(最后一个 dsh 窗口退出后停)。**「跟随 daemon」是强制的**:停止 daemon 时它托管的程序、调试会话与代理一定一起停,不提供关闭项。默认是代理跟随 dsh、程序与调试不跟随 dsh,配置存在 `~/.dsh-ris-ide/risd-lifecycle.json
|
|
73
|
+
- **入口**:dsh 顶部 ⧉ 和面板控制台的 ⧉ 都打开 **risd 维护页**(面板里不再有代理按钮:规则编辑只在这个页面),并且自动选中当前工作区(页签保持你上次的选择);**daemon 已停止或意外退出时,点 ⧉ 会先自动把它拉起**(点一次即可,失败才回退到独立窗口)。维护页「概览 → 守护进程」一行可看状态并停止 daemon;停止会同时停掉它托管的程序、调试会话和代理,页面会先弹确认列出将停止的内容。**概览底部还有「生命周期」设置**:守护进程 / 代理引擎 / 程序 / 调试会话各自可以选择是否「跟随 dsh」(最后一个 dsh 窗口退出后停)。**「跟随 daemon」是强制的**:停止 daemon 时它托管的程序、调试会话与代理一定一起停,不提供关闭项。默认是代理跟随 dsh、程序与调试不跟随 dsh,配置存在 `~/.dsh-ris-ide/risd-lifecycle.json`,**勾选即保存并生效**(没有保存按钮)、不用重启。
|
|
74
74
|
- 手动体验(`risd` 命令由本包的 `bin` 暴露;`npm link` 或把 `bin/risd.mjs` 软链进 PATH 即可):`risd serve`、`risd status`、`risd health`、`risd stop`、`risd version`;日志 `~/.dsh-ris-ide/risd.log`。
|
|
75
75
|
|
|
76
76
|
已知边界:本侧(WSL/Linux root 起的)系统层拦截仍不支持热重载(要重启);规则表的 `shadow` 端口没有内置默认值,全部来自配置与 dsh-ris-yds 的写入。
|
package/lib/client.js
CHANGED
|
@@ -296,6 +296,58 @@ window.__ModuleLoader__.load({
|
|
|
296
296
|
return knownWorkspaceCwd()
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
+
/** How the page answers "which (session, workspace) is on screen right now". */
|
|
300
|
+
var liveScopeResolver = null
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Register (or clear) the page's freshest tree scope.
|
|
304
|
+
*
|
|
305
|
+
* The panel that OWNS the tree is the only one that can answer this: it re-reads
|
|
306
|
+
* the sidebar's live Session marker and the session store on every change. `fsOp`
|
|
307
|
+
* consults it once after the host refuses a mutation as `outside-workspace`.
|
|
308
|
+
* @param {Function|null} resolver - returns `{sessionId, cwd}`, or null to clear.
|
|
309
|
+
*/
|
|
310
|
+
function setLiveScopeResolver(resolver) {
|
|
311
|
+
liveScopeResolver = typeof resolver === 'function' ? resolver : null
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** @returns {{sessionId?: string, cwd?: string}|undefined} the freshest scope. */
|
|
315
|
+
function liveScope() {
|
|
316
|
+
if (liveScopeResolver === null) return undefined
|
|
317
|
+
try {
|
|
318
|
+
var scope = liveScopeResolver()
|
|
319
|
+
return scope !== null && typeof scope === 'object' ? scope : undefined
|
|
320
|
+
} catch {
|
|
321
|
+
return undefined
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Which Session the host considers LIVE for the workspace a scope names.
|
|
327
|
+
*
|
|
328
|
+
* Read-only probe (`/windows?cwd=`); the host answers with `liveSessionFor(cwd)`,
|
|
329
|
+
* i.e. the Session whose header cwd owns that tree. A window that kept the
|
|
330
|
+
* Session it was booted on gets the right answer here after a workspace switch.
|
|
331
|
+
* @param {{sessionId?: string, cwd?: string}} scope - the scope that just failed.
|
|
332
|
+
* @returns {Promise<string|undefined>} a live session id, or undefined.
|
|
333
|
+
*/
|
|
334
|
+
async function liveSessionOfScope(scope) {
|
|
335
|
+
var cwd = scopeCwd(scope)
|
|
336
|
+
if (typeof cwd !== 'string' || cwd === '') return undefined
|
|
337
|
+
try {
|
|
338
|
+
var url = routeUrl('dsh-ris-ide/windows')
|
|
339
|
+
url.searchParams.set('cwd', cwd)
|
|
340
|
+
var response = await fetch(url.href, { headers: { accept: 'application/json' } })
|
|
341
|
+
var parsed = await response.json().catch(function () { return null })
|
|
342
|
+
if (parsed === null || parsed === undefined || parsed.ok !== true) return undefined
|
|
343
|
+
var session = parsed.session
|
|
344
|
+
var id = session !== null && typeof session === 'object' ? session.id : undefined
|
|
345
|
+
return typeof id === 'string' && id !== '' ? id : undefined
|
|
346
|
+
} catch {
|
|
347
|
+
return undefined
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
299
351
|
/**
|
|
300
352
|
* The workspace of ONE session, read through the slot's standard `useSessions`
|
|
301
353
|
* hook.
|
|
@@ -1232,22 +1284,9 @@ window.__ModuleLoader__.load({
|
|
|
1232
1284
|
return Math.min(Math.max(120, value), 720)
|
|
1233
1285
|
}
|
|
1234
1286
|
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
*/
|
|
1239
|
-
var COMPACT_MAX_KEY = 'dsh-ris-ide:ui:compact-max'
|
|
1240
|
-
|
|
1241
|
-
/**
|
|
1242
|
-
* Which compact section is maximized: 'console', 'log', or '' for the split
|
|
1243
|
-
* view. A stale/garbage value degrades to the split view, never to a blank
|
|
1244
|
-
* panel (same tolerance as the saved height).
|
|
1245
|
-
* @returns {string}
|
|
1246
|
-
*/
|
|
1247
|
-
function readCompactMax() {
|
|
1248
|
-
var raw = readPref(COMPACT_MAX_KEY, '')
|
|
1249
|
-
return raw === 'console' || raw === 'log' ? raw : ''
|
|
1250
|
-
}
|
|
1287
|
+
// The compact panel's maximised section is NOT remembered (m00584): a ⤢ was
|
|
1288
|
+
// persisted machine-wide and every later panel open showed one section only,
|
|
1289
|
+
// with nothing on screen saying why the other one was gone.
|
|
1251
1290
|
|
|
1252
1291
|
/** Clamp a font size read from storage into the supported range. */
|
|
1253
1292
|
/** The IDE-wide content font size: 10–18px in 0.5 steps (A−/A+ control). */
|
|
@@ -5556,6 +5595,13 @@ window.__ModuleLoader__.load({
|
|
|
5556
5595
|
try {
|
|
5557
5596
|
var payload = await fsClipboardState(scope)
|
|
5558
5597
|
if (payload === null || payload === undefined || payload.ok !== true) return null
|
|
5598
|
+
// The host re-checks the ORIGINALS of the last tree copies: a source that
|
|
5599
|
+
// vanished after Ctrl+C is reported here, with its still-intact staged copy.
|
|
5600
|
+
if (Array.isArray(payload.warnings)) {
|
|
5601
|
+
for (var warningIndex = 0; warningIndex < payload.warnings.length; warningIndex += 1) {
|
|
5602
|
+
if (typeof payload.warnings[warningIndex] === 'string') notify(payload.warnings[warningIndex])
|
|
5603
|
+
}
|
|
5604
|
+
}
|
|
5559
5605
|
return {
|
|
5560
5606
|
files: Array.isArray(payload.files) ? payload.files : [],
|
|
5561
5607
|
text: typeof payload.text === 'string' ? payload.text : '',
|
|
@@ -6239,7 +6285,7 @@ window.__ModuleLoader__.load({
|
|
|
6239
6285
|
var flyout = menuSub === null
|
|
6240
6286
|
? null
|
|
6241
6287
|
: h('div', {
|
|
6242
|
-
key: 'new-flyout', 'data-tree-submenu-panel': 'new',
|
|
6288
|
+
key: 'new-flyout', 'data-tree-submenu-panel': 'new', 'data-ris-ide-menu': '1',
|
|
6243
6289
|
style: Object.assign({}, S.tabMenu, {
|
|
6244
6290
|
position: 'absolute', left: menuSub.left, top: menuSub.top, zIndex: 901, minWidth: 150,
|
|
6245
6291
|
maxHeight: 320, overflowY: 'auto',
|
|
@@ -6256,6 +6302,7 @@ window.__ModuleLoader__.load({
|
|
|
6256
6302
|
return h('div', {
|
|
6257
6303
|
style: Object.assign({}, S.tabMenu, { left: treeMenu.x, top: treeMenu.y, position: 'fixed', zIndex: 900, minWidth: 150 }),
|
|
6258
6304
|
'data-tree-menu': '1',
|
|
6305
|
+
'data-ris-ide-menu': '1',
|
|
6259
6306
|
onMouseDown: function (event) { event.stopPropagation() },
|
|
6260
6307
|
onMouseLeave: function () { setMenuSub(null) },
|
|
6261
6308
|
}, items, flyout)
|
|
@@ -6690,10 +6737,13 @@ window.__ModuleLoader__.load({
|
|
|
6690
6737
|
}
|
|
6691
6738
|
|
|
6692
6739
|
/**
|
|
6693
|
-
* The saved layout of one IDE tab: `{ui:{
|
|
6694
|
-
*
|
|
6740
|
+
* The saved layout of one IDE tab: `{ui:{collapsed,section}, sizes, font,
|
|
6741
|
+
* files, file}`. Persisted per tab + WORKSPACE under
|
|
6695
6742
|
* `dsh-ris-ide:ui:<key>@<cwd>` (m13444).
|
|
6696
6743
|
*
|
|
6744
|
+
* `ui.maximized` is deliberately NOT part of this shape any more (m00584): a
|
|
6745
|
+
* blob written by an older build may still carry it and is ignored on read.
|
|
6746
|
+
*
|
|
6697
6747
|
* Pre-m13444 keys had no workspace suffix. Migration is one-shot: the tab's
|
|
6698
6748
|
* own legacy key (`…:<key>` without `@…`) is adopted ONCE and deleted, so the
|
|
6699
6749
|
* next workspace does not inherit the same open tabs again (C review P1-2).
|
|
@@ -6816,22 +6866,54 @@ window.__ModuleLoader__.load({
|
|
|
6816
6866
|
}
|
|
6817
6867
|
|
|
6818
6868
|
/**
|
|
6819
|
-
*
|
|
6820
|
-
* (a new message, or the same one after the
|
|
6869
|
+
* Which notice kinds the user closed, and at which signature: a notice stays
|
|
6870
|
+
* closed until its SIGNATURE changes (a new message, or the same one after the
|
|
6871
|
+
* state moved on).
|
|
6872
|
+
*
|
|
6873
|
+
* This lives at MODULE scope rather than in component state (m00388): the same
|
|
6874
|
+
* panel can be mounted more than once at the same moment — the DSH sidebar
|
|
6875
|
+
* keeps a hidden copy beside the visible one, and `keepMounted` keeps a copy
|
|
6876
|
+
* alive across tab switches — so a ✕ that only touched the clicked instance
|
|
6877
|
+
* left the other one rendering the notice again ("点 X 关不掉"). Every mounted
|
|
6878
|
+
* instance subscribes and re-renders together.
|
|
6879
|
+
*/
|
|
6880
|
+
var NOTICE_DISMISSALS = {}
|
|
6881
|
+
var NOTICE_DISMISSAL_LISTENERS = []
|
|
6882
|
+
/**
|
|
6883
|
+
* Whether a notice of `kind` with `signature` should still be shown.
|
|
6884
|
+
* @param {string} kind - notice kind (also `data-notice`).
|
|
6885
|
+
* @param {string} signature - the message identity this kind currently carries.
|
|
6886
|
+
* @returns {boolean} true while the user has not closed exactly this one.
|
|
6887
|
+
*/
|
|
6888
|
+
function noticeIsOpen(kind, signature) {
|
|
6889
|
+
return NOTICE_DISMISSALS[kind] !== signature
|
|
6890
|
+
}
|
|
6891
|
+
/**
|
|
6892
|
+
* Close one notice for EVERY mounted panel (and every later mount).
|
|
6893
|
+
* @param {string} kind - notice kind.
|
|
6894
|
+
* @param {string} signature - the message identity being closed.
|
|
6895
|
+
*/
|
|
6896
|
+
function dismissNotice(kind, signature) {
|
|
6897
|
+
if (NOTICE_DISMISSALS[kind] === signature) return
|
|
6898
|
+
NOTICE_DISMISSALS[kind] = signature
|
|
6899
|
+
NOTICE_DISMISSAL_LISTENERS.slice().forEach(function (listener) { listener() })
|
|
6900
|
+
}
|
|
6901
|
+
/**
|
|
6902
|
+
* Subscribe one mounted panel to the shared dismissal table.
|
|
6821
6903
|
* @returns {{isOpen: function(string, string): boolean, dismiss: function(string, string): void}}
|
|
6822
6904
|
*/
|
|
6823
6905
|
function useDismissedNotices() {
|
|
6824
|
-
var [
|
|
6906
|
+
var [, setVersion] = useState(0)
|
|
6907
|
+
useEffect(function () {
|
|
6908
|
+
var listener = function () { setVersion(function (value) { return value + 1 }) }
|
|
6909
|
+
NOTICE_DISMISSAL_LISTENERS.push(listener)
|
|
6910
|
+
return function () {
|
|
6911
|
+
NOTICE_DISMISSAL_LISTENERS = NOTICE_DISMISSAL_LISTENERS.filter(function (item) { return item !== listener })
|
|
6912
|
+
}
|
|
6913
|
+
}, [])
|
|
6825
6914
|
return {
|
|
6826
|
-
isOpen: function (kind, signature) { return
|
|
6827
|
-
dismiss: function (kind, signature) {
|
|
6828
|
-
setDismissed(function (prev) {
|
|
6829
|
-
if (prev[kind] === signature) return prev
|
|
6830
|
-
var next = Object.assign({}, prev)
|
|
6831
|
-
next[kind] = signature
|
|
6832
|
-
return next
|
|
6833
|
-
})
|
|
6834
|
-
},
|
|
6915
|
+
isOpen: function (kind, signature) { return noticeIsOpen(kind, signature) },
|
|
6916
|
+
dismiss: function (kind, signature) { dismissNotice(kind, signature) },
|
|
6835
6917
|
}
|
|
6836
6918
|
}
|
|
6837
6919
|
|
|
@@ -6916,6 +6998,18 @@ window.__ModuleLoader__.load({
|
|
|
6916
6998
|
// (Chromium < 111): without it the hover rule would be dropped entirely.
|
|
6917
6999
|
+ '{background:rgba(0,0,0,0.05);background:color-mix(in srgb, currentColor 7%, transparent)}'
|
|
6918
7000
|
|
|
7001
|
+
/**
|
|
7002
|
+
* Context-menu row hover: the same faint grey tint the tree rows use, under the
|
|
7003
|
+
* pointer over any menu this panel draws (file tree, tab strip, editor gutter).
|
|
7004
|
+
*
|
|
7005
|
+
* `!important` because `S.tabMenuItem` pins `background: transparent` as an
|
|
7006
|
+
* INLINE style — a stylesheet rule loses to inline without it. Disabled rows
|
|
7007
|
+
* (paste with an empty clipboard) keep their flat look.
|
|
7008
|
+
*/
|
|
7009
|
+
var MENU_HOVER_CSS = '[data-workbench="ris-ide"] [data-ris-ide-menu] button:hover:not(:disabled)'
|
|
7010
|
+
// Same color-mix fallback ordering as the tree rows above.
|
|
7011
|
+
+ '{background:rgba(0,0,0,0.05) !important;background:color-mix(in srgb, currentColor 7%, transparent) !important}'
|
|
7012
|
+
|
|
6919
7013
|
/**
|
|
6920
7014
|
* The editor's find panel, restyled to belong to the IDE (user口径: 美化一下
|
|
6921
7015
|
* 编辑器的搜索面板,风格和整体不一致). CodeMirror ships a 2018-looking strip:
|
|
@@ -7473,14 +7567,16 @@ window.__ModuleLoader__.load({
|
|
|
7473
7567
|
var [consoleBulk, setConsoleBulk] = useState(null)
|
|
7474
7568
|
var consoleBulkRef = useRef(false)
|
|
7475
7569
|
var [ui, setUi] = useState(function () {
|
|
7476
|
-
//
|
|
7477
|
-
//
|
|
7478
|
-
//
|
|
7479
|
-
//
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7570
|
+
// Every open starts on the plain 2x2 grid: maximise mode (⤢) is NEVER
|
|
7571
|
+
// persisted nor defaulted (m00584 — a remembered "editor" made the IDE
|
|
7572
|
+
// open looking like it had only an editor, with no hint that a pane was
|
|
7573
|
+
// maximised). Only the collapsed section is restored from the saved blob.
|
|
7574
|
+
var base = { section: 'breakpoints', collapsed: false, threadId: undefined, frameIndex: 0, note: undefined, busy: false, maximized: null }
|
|
7575
|
+
if (savedUi !== null && typeof savedUi.ui === 'object') {
|
|
7576
|
+
if (savedUi.ui.collapsed === true) base.collapsed = true
|
|
7577
|
+
if (typeof savedUi.ui.section === 'string' && savedUi.ui.section !== '') base.section = savedUi.ui.section
|
|
7578
|
+
}
|
|
7579
|
+
return base
|
|
7484
7580
|
})
|
|
7485
7581
|
/** The three user-draggable pane sizes (px). */
|
|
7486
7582
|
var [sizes, setSizes] = useState(function () {
|
|
@@ -7803,6 +7899,8 @@ var [ui, setUi] = useState(function () {
|
|
|
7803
7899
|
var forceEditPathsRef = useRef(new Set())
|
|
7804
7900
|
var [savingPath, setSavingPath] = useState(undefined)
|
|
7805
7901
|
var [pendingClose, setPendingClose] = useState(undefined)
|
|
7902
|
+
/** A "reload from disk" waiting for a decision when the tab is dirty. */
|
|
7903
|
+
var [pendingReload, setPendingReload] = useState(undefined)
|
|
7806
7904
|
/** Bulk close waiting for a decision: `{keepActive, victims, dirty}`. */
|
|
7807
7905
|
var [pendingBulk, setPendingBulk] = useState(undefined)
|
|
7808
7906
|
/** Files opened recently (newest first), shown under the open tabs. */
|
|
@@ -8194,13 +8292,26 @@ var [ui, setUi] = useState(function () {
|
|
|
8194
8292
|
setTimeout(function () { Object.keys(docsRef.current).forEach(function (path) { ensureDocRef.current(path) }) }, 0)
|
|
8195
8293
|
})
|
|
8196
8294
|
|
|
8197
|
-
/**
|
|
8198
|
-
|
|
8295
|
+
/**
|
|
8296
|
+
* Load one document (idempotent): media kinds need no read at all.
|
|
8297
|
+
* @param {string} path - absolute file path.
|
|
8298
|
+
* @param {boolean} [force] - re-read a path that is already loaded (the tab
|
|
8299
|
+
* strip's 重新加载 button); the CALLER drops the draft first, so a reload
|
|
8300
|
+
* never merges an unsaved buffer into what came back from disk.
|
|
8301
|
+
*/
|
|
8302
|
+
function ensureDoc(path, force) {
|
|
8199
8303
|
if (typeof path !== 'string' || path === '') return
|
|
8200
|
-
if (docs[path] !== undefined) return
|
|
8304
|
+
if (force !== true && docs[path] !== undefined) return
|
|
8201
8305
|
if (isPdfPath(path) || isImagePath(path)) {
|
|
8202
8306
|
var kind = isPdfPath(path) ? 'pdf' : 'image'
|
|
8203
|
-
|
|
8307
|
+
// `at` makes the reassignment a real change, so the cache-busting media
|
|
8308
|
+
// URL is rebuilt and the browser reads the file again.
|
|
8309
|
+
setDocs(function (prev) {
|
|
8310
|
+
if (prev[path] !== undefined && force !== true) return prev
|
|
8311
|
+
var next = Object.assign({}, prev)
|
|
8312
|
+
next[path] = { kind: kind, at: force === true ? Date.now() : 0 }
|
|
8313
|
+
return next
|
|
8314
|
+
})
|
|
8204
8315
|
return
|
|
8205
8316
|
}
|
|
8206
8317
|
var cancelled = { current: false }
|
|
@@ -8505,6 +8616,26 @@ var [ui, setUi] = useState(function () {
|
|
|
8505
8616
|
if (isDirty(path)) setPendingClose(path)
|
|
8506
8617
|
else closePath(path)
|
|
8507
8618
|
}
|
|
8619
|
+
/**
|
|
8620
|
+
* Re-read ONE tab from disk (the tab strip's 重新加载 button, m00388).
|
|
8621
|
+
*
|
|
8622
|
+
* "Reload" means *what is on disk now*: the draft is dropped first, never
|
|
8623
|
+
* merged. Media tabs get a fresh cache-busting URL (`ensureDoc(…, true)`);
|
|
8624
|
+
* text tabs get a brand-new document, which the CodeMirror host applies
|
|
8625
|
+
* through its `props.text` effect.
|
|
8626
|
+
* @param {string} path - absolute file path.
|
|
8627
|
+
*/
|
|
8628
|
+
function reloadPath(path) {
|
|
8629
|
+
if (typeof path !== 'string' || path === '') return
|
|
8630
|
+
forgetDoc(path)
|
|
8631
|
+
ensureDoc(path, true)
|
|
8632
|
+
}
|
|
8633
|
+
/** 重新加载: ask first when the tab holds unsaved edits. */
|
|
8634
|
+
function requestReload(path) {
|
|
8635
|
+
if (typeof path !== 'string' || path === '') return
|
|
8636
|
+
if (isDirty(path)) setPendingReload(path)
|
|
8637
|
+
else reloadPath(path)
|
|
8638
|
+
}
|
|
8508
8639
|
/** Disk text for a document: restore the file's original line endings. */
|
|
8509
8640
|
function docTextForDisk(doc) {
|
|
8510
8641
|
if (doc === undefined || doc === null) return ''
|
|
@@ -9278,12 +9409,15 @@ var [ui, setUi] = useState(function () {
|
|
|
9278
9409
|
ensureDoc(openFile)
|
|
9279
9410
|
}, [openFile, sessionId, reloadTick])
|
|
9280
9411
|
|
|
9281
|
-
/** Remember open files, the active one and the layout. */
|
|
9412
|
+
/** Remember open files, the active one and the layout (maximise mode never). */
|
|
9282
9413
|
useEffect(function () {
|
|
9283
9414
|
try {
|
|
9284
9415
|
if (typeof localStorage === 'undefined') return
|
|
9285
9416
|
localStorage.setItem(storageKey, JSON.stringify({
|
|
9286
|
-
|
|
9417
|
+
// No `maximized`: which pane is full-screened is a transient view
|
|
9418
|
+
// state, not a preference (m00584) — a restored ⤢ hid three panes and
|
|
9419
|
+
// looked like the IDE only had an editor.
|
|
9420
|
+
ui: { collapsed: ui.collapsed, section: ui.section },
|
|
9287
9421
|
files: openFiles,
|
|
9288
9422
|
file: openFile,
|
|
9289
9423
|
recent: recentFiles,
|
|
@@ -9291,7 +9425,7 @@ var [ui, setUi] = useState(function () {
|
|
|
9291
9425
|
font: uiFont,
|
|
9292
9426
|
}))
|
|
9293
9427
|
} catch (error) { /* private mode / quota: layout memory is best-effort */ }
|
|
9294
|
-
}, [ui.collapsed, ui.
|
|
9428
|
+
}, [ui.collapsed, ui.section, openFiles, openFile, recentFiles, sizes.left, sizes.leftBottom, sizes.rightBottom, sizes.debugWidth, uiFont])
|
|
9295
9429
|
|
|
9296
9430
|
/**
|
|
9297
9431
|
* Ctrl/Cmd+W closes the active source tab (asking when dirty); Ctrl/Cmd+F4
|
|
@@ -10246,12 +10380,27 @@ var [ui, setUi] = useState(function () {
|
|
|
10246
10380
|
}, '×'))
|
|
10247
10381
|
})),
|
|
10248
10382
|
h('button', { type: 'button', style: S.tabPage, 'data-tab-page': 'next', title: '下一页页签', onClick: function () { pageTabs(1) } }, '▶'),
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10383
|
+
// ± (compare with disk) and ⟳ (reload from disk) ask the SAME question,
|
|
10384
|
+
// "how does my buffer relate to the file?", and only one of them is ever
|
|
10385
|
+
// useful: a dirty buffer can only be compared, a clean one can only be
|
|
10386
|
+
// reloaded (there is nothing left to throw away). So they swap, sharing
|
|
10387
|
+
// one slot in the strip (m00808) instead of leaving a dead ± behind.
|
|
10388
|
+
// `openFile` starts as `undefined` (not ''), so test for "a real path",
|
|
10389
|
+
// not for an empty string — otherwise ⟳ looks enabled with no tab open.
|
|
10390
|
+
isDirty(openFile) === true
|
|
10391
|
+
? h('button', {
|
|
10392
|
+
type: 'button', style: S.tabPage, 'data-action': 'diff',
|
|
10393
|
+
title: '与磁盘版本对比:看这一版到底改了哪几行(' + fileBaseName(openFile) + ')',
|
|
10394
|
+
onClick: function () { setDiffPath(diffPath === openFile ? null : openFile) },
|
|
10395
|
+
}, '±')
|
|
10396
|
+
: h('button', {
|
|
10397
|
+
type: 'button', style: S.tabPage, 'data-action': 'reload-file',
|
|
10398
|
+
title: typeof openFile === 'string' && openFile !== ''
|
|
10399
|
+
? '重新加载 ' + fileBaseName(openFile) + ':丢掉当前缓冲区,重新从磁盘读取(有未保存修改时这个位置变成 ± 对比)'
|
|
10400
|
+
: '先打开一个文件(缓冲区没有未保存修改时,这个位置是重新加载)',
|
|
10401
|
+
disabled: typeof openFile !== 'string' || openFile === '',
|
|
10402
|
+
onClick: function () { requestReload(openFile) },
|
|
10403
|
+
}, '⟳'),
|
|
10255
10404
|
testRunTarget(openFile, cwd) === null
|
|
10256
10405
|
? null
|
|
10257
10406
|
: h('button', {
|
|
@@ -10335,6 +10484,34 @@ var [ui, setUi] = useState(function () {
|
|
|
10335
10484
|
onClick: function () { setPendingBulk(undefined) },
|
|
10336
10485
|
}, '×'))
|
|
10337
10486
|
: null
|
|
10487
|
+
var reloadPrompt = pendingReload !== undefined
|
|
10488
|
+
? h('div', { style: Object.assign({}, S.notice, { display: 'flex', alignItems: 'center', gap: 6 }), 'data-reload-prompt': '1' },
|
|
10489
|
+
h('span', { style: { flex: '1 1 auto', minWidth: 0 } }, '「' + fileBaseName(pendingReload) + '」有未保存的修改,重新加载会丢掉它们:'),
|
|
10490
|
+
h('button', {
|
|
10491
|
+
type: 'button', style: S.button, 'data-action': 'save-reload', title: '保存当前修改,再从磁盘重新读取',
|
|
10492
|
+
onClick: function () {
|
|
10493
|
+
var target = pendingReload
|
|
10494
|
+
setPendingReload(undefined)
|
|
10495
|
+
void savePath(target).then(function (ok) { if (ok) reloadPath(target) })
|
|
10496
|
+
},
|
|
10497
|
+
}, '保存并重载'),
|
|
10498
|
+
h('button', {
|
|
10499
|
+
type: 'button', style: S.buttonOff, 'data-action': 'discard-reload', title: '丢掉未保存的修改,按磁盘上的版本重新加载',
|
|
10500
|
+
onClick: function () {
|
|
10501
|
+
var target = pendingReload
|
|
10502
|
+
setPendingReload(undefined)
|
|
10503
|
+
reloadPath(target)
|
|
10504
|
+
},
|
|
10505
|
+
}, '丢弃重载'),
|
|
10506
|
+
h('button', {
|
|
10507
|
+
type: 'button', style: S.buttonOff, 'data-action': 'cancel-reload', title: '保持当前缓冲区不动',
|
|
10508
|
+
onClick: function () { setPendingReload(undefined) },
|
|
10509
|
+
}, '取消'),
|
|
10510
|
+
h('button', {
|
|
10511
|
+
type: 'button', style: Object.assign({}, S.buttonOff, { padding: '0 4px' }), 'data-notice-close': 'reload-prompt', title: '关闭提示(保持当前缓冲区)',
|
|
10512
|
+
onClick: function () { setPendingReload(undefined) },
|
|
10513
|
+
}, '×'))
|
|
10514
|
+
: null
|
|
10338
10515
|
var body = openFiles.length === 0
|
|
10339
10516
|
? h('div', { style: S.idePlaceholder, 'data-no-file': '1' }, '在左侧选择一个文件:打开即可编辑,Ctrl/Cmd+S 保存')
|
|
10340
10517
|
: openFiles.map(filePane)
|
|
@@ -10347,6 +10524,7 @@ var [ui, setUi] = useState(function () {
|
|
|
10347
10524
|
overflowY: 'auto', zIndex: 945,
|
|
10348
10525
|
}),
|
|
10349
10526
|
'data-tabs-menu': '1',
|
|
10527
|
+
'data-ris-ide-menu': '1',
|
|
10350
10528
|
onMouseDown: function (event) { event.stopPropagation() },
|
|
10351
10529
|
},
|
|
10352
10530
|
menuRows.length === 0 ? h('span', { style: Object.assign({}, S.meta, { display: 'block', padding: '4px 10px' }) }, '还没有打开过文件')
|
|
@@ -10457,6 +10635,7 @@ var [ui, setUi] = useState(function () {
|
|
|
10457
10635
|
tabsMenu,
|
|
10458
10636
|
prompt,
|
|
10459
10637
|
bulkPrompt,
|
|
10638
|
+
reloadPrompt,
|
|
10460
10639
|
h('div', { style: S.filePanes },
|
|
10461
10640
|
// The editor is NEVER swapped out: hiding it behind an overlay keeps
|
|
10462
10641
|
// the CodeMirror instance (and its undo history) alive, so closing the
|
|
@@ -10838,7 +11017,7 @@ var [ui, setUi] = useState(function () {
|
|
|
10838
11017
|
if (paneConfig !== null && typeof paneConfig.generate === 'function') {
|
|
10839
11018
|
consoleConfigActions.push(button('⚙', function () { paneConfig.generate() }, { key: 'config-generate', icon: true, height: 20, action: 'config-generate', title: paneConfig.exists === true ? '更新配置:按当前扫描结果同步 .dsh-ris-ide/config.json(保留你改过的字段)' : '生成配置:把扫描到的程序写成 .dsh-ris-ide/config.json' }))
|
|
10840
11019
|
}
|
|
10841
|
-
paneActions.push(button('
|
|
11020
|
+
paneActions.push(button('▦', resetLayout, { key: 'layout-reset', icon: true, height: 20, action: 'layout-reset', title: '还原布局尺寸:左列 300px、调试区 300px、两个下层 260px(不改变最大化状态;管尺寸不管内容)' }))
|
|
10842
11021
|
|
|
10843
11022
|
/** Load the visual debug settings from the host (⚙ opens on a fresh read). */
|
|
10844
11023
|
async function refreshDebugSettings() {
|
|
@@ -10953,7 +11132,7 @@ var [ui, setUi] = useState(function () {
|
|
|
10953
11132
|
},
|
|
10954
11133
|
// The sidebar's CodeMirror theme pins 13px, so the embedded viewer needs
|
|
10955
11134
|
// this rule, not inheritance, to follow A−/A+.
|
|
10956
|
-
h('style', { key: 'ide-font' }, viewerFontCss(uiFont) + viewerThemeCss(pageDark) + DEBUG_LINE_CSS + PREVIEW_CSS + SELECTION_CSS + SCROLLBAR_CSS + SEARCH_PANEL_CSS + TOAST_CSS + PROGRAM_LOADING_CSS + TREE_HOVER_CSS),
|
|
11135
|
+
h('style', { key: 'ide-font' }, viewerFontCss(uiFont) + viewerThemeCss(pageDark) + DEBUG_LINE_CSS + PREVIEW_CSS + SELECTION_CSS + SCROLLBAR_CSS + SEARCH_PANEL_CSS + TOAST_CSS + PROGRAM_LOADING_CSS + TREE_HOVER_CSS + MENU_HOVER_CSS),
|
|
10957
11136
|
(function () {
|
|
10958
11137
|
var panes = {
|
|
10959
11138
|
tree: h(IdeTree, {
|
|
@@ -11310,6 +11489,7 @@ var [ui, setUi] = useState(function () {
|
|
|
11310
11489
|
editorMenu === null ? null : h('div', {
|
|
11311
11490
|
style: Object.assign({}, S.tabMenu, { left: editorMenu.x, top: editorMenu.y, position: 'fixed', zIndex: 950, minWidth: 200 }),
|
|
11312
11491
|
'data-editor-menu': '1',
|
|
11492
|
+
'data-ris-ide-menu': '1',
|
|
11313
11493
|
onMouseDown: function (event) { event.stopPropagation() },
|
|
11314
11494
|
}, (editorMenu.items || []).map(function (item, index) {
|
|
11315
11495
|
if (item.separator === true) {
|
|
@@ -11399,6 +11579,7 @@ var [ui, setUi] = useState(function () {
|
|
|
11399
11579
|
tabMenu === null ? null : h('div', {
|
|
11400
11580
|
style: Object.assign({}, S.tabMenu, { left: tabMenu.x, top: tabMenu.y }),
|
|
11401
11581
|
'data-tab-menu': tabMenu.kind,
|
|
11582
|
+
'data-ris-ide-menu': '1',
|
|
11402
11583
|
onMouseDown: function (event) { event.stopPropagation() },
|
|
11403
11584
|
},
|
|
11404
11585
|
h('button', { type: 'button', style: S.tabMenuItem, 'data-action': 'ctx-close-others', onClick: function () { closeOtherTabsOf(); closeTabMenu() } }, '关闭其他'),
|
|
@@ -12611,22 +12792,57 @@ var [ui, setUi] = useState(function () {
|
|
|
12611
12792
|
*/
|
|
12612
12793
|
async function fsOp(action, scope, payload) {
|
|
12613
12794
|
var url = routeUrl('dsh-ris-ide/fs/' + action)
|
|
12614
|
-
|
|
12615
|
-
|
|
12616
|
-
|
|
12617
|
-
|
|
12618
|
-
|
|
12619
|
-
|
|
12620
|
-
|
|
12621
|
-
|
|
12622
|
-
|
|
12795
|
+
/**
|
|
12796
|
+
* POST one body for one scope and normalize the host's answer: the payload on
|
|
12797
|
+
* success, an `Error` (carrying the host's machine `code`) on failure. A return
|
|
12798
|
+
* instead of a throw lets `fsOp` retry exactly once.
|
|
12799
|
+
* @param {{sessionId?: string, cwd?: string}} active - the scope to send.
|
|
12800
|
+
* @returns {Promise<object|Error>} host payload or the failure.
|
|
12801
|
+
*/
|
|
12802
|
+
async function send(active) {
|
|
12803
|
+
var response = await fetch(url.href, {
|
|
12804
|
+
method: 'POST',
|
|
12805
|
+
headers: { 'content-type': 'application/json' },
|
|
12806
|
+
body: JSON.stringify(Object.assign({
|
|
12807
|
+
sessionId: active.sessionId,
|
|
12808
|
+
}, typeof active.cwd === 'string' && active.cwd !== '' ? { cwd: active.cwd } : {}, payload)),
|
|
12809
|
+
})
|
|
12810
|
+
var parsed = await response.json().catch(function () { return null })
|
|
12811
|
+
if (response.ok && parsed !== null && parsed.ok === true) return parsed
|
|
12623
12812
|
var failure = new Error(parsed !== null && parsed.message !== undefined ? parsed.message : 'HTTP ' + response.status)
|
|
12624
12813
|
// The paste flow branches on `exists` to offer 改名/覆盖: keep the host's
|
|
12625
12814
|
// machine code on the error instead of flattening it into a message.
|
|
12626
12815
|
failure.code = parsed !== null && typeof parsed.code === 'string' ? parsed.code : ''
|
|
12627
|
-
|
|
12816
|
+
return failure
|
|
12628
12817
|
}
|
|
12629
|
-
|
|
12818
|
+
var first = await send(scope)
|
|
12819
|
+
if (!(first instanceof Error)) return first
|
|
12820
|
+
/**
|
|
12821
|
+
* `outside-workspace` is the ONE failure the page can heal without the user:
|
|
12822
|
+
* it means the host fenced this request against a different workspace than the
|
|
12823
|
+
* tree on screen. After a workspace switch the panel/window can still carry the
|
|
12824
|
+
* previous Session (the standalone window keeps the Session it booted on), and
|
|
12825
|
+
* every mutation then died with 「后台任务出错:不能对工作区之外的路径执行新建文件夹」
|
|
12826
|
+
* (m00220). Re-read the live pair once — the page's own live scope first, else
|
|
12827
|
+
* the host's live Session for this workspace — and retry silently.
|
|
12828
|
+
*/
|
|
12829
|
+
if (first.code === 'outside-workspace') {
|
|
12830
|
+
var next = null
|
|
12831
|
+
var fresh = liveScope()
|
|
12832
|
+
if (fresh !== undefined && typeof fresh.sessionId === 'string' && fresh.sessionId !== '' && fresh.sessionId !== scope.sessionId) {
|
|
12833
|
+
next = { sessionId: fresh.sessionId, cwd: typeof fresh.cwd === 'string' && fresh.cwd !== '' ? fresh.cwd : scope.cwd }
|
|
12834
|
+
}
|
|
12835
|
+
if (next === null) {
|
|
12836
|
+
var alive = await liveSessionOfScope(scope)
|
|
12837
|
+
if (alive !== undefined && alive !== scope.sessionId) next = { sessionId: alive, cwd: scope.cwd }
|
|
12838
|
+
}
|
|
12839
|
+
if (next !== null) {
|
|
12840
|
+
var retried = await send(next)
|
|
12841
|
+
if (!(retried instanceof Error)) return retried
|
|
12842
|
+
throw retried
|
|
12843
|
+
}
|
|
12844
|
+
}
|
|
12845
|
+
throw first
|
|
12630
12846
|
}
|
|
12631
12847
|
function fsMkdir(scope, path) { return fsOp('mkdir', scope, { path: path }) }
|
|
12632
12848
|
function fsCreateFile(scope, path, content) { return fsOp('create', scope, { path: path, content: content === undefined ? '' : content }) }
|
|
@@ -13789,6 +14005,22 @@ var [ui, setUi] = useState(function () {
|
|
|
13789
14005
|
if (typeof storeCwd === 'string' && storeCwd !== '') cwd = storeCwd
|
|
13790
14006
|
// A stale session id must not blank the panel: the host still accepts a cwd.
|
|
13791
14007
|
if (typeof cwd !== 'string' || cwd === '') cwd = knownWorkspaceCwd()
|
|
14008
|
+
/**
|
|
14009
|
+
* Publish the freshest (Session, workspace) pair to `fsOp`'s one-shot retry.
|
|
14010
|
+
* A mutation refused as `outside-workspace` means the host fenced it against a
|
|
14011
|
+
* workspace other than the tree on screen; the retry asks THIS closure (which
|
|
14012
|
+
* re-reads the sidebar's live marker and the session store) instead of guessing.
|
|
14013
|
+
*/
|
|
14014
|
+
useEffect(function () {
|
|
14015
|
+
setLiveScopeResolver(function () {
|
|
14016
|
+
var live = liveSidebarSessionId()
|
|
14017
|
+
var nextSessionId = typeof live === 'string' && live !== '' ? live : sessionId
|
|
14018
|
+
var nextCwd = sessionWorkspaceCwd(props ? props.useSessions : undefined, nextSessionId)
|
|
14019
|
+
if (typeof nextCwd !== 'string' || nextCwd === '') nextCwd = cwd
|
|
14020
|
+
return { sessionId: nextSessionId, cwd: nextCwd }
|
|
14021
|
+
})
|
|
14022
|
+
return function () { setLiveScopeResolver(null) }
|
|
14023
|
+
}, [sessionId, cwd])
|
|
13792
14024
|
// Selections and the followed log belong to the workspace they were made in,
|
|
13793
14025
|
// so a Session switch drops them instead of showing another project's log.
|
|
13794
14026
|
var sessionIdentity = typeof sessionId === 'string' ? sessionId : ''
|
|
@@ -13822,7 +14054,8 @@ var [ui, setUi] = useState(function () {
|
|
|
13822
14054
|
// Which of the two compact sections owns the panel ('' = split view). The
|
|
13823
14055
|
// sidebar is too narrow for the IDE's 2x2 maximize, but "最大化这一段" is
|
|
13824
14056
|
// still useful when reading a long log or a long program list.
|
|
13825
|
-
|
|
14057
|
+
/** Which compact section is expanded ('console' | 'log' | ''): view state only, starts split. */
|
|
14058
|
+
var [compactMax, setCompactMax] = useState('')
|
|
13826
14059
|
// The compact log pane's "follow the tail" switch. LogTail defaults to
|
|
13827
14060
|
// following, but the sidebar view had no control for it — the IDE title bar
|
|
13828
14061
|
// owned that button, so the compact header needs its own.
|
|
@@ -14246,11 +14479,11 @@ var [ui, setUi] = useState(function () {
|
|
|
14246
14479
|
}
|
|
14247
14480
|
|
|
14248
14481
|
/** Drag the hairline above the log pane; the height is remembered on release. */
|
|
14249
|
-
/** Maximize one compact section (console | log); the other one is parked.
|
|
14482
|
+
/** Maximize one compact section (console | log); the other one is parked.
|
|
14483
|
+
* Deliberately NOT written to storage: reopening the panel always shows
|
|
14484
|
+
* the split view (m00584). */
|
|
14250
14485
|
function toggleCompactMax(section) {
|
|
14251
|
-
|
|
14252
|
-
writePref(COMPACT_MAX_KEY, next)
|
|
14253
|
-
setCompactMax(next)
|
|
14486
|
+
setCompactMax(compactMax === section ? '' : section)
|
|
14254
14487
|
}
|
|
14255
14488
|
|
|
14256
14489
|
function dragLogPane(event) {
|
|
@@ -14800,8 +15033,6 @@ var [ui, setUi] = useState(function () {
|
|
|
14800
15033
|
COMPACT_PANE_DEFAULT: COMPACT_PANE_DEFAULT,
|
|
14801
15034
|
COMPACT_UI_KEY: COMPACT_UI_KEY,
|
|
14802
15035
|
CompactLogHead: CompactLogHead,
|
|
14803
|
-
COMPACT_MAX_KEY: COMPACT_MAX_KEY,
|
|
14804
|
-
readCompactMax: readCompactMax,
|
|
14805
15036
|
readCompactPaneHeight: readCompactPaneHeight,
|
|
14806
15037
|
requestDebug: requestDebug,
|
|
14807
15038
|
requestDebugs: requestDebugs,
|
|
@@ -14853,6 +15084,14 @@ var [ui, setUi] = useState(function () {
|
|
|
14853
15084
|
debugSnapshotSuspended: debugSnapshotSuspended,
|
|
14854
15085
|
debugSuspendedThreadId: debugSuspendedThreadId,
|
|
14855
15086
|
readSavedUi: readSavedUi,
|
|
15087
|
+
// Notice dismissals are shared module state (m00388): the ✕ has to stick for
|
|
15088
|
+
// every mounted copy of the panel, so the table itself is the test seam.
|
|
15089
|
+
noticeIsOpen: noticeIsOpen,
|
|
15090
|
+
dismissNotice: dismissNotice,
|
|
15091
|
+
__resetNoticeDismissals: function () {
|
|
15092
|
+
NOTICE_DISMISSALS = {}
|
|
15093
|
+
NOTICE_DISMISSAL_LISTENERS.forEach(function (listener) { listener() })
|
|
15094
|
+
},
|
|
14856
15095
|
treeLabel: treeLabel,
|
|
14857
15096
|
childEntryFor: childEntryFor,
|
|
14858
15097
|
pathWithin: pathWithin,
|
|
@@ -18,6 +18,20 @@
|
|
|
18
18
|
| 内存 | +5MB RSS(实测) | ~40–60MB |
|
|
19
19
|
| 集成 | 面板/agent/路由共用同一会话 | 工具在 `mcp__jvm-debug__*`,面板需另建通道 |
|
|
20
20
|
|
|
21
|
+
## 本地补丁(重 vendor 时必须保留)
|
|
22
|
+
|
|
23
|
+
**`sendCommand` 的看门狗定时器要清掉**(2026-11-11,`jdwp/client.js` 与 `src/jdwp/client.ts` 同步):
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
const timer = setTimeout(() => { /* 超时 reject */ }, this.timeout)
|
|
27
|
+
timer.unref?.()
|
|
28
|
+
this.pendingRequests.set(id, { resolve, reject, timer })
|
|
29
|
+
// processBuffer 收到对应 reply 时:
|
|
30
|
+
clearTimeout(pending.timer)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
上游原实现每条命令都留一个 **10 s** 定时器、且不 `unref`、回复到达也不 `clearTimeout`:最后一条命令之后事件循环被吊满 10 s(`test/debug-engine.test.mjs` 因此从 1.9 s 变成 12.5 s),真实调试会话收尾也会白等。清理点就是收 reply 的那一支(`const pending = this.pendingRequests.get(id)` 之后、`pending.resolve(...)` 之前)——`clearTimeout(undefined)` 本身是安全的,所以不额外判空;别把清理只写在 `delete` 之后却漏掉 early-return 的分支。
|
|
34
|
+
|
|
21
35
|
## 重新构建(上游有更新或改了 TS 源码时)
|
|
22
36
|
|
|
23
37
|
```bash
|