chatroom-cli 1.143.1 → 1.143.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
@@ -51669,6 +51669,11 @@ var init_stop_agent_confirmed_adapter = __esm(() => {
51669
51669
  init_stop_agent_confirmed();
51670
51670
  });
51671
51671
 
51672
+ // src/infrastructure/services/workspace/normalize-working-dir.ts
51673
+ function normalizeWorkingDirForLookup(workingDir) {
51674
+ return workingDir.trim().replace(/[/\\]+$/, "");
51675
+ }
51676
+
51672
51677
  // src/daemon/domain/usecase/stop-agent-targets.ts
51673
51678
  async function stopAgentTargets(deps, args2) {
51674
51679
  const release2 = await deps.barrier.acquire(args2.chatroomId);
@@ -51747,7 +51752,12 @@ async function runRoleScopedStop(args2) {
51747
51752
  args2.apm.markStopIntent(args2.chatroomId, args2.role, args2.reason, undefined, args2.workingDir);
51748
51753
  const deps = createStopAgentTargetsDeps(args2);
51749
51754
  const discovered = await args2.apm.discoverStopTargets(args2.chatroomId);
51750
- const targets = discovered.filter((target) => normalizeAgentStopRole(target.role) === normalizeAgentStopRole(args2.role) && (!args2.workingDir || target.workingDir === args2.workingDir));
51755
+ const scopeDir = args2.workingDir ? normalizeWorkingDirForLookup(args2.workingDir) : undefined;
51756
+ const targets = discovered.filter((target) => normalizeAgentStopRole(target.role) === normalizeAgentStopRole(args2.role) && (scopeDir === undefined || target.workingDir !== undefined && normalizeWorkingDirForLookup(target.workingDir) === scopeDir));
51757
+ for (const target of targets) {
51758
+ if (target.workingDir !== undefined && target.workingDir !== args2.workingDir)
51759
+ args2.apm.markStopIntent(args2.chatroomId, args2.role, args2.reason, target.pid, target.workingDir);
51760
+ }
51751
51761
  return stopAgentTargets(deps, {
51752
51762
  chatroomId: args2.chatroomId,
51753
51763
  scope: { kind: "agent", role: args2.role },
@@ -86037,11 +86047,6 @@ var init_skill = __esm(() => {
86037
86047
  init_terminal_safety();
86038
86048
  });
86039
86049
 
86040
- // src/infrastructure/services/workspace/normalize-working-dir.ts
86041
- function normalizeWorkingDirForLookup(workingDir) {
86042
- return workingDir.trim().replace(/[/\\]+$/, "");
86043
- }
86044
-
86045
86050
  // src/commands/workspace/file-tree.ts
86046
86051
  async function createDefaultDeps15() {
86047
86052
  const client2 = await getConvexClient();
@@ -103262,15 +103267,28 @@ async function executeChatroomStopCommand(args2) {
103262
103267
  args2.apm.markChatroomStopIntent(args2.chatroomId, "user.stop");
103263
103268
  }
103264
103269
  const confirmedDeps = args2.apm.getConfirmedStopAdapterDeps();
103270
+ const scopeDir = args2.workingDir ? normalizeWorkingDirForLookup(args2.workingDir) : undefined;
103271
+ const isInScope = (target) => scopeDir === undefined || target.workingDir !== undefined && normalizeWorkingDirForLookup(target.workingDir) === scopeDir;
103265
103272
  const targets = await args2.apm.discoverStopTargets(args2.chatroomId);
103266
- const roles = new Set(targets.filter((target) => target.chatroomId === args2.chatroomId && (!args2.role || target.role.toLowerCase() === args2.role.toLowerCase()) && (!args2.workingDir || target.workingDir === args2.workingDir)).map((target) => target.role.toLowerCase()));
103267
- if (args2.role)
103268
- roles.add(args2.role.toLowerCase());
103273
+ const roleWorkingDirs = new Map;
103274
+ for (const target of targets) {
103275
+ if (target.chatroomId !== args2.chatroomId)
103276
+ continue;
103277
+ const role = target.role.toLowerCase();
103278
+ if (args2.role && role !== args2.role.toLowerCase())
103279
+ continue;
103280
+ if (!isInScope(target) || roleWorkingDirs.has(role))
103281
+ continue;
103282
+ roleWorkingDirs.set(role, args2.workingDir ? target.workingDir : undefined);
103283
+ }
103284
+ if (args2.role && !roleWorkingDirs.has(args2.role.toLowerCase()))
103285
+ roleWorkingDirs.set(args2.role.toLowerCase(), args2.workingDir);
103269
103286
  if (!args2.role && !args2.workingDir) {
103270
103287
  for (const role of await args2.taskService.listMachineTaskRolesForChatroom(args2.chatroomId))
103271
- roles.add(role.toLowerCase());
103288
+ if (!roleWorkingDirs.has(role.toLowerCase()))
103289
+ roleWorkingDirs.set(role.toLowerCase(), undefined);
103272
103290
  }
103273
- const results2 = await Promise.allSettled([...roles].map((role) => args2.runSerializedForAgent({ chatroomId: args2.chatroomId, role, workingDir: args2.workingDir }, { timeoutMs: AGENT_LIFECYCLE_OPERATION_TIMEOUT_MS }, async (_ops, context3) => {
103291
+ const results2 = await Promise.allSettled([...roleWorkingDirs].map(([role, workingDir]) => args2.runSerializedForAgent({ chatroomId: args2.chatroomId, role, workingDir }, { timeoutMs: AGENT_LIFECYCLE_OPERATION_TIMEOUT_MS }, async (_ops, context3) => {
103274
103292
  if (context3.signal.aborted)
103275
103293
  throw context3.signal.reason;
103276
103294
  await args2.nativeDelivery.prepareRoleRecovery({ chatroomId: args2.chatroomId, role });
@@ -103280,13 +103298,13 @@ async function executeChatroomStopCommand(args2) {
103280
103298
  chatroomId: args2.chatroomId,
103281
103299
  role,
103282
103300
  reason: "user.stop",
103283
- workingDir: args2.workingDir
103301
+ workingDir
103284
103302
  });
103285
103303
  if (result3.failures.length > 0)
103286
103304
  throw new AggregateError(result3.failures.map((failure) => failure.error), `agent stop failed room=${args2.chatroomId} role=${role}`);
103287
103305
  if (args2.workingDir) {
103288
103306
  const remainingTargets = await args2.apm.discoverStopTargets(args2.chatroomId);
103289
- const liveOutsideScope = remainingTargets.some((target) => target.chatroomId === args2.chatroomId && target.role.toLowerCase() === role && target.workingDir !== args2.workingDir);
103307
+ const liveOutsideScope = remainingTargets.some((target) => target.chatroomId === args2.chatroomId && target.role.toLowerCase() === role && !isInScope(target));
103290
103308
  if (liveOutsideScope)
103291
103309
  throw new Error(`cannot recover role with a live process outside working directory room=${args2.chatroomId} role=${role}`);
103292
103310
  }
@@ -123885,4 +123903,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
123885
123903
  });
123886
123904
  program2.parse();
123887
123905
 
123888
- //# debugId=A53D39B9C99789DF64756E2164756E21
123906
+ //# debugId=8F9B7F0317CF518264756E2164756E21