chatroom-cli 1.116.0 → 1.116.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.
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Chatroom Daemon</title>
7
- <script type="module" crossorigin src="/assets/index-CGSmO7lb.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-BRHC2Xs-.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-iM2TK7kh.css">
9
9
  </head>
10
10
  <body>
package/dist/index.js CHANGED
@@ -94301,37 +94301,6 @@ var init_git_heartbeat = __esm(() => {
94301
94301
  });
94302
94302
  });
94303
94303
 
94304
- // src/daemon/entry/workspace-git/workspace-list-subscription.ts
94305
- function toSyncWorkspaces(workingDirs) {
94306
- return workingDirs.map((workingDir) => ({ workingDir }));
94307
- }
94308
- async function reconcileWorkspaceList(session2) {
94309
- const workspaces = await session2.backend.query(api.workspaces.listRecentlyObservedWorkspacesForMachine, {
94310
- sessionId: session2.sessionId,
94311
- machineId: session2.machineId
94312
- });
94313
- if (!session2.workspaceListStore) {
94314
- session2.workspaceListStore = { workspaces: [], updatedAt: 0 };
94315
- }
94316
- session2.workspaceListStore.workspaces = toSyncWorkspaces(workspaces);
94317
- session2.workspaceListStore.updatedAt = Date.now();
94318
- }
94319
- var startWorkspaceListSubscriptionEffect = () => exports_Effect.gen(function* () {
94320
- const session2 = yield* DaemonSessionService;
94321
- session2.workspaceListStore = { workspaces: [], updatedAt: 0 };
94322
- yield* exports_Effect.promise(() => reconcileWorkspaceList(session2));
94323
- return {
94324
- stop: () => {
94325
- session2.workspaceListStore = undefined;
94326
- }
94327
- };
94328
- });
94329
- var init_workspace_list_subscription = __esm(() => {
94330
- init_esm();
94331
- init_api3();
94332
- init_daemon_services();
94333
- });
94334
-
94335
94304
  // src/daemon/entry/command-event-types.ts
94336
94305
  function isDaemonCommandEventType(value) {
94337
94306
  return DAEMON_COMMAND_EVENT_TYPES.includes(value);
@@ -94343,7 +94312,6 @@ var init_command_event_types = __esm(() => {
94343
94312
  "agent.restart",
94344
94313
  "daemon.ping",
94345
94314
  "daemon.gitRefresh",
94346
- "daemon.workspaceListChanged",
94347
94315
  "daemon.localAction",
94348
94316
  "daemon.pickFolder",
94349
94317
  "daemon.refreshCapabilities"
@@ -96472,8 +96440,6 @@ function evictStaleDedupEntries(tracker) {
96472
96440
  evictStaleEntries(tracker.capabilitiesRefreshIds, evictBefore);
96473
96441
  evictStaleEntries(tracker.localActionIds, evictBefore);
96474
96442
  evictStaleEntries(tracker.pickFolderIds, evictBefore);
96475
- if (tracker.workspaceListChangedIds)
96476
- evictStaleEntries(tracker.workspaceListChangedIds, evictBefore);
96477
96443
  processManager.evictStalePendingStops();
96478
96444
  }
96479
96445
  function createDedupTracker() {
@@ -96483,21 +96449,9 @@ function createDedupTracker() {
96483
96449
  gitRefreshIds: new Map,
96484
96450
  capabilitiesRefreshIds: new Map,
96485
96451
  localActionIds: new Map,
96486
- pickFolderIds: new Map,
96487
- workspaceListChangedIds: new Map
96452
+ pickFolderIds: new Map
96488
96453
  };
96489
96454
  }
96490
- function handleWorkspaceListChangedCommandEffect(event, tracker) {
96491
- return exports_Effect.gen(function* () {
96492
- const eventId = String(event._id);
96493
- if (tracker.workspaceListChangedIds?.has(eventId))
96494
- return;
96495
- const session2 = yield* DaemonSessionService;
96496
- yield* exports_Effect.promise(() => reconcileWorkspaceList(session2));
96497
- yield* pushGitStateEffect;
96498
- (tracker.workspaceListChangedIds ??= new Map).set(eventId, Date.now());
96499
- });
96500
- }
96501
96455
  function handleRequestStartEffect(event, tracker) {
96502
96456
  return exports_Effect.gen(function* () {
96503
96457
  const eventId = event._id.toString();
@@ -96626,27 +96580,11 @@ function handleRefreshCapabilitiesEffect(event, tracker) {
96626
96580
  })));
96627
96581
  });
96628
96582
  }
96629
- async function handleInboundCommandEvent(commandId, tracker, effectContext2, session2, claimedCommand, nativeDelivery) {
96583
+ async function handleInboundCommandEvent(commandId, tracker, effectContext2, claimedCommand, nativeDelivery) {
96630
96584
  if (claimedCommand.commandId !== commandId)
96631
96585
  return;
96632
- const renewTimer = setInterval(() => {
96633
- session2.backend.mutation(api.daemon.machineCommandInbox.renewClaim, {
96634
- sessionId: session2.sessionId,
96635
- commandId: claimedCommand.commandId
96636
- }).catch(() => {
96637
- return;
96638
- });
96639
- }, MACHINE_COMMAND_LEASE_RENEWAL_INTERVAL_MS);
96640
- try {
96641
- const { commandId: _id, machineId, deadline, timestamp, ...rest } = claimedCommand;
96642
- await exports_Effect.runPromise(dispatchCommandEventEffect({ _id, machineId, deadline, timestamp, ...rest }, tracker, nativeDelivery).pipe(exports_Effect.provide(effectContext2)));
96643
- await session2.backend.mutation(api.daemon.machineCommandInbox.acknowledge, {
96644
- sessionId: session2.sessionId,
96645
- commandId: claimedCommand.commandId
96646
- });
96647
- } finally {
96648
- clearInterval(renewTimer);
96649
- }
96586
+ const { commandId: _id, machineId, deadline, timestamp, ...rest } = claimedCommand;
96587
+ await exports_Effect.runPromise(dispatchCommandEventEffect({ _id, machineId, deadline, timestamp, ...rest }, tracker, nativeDelivery).pipe(exports_Effect.provide(effectContext2)));
96650
96588
  }
96651
96589
  var GIT_PUSH_ACTIONS, commandEventHandlers, dispatchCommandEventEffect = (event, tracker, nativeDelivery) => {
96652
96590
  if (!isDaemonCommandEventType(event.type))
@@ -96658,7 +96596,6 @@ var init_command_dispatch = __esm(() => {
96658
96596
  init_reliability();
96659
96597
  init_esm();
96660
96598
  init_git_heartbeat();
96661
- init_workspace_list_subscription();
96662
96599
  init_api3();
96663
96600
  init_capabilities_bridge();
96664
96601
  init_command_event_types();
@@ -96678,7 +96615,6 @@ var init_command_dispatch = __esm(() => {
96678
96615
  "agent.restart": handleRequestRestartEffect,
96679
96616
  "daemon.ping": handlePingCommandEffect,
96680
96617
  "daemon.gitRefresh": handleGitRefreshCommandEffect,
96681
- "daemon.workspaceListChanged": handleWorkspaceListChangedCommandEffect,
96682
96618
  "daemon.localAction": handleLocalActionCommandEffect,
96683
96619
  "daemon.pickFolder": handlePickFolderCommandEffect,
96684
96620
  "daemon.refreshCapabilities": handleRefreshCapabilitiesEffect
@@ -103294,6 +103230,37 @@ var init_git_subscription = __esm(() => {
103294
103230
  init_daemon_services();
103295
103231
  });
103296
103232
 
103233
+ // src/daemon/entry/workspace-git/workspace-list-subscription.ts
103234
+ function toSyncWorkspaces(workingDirs) {
103235
+ return workingDirs.map((workingDir) => ({ workingDir }));
103236
+ }
103237
+ async function reconcileWorkspaceList(session2) {
103238
+ const workspaces = await session2.backend.query(api.workspaces.listRecentlyObservedWorkspacesForMachine, {
103239
+ sessionId: session2.sessionId,
103240
+ machineId: session2.machineId
103241
+ });
103242
+ if (!session2.workspaceListStore) {
103243
+ session2.workspaceListStore = { workspaces: [], updatedAt: 0 };
103244
+ }
103245
+ session2.workspaceListStore.workspaces = toSyncWorkspaces(workspaces);
103246
+ session2.workspaceListStore.updatedAt = Date.now();
103247
+ }
103248
+ var startWorkspaceListSubscriptionEffect = () => exports_Effect.gen(function* () {
103249
+ const session2 = yield* DaemonSessionService;
103250
+ session2.workspaceListStore = { workspaces: [], updatedAt: 0 };
103251
+ yield* exports_Effect.promise(() => reconcileWorkspaceList(session2));
103252
+ return {
103253
+ stop: () => {
103254
+ session2.workspaceListStore = undefined;
103255
+ }
103256
+ };
103257
+ });
103258
+ var init_workspace_list_subscription = __esm(() => {
103259
+ init_esm();
103260
+ init_api3();
103261
+ init_daemon_services();
103262
+ });
103263
+
103297
103264
  // src/daemon/entry/workspace-git-inbound-registry.ts
103298
103265
  function registerWorkspaceGitInboundHandler(h) {
103299
103266
  handler5 = h;
@@ -103515,7 +103482,7 @@ Listening for commands...`);
103515
103482
  console.warn("[Daemon] command received before task inbox started");
103516
103483
  return;
103517
103484
  }
103518
- await handleInboundCommandEvent(event.commandId, dedupTracker, effectContext2, session2, event.claimedCommand, nativeDelivery);
103485
+ await handleInboundCommandEvent(event.commandId, dedupTracker, effectContext2, event.claimedCommand, nativeDelivery);
103519
103486
  } else {
103520
103487
  await drainActionableCommandRuns(session2, commandRunRuntime);
103521
103488
  }
@@ -104069,12 +104036,6 @@ async function routeInboundEvent(deps, event) {
104069
104036
  }
104070
104037
  var init_event_router = () => {};
104071
104038
 
104072
- // src/daemon/entry/workspace-membership-refresh-registry.ts
104073
- async function refreshWorkspaceMembership() {
104074
- await refreshRoomMembership?.();
104075
- }
104076
- var refreshRoomMembership = null;
104077
-
104078
104039
  // src/daemon/infrastructure/convex/subscribers/agentic-query-prompt.ts
104079
104040
  function startAgenticQueryPromptSubscriber(deps, onEvent) {
104080
104041
  let processing = false;
@@ -104477,10 +104438,52 @@ var init_git_request = __esm(() => {
104477
104438
  });
104478
104439
 
104479
104440
  // src/daemon/infrastructure/convex/subscribers/machine-command-inbox.ts
104441
+ function getMachineCommandConcurrencyKey(command) {
104442
+ return "workingDir" in command && typeof command.workingDir === "string" ? `workspace:${command.workingDir}` : MACHINE_COMMAND_KEY;
104443
+ }
104480
104444
  function startMachineCommandInboxSubscriber(deps, onClaimed) {
104481
104445
  let draining = false;
104482
104446
  let queued = false;
104483
104447
  let stopped = false;
104448
+ let machineTail = Promise.resolve();
104449
+ const workspaceTails = new Map;
104450
+ const enqueueClaimed = (claimed) => {
104451
+ const key = getMachineCommandConcurrencyKey(claimed);
104452
+ const previousMachine = machineTail;
104453
+ const previousWorkspace = workspaceTails.get(key) ?? Promise.resolve();
104454
+ const previous = key === MACHINE_COMMAND_KEY ? Promise.all([previousMachine, ...workspaceTails.values()]) : Promise.all([previousMachine, previousWorkspace]);
104455
+ const renewTimer = setInterval(() => {
104456
+ deps.wsClient.mutation(api.daemon.machineCommandInbox.renewClaim, {
104457
+ sessionId: deps.sessionId,
104458
+ commandId: claimed.commandId
104459
+ }).catch(() => {
104460
+ return;
104461
+ });
104462
+ }, MACHINE_COMMAND_LEASE_RENEWAL_INTERVAL_MS);
104463
+ const task = previous.then(async () => {
104464
+ try {
104465
+ await onClaimed(claimed);
104466
+ await deps.wsClient.mutation(api.daemon.machineCommandInbox.acknowledge, {
104467
+ sessionId: deps.sessionId,
104468
+ commandId: claimed.commandId
104469
+ });
104470
+ } finally {
104471
+ clearInterval(renewTimer);
104472
+ }
104473
+ }).catch((error) => {
104474
+ clearInterval(renewTimer);
104475
+ console.warn(`[daemon] machine command ${claimed.commandId} failed: ${String(error)}`);
104476
+ });
104477
+ if (key === MACHINE_COMMAND_KEY)
104478
+ machineTail = task;
104479
+ else
104480
+ workspaceTails.set(key, task);
104481
+ task.finally(() => {
104482
+ if (key !== MACHINE_COMMAND_KEY && workspaceTails.get(key) === task) {
104483
+ workspaceTails.delete(key);
104484
+ }
104485
+ });
104486
+ };
104484
104487
  const args2 = { sessionId: deps.sessionId, machineId: deps.machineId };
104485
104488
  const drain = async () => {
104486
104489
  if (stopped || draining) {
@@ -104493,7 +104496,7 @@ function startMachineCommandInboxSubscriber(deps, onClaimed) {
104493
104496
  queued = false;
104494
104497
  let claimed;
104495
104498
  while (claimed = await deps.wsClient.mutation(api.daemon.machineCommandInbox.claimNext, args2))
104496
- await onClaimed(claimed);
104499
+ enqueueClaimed(claimed);
104497
104500
  } while (queued && !stopped);
104498
104501
  } finally {
104499
104502
  draining = false;
@@ -104511,7 +104514,9 @@ function startMachineCommandInboxSubscriber(deps, onClaimed) {
104511
104514
  }
104512
104515
  };
104513
104516
  }
104517
+ var MACHINE_COMMAND_KEY = "__machine__";
104514
104518
  var init_machine_command_inbox = __esm(() => {
104519
+ init_reliability();
104515
104520
  init_api3();
104516
104521
  });
104517
104522
 
@@ -104527,11 +104532,6 @@ function startAllSubscribers(deps) {
104527
104532
  await deps.onAgentStopCommand?.(claimed);
104528
104533
  return;
104529
104534
  }
104530
- if (claimed.type === "daemon.workspaceListChanged") {
104531
- enhancerJob.refreshChatrooms();
104532
- gitRequest.refreshWorkspaces();
104533
- refreshWorkspaceMembership();
104534
- }
104535
104535
  await dispatchCommandInboundEvent({
104536
104536
  type: "command.received",
104537
104537
  commandId: claimed.commandId,
@@ -135008,4 +135008,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
135008
135008
  });
135009
135009
  program2.parse();
135010
135010
 
135011
- //# debugId=D0F3FF58E9CFA79B64756E2164756E21
135011
+ //# debugId=F7D4048085B1B4E264756E2164756E21