@gehennawu/dsh-service 0.17.0 → 0.17.1

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.en.md CHANGED
@@ -21,14 +21,14 @@ The Settings panel "Service Control" page has six top-level tabs: **Overview, No
21
21
  - Detects active agents, background jobs, and terminals before restart; lists them and requires explicit confirmation
22
22
  - `/restart` command also available in conversations; automatically refuses when active work is detected
23
23
  - Automatically probes for the new process after restart and reloads the page; manual reload available after 60 seconds
24
- - Overview shows the runtime environment; when a manual terminal launch is suspected, the confirmation flow warns that nothing will bring the process back
24
+ - When a manual terminal launch is suspected, the restart confirmation flow warns that nothing will bring the process back, and Health diagnostics marks it with a yellow inline caution
25
25
  - Optional `Restart` entry at the bottom of the settings left navigation, enabled by a switch in the Restart tab (off by default), sharing the exact same confirmation flow as the Restart tab
26
26
 
27
27
  ### Health diagnostics
28
28
 
29
29
  - Shows uptime, memory, session count, active agents, and background jobs
30
30
  - The "Process and runtime" card shows platform, architecture, and Node version
31
- - Full diagnostics check session storage, workspace registry, backup storage, tar availability, file permissions, runtime environment, and Node runtime version; a manual launch is flagged as a warning (no restart assurance), while an unrecognized environment is informational only (not a warning)both can be declared explicitly via `DSH_SERVICE_RUNTIME_ENV`
31
+ - Full diagnostics check session storage, workspace registry, backup storage, tar availability, file permissions, runtime environment, and Node runtime version; a manual launch is marked with a yellow inline caution (no restart assurance) that does not trigger the health alert banner, the service-control reminder, or the tab ⚠; an unrecognized environment and an empty backup list are informational only all can be declared explicitly via `DSH_SERVICE_RUNTIME_ENV`
32
32
  - Having no backups is an informational note, not a warning, and does not light the Health tab ⚠
33
33
  - File-permission deep scan and repair: checks whether the Agent can read/write DSH_HOME and workspaces; repair requires two-step confirmation
34
34
 
@@ -93,7 +93,7 @@ dsh plugin --profile web add link:/path/to/dsh-service
93
93
 
94
94
  The plugin only sends an exit signal; it does not start the process again. Without a process manager, selecting restart stops DSH Web.
95
95
 
96
- The plugin passively detects whether a process manager is present (environment variables, `/.dockerenv`, `/proc/1/cgroup`, terminal TTY): with Docker/systemd/pm2/supervisord/Kubernetes detected it restarts as usual; when nothing is detected and stdin/stdout are an interactive terminal, it treats the environment as a likely manual launch, labels the runtime environment in the overview, and switches one-click upgrade to keep the process running with manual-restart instructions. Heuristics cannot cover redirected output or wrappers like NSSM/WinSW; set `DSH_SERVICE_RUNTIME_ENV=managed|manual` to declare it explicitly.
96
+ The plugin passively detects whether a process manager is present (environment variables, `/.dockerenv`, `/proc/1/cgroup`, terminal TTY): with Docker/systemd/pm2/supervisord/Kubernetes detected it restarts as usual; when nothing is detected and stdin/stdout are an interactive terminal, it treats the environment as a likely manual launch, flags it in Health diagnostics with a yellow caution, and switches one-click upgrade to keep the process running with manual-restart instructions. Heuristics cannot cover redirected output or wrappers like NSSM/WinSW; set `DSH_SERVICE_RUNTIME_ENV=managed|manual` to declare it explicitly.
97
97
 
98
98
  ### Docker Compose
99
99
 
package/README.md CHANGED
@@ -21,14 +21,14 @@
21
21
  - 重启前检测活跃 Agent、后台任务和终端,展示清单并要求显式确认
22
22
  - 对话中输入 `/restart` 也可触发,检测到运行中工作时自动拒绝
23
23
  - 重启后自动探测新进程并刷新页面,60 秒未恢复时提供手动刷新
24
- - 概览显示「运行环境」;疑似终端手动启动时,确认流程会提示「退出后不会自动拉起」
24
+ - 疑似终端手动启动时,重启确认流程会提示「退出后不会自动拉起」,健康诊断中以黄色行内警示标注
25
25
  - 可在「重启」标签开启「设置页左列显示入口」开关(默认关闭),开启后在设置页左侧标签列底部显示「重启」快捷入口,与「重启」标签共用同一套确认流程
26
26
 
27
27
  ### 健康诊断
28
28
 
29
29
  - 显示运行时间、内存、会话数、活跃 Agent 和后台任务
30
30
  - 「进程与运行环境」卡显示平台、架构和 Node 版本
31
- - 完整诊断检查会话存储、工作区注册表、备份目录、tar 可用性、文件权限、运行环境和 Node 运行时版本;手动启动环境按警告提示重启无保障,未识别环境为信息级提示(不算警告),均可通过 `DSH_SERVICE_RUNTIME_ENV` 显式声明
31
+ - 完整诊断检查会话存储、工作区注册表、备份目录、tar 可用性、文件权限、运行环境和 Node 运行时版本;手动启动环境以黄色行内警示标注重启无保障(不触发健康提醒横幅、服务控制提醒和标签 ⚠),未识别环境与空备份为信息级提示(不算警告),均可通过 `DSH_SERVICE_RUNTIME_ENV` 显式声明
32
32
  - 没有备份属于信息级提示,不算警告,也不点亮健康诊断标签的 ⚠
33
33
  - 文件权限深检与修复:检查 Agent 是否能读写 DSH_HOME 和工作区,修复需两段式确认
34
34
 
@@ -93,7 +93,7 @@ dsh plugin --profile web add link:/path/to/dsh-service
93
93
 
94
94
  插件只发送退出信号,不负责重新启动进程。没有进程管理器时,点击重启会直接停止 DSH Web。
95
95
 
96
- 插件会用被动信号(环境变量、`/.dockerenv`、`/proc/1/cgroup`、终端 TTY)判断当前是否由进程管理器拉起:检测到 Docker/systemd/pm2/supervisord/Kubernetes 时照常自动重启;都没有且 stdin/stdout 是交互终端时视为「疑似手动启动」,概览会标注运行环境,一键升级改为「不自动退出 + 提示手动重启」。启发式无法覆盖输出重定向、NSSM/WinSW 等场景,可用环境变量 `DSH_SERVICE_RUNTIME_ENV=managed|manual` 显式声明。
96
+ 插件会用被动信号(环境变量、`/.dockerenv`、`/proc/1/cgroup`、终端 TTY)判断当前是否由进程管理器拉起:检测到 Docker/systemd/pm2/supervisord/Kubernetes 时照常自动重启;都没有且 stdin/stdout 是交互终端时视为「疑似手动启动」,健康诊断会以黄色警示标注,一键升级改为「不自动退出 + 提示手动重启」。启发式无法覆盖输出重定向、NSSM/WinSW 等场景,可用环境变量 `DSH_SERVICE_RUNTIME_ENV=managed|manual` 显式声明。
97
97
 
98
98
  ### Docker Compose
99
99
 
package/client.js CHANGED
@@ -151,7 +151,6 @@ window.__ModuleLoader__.load({
151
151
  'update.failAddingToRoot': 'pnpm 拒绝在 workspace 根目录安装(缺少 -w)',
152
152
  'update.failNotWorkspace': 'profile 不是 pnpm workspace 却传入了 -w',
153
153
  'update.failIgnoredBuilds': '依赖构建脚本被 pnpm 默认拦截,无法完成升级',
154
- 'env.line': '运行环境:{value}',
155
154
  'env.kind.docker': 'Docker 容器',
156
155
  'env.kind.container': '容器(containerd/Kubernetes)',
157
156
  'env.kind.systemd': 'systemd 服务',
@@ -159,9 +158,6 @@ window.__ModuleLoader__.load({
159
158
  'env.kind.supervisord': 'supervisord',
160
159
  'env.kind.kubernetes': 'Kubernetes',
161
160
  'env.kind.declared': '外部进程管理器(手动指定)',
162
- 'env.kind.unrecognized': '检测到未识别的进程管理器',
163
- 'env.likelyManual': '疑似终端手动启动',
164
- 'env.unknown': '未检测到进程管理器',
165
161
  'update.manualConfirmTitle': '升级前请确认:当前疑似手动启动环境',
166
162
  'update.manualConfirm': '未检测到 Docker/systemd/pm2 等进程管理器。升级完成后 DSH 不会自动重启——新版本写入磁盘,但当前进程继续运行旧版本;你需要手动关闭并重新运行 dsh 才能启用新版本。',
167
163
  'update.manualProceed': '仍要升级',
@@ -387,7 +383,6 @@ window.__ModuleLoader__.load({
387
383
  'update.failAddingToRoot': 'pnpm refused to add at the workspace root (missing -w)',
388
384
  'update.failNotWorkspace': '-w was passed but the profile is not a pnpm workspace',
389
385
  'update.failIgnoredBuilds': 'Dependency build scripts are blocked by pnpm by default, so the upgrade could not finish',
390
- 'env.line': 'Runtime environment: {value}',
391
386
  'env.kind.docker': 'Docker container',
392
387
  'env.kind.container': 'Container (containerd/Kubernetes)',
393
388
  'env.kind.systemd': 'systemd service',
@@ -395,9 +390,6 @@ window.__ModuleLoader__.load({
395
390
  'env.kind.supervisord': 'supervisord',
396
391
  'env.kind.kubernetes': 'Kubernetes',
397
392
  'env.kind.declared': 'External process manager (declared manually)',
398
- 'env.kind.unrecognized': 'Unrecognized process manager detected',
399
- 'env.likelyManual': 'Likely launched manually from a terminal',
400
- 'env.unknown': 'No process manager detected',
401
393
  'update.manualConfirmTitle': 'Confirm before upgrading: manual launch suspected',
402
394
  'update.manualConfirm': 'No process manager such as Docker/systemd/pm2 was detected. After the upgrade DSH will NOT restart automatically — the new version is written to disk while the current process keeps running the old one; close and rerun dsh manually to activate it.',
403
395
  'update.manualProceed': 'Upgrade anyway',
@@ -1764,18 +1756,7 @@ window.__ModuleLoader__.load({
1764
1756
  const pluginAction = pluginUpdate && !upgradeManualConfirm && !upgradeManualPending
1765
1757
  ? React.createElement('button', { style: Object.assign({}, neutral, { minHeight: '24px', padding: '2px 8px', fontSize: '11px' }), disabled: upgradeBusy, onClick: upgradePlugin }, translate(upgradeBusy ? 'update.upgrading' : 'update.upgrade'))
1766
1758
  : null
1767
- // 运行环境一行:managed 显示管理器标签;疑似手动启动用警示色;未知非空 kind 不得
1768
- // 显示成「未检测到」(那是 supervisorKind 为 null 时的语义)。
1769
- const runtimeEnvKinds = ['docker', 'container', 'systemd', 'pm2', 'supervisord', 'kubernetes', 'declared']
1770
- const runtimeEnvLabelKey = runtimeEnv === null
1771
- ? null
1772
- : runtimeEnv.manualStartLikely === true
1773
- ? 'env.likelyManual'
1774
- : typeof runtimeEnv.supervisorKind === 'string' && runtimeEnvKinds.includes(runtimeEnv.supervisorKind)
1775
- ? `env.kind.${runtimeEnv.supervisorKind}`
1776
- : typeof runtimeEnv.supervisorKind === 'string' && runtimeEnv.supervisorKind.length > 0
1777
- ? 'env.kind.unrecognized'
1778
- : 'env.unknown'
1759
+ // 版本卡只放版本与升级:运行环境信息在健康诊断检查项与重启确认提示中呈现(用户复核口径)。
1779
1760
  const versionBlock = React.createElement('div', { key: 'version-card', 'data-testid': 'version-card', style: card },
1780
1761
  React.createElement('div', { key: 'title', style: sectionTitle }, translate('version.title')),
1781
1762
  React.createElement('div', { style: displaySurface },
@@ -1787,10 +1768,6 @@ window.__ModuleLoader__.load({
1787
1768
  React.createElement('div', null, translate('update.details.latest', { version: dshUpdate?.latest || '—' })),
1788
1769
  channelLines(translate, dshUpdate?.tags))
1789
1770
  : null,
1790
- runtimeEnvLabelKey !== null
1791
- ? React.createElement('div', { 'data-testid': 'runtime-env-line', style: { marginTop: '8px', paddingTop: '8px', borderTop: '1px solid var(--dsw-alias-border-l1)', fontSize: '12px', color: runtimeEnv.manualStartLikely === true ? 'var(--dsw-alias-state-warn-primary)' : 'var(--dsw-alias-label-secondary)' } },
1792
- translate('env.line', { value: translate(runtimeEnvLabelKey) }))
1793
- : null,
1794
1771
  upgradeManualConfirm
1795
1772
  ? React.createElement('div', { 'data-testid': 'upgrade-manual-confirm', style: { marginTop: '10px', padding: '10px 12px', borderRadius: '6px', background: 'rgba(211,51,51,0.08)', border: '1px solid rgba(211,51,51,0.3)' } },
1796
1773
  React.createElement('p', { style: { margin: '0 0 6px', color: 'var(--dsw-alias-state-error-primary)', fontSize: '13px', fontWeight: 600 } }, translate('update.manualConfirmTitle')),
@@ -1847,7 +1824,8 @@ window.__ModuleLoader__.load({
1847
1824
  // 任务通知独立成顶部标签(v0.14 起不再混在概览里)
1848
1825
  const notifyBlock = React.createElement('div', null, notificationBlock)
1849
1826
  const maintenanceBlock = React.createElement('div', { key: 'maintenance-card', 'data-testid': 'maintenance-card', style: card }, backupBlock)
1850
- const diagnosticFailure = diagnostics?.checks?.some((check) => check.status === 'error' || check.status === 'warning') === true
1827
+ // advisory 警告(如手动启动环境的黄色提示)只做行内呈现,不点亮标签 与顶部服务控制提醒。
1828
+ const diagnosticFailure = diagnostics?.checks?.some((check) => check.status === 'error' || (check.status === 'warning' && check.advisory !== true)) === true
1851
1829
  const tabWarnings = {
1852
1830
  overview: false,
1853
1831
  notify: false,
package/index.js CHANGED
@@ -1013,12 +1013,12 @@ async function repairPermissions(ctx, dshHome, plans, planId) {
1013
1013
  return permissionSnapshot(ctx, dshHome, plans)
1014
1014
  }
1015
1015
 
1016
- // 运行环境检查(v0.17):managed/declared → ok;疑似手动启动 → warning(重启无保障);
1017
- // unknown → info(未检测到管理器也无终端特征:输出重定向、NSSM/WinSW 等包装器——维持现状
1018
- // 行为本就是默认路径,不算异常,只提示可显式声明)。detail 是客户端映射词典的令牌。
1016
+ // 运行环境检查(v0.17):managed/declared → ok;疑似手动启动 → warning 但带 advisory 标记
1017
+ //(黄色行内提示,不参与 overall 聚合、不点亮标签 ⚠ 与顶部提醒——用户复核口径);unknown →
1018
+ // info。detail 是客户端映射词典的令牌。
1019
1019
  function runtimeEnvCheck(runtimeEnv) {
1020
1020
  if (runtimeEnv === undefined || runtimeEnv === null) return null
1021
- if (runtimeEnv.manualStartLikely === true) return { id: 'runtime-env', status: 'warning', detail: 'manual' }
1021
+ if (runtimeEnv.manualStartLikely === true) return { id: 'runtime-env', status: 'warning', detail: 'manual', advisory: true }
1022
1022
  if (runtimeEnv.supervisorKind === 'declared') return { id: 'runtime-env', status: 'ok', detail: 'declared' }
1023
1023
  if (typeof runtimeEnv.supervisorKind === 'string' && runtimeEnv.supervisorKind.length > 0) {
1024
1024
  return { id: 'runtime-env', status: 'ok', detail: runtimeEnv.supervisorKind }
@@ -1081,8 +1081,9 @@ async function collectDiagnostics(ctx, dshHome, runtimeEnv) {
1081
1081
  add('node-version', Number.isFinite(nodeMajor) && nodeMajor >= requiredNodeMajor ? 'ok' : 'warning', `${process.version}:${requiredNodeMajor}`)
1082
1082
 
1083
1083
  let status = 'ok'
1084
+ // advisory 警告(手动启动环境的黄色提示)只做行内呈现:不把 overall 拉成 warning。
1084
1085
  if (checks.some((check) => check.status === 'error')) status = 'error'
1085
- else if (checks.some((check) => check.status === 'warning')) status = 'warning'
1086
+ else if (checks.some((check) => check.status === 'warning' && check.advisory !== true)) status = 'warning'
1086
1087
  return { status, checkedAt: Date.now(), checks }
1087
1088
  }
1088
1089
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gehennawu/dsh-service",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "DSH Web 自托管运维面板:安全重启、健康监控、备份和 Linux 权限维护。",
5
5
  "type": "module",
6
6
  "scripts": {