chatroom-cli 1.48.0 → 1.49.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 +49 -14
- package/dist/index.js.map +7 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26937,6 +26937,40 @@ var init_registry2 = __esm(() => {
|
|
|
26937
26937
|
registry = new Map;
|
|
26938
26938
|
});
|
|
26939
26939
|
|
|
26940
|
+
// src/infrastructure/services/remote-agents/claude/claude-models.ts
|
|
26941
|
+
async function fetchClaudeModels() {
|
|
26942
|
+
const apiKey = process.env.ANTHROPIC_API_KEY?.trim();
|
|
26943
|
+
if (!apiKey)
|
|
26944
|
+
return;
|
|
26945
|
+
try {
|
|
26946
|
+
const resp = await fetch("https://api.anthropic.com/v1/models", {
|
|
26947
|
+
headers: {
|
|
26948
|
+
"x-api-key": apiKey,
|
|
26949
|
+
"anthropic-version": "2023-06-01"
|
|
26950
|
+
}
|
|
26951
|
+
});
|
|
26952
|
+
if (!resp.ok)
|
|
26953
|
+
return;
|
|
26954
|
+
const json = await resp.json();
|
|
26955
|
+
const ids3 = json.data.map((m) => m.id).filter((id3) => id3.startsWith("claude-"));
|
|
26956
|
+
return ids3.length > 0 ? ids3 : undefined;
|
|
26957
|
+
} catch {
|
|
26958
|
+
return;
|
|
26959
|
+
}
|
|
26960
|
+
}
|
|
26961
|
+
var CLAUDE_FALLBACK_MODELS;
|
|
26962
|
+
var init_claude_models = __esm(() => {
|
|
26963
|
+
CLAUDE_FALLBACK_MODELS = [
|
|
26964
|
+
"opus",
|
|
26965
|
+
"sonnet",
|
|
26966
|
+
"haiku",
|
|
26967
|
+
"claude-opus-4-8",
|
|
26968
|
+
"claude-opus-4-6",
|
|
26969
|
+
"claude-sonnet-4-6",
|
|
26970
|
+
"claude-haiku-4-5"
|
|
26971
|
+
];
|
|
26972
|
+
});
|
|
26973
|
+
|
|
26940
26974
|
// src/infrastructure/services/remote-agents/claude/claude-stream-reader.ts
|
|
26941
26975
|
import { createInterface as createInterface4 } from "node:readline";
|
|
26942
26976
|
|
|
@@ -27002,6 +27036,7 @@ var init_claude_stream_reader = () => {};
|
|
|
27002
27036
|
var CLAUDE_COMMAND = "claude", DEFAULT_MAX_TURNS = 200, ClaudeCodeAgentService;
|
|
27003
27037
|
var init_claude_code_agent_service = __esm(() => {
|
|
27004
27038
|
init_base_cli_agent_service();
|
|
27039
|
+
init_claude_models();
|
|
27005
27040
|
init_claude_stream_reader();
|
|
27006
27041
|
ClaudeCodeAgentService = class ClaudeCodeAgentService extends BaseCLIAgentService {
|
|
27007
27042
|
id = "claude";
|
|
@@ -27017,7 +27052,10 @@ var init_claude_code_agent_service = __esm(() => {
|
|
|
27017
27052
|
return this.checkVersion(CLAUDE_COMMAND);
|
|
27018
27053
|
}
|
|
27019
27054
|
async listModels() {
|
|
27020
|
-
|
|
27055
|
+
const dynamic = await fetchClaudeModels();
|
|
27056
|
+
if (dynamic)
|
|
27057
|
+
return dynamic;
|
|
27058
|
+
return [...CLAUDE_FALLBACK_MODELS];
|
|
27021
27059
|
}
|
|
27022
27060
|
async spawn(options) {
|
|
27023
27061
|
const { prompt, systemPrompt, model } = options;
|
|
@@ -27456,9 +27494,6 @@ class CursorSdkStreamAdapter {
|
|
|
27456
27494
|
case "status":
|
|
27457
27495
|
process.stdout.write(`${this.logPrefix} status: ${message.status}]
|
|
27458
27496
|
`);
|
|
27459
|
-
if (TERMINAL_STATUS.has(message.status)) {
|
|
27460
|
-
this.emitAgentEnd();
|
|
27461
|
-
}
|
|
27462
27497
|
break;
|
|
27463
27498
|
case "thinking":
|
|
27464
27499
|
process.stdout.write(`${this.logPrefix} thinking] ${message.text}
|
|
@@ -27474,6 +27509,9 @@ class CursorSdkStreamAdapter {
|
|
|
27474
27509
|
break;
|
|
27475
27510
|
}
|
|
27476
27511
|
}
|
|
27512
|
+
flushPendingOutput() {
|
|
27513
|
+
this.flushText();
|
|
27514
|
+
}
|
|
27477
27515
|
finish() {
|
|
27478
27516
|
this.flushText();
|
|
27479
27517
|
this.emitAgentEnd();
|
|
@@ -27515,10 +27553,6 @@ class CursorSdkStreamAdapter {
|
|
|
27515
27553
|
cb();
|
|
27516
27554
|
}
|
|
27517
27555
|
}
|
|
27518
|
-
var TERMINAL_STATUS;
|
|
27519
|
-
var init_cursor_sdk_stream_adapter = __esm(() => {
|
|
27520
|
-
TERMINAL_STATUS = new Set(["FINISHED", "ERROR", "CANCELLED"]);
|
|
27521
|
-
});
|
|
27522
27556
|
|
|
27523
27557
|
// src/infrastructure/services/remote-agents/cursor-sdk/cursor-sdk-agent-service.ts
|
|
27524
27558
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
@@ -27596,7 +27630,6 @@ var init_cursor_sdk_agent_service = __esm(() => {
|
|
|
27596
27630
|
init_base_cli_agent_service();
|
|
27597
27631
|
init_detection_result();
|
|
27598
27632
|
init_cursor_models();
|
|
27599
|
-
init_cursor_sdk_stream_adapter();
|
|
27600
27633
|
CursorSdkAgentService = class CursorSdkAgentService extends BaseCLIAgentService {
|
|
27601
27634
|
id = "cursor-sdk";
|
|
27602
27635
|
displayName = "Cursor (SDK)";
|
|
@@ -27752,6 +27785,10 @@ ${options.prompt}` : options.prompt;
|
|
|
27752
27785
|
for (const cb of outputCallbacks)
|
|
27753
27786
|
cb();
|
|
27754
27787
|
});
|
|
27788
|
+
adapter.onAgentEnd(() => {
|
|
27789
|
+
for (const cb of agentEndCallbacks)
|
|
27790
|
+
cb();
|
|
27791
|
+
});
|
|
27755
27792
|
for await (const message of run3.stream()) {
|
|
27756
27793
|
if (session.aborted)
|
|
27757
27794
|
break;
|
|
@@ -27763,15 +27800,14 @@ ${options.prompt}` : options.prompt;
|
|
|
27763
27800
|
break;
|
|
27764
27801
|
}
|
|
27765
27802
|
const result = await withTimeout(run3.wait(), RUN_WAIT_TIMEOUT_MS, "run.wait");
|
|
27766
|
-
adapter.
|
|
27803
|
+
adapter.flushPendingOutput();
|
|
27767
27804
|
if (result.status === "error") {
|
|
27768
27805
|
exitCode = 2;
|
|
27769
27806
|
process.stderr.write(`${logPrefix} run-error] run ${result.id} failed
|
|
27770
27807
|
`);
|
|
27771
27808
|
break;
|
|
27772
27809
|
}
|
|
27773
|
-
|
|
27774
|
-
cb();
|
|
27810
|
+
adapter.finish();
|
|
27775
27811
|
const resumePrompt = await waitForResumeOrAbort(session);
|
|
27776
27812
|
if (resumePrompt === null || session.aborted) {
|
|
27777
27813
|
if (session.aborted) {
|
|
@@ -27819,7 +27855,6 @@ ${options.prompt}` : options.prompt;
|
|
|
27819
27855
|
// src/infrastructure/services/remote-agents/cursor-sdk/index.ts
|
|
27820
27856
|
var init_cursor_sdk = __esm(() => {
|
|
27821
27857
|
init_cursor_sdk_agent_service();
|
|
27822
|
-
init_cursor_sdk_stream_adapter();
|
|
27823
27858
|
});
|
|
27824
27859
|
|
|
27825
27860
|
// ../../node_modules/.pnpm/@opencode-ai+sdk@1.15.11/node_modules/@opencode-ai/sdk/dist/gen/types.gen.js
|
|
@@ -86469,4 +86504,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
|
86469
86504
|
});
|
|
86470
86505
|
program2.parse();
|
|
86471
86506
|
|
|
86472
|
-
//# debugId=
|
|
86507
|
+
//# debugId=1017D812F7A83DCE64756E2164756E21
|