chatroom-cli 1.13.1 → 1.13.3

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/dist/index.js +25 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10227,7 +10227,7 @@ class BaseCLIAgentService {
10227
10227
  }
10228
10228
  checkVersion(command) {
10229
10229
  try {
10230
- const output = this.deps.execSync(`${command} --version`, {
10230
+ const output = this.deps.execSync(`${command} --version 2>&1`, {
10231
10231
  stdio: ["pipe", "pipe", "pipe"],
10232
10232
  timeout: 5000
10233
10233
  }).toString().trim();
@@ -10500,7 +10500,7 @@ var init_pi_agent_service = __esm(() => {
10500
10500
  }
10501
10501
  async listModels() {
10502
10502
  try {
10503
- const output = this.deps.execSync(`${PI_COMMAND} --list-models`, {
10503
+ const output = this.deps.execSync(`${PI_COMMAND} --list-models 2>&1`, {
10504
10504
  stdio: ["pipe", "pipe", "pipe"],
10505
10505
  timeout: 1e4
10506
10506
  }).toString().trim();
@@ -14883,7 +14883,7 @@ var init_on_request_start_agent = __esm(() => {
14883
14883
 
14884
14884
  // src/commands/machine/daemon-start/handlers/stop-agent.ts
14885
14885
  async function executeStopAgent(ctx, args) {
14886
- const { chatroomId, role, reason } = args;
14886
+ const { chatroomId, role, reason, pid } = args;
14887
14887
  console.log(` ↪ stop-agent command received`);
14888
14888
  console.log(` Chatroom: ${chatroomId}`);
14889
14889
  console.log(` Role: ${role}`);
@@ -14891,7 +14891,8 @@ async function executeStopAgent(ctx, args) {
14891
14891
  const result = await ctx.deps.agentProcessManager.stop({
14892
14892
  chatroomId,
14893
14893
  role,
14894
- reason
14894
+ reason,
14895
+ pid
14895
14896
  });
14896
14897
  const msg = result.success ? `Agent stopped (${role})` : `Failed to stop agent (${role})`;
14897
14898
  console.log(` ${result.success ? "✅" : "⚠️ "} ${msg}`);
@@ -14907,7 +14908,8 @@ async function onRequestStopAgent(ctx, event) {
14907
14908
  await executeStopAgent(ctx, {
14908
14909
  chatroomId: event.chatroomId,
14909
14910
  role: event.role,
14910
- reason: event.reason
14911
+ reason: event.reason,
14912
+ pid: event.pid
14911
14913
  });
14912
14914
  }
14913
14915
  var init_on_request_stop_agent = () => {};
@@ -15890,12 +15892,18 @@ class AgentProcessManager {
15890
15892
  const key = agentKey2(opts.chatroomId, opts.role);
15891
15893
  const slot = this.slots.get(key);
15892
15894
  if (!slot || slot.state === "idle") {
15895
+ const eventPid = opts.pid;
15896
+ if (eventPid && eventPid > 0) {
15897
+ try {
15898
+ this.deps.processes.kill(eventPid, "SIGTERM");
15899
+ } catch {}
15900
+ }
15893
15901
  this.deps.backend.mutation(api.machines.recordAgentExited, {
15894
15902
  sessionId: this.deps.sessionId,
15895
15903
  machineId: this.deps.machineId,
15896
15904
  chatroomId: opts.chatroomId,
15897
15905
  role: opts.role,
15898
- pid: 0,
15906
+ pid: eventPid ?? 0,
15899
15907
  stopReason: opts.reason,
15900
15908
  exitCode: undefined,
15901
15909
  signal: undefined,
@@ -16381,6 +16389,17 @@ async function recoverState(ctx) {
16381
16389
  console.log(` ⚠️ Recovery failed: ${e.message}`);
16382
16390
  console.log(` Continuing with fresh state`);
16383
16391
  }
16392
+ try {
16393
+ const result = await ctx.deps.backend.mutation(api.machines.clearAllSpawnedPids, {
16394
+ sessionId: ctx.sessionId,
16395
+ machineId: ctx.machineId
16396
+ });
16397
+ if (result.clearedCount > 0) {
16398
+ console.log(` \uD83E\uDDF9 Cleared ${result.clearedCount} stale agent PID(s) from backend`);
16399
+ }
16400
+ } catch (e) {
16401
+ console.log(` ⚠️ Failed to clear stale PIDs: ${e.message}`);
16402
+ }
16384
16403
  }
16385
16404
  async function initDaemon() {
16386
16405
  if (!acquireLock()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chatroom-cli",
3
- "version": "1.13.1",
3
+ "version": "1.13.3",
4
4
  "description": "CLI for multi-agent chatroom collaboration",
5
5
  "type": "module",
6
6
  "bin": {