chatroom-cli 1.103.1 → 1.104.1

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-DOiewvQz.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-uWf8XoMg.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-iM2TK7kh.css">
9
9
  </head>
10
10
  <body>
package/dist/index.js CHANGED
@@ -29328,8 +29328,13 @@ var init_claude_model_variants = __esm(() => {
29328
29328
  {},
29329
29329
  ...CLAUDE_EFFORT_VALUES.map((effort) => ({ effort }))
29330
29330
  ];
29331
- CLAUDE_SPAWN_ALIASES = ["opus", "sonnet", "haiku"];
29331
+ CLAUDE_SPAWN_ALIASES = [];
29332
29332
  CLAUDE_CATALOG_BASE_MODEL_IDS = [
29333
+ "opus",
29334
+ "sonnet",
29335
+ "haiku",
29336
+ "claude-opus-5",
29337
+ "claude-sonnet-5",
29333
29338
  "claude-opus-4-8",
29334
29339
  "claude-opus-4-6",
29335
29340
  "claude-sonnet-4-6",
@@ -30445,8 +30450,8 @@ var init_claude_sdk_agent_service = __esm(() => {
30445
30450
  maxTurns: DEFAULT_MAX_TURNS2,
30446
30451
  pathToClaudeCodeExecutable: executablePath,
30447
30452
  includePartialMessages: true,
30448
- systemPrompt: isFirstQuery && !sdkSession.resumeOnFirstQuery ? sdkSession.storedSystemPrompt : undefined,
30449
- resume: useResume ? sdkSession.sessionId : undefined,
30453
+ ...isFirstQuery && !sdkSession.resumeOnFirstQuery && sdkSession.storedSystemPrompt !== undefined ? { systemPrompt: sdkSession.storedSystemPrompt } : {},
30454
+ ...useResume && sdkSession.sessionId !== undefined ? { resume: sdkSession.sessionId } : {},
30450
30455
  settingSources: [],
30451
30456
  permissionMode: "bypassPermissions",
30452
30457
  allowDangerouslySkipPermissions: true,
@@ -79539,7 +79544,7 @@ To reconnect, run:`);
79539
79544
  chatroomId: this.chatroomId,
79540
79545
  role: this.role,
79541
79546
  taskId: task._id,
79542
- messageId: message?._id,
79547
+ ...message?._id !== undefined ? { messageId: message._id } : {},
79543
79548
  convexUrl: getConvexUrl()
79544
79549
  });
79545
79550
  const taskReceivedTime = new Date().toISOString().replace("T", " ").substring(0, 19);
@@ -100836,9 +100841,11 @@ function snapshotKey(taskId, role) {
100836
100841
 
100837
100842
  class MachineTaskSnapshotState {
100838
100843
  snapshots = new Map;
100844
+ initialized = false;
100839
100845
  replace(snapshots) {
100840
100846
  this.snapshots.clear();
100841
100847
  this.upsert(snapshots);
100848
+ this.initialized = true;
100842
100849
  }
100843
100850
  applySignalPage(signals, snapshots) {
100844
100851
  const snapshotsByKey = new Map(snapshots.map((snapshot) => [
@@ -100859,6 +100866,13 @@ class MachineTaskSnapshotState {
100859
100866
  const roleLower = role.toLowerCase();
100860
100867
  return [...this.snapshots.values()].filter((snapshot) => snapshot.chatroomId === chatroomId && snapshot.agentConfig.role.toLowerCase() === roleLower);
100861
100868
  }
100869
+ isInitialized() {
100870
+ return this.initialized;
100871
+ }
100872
+ getForRole(chatroomId, role, taskId) {
100873
+ const snapshot = this.snapshots.get(snapshotKey(taskId, role));
100874
+ return snapshot?.chatroomId === chatroomId ? snapshot : null;
100875
+ }
100862
100876
  listAll() {
100863
100877
  return [...this.snapshots.values()];
100864
100878
  }
@@ -103195,6 +103209,27 @@ var init_native_harness_session_exit = __esm(() => {
103195
103209
  init_native_task_delivery_coordinator();
103196
103210
  });
103197
103211
 
103212
+ // src/daemon/entry/native-delivery/native-turn-end-inbox.ts
103213
+ function decideNativeTurnEndFromInbox(params) {
103214
+ const session2 = getNativeDeliverySession();
103215
+ if (!params.taskId || !session2)
103216
+ return "unknown";
103217
+ const { taskSnapshotState } = session2;
103218
+ if (!taskSnapshotState.isInitialized())
103219
+ return "unknown";
103220
+ const task = taskSnapshotState.getForRole(params.chatroomId, params.role, params.taskId);
103221
+ return task ? ACTIVE_TASK_DECISIONS[task.status] : "handoff-completed";
103222
+ }
103223
+ var ACTIVE_TASK_DECISIONS;
103224
+ var init_native_turn_end_inbox = __esm(() => {
103225
+ init_native_delivery_session_registry();
103226
+ ACTIVE_TASK_DECISIONS = {
103227
+ pending: "unknown",
103228
+ acknowledged: "unknown",
103229
+ in_progress: "needs-handoff-reminder"
103230
+ };
103231
+ });
103232
+
103198
103233
  // src/daemon/domain/entities/native-turn-phase.ts
103199
103234
  var init_native_turn_phase = () => {};
103200
103235
 
@@ -103659,6 +103694,25 @@ class AgentProcessManager {
103659
103694
  console.log(`[AgentProcessManager] ✅ Handled rapid resume storm for ${opts.role}`);
103660
103695
  return;
103661
103696
  }
103697
+ const inboxDecision = decideNativeTurnEndFromInbox({
103698
+ chatroomId: opts.chatroomId,
103699
+ role: opts.role,
103700
+ taskId: slot?.lastInFlightTaskId
103701
+ });
103702
+ if (inboxDecision === "needs-handoff-reminder") {
103703
+ await this.injectHarnessReminder(opts.chatroomId, opts.role, NATIVE_HANDOFF_REMINDER);
103704
+ console.log(`[AgentProcessManager] ⏩ Handoff reminder injected for ${opts.role} (inbox)`);
103705
+ return;
103706
+ }
103707
+ if (inboxDecision === "handoff-completed") {
103708
+ if (slot) {
103709
+ setNativeTurnPhase(slot, defaultNativeTurnPhase());
103710
+ this.clearLastInFlightTask(opts.chatroomId, opts.role);
103711
+ }
103712
+ notifyNativeTurnIdle({ chatroomId: opts.chatroomId, role: opts.role });
103713
+ console.log(`[AgentProcessManager] ✅ Native agent_end handled for ${opts.role} (inbox)`);
103714
+ return;
103715
+ }
103662
103716
  try {
103663
103717
  const result = await this.deps.backend.mutation(api.participants.handleNativeAgentEnd, {
103664
103718
  sessionId: this.deps.sessionId,
@@ -104989,6 +105043,7 @@ var init_agent_process_manager = __esm(() => {
104989
105043
  init_orphan_tracker();
104990
105044
  init_native_harness_session_exit();
104991
105045
  init_native_task_delivery_coordinator();
105046
+ init_native_turn_end_inbox();
104992
105047
  init_native_turn_phase2();
104993
105048
  init_native_spawn_presence();
104994
105049
  init_no_op_session_monitor();
@@ -110359,8 +110414,9 @@ var init_on_request_stop_agent = __esm(() => {
110359
110414
  // src/daemon/entry/events/agent/on-stop-scope-agent.ts
110360
110415
  var onStopScopeAgentEffect = (event) => exports_Effect.gen(function* () {
110361
110416
  const agentMgr = yield* DaemonAgentProcessManagerService;
110362
- if (agentMgr.runInboxScopedStop)
110363
- yield* agentMgr.runInboxScopedStop(event);
110417
+ const stop4 = agentMgr.runInboxScopedStop;
110418
+ if (stop4)
110419
+ yield* stop4(event);
110364
110420
  });
110365
110421
  var init_on_stop_scope_agent = __esm(() => {
110366
110422
  init_esm();
@@ -111914,13 +111970,6 @@ var init_file_content_subscription = __esm(() => {
111914
111970
  init_daemon_services();
111915
111971
  });
111916
111972
 
111917
- // src/infrastructure/services/workspace/file-tree-data-hash.ts
111918
- import { createHash as createHash6 } from "node:crypto";
111919
- function computeFileTreeDataHash(tree) {
111920
- return createHash6("md5").update(JSON.stringify(tree)).digest("hex");
111921
- }
111922
- var init_file_tree_data_hash = () => {};
111923
-
111924
111973
  // src/infrastructure/services/workspace/file-tree-sync-ranker.ts
111925
111974
  function fileExtension(p) {
111926
111975
  const b = (p.split("/").pop() ?? p).toLowerCase();
@@ -112741,6 +112790,13 @@ var init_file_tree_scanner = __esm(() => {
112741
112790
  init_workspace_visibility_policy();
112742
112791
  });
112743
112792
 
112793
+ // src/infrastructure/services/workspace/file-tree-data-hash.ts
112794
+ import { createHash as createHash6 } from "node:crypto";
112795
+ function computeFileTreeDataHash(tree) {
112796
+ return createHash6("md5").update(JSON.stringify(tree)).digest("hex");
112797
+ }
112798
+ var init_file_tree_data_hash = () => {};
112799
+
112744
112800
  // src/infrastructure/services/workspace/git-workspace-porcelain.ts
112745
112801
  import { existsSync as existsSync9 } from "node:fs";
112746
112802
  import path4 from "node:path";
@@ -116074,6 +116130,17 @@ var init_workspace_file_tree_delta_send = __esm(() => {
116074
116130
  function logSubscriptionWarn(label, err) {
116075
116131
  console.warn(`[${formatTimestamp()}] ⚠️ ${label}: ${getErrorMessage(err)}`);
116076
116132
  }
116133
+ async function runOneShotFileTreeSync(session2, workingDir) {
116134
+ const normalized = normalizeWorkingDirForLookup(workingDir);
116135
+ const tree = await scanFileTree(normalized);
116136
+ const send = createWorkspaceFileTreeCheckpointSend(session2, normalized);
116137
+ await send({ tree, revision: 0 });
116138
+ await session2.backend.mutation(api.workspaceFiles.fulfillFileTreeRequest, {
116139
+ sessionId: session2.sessionId,
116140
+ machineId: session2.machineId,
116141
+ workingDir: normalized
116142
+ });
116143
+ }
116077
116144
  async function stopCoordinatorForWorkingDir(coordinators, checkpointOutboxRegistry, deltaOutboxRegistry, normalized) {
116078
116145
  const coordinatorPromise = coordinators.get(normalized);
116079
116146
  if (!coordinatorPromise)
@@ -116082,8 +116149,8 @@ async function stopCoordinatorForWorkingDir(coordinators, checkpointOutboxRegist
116082
116149
  await coordinatorPromise.then((coordinator2) => coordinator2.stop()).catch(() => {
116083
116150
  return;
116084
116151
  });
116085
- await checkpointOutboxRegistry.stop(normalized);
116086
- await deltaOutboxRegistry.stop(normalized);
116152
+ await checkpointOutboxRegistry?.stop(normalized);
116153
+ await deltaOutboxRegistry?.stop(normalized);
116087
116154
  }
116088
116155
  async function drainPendingFileTreeReleaseRequests(session2, coordinators, checkpointOutboxRegistry, deltaOutboxRegistry) {
116089
116156
  const releases = await session2.backend.query(api.workspaceFiles.getPendingFileTreeReleaseRequests, {
@@ -116108,7 +116175,36 @@ async function drainPendingFileTreeReleaseRequests(session2, coordinators, check
116108
116175
  });
116109
116176
  }
116110
116177
  }
116111
- async function processPendingFileTreeRequests(session2, coordinators, ensureCoordinator, requests) {
116178
+ async function processOnePendingFileTreeRequest(session2, coordinators, ensureCoordinator, normalized, force, checkpointOutboxRegistry, deltaOutboxRegistry) {
116179
+ const start3 = Date.now();
116180
+ const lease = await session2.backend.query(api.workspaceFiles.getFileTreeWatchLease, {
116181
+ sessionId: session2.sessionId,
116182
+ machineId: session2.machineId,
116183
+ workingDir: normalized
116184
+ });
116185
+ if (!lease?.leaseActive) {
116186
+ await stopCoordinatorForWorkingDir(coordinators, checkpointOutboxRegistry, deltaOutboxRegistry, normalized);
116187
+ await runOneShotFileTreeSync(session2, normalized);
116188
+ console.log(`[${formatTimestamp()}] \uD83C\uDF33 File tree ready: ${normalized} (${Date.now() - start3}ms, one-shot)`);
116189
+ return;
116190
+ }
116191
+ await ensureCoordinator(normalized, force);
116192
+ await session2.backend.mutation(api.workspaceFiles.fulfillFileTreeRequest, {
116193
+ sessionId: session2.sessionId,
116194
+ machineId: session2.machineId,
116195
+ workingDir: normalized
116196
+ });
116197
+ const leaseAfterFulfill = await session2.backend.query(api.workspaceFiles.getFileTreeWatchLease, {
116198
+ sessionId: session2.sessionId,
116199
+ machineId: session2.machineId,
116200
+ workingDir: normalized
116201
+ });
116202
+ if (!leaseAfterFulfill?.leaseActive) {
116203
+ await stopCoordinatorForWorkingDir(coordinators, checkpointOutboxRegistry, deltaOutboxRegistry, normalized);
116204
+ }
116205
+ console.log(`[${formatTimestamp()}] \uD83C\uDF33 File tree ready: ${normalized} (${Date.now() - start3}ms${force ? ", reconciled" : ", cached"})`);
116206
+ }
116207
+ async function processPendingFileTreeRequests(session2, coordinators, ensureCoordinator, requests, checkpointOutboxRegistry, deltaOutboxRegistry) {
116112
116208
  if (!requests?.length)
116113
116209
  return;
116114
116210
  const requestsByDir = new Map;
@@ -116118,25 +116214,20 @@ async function processPendingFileTreeRequests(session2, coordinators, ensureCoor
116118
116214
  }
116119
116215
  for (const [normalized, force] of requestsByDir) {
116120
116216
  await enqueueFileTreeSync(session2.machineId, normalized, async () => {
116121
- const start3 = Date.now();
116122
- await ensureCoordinator(normalized, force).then(() => session2.backend.mutation(api.workspaceFiles.fulfillFileTreeRequest, {
116123
- sessionId: session2.sessionId,
116124
- machineId: session2.machineId,
116125
- workingDir: normalized
116126
- })).then(() => {
116127
- console.log(`[${formatTimestamp()}] \uD83C\uDF33 File tree ready: ${normalized} (${Date.now() - start3}ms${force ? ", reconciled" : ", cached"})`);
116128
- }).catch((err) => {
116217
+ try {
116218
+ await processOnePendingFileTreeRequest(session2, coordinators, ensureCoordinator, normalized, force, checkpointOutboxRegistry, deltaOutboxRegistry);
116219
+ } catch (err) {
116129
116220
  logSubscriptionWarn(`File tree failed for ${normalized}`, err);
116130
- });
116221
+ }
116131
116222
  });
116132
116223
  }
116133
116224
  }
116134
- async function drainPendingFileTreeRequests(session2, coordinators, ensureCoordinator) {
116225
+ async function drainPendingFileTreeRequests(session2, coordinators, ensureCoordinator, checkpointOutboxRegistry, deltaOutboxRegistry) {
116135
116226
  const requests = await session2.backend.query(api.workspaceFiles.getPendingFileTreeRequests, {
116136
116227
  sessionId: session2.sessionId,
116137
116228
  machineId: session2.machineId
116138
116229
  });
116139
- await processPendingFileTreeRequests(session2, coordinators, ensureCoordinator, requests);
116230
+ await processPendingFileTreeRequests(session2, coordinators, ensureCoordinator, requests, checkpointOutboxRegistry, deltaOutboxRegistry);
116140
116231
  }
116141
116232
  var startFileTreeSubscriptionEffect = () => exports_Effect.gen(function* () {
116142
116233
  const session2 = yield* DaemonSessionService;
@@ -116185,7 +116276,7 @@ var startFileTreeSubscriptionEffect = () => exports_Effect.gen(function* () {
116185
116276
  });
116186
116277
  };
116187
116278
  return {
116188
- drainPendingFileTreeRequests: () => drainPendingFileTreeRequests(session2, coordinators, ensureCoordinator),
116279
+ drainPendingFileTreeRequests: () => drainPendingFileTreeRequests(session2, coordinators, ensureCoordinator, checkpointOutboxRegistry, deltaOutboxRegistry),
116189
116280
  drainPendingFileTreeReleaseRequests: () => drainPendingFileTreeReleaseRequests(session2, coordinators, checkpointOutboxRegistry, deltaOutboxRegistry),
116190
116281
  stop: () => {
116191
116282
  (async () => {
@@ -116201,6 +116292,7 @@ var startFileTreeSubscriptionEffect = () => exports_Effect.gen(function* () {
116201
116292
  var init_file_tree_subscription = __esm(() => {
116202
116293
  init_esm();
116203
116294
  init_api3();
116295
+ init_file_tree_scanner();
116204
116296
  init_workspace_file_tree_coordinator();
116205
116297
  init_workspace_sync_queue();
116206
116298
  init_convex_error();
@@ -134469,7 +134561,9 @@ var init_opencode_install = __esm(() => {
134469
134561
 
134470
134562
  // src/infrastructure/retry-queue.ts
134471
134563
  async function withRetry(fn2, opts) {
134472
- const { maxRetries, baseDelayMs, maxDelayMs } = { ...DEFAULTS, ...opts };
134564
+ const maxRetries = opts?.maxRetries ?? DEFAULTS.maxRetries;
134565
+ const baseDelayMs = opts?.baseDelayMs ?? DEFAULTS.baseDelayMs;
134566
+ const maxDelayMs = opts?.maxDelayMs ?? DEFAULTS.maxDelayMs;
134473
134567
  for (let attempt = 0;attempt <= maxRetries; attempt++) {
134474
134568
  try {
134475
134569
  return await fn2();
@@ -135092,4 +135186,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
135092
135186
  });
135093
135187
  program2.parse();
135094
135188
 
135095
- //# debugId=48E3BD8E7ACDCBFA64756E2164756E21
135189
+ //# debugId=398908BA09BE4DBA64756E2164756E21