dsh-ris-ide 1.8.0 → 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 +5 -3
- package/bin/risd.mjs +14 -17
- package/lib/client.js +400 -93
- 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/proxybridge-bundle.js +1 -1
- package/lib/proxybridge-health.js +206 -0
- package/lib/redirector.js +1181 -90
- package/lib/risd/lifecycle.js +9 -3
- package/lib/risd/server.js +762 -26
- package/lib/risd/ui.js +419 -98
- package/lib/risd-client.js +4 -1
- package/lib/startup.js +27 -7
- package/package.json +2 -2
- package/test/client-viewer.test.mjs +299 -120
- 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/proxybridge-health.test.mjs +116 -0
- package/test/redirector-bundle.test.mjs +21 -67
- package/test/redirector.test.mjs +395 -5
- package/test/risd-api.test.mjs +114 -17
- 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-restart.test.mjs +104 -0
- 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 +322 -4
- package/test/risd-write.test.mjs +2 -1
- package/test/startup-reconcile.test.mjs +44 -8
- package/test/proxy-restart.test.mjs +0 -37
package/lib/risd-client.js
CHANGED
|
@@ -205,10 +205,13 @@ export function saveProxy(state, { cwd, config, revision, gitHost } = {}) {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
/** Run one of the three-layer actions (engine + bridge + git) in the daemon. */
|
|
208
|
-
export function proxyAction(state, { cwd, action, gitHost, ruleId } = {}) {
|
|
208
|
+
export function proxyAction(state, { cwd, action, gitHost, ruleId, interactive } = {}) {
|
|
209
209
|
const body = { cwd, action }
|
|
210
210
|
if (typeof gitHost === 'string' && gitHost !== '') body.gitHost = gitHost
|
|
211
211
|
if (typeof ruleId === 'string' && ruleId !== '') body.ruleId = ruleId
|
|
212
|
+
// Only an explicit click sets this: a password dialog must never be a side
|
|
213
|
+
// effect of saving rules or of dsh starting (m13910).
|
|
214
|
+
if (interactive === true) body.interactive = true
|
|
212
215
|
return risdRequest(state, '/v1/action', { method: 'POST', body })
|
|
213
216
|
}
|
|
214
217
|
|
package/lib/startup.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// @module dsh-ris-ide/startup
|
|
15
15
|
import { existsSync, rmSync } from 'node:fs'
|
|
16
16
|
import { proxyPid, proxyPidPath, proxyStatus, readProxyConfig } from './proxy.js'
|
|
17
|
-
import { reloadFailedPath, readWindowsServiceState, redirectorStatusCached, restoreWindowsService } from './redirector.js'
|
|
17
|
+
import { clearWindowsServiceState, reloadFailedPath, readWindowsServiceState, redirectorStatusCached, restoreWindowsService } from './redirector.js'
|
|
18
18
|
import { clearGitProxy, enabledGitRuleHost, readGitProxyState, syncGitProxy } from './risd/git.js'
|
|
19
19
|
import { readRisdState, removeRisdState } from './risd/state.js'
|
|
20
20
|
import { risdHealth } from './risd-client.js'
|
|
@@ -22,11 +22,27 @@ import { risdHealth } from './risd-client.js'
|
|
|
22
22
|
/**
|
|
23
23
|
* Bring the machine back in line with the current rules.
|
|
24
24
|
*
|
|
25
|
-
* @param {
|
|
26
|
-
*
|
|
25
|
+
* @param {object} [options] - workspace hint (legacy paths), a logger, and the two
|
|
26
|
+
* bridge probes. The probes are injectable on purpose: `redirectorStatusCached()`
|
|
27
|
+
* shells out to PowerShell on WSL/Windows (seconds, and only accurate while the
|
|
28
|
+
* probe of the moment answers) and `restoreWindowsService()` really runs
|
|
29
|
+
* `Set-Service`/`Start-Service`. A test that called them directly was (a) slow,
|
|
30
|
+
* (b) flaky — a bridge that happened to be running silently changed the branch —
|
|
31
|
+
* and (c) able to restart the developer's own ProxyBridgeSvc.
|
|
32
|
+
* @param {string} [options.cwd] - workspace hint, only used to resolve legacy paths.
|
|
33
|
+
* @param {(message: string) => void} [options.log] - logger.
|
|
34
|
+
* @param {() => {running?: boolean}} [options.status] - bridge status probe.
|
|
35
|
+
* @param {() => {restored?: boolean, reason?: string}} [options.restore] - service restore.
|
|
36
|
+
* @param {number|null} [options.ownPid] - this process, so its own state is never removed.
|
|
27
37
|
* @returns {Promise<{ok: boolean, notes: string[]}>} what was cleaned (empty = clean).
|
|
28
38
|
*/
|
|
29
|
-
export async function reconcileStartupLeftovers({
|
|
39
|
+
export async function reconcileStartupLeftovers({
|
|
40
|
+
cwd = '',
|
|
41
|
+
log = () => {},
|
|
42
|
+
ownPid = null,
|
|
43
|
+
status = redirectorStatusCached,
|
|
44
|
+
restore = restoreWindowsService,
|
|
45
|
+
} = {}) {
|
|
30
46
|
const notes = []
|
|
31
47
|
const note = (message) => {
|
|
32
48
|
notes.push(message)
|
|
@@ -85,15 +101,19 @@ export async function reconcileStartupLeftovers({ cwd = '', log = () => {}, ownP
|
|
|
85
101
|
|
|
86
102
|
// A reload failure marker from the previous run describes a bridge that is not
|
|
87
103
|
// running any more; keeping it makes the panel warn about nothing.
|
|
88
|
-
if (existsSync(reloadFailedPath()) &&
|
|
104
|
+
if (existsSync(reloadFailedPath()) && status().running !== true) {
|
|
89
105
|
rmSync(reloadFailedPath(), { force: true })
|
|
90
106
|
note('清掉了上次遗留的桥接重载失败标记')
|
|
91
107
|
}
|
|
92
108
|
|
|
93
109
|
const serviceState = readWindowsServiceState()
|
|
94
110
|
if (serviceState !== null && serviceState.stoppedByUs === true) {
|
|
95
|
-
if (
|
|
96
|
-
const restored =
|
|
111
|
+
if (status().running !== true) {
|
|
112
|
+
const restored = restore()
|
|
113
|
+
// `restoreWindowsService()` clears the record itself; with an injected
|
|
114
|
+
// `restore` (tests) nothing would, so clear here too — the record describes a
|
|
115
|
+
// service that is no longer parked either way.
|
|
116
|
+
if (restored.restored === true) clearWindowsServiceState()
|
|
97
117
|
note(restored.restored === true
|
|
98
118
|
? '已恢复上次被停用的 ProxyBridgeSvc'
|
|
99
119
|
: `ProxyBridgeSvc 未能自动恢复:${restored.reason ?? '未知原因'}(可手动把启动类型改回 Automatic)`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ris-ide",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "RIS-IDE local dev panel for the DSH web GUI: live log tail, one-click start/stop of workspace programs, JDWP debugging, file tree + editor, and a standalone IDE window that carries no session history. · DSH 右侧栏本地开发面板:日志实时跟随、一键启停本地程序、Java 断点调试、文件树与编辑器、独立 IDE 窗口。",
|
|
6
6
|
"keywords": [
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
|
-
"test": "node --test \"test/*.test.mjs\"",
|
|
78
|
+
"test": "node --test --test-timeout=120000 \"test/*.test.mjs\"",
|
|
79
79
|
"build": "tsdown --config tsdown.config.mjs",
|
|
80
80
|
"check:listing": "node bin/check-listing.mjs"
|
|
81
81
|
},
|