@jiyr0119/dsh-service-console 0.10.0 → 0.11.0

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 CHANGED
@@ -24,7 +24,7 @@ Single-purpose plugin for the DeepSeek Harness web UI. When the model (or you) s
24
24
  - **Control** — graceful stop to the process group, restart with a safe saved launch command. Every action is confirmed twice and re-validated against the current snapshot.
25
25
  - **Safeguards** — PID-reuse / fingerprint checks before any signal; unknown and protected services are read-only; force-kill is off by default; no implicit auto-cleanup; command output is redacted.
26
26
  - **All local services** — every listening service on this machine is visible; ownership is shown as a safety signal rather than a hidden category filter.
27
- - **Search, config, i18n** — keyword filtering, graceful timeout / force-kill settings, auto-refresh interval, and Chinese/English labels following DSH's active locale through the platform `t` seat.
27
+ - **Search, config, i18n** — keyword filtering, graceful timeout / force-kill settings, auto-refresh interval, and labels in all **8 DSH languages** (`zh en ja es fr de ru pt`) following the active locale through the platform `t` seat.
28
28
  - **Scanning** — opening the console fetches a snapshot; the refresh button rescans on demand, and an optional interval (off / 2 / 5 / 10 / 30 s) keeps the list live while the panel is open.
29
29
  - **DSH-native inspector** — an expanded service record card presents process identity, ports, command, working directory and ownership evidence in the Web UI's token-based visual language.
30
30
  - **Chat card + model tool** — a read-only `service_list` model tool with a bounded presentation payload, plus a settings page with its own navigation icon.
@@ -46,9 +46,9 @@ Requires DSH `>=0.2.2-rc.5 <0.3.0` (declared as `engines.dsh`) and Node.js `>=24
46
46
 
47
47
  ## UI preview
48
48
 
49
- ![Service Console 0.2.0 — all local services and DSH-style inspector](./assets/service-console-0.2.0.gif)
49
+ ![Service Console 0.11.0 — right-Sidebar tab with ownership badges and the protected-process guard](./assets/service-console-0.11.0.png)
50
50
 
51
- The preview shows the complete local listening-service list and the expanded inspector card. The ownership badge remains visible as a safety signal, while the list itself is no longer split into conversation/workspace/machine categories.
51
+ The preview shows the console as a right-Sidebar tab: the scope filter, search, and one collapsed row per service with its ownership badge and the protected-process capsule. Expand a row for the full inspector (process id, parent, start time, evidence).
52
52
 
53
53
  **[→ Interactive Demo](./demo/index.html)** — try the Service Console UI in your browser (no installation required).
54
54
 
@@ -59,6 +59,11 @@ The preview shows the complete local listening-service list and the expanded ins
59
59
  - Sensitive tokens/passwords in command summaries are redacted.
60
60
  - This plugin is **not** a general process manager: system-critical, high-privilege, unknown and protected processes are read-only.
61
61
 
62
+ ## Docs
63
+
64
+ - [User guide](docs/user-guide.zh.md) · [兼容矩阵](docs/compatibility.zh.md) · [故障排查](docs/troubleshooting.zh.md)
65
+ - [Right-Sidebar tab / composer pill / chat card: the three entry points](docs/DETAIL.md)
66
+
62
67
  ## Development
63
68
 
64
69
  ```bash
@@ -74,9 +79,20 @@ npm test # unit + integration tests (node --test)
74
79
 
75
80
  | File | Type | What it covers |
76
81
  | --- | --- | --- |
77
- | `test/process-inspector.test.mjs` | Unit | Platform output parsing (`parseLstart`, `parseListenRows`, `parsePsRows`, `parseAddress`), command redaction, five-level ownership classification |
78
- | `test/host-more.test.mjs` | Unit | Config validation, session ledger, lifecycle state machine (stop/restart) with fake dependencies, service aggregation & fingerprint stability |
79
- | `test/integration.test.mjs` | Integration | Real system commands + a temporary HTTP server spawned by the test itself; signals are only ever sent to test-owned processes |
82
+ | `test/process-inspector.test.mjs` | Unit | Machine-readable `lsof`/`ps` parsing, cancellation of child processes, command redaction |
83
+ | `test/host-more.test.mjs` | Unit | Config schema/merge, ownership & ledger, lifecycle state machine, scan-failure error codes, service aggregation |
84
+ | `test/ledger-projection.test.mjs` | Unit | Session-log reducer: settlement semantics, PTC events, caps, TTL, malformed state |
85
+ | `test/service-list-view.test.mjs` | Unit | Chat-card/pill projections, loopback URL allow-list, prototype-injection hardening |
86
+ | `test/snapshot-cache.test.mjs` | Unit | TTL, single-flight, stale-while-error, invalidation |
87
+ | `test/i18n-dictionaries.test.mjs` | Unit | All 8 languages share one key set and identical placeholders per key |
88
+ | `test/plugin-metadata.test.mjs` | Unit | Locale meta, one-image detail documents, packaged `exports` for locale/icon |
89
+ | `test/hot-reload.test.mjs` | Unit | Duplicate registration / route / tool handling under hot double-load; loopback guard; config route |
90
+ | `test/protection.test.mjs` | Unit | Protected-process classification and snapshot integration |
91
+ | `test/locale-race.test.mjs` | Unit | Locale service arriving late, double-load disposal order, provider restart |
92
+ | `test/service-tool.test.mjs` | Unit | `service_list` schema, filtering, rendered text, presentation payload |
93
+ | `test/integration.test.mjs` | Integration | Real system commands + a temporary HTTP server; signals only to test-owned processes |
94
+
95
+ `scripts/gui-smoke.mjs` (`npm run smoke:gui`) is the release gate: it boots a real DSH web profile in an isolated `DSH_HOME`, installs the packed tarball, and drives Chromium to assert activation, the projection registration, the tab, a real scan, the tablist semantics and the public close event.
80
96
 
81
97
  ```bash
82
98
  npm test # full suite
package/README.zh.md CHANGED
@@ -26,7 +26,7 @@
26
26
  - **受控操作** — 对进程组优雅停止;对保存了安全启动命令的服务重启。每个动作均二次确认,并在操作前重新校验快照。
27
27
  - **安全防护** — 任何信号前校验 PID 复用 / fingerprint;未知与受保护服务只读;强制终止默认关闭;无隐式自动清理;命令输出脱敏。
28
28
  - **全量本机服务** — 展示本机全部监听服务;归属只作为安全提示,不再隐藏端口分类,用户可自行选择要查看或停止的服务。
29
- - **搜索 / 配置 / 国际化** — 支持关键字过滤、优雅超时 / 强制终止、自动刷新间隔;中英文文案通过平台 `t` seat 跟随 DSH 当前语言。
29
+ - **搜索 / 配置 / 国际化** — 支持关键字过滤、优雅超时 / 强制终止、自动刷新间隔;**DSH 全部 8 种语言**(`zh en ja es fr de ru pt`)通过平台 `t` seat 跟随当前语言。
30
30
  - **扫描** — 打开控制台时获取快照;刷新按钮按需重扫,可选的自动刷新间隔(关闭 / 2 / 5 / 10 / 30 秒)在面板打开期间保持列表最新。
31
31
  - **DSH 原生检查卡片** — 展开详情采用 DSH Web token 化视觉风格,展示进程身份、端口、命令、工作目录和归属证据。
32
32
  - **聊天卡片 + 模型工具** — 只读 `service_list` 模型工具(呈现载荷有界),以及带独立导航图标的设置页。
@@ -48,9 +48,9 @@ dsh plugin --profile web add -w @jiyr0119/dsh-service-console@latest
48
48
 
49
49
  ## 界面预览
50
50
 
51
- ![Service Console 0.2.0:全量本机服务与 DSH 风格检查卡片](./assets/service-console-0.2.0.gif)
51
+ ![Service Console 0.11.0:右侧栏标签、归属徽标与受保护进程门禁](./assets/service-console-0.11.0.png)
52
52
 
53
- 预览展示本机完整监听服务列表与展开后的检查卡片。归属徽标仍作为安全提示保留,但列表不再按对话 / 工作区 / 本机拆分隐藏服务。
53
+ 预览展示右侧栏里的控制台:范围切换、搜索,以及每个服务一行(折叠态)的归属徽标与受保护胶囊;展开某行可见进程 id、父进程、启动时间与归属证据。
54
54
 
55
55
  **[→ 交互式演示](./demo/index.html)** — 无需安装即可在浏览器中体验 Service Console 界面。
56
56
 
@@ -61,6 +61,11 @@ dsh plugin --profile web add -w @jiyr0119/dsh-service-console@latest
61
61
  - 命令摘要中的敏感 token/密码会脱敏。
62
62
  - 本插件**不是**通用进程管理器:系统关键、高权限、未知和受保护进程一律只读。
63
63
 
64
+ ## 文档
65
+
66
+ - [使用指南](docs/user-guide.zh.md) · [兼容矩阵](docs/compatibility.zh.md) · [故障排查](docs/troubleshooting.zh.md)
67
+ - [三种入口:右侧栏标签 / 常驻 pill / 聊天卡片](docs/DETAIL.zh.md)
68
+
64
69
  ## 开发
65
70
 
66
71
  ```bash
package/docs/DETAIL.md ADDED
@@ -0,0 +1 @@
1
+ ![Service Console in the DSH web UI: the right-Sidebar tab lists local services with ownership badges, a composer pill above the input, and a chat card from the model's service_list tool](preview.svg)
@@ -0,0 +1 @@
1
+ ![DSH Web 界面中的服务控制台:右侧栏标签列出本机服务与归属徽标,输入框上方有常驻 pill,对话中还有 service_list 工具卡片](preview.svg)
@@ -7,7 +7,7 @@
7
7
  ## 1. 门槛自查(提交前复核贡献指南)
8
8
 
9
9
  - [x] `package.json` 声明 `dsh.bundle.patch` → `./cordis.patch.yml`(已声明)
10
- - [x] 真实可用代码 + 活跃维护(T1/T2 已完成,测试 9 项全绿)
10
+ - [x] 真实可用代码 + 活跃维护(0.11.0:单测 94+ 全绿、GUI 自动烟测 9/9、发布流程全自动)
11
11
  - [x] 添加 `dsh-plugin` GitHub topic(T3-4 执行时配置)
12
12
  - [ ] repo 年龄 ≥ 1 天、commits ≥ 10(创建后自然满足,提交当天复核)
13
13
  - [x] 描述只讲事实,无营销词
@@ -19,10 +19,10 @@
19
19
  ```yaml
20
20
  url: https://github.com/Jiyr0119/dsh-service-console
21
21
  name: Jiyr0119/dsh-service-console
22
- category: ui
22
+ category: dev
23
23
  description:
24
- en: 'Local development service console for DSH: discovers listening ports, shows service ownership, and safely inspects, stops, or restarts services related to a conversation or workspace.'
25
- zh: 'DSH 本地开发服务控制台:发现监听端口,展示服务归属,并安全地查看、停止或重启与对话或工作区相关的服务。'
24
+ en: 'Local development service console for DSH: discovers listening TCP ports, attributes each service to a conversation, workspace, or the machine, and safely stops or restarts servers. Shown as a right-Sidebar tab, an ambient composer pill, and an actionable chat card for the built-in service_list tool. 8 UI languages.'
25
+ zh: 'DSH 本地开发服务控制台:发现本机监听端口,识别服务归属的对话 / 工作区 / 本机,并安全停止或重启。以右侧栏标签、输入框上方常驻 pill、service_list 工具卡片三种形态呈现,支持 8 种界面语言。'
26
26
  ```
27
27
 
28
28
  - 描述以句号结尾;含 `: `(英文冒号+空格)必须加引号;避免裸 `[file: ...]` 触发 awesome-lint 引用规则。
@@ -33,13 +33,11 @@ description:
33
33
 
34
34
  ```json
35
35
  "https://github.com/Jiyr0119/dsh-service-console": [
36
- "https://raw.githubusercontent.com/Jiyr0119/dsh-service-console/main/assets/screenshots/panel.png",
37
- "https://raw.githubusercontent.com/Jiyr0119/dsh-service-console/main/assets/screenshots/ownership.png",
38
- "https://raw.githubusercontent.com/Jiyr0119/dsh-service-console/main/assets/screenshots/stop-confirm.png"
36
+ "https://raw.githubusercontent.com/Jiyr0119/dsh-service-console/main/assets/service-console-0.11.0.png"
39
37
  ]
40
38
  ```
41
39
 
42
- 建议截图内容:服务列表面板 / 归属徽标与详情证据 / 停止确认框。
40
+ 仓库里已有 0.11.0 的真实界面截图(右侧栏标签 + 归属徽标 + 受保护胶囊),可直接引用;需要多图时再补「详情证据」「确认行」两张。
43
41
 
44
42
  ## 4. 执行步骤(T3-4 仓库就绪后)
45
43
 
@@ -47,7 +45,7 @@ description:
47
45
  # 1) 双语 issue
48
46
  gh issue create --repo awesome-dsh-plugin/awesome-dsh-plugin --title "Add DSH Service Console / 新增 DSH 服务控制台" --body-file issue.md
49
47
 
50
- # 2) 从 canonical 建分支
48
+ # 2) 从 canonical 建分支(截图必须先提交到本仓库 assets/ 再引用)
51
49
  gh repo clone Jiyr0119/awesome-dsh-plugin && cd awesome-dsh-plugin
52
50
  git remote add upstream https://github.com/awesome-dsh-plugin/awesome-dsh-plugin.git
53
51
  git fetch upstream main
@@ -0,0 +1,24 @@
1
+ # 兼容矩阵
2
+
3
+ ## 支持的运行环境
4
+
5
+ | 维度 | 要求 | 说明 |
6
+ |---|---|---|
7
+ | DSH | `>=0.2.2-rc.5 <0.3.0` | 由 `package.json` 的 `engines.dsh` 声明;不匹配时 DSH 的安装/启动检查会拒绝该插件 |
8
+ | Node.js | `>=24.9.0` | DSH 0.2.2-rc.5 自身的运行时下限;本插件是纯 ESM,无原生依赖 |
9
+ | 平台 | macOS / Linux | 依赖 `lsof` 与 BSD/GNU `ps`;**Windows 暂不支持**(等待 `Get-NetTCPConnection` 实现) |
10
+ | DSH 界面 | Web(含 Desktop 内置 Web 视图) | 注册的是一组 Web 插槽:右侧栏 tab、composer dock、header 工具区、设置页 |
11
+ | 所需宿主能力 | `webServer`、`timer`;可选 `tools`、`sessionProjections`、`sessions`、`workspaceRegistry` | 缺少可选能力时对应功能降级:无 `tools` 不注册模型工具;无 `sessionProjections` 退回内存台账 |
12
+
13
+ ## 实测过的版本
14
+
15
+ | DSH | 结果 |
16
+ |---|---|
17
+ | 0.2.2-rc.5 | 全部功能;GUI 自动烟测 9/9、单测 94/94(0.11.0) |
18
+ | 0.2.0-rc.2 及更早 | 未验证;`engines.dsh` 会拒绝安装 |
19
+
20
+ ## 已知边界
21
+
22
+ - 冷会话(从未在本进程里恢复过)没有可读的 projection,归因退化为启发式(`workspace-inferred` / `other-local` / `unknown`),不会伪造「本次对话」。
23
+ - 本插件的「重启」需要台账里有该服务的启动命令;没有记录时返回 `RESTART_UNSAFE`(只读提示,不猜测命令)。
24
+ - 扫描依赖 `lsof` 的权限:无权限时返回 `PERMISSION_DENIED`,不会把失败伪装成「没有服务」。
@@ -0,0 +1,65 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="640" height="300" viewBox="0 0 640 300" fill="none">
2
+ <!-- Service Console — text-free feature illustration (readable in light and dark themes). -->
3
+ <g stroke="#8E939B" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round">
4
+ <!-- chat column -->
5
+ <rect x="24" y="24" width="356" height="252" rx="14" />
6
+ <rect x="48" y="52" width="180" height="30" rx="10" />
7
+ <rect x="236" y="96" width="120" height="26" rx="10" />
8
+ <rect x="48" y="140" width="150" height="26" rx="10" />
9
+ <!-- chat card from service_list -->
10
+ <rect x="48" y="182" width="308" height="46" rx="10" />
11
+ <path d="M62 195h10M62 202h10M62 209h10" />
12
+ <path d="M84 200h96M84 209h64" />
13
+ <rect x="286" y="193" width="58" height="16" rx="8" stroke="#2E8B57" />
14
+ <!-- composer + pill -->
15
+ <rect x="48" y="240" width="308" height="30" rx="12" />
16
+ </g>
17
+
18
+ <!-- composer pill: green dot + label dashes + port dashes -->
19
+ <rect x="150" y="222" width="112" height="18" rx="9" stroke="#2E8B57" stroke-width="1.4" />
20
+ <circle cx="161" cy="231" r="3" fill="#2E8B57" />
21
+ <g stroke="#8E939B" stroke-width="1.4" stroke-linecap="round">
22
+ <path d="M171 231h34" />
23
+ <path d="M211 231h14" stroke="#B8860B" />
24
+ </g>
25
+
26
+ <!-- right Sidebar panel -->
27
+ <g stroke="#8E939B" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round">
28
+ <rect x="396" y="24" width="220" height="252" rx="14" />
29
+ <!-- tab chip -->
30
+ <rect x="412" y="36" width="112" height="20" rx="6" stroke="#4C8DFF" />
31
+ <path d="M424 46h60" stroke="#4C8DFF" />
32
+ <!-- segmented control -->
33
+ <rect x="412" y="68" width="188" height="24" rx="12" />
34
+ <rect x="416" y="72" width="58" height="16" rx="8" fill="#4C8DFF" stroke="none" />
35
+ <path d="M486 80h24M520 80h24M548 80h20" />
36
+ <!-- search -->
37
+ <rect x="412" y="104" width="188" height="22" rx="11" />
38
+ <circle cx="426" cy="115" r="4" />
39
+ <path d="M436 115h64" />
40
+ <!-- service rows -->
41
+ <rect x="412" y="138" width="188" height="34" rx="8" />
42
+ <rect x="412" y="180" width="188" height="34" rx="8" />
43
+ <rect x="412" y="222" width="188" height="34" rx="8" />
44
+ </g>
45
+ <!-- ownership dots + labels + protected capsules -->
46
+ <circle cx="426" cy="155" r="4" fill="#2E8B57" />
47
+ <circle cx="426" cy="197" r="4" fill="#B8860B" />
48
+ <circle cx="426" cy="239" r="4" fill="#C0392B" />
49
+ <g stroke="#8E939B" stroke-width="1.4" stroke-linecap="round">
50
+ <path d="M438 152h46M438 160h28" />
51
+ <path d="M438 194h52M438 202h30" />
52
+ <path d="M438 236h40M438 244h34" />
53
+ </g>
54
+ <g stroke="#C0392B" stroke-width="1.4">
55
+ <rect x="548" y="148" width="44" height="16" rx="8" />
56
+ <rect x="548" y="232" width="44" height="16" rx="8" />
57
+ <!-- lock glyph inside the protected capsule -->
58
+ <rect x="556" y="154" width="7" height="6" rx="1" />
59
+ <path d="M557.5 154v-2a2 2 0 0 1 4 0v2" stroke-linecap="round" />
60
+ </g>
61
+ <g stroke="#4C8DFF" stroke-width="1.4">
62
+ <rect x="548" y="190" width="44" height="16" rx="8" />
63
+ <path d="M556 198h9M563 194l4 4-4 4" stroke-linecap="round" stroke-linejoin="round" />
64
+ </g>
65
+ </svg>
@@ -180,3 +180,19 @@ rc.5 内置 `zh, en, ja, es, fr, de, ru, pt`;现在只有 zh/en,其余回落
180
180
  | 10 | A13 8 语言词典 | ⏳ 待做 | — |
181
181
 
182
182
  未做项统一原因:它们改变可见 UI/交互或需要真机运行时验证,而本次会话没有浏览器控制权——按「先落地可类型化、可单测验证的部分」处理,其余留作下一轮(每项在 §3 都有完整实现要点)。
183
+
184
+
185
+ ---
186
+
187
+ ## 8. 截至 0.11.0 的实施状态(后续更新)
188
+
189
+ 第 7 节写于 0.8.0 发布时,以下条目随后已落地,予以更新:
190
+
191
+ | 项 | 状态 | 版本 |
192
+ |---|---|---|
193
+ | A5 右侧栏 tab 迁移 | ✅ 已完成 | 0.9.0 |
194
+ | A8 composer 常驻 pill | ✅ 已完成 | 0.9.0 |
195
+ | A12 可取消扫描 + `timeoutMs` | ✅ 已完成(另加 3 条机器可读命令 + 缓存) | 0.10.0 |
196
+ | A13 8 语言词典 | ✅ 已完成 | 0.11.0 |
197
+ | A4 客户端 `tool.call.toolview` 卡片 | ✅ 已完成(宿主呈现层 + 纯投影 + 回退) | 0.9.0 |
198
+ | A2/A6/P0 全部 | ✅ 已完成 | 0.8.0 |
@@ -0,0 +1,33 @@
1
+ # 故障排查
2
+
3
+ ## 面板显示「扫描失败」而不是「没有服务」
4
+
5
+ 0.10.0 起扫描失败有明确错误码:
6
+
7
+ | 提示 | 含义 | 处理 |
8
+ |---|---|---|
9
+ | `扫描超时` / `SCAN_TIMEOUT` | `lsof`/`ps` 没在预算内返回(默认 8s,可用 `scanTimeoutMs` 调整) | 重试;持续出现说明系统负载高或 `lsof` 卡住 |
10
+ | `扫描失败` / `SCAN_FAILED` | `lsof` 以非 0/1 退出,或退出码 1 但 stderr 非空 | 在终端手动跑 `lsof -nP -iTCP -sTCP:LISTEN -Fpcn` 看报错 |
11
+ | `没有权限` / `PERMISSION_DENIED` | `lsof` 被拒绝(受限环境、SIP、容器) | 用有权限的用户运行 DSH;或只读查看 |
12
+
13
+ ## 看不到某个服务
14
+
15
+ - 默认范围是「当前工作区」;切到「本机」或搜端口。
16
+ - 「显示未知服务」被关掉时会隐藏归属未知的行。
17
+ - 只监听 Unix socket 的进程不会出现(只扫描 TCP LISTEN)。
18
+
19
+ ## 「重启」按钮不出现
20
+
21
+ 重启需要台账里有**该服务的启动命令**(来自会话里 `bash` 执行的 dev 命令)。手动在外部终端起的服务没有启动记录,只能停止。冷会话(本进程从未恢复过)同样没有记录。
22
+
23
+ ## 服务显示「受保护」
24
+
25
+ DSH 控制台端口、插件宿主进程、系统进程(launchd/systemd/WindowServer 等)、root 进程、系统目录或系统二进制路径下的进程,一律只读。这是设计目标,不是 bug。
26
+
27
+ ## 设置改了但重启后失效
28
+
29
+ 配置文件在 `~/.dsh/plugins/dsh-service-console/config.json`,只保存改过的字段;如果 `cordis.yml` 的组合行里显式写了同名 `config:`,**用户文件优先**(这是刻意的:用户的显式选择压过部署基线)。删掉文件即可回到基线。
30
+
31
+ ## 远程访问时按钮点了报错
32
+
33
+ 变更类路由只接受本机回环来源,非本机调用会返回 `FORBIDDEN_REMOTE`(界面显示「非本机来源:只读」)。把 DSH Web 暴露到网络接口时,控制台是只读的——这是防止远程杀掉本机进程的安全设计。
@@ -0,0 +1,33 @@
1
+ # 使用指南
2
+
3
+ 安装:`dsh plugin --profile <profile> add -w @jiyr0119/dsh-service-console@latest`,然后刷新界面。
4
+
5
+ ## 三种入口
6
+
7
+ 1. **会话头部「服务」按钮** → 在**右侧栏**打开控制台标签页。停靠/浮动、拖宽、全屏、按会话记忆布局都由 DSH 侧栏提供。
8
+ 2. **输入框上方的常驻 pill**(例如 `2 个会话服务` 后面跟 `:5173 :3000`)→ 只有当前会话确实起了服务时才出现,点一下打开控制台。
9
+ 3. **对话里的 `service_list` 卡片** → 模型调用只读工具后,服务清单以可折叠卡片呈现,行内可直接打开 URL、停止/重启、或打开控制台。
10
+
11
+ ## 阅读列表
12
+
13
+ - 每行:服务名、端口、pid、归属徽标(`本次对话` / `工作区推断` / `本机其他` / `未知` / `受保护`)、是否可重启。
14
+ - 范围切换(本次对话 / 当前工作区 / 本机):受保护目标与范围无关,**始终可见**。
15
+ - 搜索:服务名、pid、命令、工作目录、端口都能匹配。
16
+ - 详情:展开后显示服务 id、进程/父进程、启动时间与归属证据。
17
+
18
+ ## 安全规则
19
+
20
+ - **受保护目标只读**:DSH 自身端口、插件宿主进程、系统关键进程、root 进程、系统目录/二进制。
21
+ - **变更只接受本机来源**:停止/重启/写配置在非回环调用时返回 `FORBIDDEN_REMOTE`。
22
+ - **重启需要台账**:只有记录过安全启动命令的服务才有「重启」。
23
+ - 默认**不做**强制终止(可在设置里显式打开)。
24
+
25
+ ## 设置页
26
+
27
+ 设置 →「服务控制台」:自动刷新间隔(关闭 / 2 / 5 / 10 / 30 秒)、默认范围、优雅超时、显示未知服务、允许强制终止、恢复默认。
28
+
29
+ 配置持久化在 `~/.dsh/plugins/dsh-service-console/config.json`,**只保存你改过的字段**;组合行里的 `config:` 是基线,用户文件优先。
30
+
31
+ ## 重启与 fork 之后
32
+
33
+ 台账现在由会话日志派生(session projection):宿主重启后,重新打开该会话即可恢复归属;从某个会话 fork 出来的子会话会继承父会话的启动记录(同一血脉起的服务算在子会话名下)。
package/icon.svg CHANGED
@@ -1,8 +1,8 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36" fill="none">
2
2
  <!-- Local service console: a monitor with a terminal prompt row and a live status dot. -->
3
- <rect x="4.25" y="8.25" width="27.5" height="18.5" rx="3.25" stroke="#C6CBD4" stroke-width="1.9" />
4
- <path d="M10.5 15.25 L14 18 L10.5 20.75" stroke="#C6CBD4" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" />
5
- <path d="M17.5 20.75 H24" stroke="#C6CBD4" stroke-width="1.9" stroke-linecap="round" />
6
- <path d="M13.5 30.25 H22.5" stroke="#C6CBD4" stroke-width="1.9" stroke-linecap="round" />
3
+ <rect x="4.25" y="8.25" width="27.5" height="18.5" rx="3.25" stroke="#6B7280" stroke-width="1.9" />
4
+ <path d="M10.5 15.25 L14 18 L10.5 20.75" stroke="#6B7280" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" />
5
+ <path d="M17.5 20.75 H24" stroke="#6B7280" stroke-width="1.9" stroke-linecap="round" />
6
+ <path d="M13.5 30.25 H22.5" stroke="#6B7280" stroke-width="1.9" stroke-linecap="round" />
7
7
  <circle cx="29.25" cy="9.25" r="3.5" fill="#3FBF7F" stroke="#1B1D21" stroke-width="1.5" />
8
8
  </svg>
@@ -17,6 +17,8 @@ const ZH_DICT = {
17
17
  "status.done": "{n} 项服务",
18
18
  "status.lastScan": "最近扫描",
19
19
  "status.error": "扫描失败",
20
+ "status.loading": "加载中…",
21
+ "status.rpcError": "本地接口无响应",
20
22
  "svc.noSvc": "未发现服务",
21
23
  "card.summary": "{count}/{total} 项服务",
22
24
  "card.more": "还有 {n} 项…",
@@ -104,6 +106,8 @@ const EN_DICT = {
104
106
  "status.done": "{n} services",
105
107
  "status.lastScan": "Last scan",
106
108
  "status.error": "Scan failed",
109
+ "status.loading": "Loading…",
110
+ "status.rpcError": "Local API did not respond",
107
111
  "svc.noSvc": "no services found",
108
112
  "card.summary": "{count}/{total} services",
109
113
  "card.more": "{n} more…",
@@ -0,0 +1,91 @@
1
+ // src/client/locales/de.ts
2
+ const DE_DICT = {
3
+ "plugin.name": "Dienstkonsole",
4
+ "panel.title": "Service Console",
5
+ "panel.subtitle": "Dienste, die auf dieser Maschine lauschen",
6
+ "entry.label": "Dienste",
7
+ "entry.tip": "Dienstkonsole",
8
+ "search.ph": "Dienste, Ports oder Pfade suchen…",
9
+ "status.scanning": "Wird gescannt…",
10
+ "status.done": "{n} Dienste",
11
+ "status.lastScan": "Letzter Scan",
12
+ "status.error": "Scan fehlgeschlagen",
13
+ "status.loading": "Lädt…",
14
+ "status.rpcError": "Lokale API antwortet nicht",
15
+ "svc.noSvc": "keine Dienste gefunden",
16
+ "card.summary": "{count}/{total} Dienste",
17
+ "card.more": "{n} weitere…",
18
+ "card.confirm": "{action} für {name} ausführen?",
19
+ "svc.restartable": "neustartbar",
20
+ "dock.pill": "{n} Dienst(e) dieses Chats",
21
+ "dock.open": "Dienstkonsole öffnen",
22
+ "svc.ports": "Ports",
23
+ "svc.pid": "pid",
24
+ "svc.command": "Befehl",
25
+ "svc.cwd": "Arbeitsverzeichnis",
26
+ "action.stop": "Stoppen",
27
+ "action.restart": "Neustart",
28
+ "action.detail": "Details",
29
+ "action.open": "Öffnen",
30
+ "action.confirm": "Bestätigen",
31
+ "action.cancel": "Abbrechen",
32
+ "action.pending": "Läuft…",
33
+ "confirm.stop": "Stoppen bestätigen?",
34
+ "confirm.restart": "Neustart bestätigen?",
35
+ "confirm.txt": "{action} für {name} (pid {pid}) ausführen?",
36
+ "result.stopped": "Gestoppt",
37
+ "result.restarted": "Neu gestartet",
38
+ "result.error": "Aktion fehlgeschlagen",
39
+ "own.conversation": "Dieser Chat",
40
+ "own.workspace": "Arbeitsbereich",
41
+ "own.other": "Andere lokal",
42
+ "own.unknown": "Unbekannt",
43
+ "own.protected": "Geschützt",
44
+ "scope.filter": "Dienstbereich",
45
+ "scope.conversation": "Dieser Chat",
46
+ "scope.workspace": "Aktueller Arbeitsbereich",
47
+ "scope.machine": "Diese Maschine",
48
+ "scope.machineWarn": "Der Maschinenbereich kann Dienste anderer Projekte betreffen",
49
+ "detail.title": "Details",
50
+ "detail.serviceRecord": "SERVICE RECORD",
51
+ "detail.serviceId": "SERVICE ID",
52
+ "detail.process": "PROCESS",
53
+ "detail.parent": "PARENT",
54
+ "detail.started": "STARTED",
55
+ "detail.evidence": "Zuordnungsnachweise",
56
+ "err.PERMISSION_DENIED": "Keine Berechtigung für diesen Dienst",
57
+ "err.TARGET_GONE": "Der Dienst ist bereits beendet",
58
+ "err.PID_REUSED": "Prozess ausgetauscht; Aktion abgebrochen",
59
+ "err.UNKNOWN_OWNERSHIP": "Herkunft unklar; Aktion nicht erlaubt",
60
+ "err.PROTECTED_PROCESS": "Geschützter Prozess; Aktion nicht erlaubt",
61
+ "err.GRACEFUL_TIMEOUT": "Nicht innerhalb der Wartezeit beendet",
62
+ "err.RESTART_UNSAFE": "Keine sicheren Startinformationen",
63
+ "err.PORT_CONFLICT": "Port noch belegt",
64
+ "err.START_TIMEOUT": "Kein Lauschen innerhalb der erwarteten Zeit",
65
+ "err.FORBIDDEN_REMOTE": "Nicht lokal: schreibgeschützt",
66
+ "err.SCAN_FAILED": "Scan fehlgeschlagen: Ports nicht lesbar",
67
+ "err.BAD_REQUEST": "Ungültige Anfrage",
68
+ "err.INTERNAL": "Interner Fehler",
69
+ "err.SCAN_TIMEOUT": "Zeitüberschreitung beim Scan",
70
+ "tab.services": "Dienste",
71
+ "tab.settings": "Einstellungen",
72
+ "settings.title": "Panel-Einstellungen",
73
+ "settings.general": "Allgemein",
74
+ "settings.refreshInterval": "Automatisches Aktualisieren",
75
+ "settings.refresh.desc": "Erneut scannen, solange das Panel offen ist",
76
+ "settings.refreshOff": "Aus",
77
+ "settings.refreshN": "{n} s",
78
+ "settings.defaultScope": "Standardbereich",
79
+ "settings.showUnknown": "Unbekannte Dienste zeigen",
80
+ "settings.showUnknown.desc": "Blendet Dienste mit unbekannter Herkunft aus",
81
+ "settings.gracefulTimeout": "Kulanz-Timeout (ms)",
82
+ "settings.forceKill": "Hartes Beenden erlauben",
83
+ "settings.forceKill.desc": "Sendet SIGKILL nach dem Kulanz-Timeout",
84
+ "settings.restore": "Standard wiederherstellen",
85
+ "settings.note": "Gespeichert in ~/.dsh/plugins/dsh-service-console/config.json — bleibt nach Neustart erhalten.",
86
+ "settings.nav": "Service Console",
87
+ "star.developer": "Entwickler",
88
+ "star.ask": "⭐ Ein Stern erfreut den Autor",
89
+ "star.cta": "★ Stern geben"
90
+ };
91
+ export { DE_DICT };
@@ -0,0 +1,91 @@
1
+ // src/client/locales/es.ts
2
+ const ES_DICT = {
3
+ "plugin.name": "Consola de servicios",
4
+ "panel.title": "Service Console",
5
+ "panel.subtitle": "Servicios a la escucha en esta máquina",
6
+ "entry.label": "Servicios",
7
+ "entry.tip": "Consola de servicios",
8
+ "search.ph": "Buscar servicios, puertos o rutas…",
9
+ "status.scanning": "Explorando…",
10
+ "status.done": "{n} servicios",
11
+ "status.lastScan": "Última exploración",
12
+ "status.error": "La exploración falló",
13
+ "status.loading": "Cargando…",
14
+ "status.rpcError": "La API local no responde",
15
+ "svc.noSvc": "no se encontraron servicios",
16
+ "card.summary": "{count}/{total} servicios",
17
+ "card.more": "{n} más…",
18
+ "card.confirm": "¿{action} {name}?",
19
+ "svc.restartable": "reiniciable",
20
+ "dock.pill": "{n} servicio(s) de este chat",
21
+ "dock.open": "Abrir la consola de servicios",
22
+ "svc.ports": "Puertos",
23
+ "svc.pid": "pid",
24
+ "svc.command": "Comando",
25
+ "svc.cwd": "Directorio",
26
+ "action.stop": "Detener",
27
+ "action.restart": "Reiniciar",
28
+ "action.detail": "Detalle",
29
+ "action.open": "Abrir",
30
+ "action.confirm": "Aceptar",
31
+ "action.cancel": "Cancelar",
32
+ "action.pending": "Procesando…",
33
+ "confirm.stop": "¿Confirmar detención?",
34
+ "confirm.restart": "¿Confirmar reinicio?",
35
+ "confirm.txt": "¿{action} {name} (pid {pid})?",
36
+ "result.stopped": "Detenido",
37
+ "result.restarted": "Reiniciado",
38
+ "result.error": "La acción falló",
39
+ "own.conversation": "Este chat",
40
+ "own.workspace": "Espacio de trabajo",
41
+ "own.other": "Otro local",
42
+ "own.unknown": "Desconocido",
43
+ "own.protected": "Protegido",
44
+ "scope.filter": "Ámbito de servicios",
45
+ "scope.conversation": "Este chat",
46
+ "scope.workspace": "Espacio de trabajo actual",
47
+ "scope.machine": "Esta máquina",
48
+ "scope.machineWarn": "El ámbito de máquina puede afectar a servicios de otros proyectos",
49
+ "detail.title": "Detalle",
50
+ "detail.serviceRecord": "SERVICE RECORD",
51
+ "detail.serviceId": "SERVICE ID",
52
+ "detail.process": "PROCESS",
53
+ "detail.parent": "PARENT",
54
+ "detail.started": "STARTED",
55
+ "detail.evidence": "Evidencia de atribución",
56
+ "err.PERMISSION_DENIED": "Sin permiso para este servicio",
57
+ "err.TARGET_GONE": "El servicio ya terminó",
58
+ "err.PID_REUSED": "El proceso cambió; operación cancelada",
59
+ "err.UNKNOWN_OWNERSHIP": "Origen no confirmado; no se permite operar",
60
+ "err.PROTECTED_PROCESS": "Proceso protegido; no se puede operar",
61
+ "err.GRACEFUL_TIMEOUT": "No terminó dentro del tiempo de espera",
62
+ "err.RESTART_UNSAFE": "Falta información de arranque segura",
63
+ "err.PORT_CONFLICT": "El puerto sigue ocupado",
64
+ "err.START_TIMEOUT": "No empezó a escuchar a tiempo",
65
+ "err.FORBIDDEN_REMOTE": "Origen no local: solo lectura",
66
+ "err.SCAN_FAILED": "La exploración falló: no se pueden leer los puertos",
67
+ "err.BAD_REQUEST": "Solicitud no válida",
68
+ "err.INTERNAL": "Error interno",
69
+ "err.SCAN_TIMEOUT": "La exploración agotó el tiempo",
70
+ "tab.services": "Servicios",
71
+ "tab.settings": "Ajustes",
72
+ "settings.title": "Ajustes del panel",
73
+ "settings.general": "General",
74
+ "settings.refreshInterval": "Intervalo de actualización",
75
+ "settings.refresh.desc": "Vuelve a explorar mientras el panel está abierto",
76
+ "settings.refreshOff": "Desactivado",
77
+ "settings.refreshN": "{n} s",
78
+ "settings.defaultScope": "Ámbito por defecto",
79
+ "settings.showUnknown": "Mostrar servicios desconocidos",
80
+ "settings.showUnknown.desc": "Al desactivarlo se ocultan los de origen desconocido",
81
+ "settings.gracefulTimeout": "Tiempo de gracia (ms)",
82
+ "settings.forceKill": "Permitir terminación forzada",
83
+ "settings.forceKill.desc": "Envía SIGKILL tras el tiempo de gracia",
84
+ "settings.restore": "Restaurar valores",
85
+ "settings.note": "Se guarda en ~/.dsh/plugins/dsh-service-console/config.json y persiste tras reiniciar.",
86
+ "settings.nav": "Service Console",
87
+ "star.developer": "Desarrollador",
88
+ "star.ask": "⭐ Si te sirvió, una estrella alegra el día del autor",
89
+ "star.cta": "★ Dar una estrella"
90
+ };
91
+ export { ES_DICT };