chatroom-cli 1.69.0 → 1.69.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.
package/dist/index.js CHANGED
@@ -29919,6 +29919,22 @@ var init_commandcode = __esm(() => {
29919
29919
  init_command_code_agent_service();
29920
29920
  });
29921
29921
 
29922
+ // src/infrastructure/services/remote-agents/tap-process-stream-writes.ts
29923
+ function tapProcessStreamWrites(onWrite) {
29924
+ const stdoutOriginal = process.stdout.write.bind(process.stdout);
29925
+ const stderrOriginal = process.stderr.write.bind(process.stderr);
29926
+ const wrap = (original) => (...args2) => {
29927
+ onWrite();
29928
+ return original(...args2);
29929
+ };
29930
+ process.stdout.write = wrap(stdoutOriginal);
29931
+ process.stderr.write = wrap(stderrOriginal);
29932
+ return () => {
29933
+ process.stdout.write = stdoutOriginal;
29934
+ process.stderr.write = stderrOriginal;
29935
+ };
29936
+ }
29937
+
29922
29938
  // src/infrastructure/services/remote-agents/cursor-sdk/cursor-models.ts
29923
29939
  function resolveCursorSdkModel(model) {
29924
29940
  const prefix = `${CURSOR_PROVIDER2}/`;
@@ -30508,56 +30524,66 @@ ${deferredResume}` : deferredResume;
30508
30524
  isFirstTurn = true;
30509
30525
  }
30510
30526
  }
30511
- const run3 = await withTimeout(agent.send(nextPrompt, {
30512
- local: { force: isFirstTurn },
30513
- idempotencyKey: randomUUID2()
30514
- }), SEND_TIMEOUT_MS, "agent.send");
30515
- session2.run = run3;
30516
- isFirstTurn = false;
30517
- const adapter = new CursorSdkStreamAdapter(logPrefix, emitLogLine);
30518
- wireNativeStreamAdapter({
30519
- adapter,
30520
- assistantTextCallbacks,
30521
- outputCallbacks,
30522
- agentEndCallbacks,
30523
- entry
30524
- });
30527
+ const notifyHarnessOutput = () => {
30528
+ entry.lastOutputAt = Date.now();
30529
+ for (const cb of outputCallbacks)
30530
+ cb();
30531
+ };
30532
+ const restoreStreamTap = tapProcessStreamWrites(notifyHarnessOutput);
30525
30533
  try {
30526
- for await (const message of run3.stream()) {
30527
- if (session2.aborted)
30528
- break;
30529
- adapter.handleMessage(message);
30534
+ const run3 = await withTimeout(agent.send(nextPrompt, {
30535
+ local: { force: isFirstTurn },
30536
+ idempotencyKey: randomUUID2()
30537
+ }), SEND_TIMEOUT_MS, "agent.send");
30538
+ session2.run = run3;
30539
+ isFirstTurn = false;
30540
+ const adapter = new CursorSdkStreamAdapter(logPrefix, emitLogLine);
30541
+ wireNativeStreamAdapter({
30542
+ adapter,
30543
+ assistantTextCallbacks,
30544
+ outputCallbacks,
30545
+ agentEndCallbacks,
30546
+ entry
30547
+ });
30548
+ try {
30549
+ for await (const message of run3.stream()) {
30550
+ if (session2.aborted)
30551
+ break;
30552
+ adapter.handleMessage(message);
30553
+ }
30554
+ } catch (streamErr) {
30555
+ exitCode = 1;
30556
+ writeSpawnError2(logPrefix, streamErr, emitLogLine);
30557
+ break;
30530
30558
  }
30531
- } catch (streamErr) {
30532
- exitCode = 1;
30533
- writeSpawnError2(logPrefix, streamErr, emitLogLine);
30534
- break;
30535
- }
30536
- if (session2.aborted) {
30537
- exitCode = 1;
30538
- exitSignal = "SIGTERM";
30539
- break;
30540
- }
30541
- let result;
30542
- try {
30543
- result = await withTimeout(run3.wait(), RUN_WAIT_TIMEOUT_MS, "run.wait");
30544
- } catch (waitErr) {
30545
- exitCode = 1;
30546
- writeSpawnError2(logPrefix, waitErr, emitLogLine);
30547
- break;
30548
- }
30549
- adapter.flushPendingOutput();
30550
- if (result.status === "error") {
30551
- exitCode = 2;
30552
- const detail = typeof result.result === "string" && result.result.trim().length > 0 ? result.result.trim() : `no error detail from SDK (run ${result.id})`;
30553
- const runErrorLine = formatAgentLogLine(logPrefix, "run-error", `run ${result.id} failed: ${detail}`);
30554
- process.stderr.write(`${runErrorLine}
30559
+ if (session2.aborted) {
30560
+ exitCode = 1;
30561
+ exitSignal = "SIGTERM";
30562
+ break;
30563
+ }
30564
+ let result;
30565
+ try {
30566
+ result = await withTimeout(run3.wait(), RUN_WAIT_TIMEOUT_MS, "run.wait");
30567
+ } catch (waitErr) {
30568
+ exitCode = 1;
30569
+ writeSpawnError2(logPrefix, waitErr, emitLogLine);
30570
+ break;
30571
+ }
30572
+ adapter.flushPendingOutput();
30573
+ if (result.status === "error") {
30574
+ exitCode = 2;
30575
+ const detail = typeof result.result === "string" && result.result.trim().length > 0 ? result.result.trim() : `no error detail from SDK (run ${result.id})`;
30576
+ const runErrorLine = formatAgentLogLine(logPrefix, "run-error", `run ${result.id} failed: ${detail}`);
30577
+ process.stderr.write(`${runErrorLine}
30555
30578
  `);
30556
- emitLogLine(runErrorLine);
30557
- break;
30579
+ emitLogLine(runErrorLine);
30580
+ break;
30581
+ }
30582
+ adapter.finish();
30583
+ nextPrompt = null;
30584
+ } finally {
30585
+ restoreStreamTap();
30558
30586
  }
30559
- adapter.finish();
30560
- nextPrompt = null;
30561
30587
  } catch (turnErr) {
30562
30588
  exitCode = 1;
30563
30589
  writeSpawnError2(logPrefix, turnErr, emitLogLine);
@@ -113399,4 +113425,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
113399
113425
  });
113400
113426
  program2.parse();
113401
113427
 
113402
- //# debugId=766A192ADD34FFEC64756E2164756E21
113428
+ //# debugId=FD69F45D45D4302D64756E2164756E21