chatroom-cli 1.69.0 → 1.69.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 +81 -50
- package/dist/index.js.map +6 -5
- package/package.json +1 -1
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
|
|
30512
|
-
|
|
30513
|
-
|
|
30514
|
-
|
|
30515
|
-
|
|
30516
|
-
|
|
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
|
-
|
|
30527
|
-
|
|
30528
|
-
|
|
30529
|
-
|
|
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
|
-
|
|
30532
|
-
|
|
30533
|
-
|
|
30534
|
-
|
|
30535
|
-
|
|
30536
|
-
|
|
30537
|
-
|
|
30538
|
-
|
|
30539
|
-
|
|
30540
|
-
|
|
30541
|
-
|
|
30542
|
-
|
|
30543
|
-
|
|
30544
|
-
|
|
30545
|
-
|
|
30546
|
-
|
|
30547
|
-
|
|
30548
|
-
|
|
30549
|
-
|
|
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
|
-
|
|
30557
|
-
|
|
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);
|
|
@@ -76076,12 +76102,17 @@ function createDefaultDeps6() {
|
|
|
76076
76102
|
}
|
|
76077
76103
|
const chunks = [];
|
|
76078
76104
|
let totalBytes = 0;
|
|
76079
|
-
|
|
76080
|
-
|
|
76105
|
+
const reader = response.body.getReader();
|
|
76106
|
+
for (;; ) {
|
|
76107
|
+
const { done: done9, value } = await reader.read();
|
|
76108
|
+
if (done9)
|
|
76109
|
+
break;
|
|
76110
|
+
totalBytes += value.byteLength;
|
|
76081
76111
|
if (totalBytes > MAX_DOWNLOAD_BYTES) {
|
|
76112
|
+
await reader.cancel();
|
|
76082
76113
|
throw new Error("PDF exceeds maximum size of 50MB");
|
|
76083
76114
|
}
|
|
76084
|
-
chunks.push(
|
|
76115
|
+
chunks.push(value);
|
|
76085
76116
|
}
|
|
76086
76117
|
return Buffer.concat(chunks);
|
|
76087
76118
|
}
|
|
@@ -113399,4 +113430,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
|
113399
113430
|
});
|
|
113400
113431
|
program2.parse();
|
|
113401
113432
|
|
|
113402
|
-
//# debugId=
|
|
113433
|
+
//# debugId=EEDF99734E15FED664756E2164756E21
|