chatroom-cli 1.108.0 → 1.108.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/dist/index.js CHANGED
@@ -85917,7 +85917,7 @@ var AgentLifecycleOutboxService, AgentLifecycleOutboxServiceLive = (registry2, m
85917
85917
  recover: () => exports_Effect.promise(() => mgr.recover()),
85918
85918
  getSlot: (chatroomId, role) => mgr.getSlot(chatroomId, role),
85919
85919
  listActive: () => mgr.listActive(),
85920
- clearStuckStoppingSlot: (chatroomId, role) => exports_Effect.promise(() => mgr.clearStuckStoppingSlot(chatroomId, role)),
85920
+ clearStuckStoppingSlot: (chatroomId, role, options) => exports_Effect.promise(() => mgr.clearStuckStoppingSlot(chatroomId, role, options)),
85921
85921
  whenTurnEndsIdle: () => exports_Effect.promise(() => mgr.whenTurnEndsIdle()),
85922
85922
  resumeTurnForSlot: (args2) => exports_Effect.promise(() => mgr.resumeTurnForSlot(args2)),
85923
85923
  setLastInFlightTask: (chatroomId, role, taskId) => exports_Effect.sync(() => mgr.setLastInFlightTask(chatroomId, role, taskId)),
@@ -104777,7 +104777,7 @@ class AgentProcessManager {
104777
104777
  }
104778
104778
  return result;
104779
104779
  }
104780
- async clearStuckStoppingSlot(chatroomId, role) {
104780
+ async clearStuckStoppingSlot(chatroomId, role, options) {
104781
104781
  const key = agentKey3(chatroomId, role);
104782
104782
  const slot = this.slots.get(key);
104783
104783
  if (!slot || slot.state !== "stopping") {
@@ -104787,7 +104787,7 @@ class AgentProcessManager {
104787
104787
  if (elapsed3 < STOPPING_TIMEOUT_MS) {
104788
104788
  return false;
104789
104789
  }
104790
- await this.forceClearStuckStoppingSlot(key, slot, chatroomId, role, "daemon.stop_timeout");
104790
+ await this.forceClearStuckStoppingSlot(key, slot, chatroomId, role, "daemon.stop_timeout", options?.clearStopIntent);
104791
104791
  console.warn(`[AgentProcessManager] ⚠️ Cleared stuck stopping slot for ${role}@${chatroomId}`);
104792
104792
  return true;
104793
104793
  }
@@ -105615,7 +105615,7 @@ class AgentProcessManager {
105615
105615
  slot.pendingOperation = undefined;
105616
105616
  slot.stoppingSince = undefined;
105617
105617
  }
105618
- async forceClearStuckStoppingSlot(key, slot, chatroomId, role, reason) {
105618
+ async forceClearStuckStoppingSlot(key, slot, chatroomId, role, reason, clearStopIntent = false) {
105619
105619
  const pid = slot.pid;
105620
105620
  const harness = slot.harness;
105621
105621
  const stopCommandId = slot.stopCommandId;
@@ -105623,6 +105623,9 @@ class AgentProcessManager {
105623
105623
  const durationMs = slot.stoppingSince ? this.deps.clock.now() - slot.stoppingSince : STOPPING_TIMEOUT_MS;
105624
105624
  this.bumpStopGeneration(slot);
105625
105625
  this.clearSlotRuntimeState(slot);
105626
+ if (clearStopIntent) {
105627
+ this.clearStopIntent(slot);
105628
+ }
105626
105629
  logDaemonAuditEvent(this.deps.logEvent, {
105627
105630
  type: "agent.stopTimeout",
105628
105631
  chatroomId,
@@ -118200,7 +118203,7 @@ function runNativeReviveEffect(task, runtime4, effectContext2, agentMgr) {
118200
118203
  const { chatroomId, agentConfig, role, workingDir, wantResume } = ctx;
118201
118204
  console.log(`[TaskMonitor] native revive ${role}@${chatroomId} — backend PID stale or missing locally for pending task ${task.taskId}`);
118202
118205
  exports_Runtime.runFork(runtime4)(exports_Effect.gen(function* () {
118203
- yield* agentMgr.ensureRunning({
118206
+ const result = yield* agentMgr.ensureRunning({
118204
118207
  chatroomId,
118205
118208
  role,
118206
118209
  agentHarness: agentConfig.agentHarness,
@@ -118211,6 +118214,9 @@ function runNativeReviveEffect(task, runtime4, effectContext2, agentMgr) {
118211
118214
  lifecycleRevision: task.agentConfig.configLifecycleRevision,
118212
118215
  taskId: task.taskId
118213
118216
  });
118217
+ if (!result.success) {
118218
+ yield* exports_Effect.sync(() => console.warn(`[TaskMonitor] native revive rejected for ${role}@${chatroomId}: ${result.error ?? "unknown error"}`));
118219
+ }
118214
118220
  }).pipe(exports_Effect.provide(effectContext2), exports_Effect.catchAll((err) => exports_Effect.sync(() => console.warn(`[TaskMonitor] native revive failed for ${role}@${chatroomId}: ${getErrorMessage(err)}`)))));
118215
118221
  }
118216
118222
  function runNativeWakeEffect(task, runtime4, effectContext2, agentMgr) {
@@ -118220,7 +118226,7 @@ function runNativeWakeEffect(task, runtime4, effectContext2, agentMgr) {
118220
118226
  const { chatroomId, agentConfig, role, workingDir, wantResume } = ctx;
118221
118227
  console.log(`[TaskMonitor] native wake ${role}@${chatroomId} — operational_state=stopped with pending task ${task.taskId}`);
118222
118228
  exports_Runtime.runFork(runtime4)(exports_Effect.gen(function* () {
118223
- yield* agentMgr.ensureRunning({
118229
+ const result = yield* agentMgr.ensureRunning({
118224
118230
  chatroomId,
118225
118231
  role,
118226
118232
  agentHarness: agentConfig.agentHarness,
@@ -118231,6 +118237,9 @@ function runNativeWakeEffect(task, runtime4, effectContext2, agentMgr) {
118231
118237
  lifecycleRevision: task.agentConfig.configLifecycleRevision,
118232
118238
  taskId: task.taskId
118233
118239
  });
118240
+ if (!result.success) {
118241
+ yield* exports_Effect.sync(() => console.warn(`[TaskMonitor] native wake rejected for ${role}@${chatroomId}: ${result.error ?? "unknown error"}`));
118242
+ }
118234
118243
  }).pipe(exports_Effect.provide(effectContext2), exports_Effect.catchAll((err) => exports_Effect.sync(() => console.warn(`[TaskMonitor] native wake failed for ${role}@${chatroomId}: ${getErrorMessage(err)}`)))));
118235
118244
  }
118236
118245
  async function fetchTaskForAction(sessionDeps, machineId, snapshotRow) {
@@ -118242,8 +118251,10 @@ async function fetchTaskForAction(sessionDeps, machineId, snapshotRow) {
118242
118251
  });
118243
118252
  return result ? mapAssignedTaskView(result) : null;
118244
118253
  }
118245
- async function clearStuckStoppingSlotIfNeeded(agentMgr, chatroomId, role) {
118246
- const cleared = await agentMgr.clearStuckStoppingSlot(chatroomId, role);
118254
+ async function clearStuckStoppingSlotIfNeeded(agentMgr, chatroomId, role, clearStopIntent) {
118255
+ const cleared = await agentMgr.clearStuckStoppingSlot(chatroomId, role, {
118256
+ clearStopIntent
118257
+ });
118247
118258
  if (cleared) {
118248
118259
  console.log(`[TaskMonitor] cleared stuck stopping slot for ${role}@${chatroomId}`);
118249
118260
  }
@@ -118257,7 +118268,7 @@ async function normalizeStuckStoppingSlots(tasks, agentMgr) {
118257
118268
  seen.add(key);
118258
118269
  if (isRestartOrchestratorInFlight(row.chatroomId, row.agentConfig.role))
118259
118270
  continue;
118260
- await clearStuckStoppingSlotIfNeeded(agentMgr, row.chatroomId, row.agentConfig.role);
118271
+ await clearStuckStoppingSlotIfNeeded(agentMgr, row.chatroomId, row.agentConfig.role, row.agentConfig.desiredState === "running");
118261
118272
  }
118262
118273
  }
118263
118274
  async function reviveNativeTasks(tasks, localHealth, now, cooldown, runtime4, effectContext2, agentMgr, sessionDeps, machineId) {
@@ -136473,4 +136484,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
136473
136484
  });
136474
136485
  program2.parse();
136475
136486
 
136476
- //# debugId=EB3069D51EE4D31664756E2164756E21
136487
+ //# debugId=190F58A249CBBB8164756E2164756E21