chatroom-cli 1.107.0 → 1.107.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
@@ -80716,6 +80716,7 @@ ${getHandoffNotApplicableSectionComment("List tradeoffs")}
80716
80716
 
80717
80717
  ## System Design
80718
80718
  ${getHandoffNotApplicableSectionComment("Include a mermaid diagram when the change has non-trivial structure")}
80719
+ <!-- Mermaid formatting: wrap the diagram in a fenced code block that begins with \`\`\`mermaid and ends with \`\`\`. Never write a bare "mermaid" line — it will not render. -->
80719
80720
 
80720
80721
  \`\`\`mermaid
80721
80722
  flowchart TD
@@ -106082,6 +106083,7 @@ var init_model_catalog = __esm(() => {
106082
106083
  init_model_provider();
106083
106084
  init_model_variant();
106084
106085
  CODEX_MODEL_IDS = [
106086
+ "gpt-6-astra",
106085
106087
  "gpt-5.6-terra",
106086
106088
  "gpt-5.6-luna",
106087
106089
  "gpt-5.6-sol",
@@ -117783,6 +117785,18 @@ var init_task_delivery_processor = __esm(() => {
117783
117785
  init_task_delivery_logic();
117784
117786
  });
117785
117787
 
117788
+ // src/daemon/entry/task-inbox-membership-registry.ts
117789
+ function registerTaskInboxRoomMembershipRefresh(refresh) {
117790
+ refreshRoomMembership = refresh;
117791
+ }
117792
+ function unregisterTaskInboxRoomMembershipRefresh() {
117793
+ refreshRoomMembership = null;
117794
+ }
117795
+ async function refreshTaskInboxRoomMembership() {
117796
+ await refreshRoomMembership?.();
117797
+ }
117798
+ var refreshRoomMembership = null;
117799
+
117786
117800
  // src/daemon/infrastructure/agent-operational/operational-signal-contract.ts
117787
117801
  function asChatroomId(chatroomId) {
117788
117802
  return chatroomId;
@@ -118155,6 +118169,30 @@ var init_task_inbox_delivery = __esm(() => {
118155
118169
  init_enrich_snapshot_with_operational();
118156
118170
  });
118157
118171
 
118172
+ // src/daemon/infrastructure/inbox/task-signal-contract.ts
118173
+ function asChatroomId2(chatroomId) {
118174
+ return chatroomId;
118175
+ }
118176
+ function buildSubscribeTaskStatusSignalsSinceArgs(input) {
118177
+ return {
118178
+ sessionId: input.sessionId,
118179
+ machineId: input.machineId,
118180
+ chatroomId: asChatroomId2(input.chatroomId),
118181
+ afterKey: input.afterKey,
118182
+ ...input.limit === undefined ? {} : { limit: input.limit }
118183
+ };
118184
+ }
118185
+ function buildListTasksForMachineSignalRangeArgs(input) {
118186
+ return {
118187
+ sessionId: input.sessionId,
118188
+ machineId: input.machineId,
118189
+ chatroomId: asChatroomId2(input.chatroomId),
118190
+ afterSignalKey: input.afterSignalKey,
118191
+ throughSignalKey: input.throughSignalKey,
118192
+ ...input.limit === undefined ? {} : { limit: input.limit }
118193
+ };
118194
+ }
118195
+
118158
118196
  // src/daemon/infrastructure/inbox/task.ts
118159
118197
  function taskSignalCursorAt(timestamp) {
118160
118198
  return `${String(Math.max(0, Math.floor(timestamp))).padStart(16, "0")}:`;
@@ -118194,12 +118232,13 @@ function waitForTaskSignalPage(options, afterSignalKey) {
118194
118232
  settle2(() => reject(error51));
118195
118233
  return;
118196
118234
  }
118197
- unsubscribe = options.client.onUpdate(api.messageList.subscribeTaskStatusSignalsSince, {
118235
+ unsubscribe = options.client.onUpdate(api.messageList.subscribeTaskStatusSignalsSince, buildSubscribeTaskStatusSignalsSinceArgs({
118198
118236
  sessionId: options.sessionId,
118199
118237
  machineId: options.machineId,
118238
+ chatroomId: options.chatroomId,
118200
118239
  afterKey: afterSignalKey,
118201
118240
  limit: options.signalPageLimit ?? DEFAULT_SIGNAL_PAGE_LIMIT2
118202
- }, (result) => {
118241
+ }), (result) => {
118203
118242
  if (!result || typeof result !== "object")
118204
118243
  return;
118205
118244
  const page = result;
@@ -118230,13 +118269,14 @@ async function fetchSnapshotsForSignalPage(options, page) {
118230
118269
  let afterSignalKey = page.afterSignalKey;
118231
118270
  while (true) {
118232
118271
  throwIfAborted2(options.signal);
118233
- const result = await options.client.query(api.tasks.listTasksForMachineSignalRange, {
118272
+ const result = await options.client.query(api.tasks.listTasksForMachineSignalRange, buildListTasksForMachineSignalRangeArgs({
118234
118273
  sessionId: options.sessionId,
118235
118274
  machineId: options.machineId,
118275
+ chatroomId: options.chatroomId,
118236
118276
  afterSignalKey,
118237
118277
  throughSignalKey: page.highSignalKey,
118238
118278
  limit: options.taskPageLimit ?? DEFAULT_TASK_PAGE_LIMIT
118239
- });
118279
+ }));
118240
118280
  snapshots.push(...result.snapshots);
118241
118281
  if (!result.hasMore || !result.nextSignalKey)
118242
118282
  break;
@@ -118283,7 +118323,7 @@ async function bootstrapMachineAssignedTaskSnapshots(deps) {
118283
118323
  function isAbortError2(error51) {
118284
118324
  return error51 instanceof Error && error51.name === "AbortError";
118285
118325
  }
118286
- function operationalScopeKey(machineId, chatroomId) {
118326
+ function roomScopeKey(machineId, chatroomId) {
118287
118327
  return JSON.stringify([machineId, chatroomId]);
118288
118328
  }
118289
118329
  async function runInboxLoopWithRestart(options, onUpdate, isStopped) {
@@ -118337,10 +118377,6 @@ var NATIVE_DELIVERY_RECONCILE_MS = 1e4, INBOX_RESTART_INITIAL_MS = 1000, INBOX_R
118337
118377
  };
118338
118378
  console.log(`[${formatTimestamp()}] \uD83D\uDCEC Starting task-inbox (chatroom-scoped operational signals)`);
118339
118379
  const inboxStore = createInboxStateStore(resolveInboxDbPath(session2.machineId));
118340
- const persisted = inboxStore.get({
118341
- inboxType: "task",
118342
- scopeKey: session2.machineId
118343
- });
118344
118380
  const serviceStartedAt = Date.now();
118345
118381
  const abort = new AbortController;
118346
118382
  let stopped = false;
@@ -118361,14 +118397,6 @@ var NATIVE_DELIVERY_RECONCILE_MS = 1e4, INBOX_RESTART_INITIAL_MS = 1000, INBOX_R
118361
118397
  const cooldown = new RecoveryCooldown;
118362
118398
  let inboxUpdatesInFlight = 0;
118363
118399
  let reconcileInFlight = false;
118364
- const inboxOptions = {
118365
- client: wsClient2,
118366
- sessionId: session2.sessionId,
118367
- machineId: session2.machineId,
118368
- serviceStartedAt,
118369
- initialAfterSignalKey: persisted?.state.afterSignalKey,
118370
- signal: abort.signal
118371
- };
118372
118400
  const bootstrapSucceeded = yield* exports_Effect.tryPromise(async () => {
118373
118401
  const rows = await fetchMachineAgentOperationalStatus(sessionDeps, session2.machineId);
118374
118402
  agentOperationalReadModel.replace(rows);
@@ -118390,7 +118418,7 @@ var NATIVE_DELIVERY_RECONCILE_MS = 1e4, INBOX_RESTART_INITIAL_MS = 1000, INBOX_R
118390
118418
  }
118391
118419
  inboxStore.save({
118392
118420
  inboxType: "operational",
118393
- scopeKey: operationalScopeKey(session2.machineId, chatroomId)
118421
+ scopeKey: roomScopeKey(session2.machineId, chatroomId)
118394
118422
  }, { afterSignalKey: update6.throughSignalKey });
118395
118423
  try {
118396
118424
  await ackMachineOperationalSignals(sessionDeps, session2.machineId, chatroomId, update6.throughSignalKey);
@@ -118401,7 +118429,7 @@ var NATIVE_DELIVERY_RECONCILE_MS = 1e4, INBOX_RESTART_INITIAL_MS = 1000, INBOX_R
118401
118429
  inboxUpdatesInFlight -= 1;
118402
118430
  }
118403
118431
  };
118404
- const ensureOperationalInbox = (chatroomId) => {
118432
+ const ensureRoomInboxes = (chatroomId) => {
118405
118433
  const existing = roomWatchers.get(chatroomId);
118406
118434
  if (existing)
118407
118435
  return existing.startPromise;
@@ -118422,25 +118450,25 @@ var NATIVE_DELIVERY_RECONCILE_MS = 1e4, INBOX_RESTART_INITIAL_MS = 1000, INBOX_R
118422
118450
  console.warn(`[OperationalInbox room=${chatroomId}] operational hydration failed:`, error51);
118423
118451
  }
118424
118452
  }
118425
- const roomKey = {
118453
+ const operationalRoomKey = {
118426
118454
  inboxType: "operational",
118427
- scopeKey: operationalScopeKey(session2.machineId, chatroomId)
118455
+ scopeKey: roomScopeKey(session2.machineId, chatroomId)
118428
118456
  };
118429
- const persistedRoom = inboxStore.get(roomKey);
118430
- let initialCursor;
118431
- if (persistedRoom) {
118432
- initialCursor = persistedRoom.state.afterSignalKey;
118433
- ackMachineOperationalSignals(sessionDeps, session2.machineId, chatroomId, initialCursor).catch((error51) => console.warn(`[OperationalInbox room=${chatroomId}] startup signal cleanup failed:`, error51));
118457
+ const persistedOperationalRoom = inboxStore.get(operationalRoomKey);
118458
+ let operationalCursor;
118459
+ if (persistedOperationalRoom) {
118460
+ operationalCursor = persistedOperationalRoom.state.afterSignalKey;
118461
+ ackMachineOperationalSignals(sessionDeps, session2.machineId, chatroomId, operationalCursor).catch((error51) => console.warn(`[OperationalInbox room=${chatroomId}] startup signal cleanup failed:`, error51));
118434
118462
  } else if (bootstrapSucceeded) {
118435
- initialCursor = operationalSignalCursorAt(serviceStartedAt);
118463
+ operationalCursor = operationalSignalCursorAt(serviceStartedAt);
118436
118464
  try {
118437
- inboxStore.save(roomKey, { afterSignalKey: initialCursor });
118438
- ackMachineOperationalSignals(sessionDeps, session2.machineId, chatroomId, initialCursor).catch((error51) => console.warn(`[OperationalInbox room=${chatroomId}] startup signal cleanup failed:`, error51));
118465
+ inboxStore.save(operationalRoomKey, { afterSignalKey: operationalCursor });
118466
+ ackMachineOperationalSignals(sessionDeps, session2.machineId, chatroomId, operationalCursor).catch((error51) => console.warn(`[OperationalInbox room=${chatroomId}] startup signal cleanup failed:`, error51));
118439
118467
  } catch (error51) {
118440
118468
  console.warn(`[OperationalInbox room=${chatroomId}] failed to persist bootstrap baseline:`, error51);
118441
118469
  }
118442
118470
  } else {
118443
- initialCursor = operationalSignalCursorAt(serviceStartedAt);
118471
+ operationalCursor = operationalSignalCursorAt(serviceStartedAt);
118444
118472
  }
118445
118473
  runOperationalInboxLoopWithRestart({
118446
118474
  client: wsClient2,
@@ -118448,13 +118476,83 @@ var NATIVE_DELIVERY_RECONCILE_MS = 1e4, INBOX_RESTART_INITIAL_MS = 1000, INBOX_R
118448
118476
  machineId: session2.machineId,
118449
118477
  chatroomId,
118450
118478
  serviceStartedAt,
118451
- initialAfterSignalKey: initialCursor,
118479
+ initialAfterSignalKey: operationalCursor,
118452
118480
  signal: controller.signal
118453
118481
  }, operationalHandler, () => stopped);
118482
+ const taskRoomKey = {
118483
+ inboxType: "task",
118484
+ scopeKey: roomScopeKey(session2.machineId, chatroomId)
118485
+ };
118486
+ const persistedTaskRoom = inboxStore.get(taskRoomKey);
118487
+ let taskCursor;
118488
+ if (persistedTaskRoom) {
118489
+ taskCursor = persistedTaskRoom.state.afterSignalKey;
118490
+ } else if (bootstrapSucceeded) {
118491
+ taskCursor = taskSignalCursorAt(serviceStartedAt);
118492
+ try {
118493
+ inboxStore.save(taskRoomKey, { afterSignalKey: taskCursor });
118494
+ } catch (error51) {
118495
+ console.warn(`[TaskInbox room=${chatroomId}] failed to persist bootstrap baseline:`, error51);
118496
+ }
118497
+ } else {
118498
+ taskCursor = taskSignalCursorAt(serviceStartedAt);
118499
+ }
118500
+ const taskHandlerForRoom = async (update6) => {
118501
+ inboxUpdatesInFlight += 1;
118502
+ try {
118503
+ await handleTaskInboxUpdate(update6, {
118504
+ runtime: runtime4,
118505
+ effectContext: effectContext2,
118506
+ cooldown,
118507
+ agentMgr,
118508
+ sessionDeps,
118509
+ machineId: session2.machineId,
118510
+ taskSnapshotState
118511
+ });
118512
+ inboxStore.save(taskRoomKey, { afterSignalKey: update6.throughSignalKey });
118513
+ } finally {
118514
+ inboxUpdatesInFlight -= 1;
118515
+ }
118516
+ };
118517
+ runInboxLoopWithRestart({
118518
+ client: wsClient2,
118519
+ sessionId: session2.sessionId,
118520
+ machineId: session2.machineId,
118521
+ chatroomId,
118522
+ serviceStartedAt,
118523
+ initialAfterSignalKey: taskCursor,
118524
+ signal: controller.signal
118525
+ }, taskHandlerForRoom, () => stopped);
118454
118526
  })();
118455
118527
  return entry.startPromise;
118456
118528
  };
118457
- yield* exports_Effect.tryPromise(() => Promise.all([...knownRoomIds].map((chatroomId) => ensureOperationalInbox(chatroomId)))).pipe(exports_Effect.catchAll((error51) => {
118529
+ const refreshRoomMembership2 = async () => {
118530
+ try {
118531
+ const workspaces = await wsClient2.query(api.workspaces.listWorkspacesForMachine, {
118532
+ sessionId: session2.sessionId,
118533
+ machineId: session2.machineId
118534
+ });
118535
+ if (stopped)
118536
+ return;
118537
+ const chatroomIds = [
118538
+ ...new Set((workspaces ?? []).map((workspace) => workspace.chatroomId))
118539
+ ];
118540
+ const activeChatroomIds = new Set(chatroomIds);
118541
+ for (const [chatroomId, watcher] of roomWatchers) {
118542
+ if (activeChatroomIds.has(chatroomId))
118543
+ continue;
118544
+ watcher.controller.abort();
118545
+ roomWatchers.delete(chatroomId);
118546
+ knownRoomIds.delete(chatroomId);
118547
+ }
118548
+ await Promise.all(chatroomIds.map((chatroomId) => ensureRoomInboxes(chatroomId)));
118549
+ } catch (error51) {
118550
+ console.warn("[TaskInbox] room membership refresh failed:", error51);
118551
+ }
118552
+ };
118553
+ registerTaskInboxRoomMembershipRefresh(refreshRoomMembership2);
118554
+ yield* exports_Effect.promise(refreshRoomMembership2);
118555
+ yield* exports_Effect.tryPromise(() => Promise.all([...knownRoomIds].map((chatroomId) => ensureRoomInboxes(chatroomId)))).pipe(exports_Effect.catchAll((error51) => {
118458
118556
  console.warn("[OperationalInbox] initial watcher start failed:", error51);
118459
118557
  return exports_Effect.void;
118460
118558
  }));
@@ -118467,38 +118565,12 @@ var NATIVE_DELIVERY_RECONCILE_MS = 1e4, INBOX_RESTART_INITIAL_MS = 1000, INBOX_R
118467
118565
  machineId: session2.machineId,
118468
118566
  taskSnapshotState,
118469
118567
  onDiscoveredChatrooms: async (chatroomIds) => {
118470
- await Promise.all(chatroomIds.map((chatroomId) => ensureOperationalInbox(chatroomId)));
118568
+ await Promise.all(chatroomIds.map((chatroomId) => ensureRoomInboxes(chatroomId)));
118471
118569
  }
118472
118570
  })).pipe(exports_Effect.catchAll((error51) => {
118473
118571
  console.warn("[TaskInbox] bootstrap failed:", error51);
118474
118572
  return exports_Effect.void;
118475
118573
  }));
118476
- const inboxHandler = async (update6) => {
118477
- inboxUpdatesInFlight += 1;
118478
- try {
118479
- const chatroomIds = [
118480
- ...new Set([
118481
- ...update6.snapshots.map((snapshot) => snapshot.chatroomId),
118482
- ...update6.signals.map((signal) => signal.chatroomId)
118483
- ])
118484
- ];
118485
- if (chatroomIds.length > 0) {
118486
- await Promise.all(chatroomIds.map((chatroomId) => ensureOperationalInbox(chatroomId)));
118487
- }
118488
- await handleTaskInboxUpdate(update6, {
118489
- runtime: runtime4,
118490
- effectContext: effectContext2,
118491
- cooldown,
118492
- agentMgr,
118493
- sessionDeps,
118494
- machineId: session2.machineId,
118495
- taskSnapshotState
118496
- });
118497
- inboxStore.save({ inboxType: "task", scopeKey: session2.machineId }, { afterSignalKey: update6.throughSignalKey });
118498
- } finally {
118499
- inboxUpdatesInFlight -= 1;
118500
- }
118501
- };
118502
118574
  const reconcileTimer = setInterval(() => {
118503
118575
  if (stopped || inboxUpdatesInFlight > 0 || reconcileInFlight)
118504
118576
  return;
@@ -118509,7 +118581,6 @@ var NATIVE_DELIVERY_RECONCILE_MS = 1e4, INBOX_RESTART_INITIAL_MS = 1000, INBOX_R
118509
118581
  reconcileInFlight = false;
118510
118582
  });
118511
118583
  }, NATIVE_DELIVERY_RECONCILE_MS);
118512
- runInboxLoopWithRestart(inboxOptions, inboxHandler, () => stopped);
118513
118584
  return {
118514
118585
  stop() {
118515
118586
  stopped = true;
@@ -118518,6 +118589,7 @@ var NATIVE_DELIVERY_RECONCILE_MS = 1e4, INBOX_RESTART_INITIAL_MS = 1000, INBOX_R
118518
118589
  watcher.controller.abort();
118519
118590
  }
118520
118591
  clearInterval(reconcileTimer);
118592
+ unregisterTaskInboxRoomMembershipRefresh();
118521
118593
  unregisterNativeDeliverySession();
118522
118594
  inboxStore.close();
118523
118595
  }
@@ -119684,7 +119756,10 @@ var init_command_run = __esm(() => {
119684
119756
  // src/daemon/infrastructure/convex/subscribers/enhancer-job.ts
119685
119757
  function startEnhancerJobSubscriber2(deps, onEvent) {
119686
119758
  const seen = new Set;
119687
- const unsub = deps.wsClient.onUpdate(api.daemon.enhancer.index.pendingForMachine, { sessionId: deps.sessionId, machineId: deps.machineId }, (jobs) => {
119759
+ const watchers = new Map;
119760
+ let stopped = false;
119761
+ let refreshInFlight = false;
119762
+ const onPendingJobs = (jobs) => {
119688
119763
  if (!jobs?.length)
119689
119764
  return;
119690
119765
  for (const job of jobs) {
@@ -119695,13 +119770,57 @@ function startEnhancerJobSubscriber2(deps, onEvent) {
119695
119770
  seen.add(job.jobId);
119696
119771
  onEvent({ type: "enhancer.job-assigned", jobId: job.jobId });
119697
119772
  }
119698
- }, (err) => {
119773
+ };
119774
+ const onError3 = (err) => {
119699
119775
  console.warn(`[daemon] enhancer-job subscriber error: ${err instanceof Error ? err.message : String(err)}`);
119700
- });
119776
+ };
119777
+ const watchChatroom = (chatroomId) => {
119778
+ if (watchers.has(chatroomId) || stopped)
119779
+ return;
119780
+ const unsub = deps.wsClient.onUpdate(api.daemon.enhancer.index.pendingForChatroom, {
119781
+ sessionId: deps.sessionId,
119782
+ machineId: deps.machineId,
119783
+ chatroomId
119784
+ }, onPendingJobs, onError3);
119785
+ watchers.set(chatroomId, unsub);
119786
+ };
119787
+ const refreshChatrooms = async () => {
119788
+ if (refreshInFlight)
119789
+ return;
119790
+ refreshInFlight = true;
119791
+ try {
119792
+ const workspaces = await deps.wsClient.query(api.workspaces.listWorkspacesForMachine, {
119793
+ sessionId: deps.sessionId,
119794
+ machineId: deps.machineId
119795
+ });
119796
+ if (stopped)
119797
+ return;
119798
+ const roomIds = [
119799
+ ...new Set((workspaces ?? []).map((ws) => ws.chatroomId))
119800
+ ];
119801
+ for (const [roomId, unsub] of watchers) {
119802
+ if (!roomIds.includes(roomId)) {
119803
+ unsub();
119804
+ watchers.delete(roomId);
119805
+ }
119806
+ }
119807
+ for (const roomId of roomIds)
119808
+ watchChatroom(roomId);
119809
+ } catch (error51) {
119810
+ console.warn(`[daemon] enhancer-job room refresh failed: ${error51 instanceof Error ? error51.message : String(error51)}`);
119811
+ } finally {
119812
+ refreshInFlight = false;
119813
+ }
119814
+ };
119815
+ refreshChatrooms();
119701
119816
  return {
119702
119817
  async stop() {
119703
- unsub();
119704
- }
119818
+ stopped = true;
119819
+ for (const unsub of watchers.values())
119820
+ unsub();
119821
+ watchers.clear();
119822
+ },
119823
+ refreshChatrooms
119705
119824
  };
119706
119825
  }
119707
119826
  var init_enhancer_job = __esm(() => {
@@ -119859,7 +119978,11 @@ function requestId2(req) {
119859
119978
  }
119860
119979
  function startGitRequestSubscriber(deps, onEvent) {
119861
119980
  const seen = new Set;
119862
- const unsub = deps.wsClient.onUpdate(api.workspaces.getPendingRequests, { sessionId: deps.sessionId, machineId: deps.machineId }, (requests) => {
119981
+ const watchers = new Map;
119982
+ let stopped = false;
119983
+ let refreshInFlight = false;
119984
+ let queued = false;
119985
+ const onPendingRequests = (requests) => {
119863
119986
  if (!requests?.length)
119864
119987
  return;
119865
119988
  for (const req of requests) {
@@ -119871,13 +119994,58 @@ function startGitRequestSubscriber(deps, onEvent) {
119871
119994
  seen.add(id3);
119872
119995
  onEvent({ type: "git.request", requestId: id3 });
119873
119996
  }
119874
- }, (err) => {
119997
+ };
119998
+ const onError3 = (err) => {
119875
119999
  console.warn(`[daemon] git-request subscriber error: ${err instanceof Error ? err.message : String(err)}`);
119876
- });
120000
+ };
120001
+ const watchWorkspace = (workingDir) => {
120002
+ if (watchers.has(workingDir) || stopped)
120003
+ return;
120004
+ const unsub = deps.wsClient.onUpdate(api.workspaces.getPendingRequestsForWorkspace, { sessionId: deps.sessionId, machineId: deps.machineId, workingDir }, onPendingRequests, onError3);
120005
+ watchers.set(workingDir, unsub);
120006
+ };
120007
+ const refreshWorkspaces = async () => {
120008
+ if (refreshInFlight) {
120009
+ queued = true;
120010
+ return;
120011
+ }
120012
+ refreshInFlight = true;
120013
+ try {
120014
+ do {
120015
+ queued = false;
120016
+ const workspaces = await deps.wsClient.query(api.workspaces.listWorkspacesForMachine, {
120017
+ sessionId: deps.sessionId,
120018
+ machineId: deps.machineId
120019
+ });
120020
+ if (stopped)
120021
+ return;
120022
+ const workingDirs = [
120023
+ ...new Set((workspaces ?? []).map((ws) => ws.workingDir))
120024
+ ];
120025
+ for (const [workingDir, unsub] of watchers) {
120026
+ if (!workingDirs.includes(workingDir)) {
120027
+ unsub();
120028
+ watchers.delete(workingDir);
120029
+ }
120030
+ }
120031
+ for (const workingDir of workingDirs)
120032
+ watchWorkspace(workingDir);
120033
+ } while (queued && !stopped);
120034
+ } catch (error51) {
120035
+ console.warn(`[daemon] git-request workspace refresh failed: ${error51 instanceof Error ? error51.message : String(error51)}`);
120036
+ } finally {
120037
+ refreshInFlight = false;
120038
+ }
120039
+ };
120040
+ refreshWorkspaces();
119877
120041
  return {
119878
120042
  async stop() {
119879
- unsub();
119880
- }
120043
+ stopped = true;
120044
+ for (const unsub of watchers.values())
120045
+ unsub();
120046
+ watchers.clear();
120047
+ },
120048
+ refreshWorkspaces
119881
120049
  };
119882
120050
  }
119883
120051
  var init_git_request = __esm(() => {
@@ -119928,7 +120096,14 @@ function startAllSubscribers(deps) {
119928
120096
  const onEvent = (event) => {
119929
120097
  routeInboundEvent(deps.router, event);
119930
120098
  };
120099
+ const enhancerJob = startEnhancerJobSubscriber2(deps, onEvent);
120100
+ const gitRequest = startGitRequestSubscriber(deps, onEvent);
119931
120101
  const machineCommands = startMachineCommandInboxSubscriber(deps, async (claimed) => {
120102
+ if (claimed.type === "daemon.workspaceListChanged") {
120103
+ enhancerJob.refreshChatrooms();
120104
+ gitRequest.refreshWorkspaces();
120105
+ refreshTaskInboxRoomMembership();
120106
+ }
119932
120107
  await dispatchCommandInboundEvent({
119933
120108
  type: "command.received",
119934
120109
  commandId: claimed.commandId,
@@ -119936,14 +120111,12 @@ function startAllSubscribers(deps) {
119936
120111
  });
119937
120112
  });
119938
120113
  const commandRun = startCommandRunSubscriber(deps, onEvent);
119939
- const gitRequest = startGitRequestSubscriber(deps, onEvent);
119940
120114
  const fileTree = startFileTreeRequestSubscriber(deps, onEvent);
119941
120115
  const fileTreeRelease = startFileTreeReleaseRequestSubscriber(deps, onEvent);
119942
120116
  const fileContent = startFileContentRequestSubscriber(deps, onEvent);
119943
120117
  const fileWrite = startFileWriteRequestSubscriber(deps, onEvent);
119944
120118
  const agenticQuerySession = startAgenticQuerySessionSubscriber(deps, onEvent);
119945
120119
  const agenticQueryPrompt = startAgenticQueryPromptSubscriber(deps, onEvent);
119946
- const enhancerJob = startEnhancerJobSubscriber2(deps, onEvent);
119947
120120
  return {
119948
120121
  async stopAll() {
119949
120122
  await Promise.all([
@@ -135734,4 +135907,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
135734
135907
  });
135735
135908
  program2.parse();
135736
135909
 
135737
- //# debugId=962BD51641BEFD4F64756E2164756E21
135910
+ //# debugId=FF0641D1EDD955EA64756E2164756E21