@geekbeer/minion 2.68.1 → 2.68.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekbeer/minion",
3
- "version": "2.68.1",
3
+ "version": "2.68.2",
4
4
  "description": "AI Agent runtime for Minion - manages status and skill deployment on VPS",
5
5
  "main": "linux/server.js",
6
6
  "bin": {
@@ -6,12 +6,20 @@
6
6
 
7
7
  const { exec, spawn } = require('child_process')
8
8
  const { promisify } = require('util')
9
+ const fs = require('fs')
10
+ const path = require('path')
11
+ const os = require('os')
9
12
  const execAsync = promisify(exec)
10
13
 
11
14
  const { verifyToken } = require('../../core/lib/auth')
12
15
  const { config } = require('../../core/config')
13
16
  const { detectProcessManager, buildAllowedCommands } = require('../lib/process-manager')
14
17
 
18
+ const SPAWN_LOG = path.join(os.homedir(), '.minion', 'spawn-debug.log')
19
+ function spawnLog(msg) {
20
+ try { fs.appendFileSync(SPAWN_LOG, `${new Date().toISOString()} ${msg}\n`) } catch {}
21
+ }
22
+
15
23
  const PROC_MGR = detectProcessManager()
16
24
  const ALLOWED_COMMANDS = buildAllowedCommands(PROC_MGR, config)
17
25
 
@@ -57,19 +65,26 @@ async function commandRoutes(fastify) {
57
65
  console.log(`[Command] Scheduling deferred command: ${command}`)
58
66
  setTimeout(() => {
59
67
  if (allowedCommand.spawnArgs) {
60
- // Use spawn with detached:true for update scripts.
61
- // Avoids cmd.exe quoting issues and -WindowStyle Hidden hangs
62
- // in non-interactive sessions that caused HQ update timeouts.
63
68
  const [cmd, args] = allowedCommand.spawnArgs
69
+ spawnLog(`[${command}] spawn: ${cmd} ${JSON.stringify(args)}`)
64
70
  try {
65
71
  const child = spawn(cmd, args, {
66
72
  detached: true,
67
73
  stdio: 'ignore',
68
74
  windowsHide: true,
69
75
  })
76
+ child.on('error', (err) => {
77
+ spawnLog(`[${command}] child error: ${err.message}`)
78
+ console.error(`[Command] Spawn child error: ${command} - ${err.message}`)
79
+ })
80
+ child.on('exit', (code, signal) => {
81
+ spawnLog(`[${command}] child exit: code=${code} signal=${signal}`)
82
+ })
70
83
  child.unref()
84
+ spawnLog(`[${command}] spawned pid=${child.pid}`)
71
85
  console.log(`[Command] Deferred command spawned: ${command} (pid: ${child.pid})`)
72
86
  } catch (err) {
87
+ spawnLog(`[${command}] spawn threw: ${err.message}`)
73
88
  console.error(`[Command] Deferred spawn failed: ${command} - ${err.message}`)
74
89
  }
75
90
  } else {