chatroom-cli 1.43.3 → 1.44.0

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
@@ -27123,6 +27123,207 @@ var init_claude = __esm(() => {
27123
27123
  init_claude_code_agent_service();
27124
27124
  });
27125
27125
 
27126
+ // src/infrastructure/services/remote-agents/commandcode/command-code-stream-reader.ts
27127
+ import { createInterface as createInterface5 } from "node:readline";
27128
+
27129
+ class CommandCodeStreamReader {
27130
+ textCallbacks = [];
27131
+ agentEndCallbacks = [];
27132
+ anyEventCallbacks = [];
27133
+ constructor(stream) {
27134
+ const rl = createInterface5({ input: stream, crlfDelay: Infinity });
27135
+ rl.on("line", (line) => {
27136
+ const trimmed = line.trim();
27137
+ if (!trimmed)
27138
+ return;
27139
+ for (const cb of this.anyEventCallbacks)
27140
+ cb();
27141
+ for (const cb of this.textCallbacks)
27142
+ cb(trimmed);
27143
+ });
27144
+ stream.on("close", () => {
27145
+ for (const cb of this.agentEndCallbacks)
27146
+ cb();
27147
+ });
27148
+ }
27149
+ onText(cb) {
27150
+ this.textCallbacks.push(cb);
27151
+ }
27152
+ onAnyEvent(cb) {
27153
+ this.anyEventCallbacks.push(cb);
27154
+ }
27155
+ onAgentEnd(cb) {
27156
+ this.agentEndCallbacks.push(cb);
27157
+ }
27158
+ }
27159
+ var init_command_code_stream_reader = () => {};
27160
+
27161
+ // src/infrastructure/services/remote-agents/commandcode/command-code-agent-service.ts
27162
+ var COMMANDCODE_COMMAND = "cmd", COMMANDCODE_MODELS, CommandCodeAgentService;
27163
+ var init_command_code_agent_service = __esm(() => {
27164
+ init_base_cli_agent_service();
27165
+ init_command_code_stream_reader();
27166
+ COMMANDCODE_MODELS = [
27167
+ "claude-sonnet-4-6",
27168
+ "claude-opus-4-7",
27169
+ "claude-opus-4-6",
27170
+ "claude-haiku-4-5",
27171
+ "gpt-5.5",
27172
+ "gpt-5.4",
27173
+ "gpt-5.3-codex",
27174
+ "gpt-5.4-mini",
27175
+ "google/gemini-3.5-flash",
27176
+ "google/gemini-3.1-flash-lite",
27177
+ "moonshotai/Kimi-K2.6",
27178
+ "moonshotai/Kimi-K2.5",
27179
+ "zai-org/GLM-5.1",
27180
+ "zai-org/GLM-5",
27181
+ "MiniMaxAI/MiniMax-M2.7",
27182
+ "MiniMaxAI/MiniMax-M2.5",
27183
+ "deepseek/deepseek-v4-pro",
27184
+ "deepseek/deepseek-v4-flash",
27185
+ "Qwen/Qwen3.6-Max-Preview",
27186
+ "Qwen/Qwen3.6-Plus",
27187
+ "Qwen/Qwen3.7-Max",
27188
+ "stepfun/Step-3.5-Flash"
27189
+ ];
27190
+ CommandCodeAgentService = class CommandCodeAgentService extends BaseCLIAgentService {
27191
+ id = "commandcode";
27192
+ displayName = "CommandCode";
27193
+ command = COMMANDCODE_COMMAND;
27194
+ constructor(deps) {
27195
+ super(deps);
27196
+ }
27197
+ async isInstalled() {
27198
+ return this.checkInstalled(COMMANDCODE_COMMAND);
27199
+ }
27200
+ async getVersion() {
27201
+ return this.checkVersion(COMMANDCODE_COMMAND);
27202
+ }
27203
+ async listModels() {
27204
+ return COMMANDCODE_MODELS;
27205
+ }
27206
+ async spawn(options) {
27207
+ const args2 = ["-p", "--skip-onboarding", "--yolo", "--max-turns", "999999"];
27208
+ if (options.model) {
27209
+ args2.push("--model", options.model);
27210
+ }
27211
+ const fullPrompt = options.systemPrompt ? `${options.systemPrompt}
27212
+
27213
+ ${options.prompt}` : options.prompt;
27214
+ const childProcess = this.deps.spawn(COMMANDCODE_COMMAND, args2, {
27215
+ cwd: options.workingDir,
27216
+ stdio: ["pipe", "pipe", "pipe"],
27217
+ shell: false,
27218
+ detached: true,
27219
+ env: {
27220
+ ...process.env,
27221
+ GIT_EDITOR: "true",
27222
+ GIT_SEQUENCE_EDITOR: "true"
27223
+ }
27224
+ });
27225
+ childProcess.stdin?.write(fullPrompt);
27226
+ childProcess.stdin?.end();
27227
+ await new Promise((resolve) => setTimeout(resolve, 500));
27228
+ if (childProcess.killed || childProcess.exitCode !== null) {
27229
+ throw new Error(`Agent process exited immediately (exit code: ${childProcess.exitCode})`);
27230
+ }
27231
+ if (!childProcess.pid) {
27232
+ throw new Error("Agent process started but has no PID");
27233
+ }
27234
+ const pid = childProcess.pid;
27235
+ const context4 = options.context;
27236
+ const entry = this.registerProcess(pid, context4);
27237
+ const roleTag = context4.role ?? "unknown";
27238
+ const chatroomSuffix = context4.chatroomId ? `@${context4.chatroomId.slice(-6)}` : "";
27239
+ const logPrefix = `[commandcode:${roleTag}${chatroomSuffix}`;
27240
+ const outputCallbacks = [];
27241
+ if (childProcess.stdout) {
27242
+ const reader = new CommandCodeStreamReader(childProcess.stdout);
27243
+ let textBuffer = "";
27244
+ const flushText = () => {
27245
+ if (!textBuffer)
27246
+ return;
27247
+ for (const line of textBuffer.split(`
27248
+ `)) {
27249
+ if (line)
27250
+ process.stdout.write(`${logPrefix} text] ${line}
27251
+ `);
27252
+ }
27253
+ textBuffer = "";
27254
+ };
27255
+ reader.onText((text) => {
27256
+ textBuffer += text;
27257
+ if (textBuffer.includes(`
27258
+ `))
27259
+ flushText();
27260
+ entry.lastOutputAt = Date.now();
27261
+ for (const cb of outputCallbacks)
27262
+ cb();
27263
+ });
27264
+ reader.onAnyEvent(() => {
27265
+ entry.lastOutputAt = Date.now();
27266
+ for (const cb of outputCallbacks)
27267
+ cb();
27268
+ });
27269
+ reader.onAgentEnd(() => {
27270
+ flushText();
27271
+ process.stdout.write(`${logPrefix} agent_end]
27272
+ `);
27273
+ });
27274
+ if (childProcess.stderr) {
27275
+ childProcess.stderr.pipe(process.stderr, { end: false });
27276
+ childProcess.stderr.on("data", () => {
27277
+ entry.lastOutputAt = Date.now();
27278
+ for (const cb of outputCallbacks)
27279
+ cb();
27280
+ });
27281
+ }
27282
+ return {
27283
+ pid,
27284
+ onExit: (cb) => {
27285
+ childProcess.on("exit", (code2, signal) => {
27286
+ this.deleteProcess(pid);
27287
+ cb({ code: code2, signal, context: context4 });
27288
+ });
27289
+ },
27290
+ onOutput: (cb) => {
27291
+ outputCallbacks.push(cb);
27292
+ },
27293
+ onAgentEnd: (cb) => {
27294
+ reader.onAgentEnd(cb);
27295
+ }
27296
+ };
27297
+ }
27298
+ if (childProcess.stderr) {
27299
+ childProcess.stderr.pipe(process.stderr, { end: false });
27300
+ childProcess.stderr.on("data", () => {
27301
+ entry.lastOutputAt = Date.now();
27302
+ for (const cb of outputCallbacks)
27303
+ cb();
27304
+ });
27305
+ }
27306
+ return {
27307
+ pid,
27308
+ onExit: (cb) => {
27309
+ childProcess.on("exit", (code2, signal) => {
27310
+ this.deleteProcess(pid);
27311
+ cb({ code: code2, signal, context: context4 });
27312
+ });
27313
+ },
27314
+ onOutput: (cb) => {
27315
+ outputCallbacks.push(cb);
27316
+ }
27317
+ };
27318
+ }
27319
+ };
27320
+ });
27321
+
27322
+ // src/infrastructure/services/remote-agents/commandcode/index.ts
27323
+ var init_commandcode = __esm(() => {
27324
+ init_command_code_agent_service();
27325
+ });
27326
+
27126
27327
  // ../../node_modules/.pnpm/@opencode-ai+sdk@1.14.22/node_modules/@opencode-ai/sdk/dist/gen/types.gen.js
27127
27328
  var init_types_gen = () => {};
27128
27329
 
@@ -29517,12 +29718,14 @@ function initHarnessRegistry() {
29517
29718
  registerHarness(new PiAgentService);
29518
29719
  registerHarness(new CursorAgentService);
29519
29720
  registerHarness(new ClaudeCodeAgentService);
29721
+ registerHarness(new CommandCodeAgentService);
29520
29722
  registerHarness(new CopilotAgentService);
29521
29723
  initialized = true;
29522
29724
  }
29523
29725
  var initialized = false;
29524
29726
  var init_init_registry = __esm(() => {
29525
29727
  init_claude();
29728
+ init_commandcode();
29526
29729
  init_copilot();
29527
29730
  init_cursor();
29528
29731
  init_opencode();
@@ -79678,5 +79881,5 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
79678
79881
  });
79679
79882
  program2.parse();
79680
79883
 
79681
- //# debugId=A50E5218AF2CBB4A64756E2164756E21
79884
+ //# debugId=DFA3745A7992596664756E2164756E21
79682
79885
  //# sourceMappingURL=index.js.map