dsh-ops-kit 0.3.4 → 0.3.5

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.
Files changed (2) hide show
  1. package/index.js +5 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1697,7 +1697,7 @@ async function tailProcessLog(cfg, source, lines = 200) {
1697
1697
  if (raw.startsWith('jar:')) {
1698
1698
  const jar = raw.slice(4).trim()
1699
1699
  if (!/^[A-Za-z0-9._@/-]+$/.test(jar)) throw new Error('bad jar name')
1700
- const found = await ssh(cfg, `pgrep -f -- ${JSON.stringify(jar)} 2>/dev/null | head -1`, 20_000)
1700
+ const found = await ssh(cfg, `for p in $(pgrep -f -- ${JSON.stringify(jar)} 2>/dev/null); do c=$(tr '\\0' ' ' < /proc/$p/cmdline 2>/dev/null); case "$c" in *java*) echo "$p"; break;; esac; done`, 20_000)
1701
1701
  pid = Number(String(found.stdout || '').trim())
1702
1702
  if (!pid) {
1703
1703
  return {
@@ -1722,10 +1722,10 @@ async function tailProcessLog(cfg, source, lines = 200) {
1722
1722
 
1723
1723
  if (probed && probed !== '-' && !probed.startsWith('session-') && !probed.includes(' ')) {
1724
1724
  const res = await ssh(cfg, `journalctl -u ${probed} -n ${n} --no-pager 2>&1`, 25_000)
1725
- return {
1726
- host: cfg.name, source: raw, resolved: probed, via: 'journal',
1727
- ok: res.ok, lines: String(res.stdout || '').slice(0, 60_000),
1728
- error: res.ok ? '' : cleanStderr(res.stderr),
1725
+ const body = String(res.stdout || '')
1726
+ const meaningful = body.split('\n').filter(line => line.trim() && !line.startsWith('--')).length > 0
1727
+ if (res.ok && meaningful) {
1728
+ return { host: cfg.name, source: raw, resolved: probed, via: 'journal', ok: true, lines: body.slice(0, 60_000), error: '' }
1729
1729
  }
1730
1730
  }
1731
1731
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ops-kit",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Server operations kit for DeepSeek Harness: server cards, health charts, config browser, app manager and plain-language AI diagnosis — over SSH, no agent install.",
5
5
  "license": "MIT",
6
6
  "type": "module",