@opencow-ai/opencow-agent-sdk 0.4.8 → 0.4.9

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/cli.mjs CHANGED
@@ -94436,7 +94436,7 @@ function printStartupScreen() {
94436
94436
  const sLen = ` ● ${sL} Ready — type /help to begin`.length;
94437
94437
  out.push(boxRow(sRow, W2, sLen));
94438
94438
  out.push(`${rgb(...BORDER)}╚${"═".repeat(W2 - 2)}╝${RESET}`);
94439
- out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.8"}${RESET}`);
94439
+ out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.9"}${RESET}`);
94440
94440
  out.push("");
94441
94441
  process.stdout.write(out.join(`
94442
94442
  `) + `
@@ -244306,7 +244306,7 @@ function getAnthropicEnvMetadata() {
244306
244306
  function getBuildAgeMinutes() {
244307
244307
  if (false)
244308
244308
  ;
244309
- const buildTime = new Date("2026-06-20T04:27:50.766Z").getTime();
244309
+ const buildTime = new Date("2026-06-23T13:05:35.394Z").getTime();
244310
244310
  if (isNaN(buildTime))
244311
244311
  return;
244312
244312
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -277643,11 +277643,14 @@ ${stderr}` : stdout;
277643
277643
  }
277644
277644
  } while (!generatorResult.done);
277645
277645
  result = generatorResult.value;
277646
- trackGitOperations(input.command, result.code, result.stdout);
277646
+ const stdout2 = result.stdout || "";
277647
+ const stderr = result.stderr || "";
277648
+ const combinedOutput = [stdout2, stderr].filter(Boolean).join(stdout2 && stderr ? EOL : "");
277649
+ trackGitOperations(input.command, result.code, combinedOutput);
277647
277650
  const isInterrupt = result.interrupted && abortController.signal.reason === "interrupt";
277648
- stdoutAccumulator.append((result.stdout || "").trimEnd() + EOL);
277649
- interpretationResult = interpretCommandResult(input.command, result.code, result.stdout || "", "");
277650
- if (result.stdout && result.stdout.includes(".git/index.lock': File exists")) {
277651
+ stdoutAccumulator.append(combinedOutput.trimEnd() + EOL);
277652
+ interpretationResult = interpretCommandResult(input.command, result.code, stdout2, stderr);
277653
+ if (combinedOutput.includes(".git/index.lock': File exists")) {
277651
277654
  logEvent("tengu_git_index_lock_error", {});
277652
277655
  }
277653
277656
  if (interpretationResult.isError && !isInterrupt) {
@@ -277661,7 +277664,8 @@ ${stderr}` : stdout;
277661
277664
  stderrForShellReset = stdErrAppendShellResetMessage("");
277662
277665
  }
277663
277666
  }
277664
- const outputWithSbFailures = SandboxManager4.annotateStderrWithSandboxFailures(input.command, result.stdout || "");
277667
+ const annotatedOutput = SandboxManager4.annotateStderrWithSandboxFailures(input.command, combinedOutput);
277668
+ const outputWithSbFailures = annotatedOutput || combinedOutput;
277665
277669
  if (result.preSpawnError) {
277666
277670
  throw new Error(result.preSpawnError);
277667
277671
  }
@@ -319222,6 +319226,7 @@ class ShellCommandImpl {
319222
319226
  #shouldAutoBackground;
319223
319227
  #resultResolver = null;
319224
319228
  #exitCodeResolver = null;
319229
+ #stdioClosedPromise = null;
319225
319230
  #boundAbortHandler = null;
319226
319231
  taskOutput;
319227
319232
  static #handleTimeout(self2) {
@@ -319309,6 +319314,11 @@ class ShellCommandImpl {
319309
319314
  });
319310
319315
  this.#childProcess.once("exit", this.#exitHandler.bind(this));
319311
319316
  this.#childProcess.once("error", this.#errorHandler.bind(this));
319317
+ this.#stdioClosedPromise = new Promise((resolve34) => {
319318
+ this.#childProcess.once("close", () => {
319319
+ resolve34();
319320
+ });
319321
+ });
319312
319322
  this.#timeoutId = setTimeout(ShellCommandImpl.#handleTimeout, this.#timeout, this);
319313
319323
  const exitPromise = new Promise((resolve34) => {
319314
319324
  this.#exitCodeResolver = resolve34;
@@ -319323,6 +319333,9 @@ class ShellCommandImpl {
319323
319333
  if (this.#status === "running" || this.#status === "backgrounded") {
319324
319334
  this.#status = "completed";
319325
319335
  }
319336
+ if (this.taskOutput.stdoutToFile && !this.#backgroundTaskId) {
319337
+ await this.#waitForFileOutputFlush(code);
319338
+ }
319326
319339
  const stdout = await this.taskOutput.getStdout();
319327
319340
  const result = {
319328
319341
  code,
@@ -319351,6 +319364,20 @@ class ShellCommandImpl {
319351
319364
  resultResolver(result);
319352
319365
  }
319353
319366
  }
319367
+ async#waitForFileOutputFlush(code) {
319368
+ const stdioClosedPromise = this.#stdioClosedPromise;
319369
+ if (!stdioClosedPromise) {
319370
+ return;
319371
+ }
319372
+ const graceMs = code === 0 ? OUTPUT_CLOSE_GRACE_MS : ERROR_OUTPUT_CLOSE_GRACE_MS;
319373
+ await Promise.race([
319374
+ stdioClosedPromise,
319375
+ new Promise((resolve34) => {
319376
+ const timeout = setTimeout(resolve34, graceMs);
319377
+ timeout.unref();
319378
+ })
319379
+ ]);
319380
+ }
319354
319381
  #doKill(code) {
319355
319382
  this.#status = "killed";
319356
319383
  if (this.#childProcess.pid) {
@@ -319434,7 +319461,7 @@ function createFailedCommand(preSpawnError) {
319434
319461
  cleanup() {}
319435
319462
  };
319436
319463
  }
319437
- var import_tree_kill, SIGKILL = 137, SIGTERM = 143, SIZE_WATCHDOG_INTERVAL_MS = 5000;
319464
+ var import_tree_kill, SIGKILL = 137, SIGTERM = 143, SIZE_WATCHDOG_INTERVAL_MS = 5000, OUTPUT_CLOSE_GRACE_MS = 100, ERROR_OUTPUT_CLOSE_GRACE_MS = 1000;
319438
319465
  var init_ShellCommand = __esm(() => {
319439
319466
  init_Task();
319440
319467
  init_format2();
@@ -479642,7 +479669,7 @@ function buildPrimarySection() {
479642
479669
  }, undefined, false, undefined, this);
479643
479670
  return [{
479644
479671
  label: "Version",
479645
- value: "0.4.8"
479672
+ value: "0.4.9"
479646
479673
  }, {
479647
479674
  label: "Session name",
479648
479675
  value: nameValue
@@ -535964,7 +535991,7 @@ var init_bridge_kick = __esm(() => {
535964
535991
  var call58 = async () => {
535965
535992
  return {
535966
535993
  type: "text",
535967
- value: `${"99.0.0"} (built ${"2026-06-20T04:27:50.766Z"})`
535994
+ value: `${"99.0.0"} (built ${"2026-06-23T13:05:35.394Z"})`
535968
535995
  };
535969
535996
  }, version2, version_default;
535970
535997
  var init_version = __esm(() => {
@@ -558074,7 +558101,7 @@ function WelcomeV2() {
558074
558101
  dimColor: true,
558075
558102
  children: [
558076
558103
  "v",
558077
- "0.4.8",
558104
+ "0.4.9",
558078
558105
  " "
558079
558106
  ]
558080
558107
  }, undefined, true, undefined, this)
@@ -558274,7 +558301,7 @@ function WelcomeV2() {
558274
558301
  dimColor: true,
558275
558302
  children: [
558276
558303
  "v",
558277
- "0.4.8",
558304
+ "0.4.9",
558278
558305
  " "
558279
558306
  ]
558280
558307
  }, undefined, true, undefined, this)
@@ -558500,7 +558527,7 @@ function AppleTerminalWelcomeV2(t0) {
558500
558527
  dimColor: true,
558501
558528
  children: [
558502
558529
  "v",
558503
- "0.4.8",
558530
+ "0.4.9",
558504
558531
  " "
558505
558532
  ]
558506
558533
  }, undefined, true, undefined, this);
@@ -558754,7 +558781,7 @@ function AppleTerminalWelcomeV2(t0) {
558754
558781
  dimColor: true,
558755
558782
  children: [
558756
558783
  "v",
558757
- "0.4.8",
558784
+ "0.4.9",
558758
558785
  " "
558759
558786
  ]
558760
558787
  }, undefined, true, undefined, this);
@@ -579611,7 +579638,7 @@ Usage: claude --remote "your task description"`, () => gracefulShutdown(1));
579611
579638
  pendingHookMessages
579612
579639
  }, renderAndRun);
579613
579640
  }
579614
- }).version("0.4.8 (OpenCow)", "-v, --version", "Output the version number");
579641
+ }).version("0.4.9 (OpenCow)", "-v, --version", "Output the version number");
579615
579642
  program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
579616
579643
  program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
579617
579644
  if (canUserConfigureAdvisor()) {
@@ -580257,7 +580284,7 @@ if (false) {}
580257
580284
  async function main2() {
580258
580285
  const args = process.argv.slice(2);
580259
580286
  if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
580260
- console.log(`${"0.4.8"} (OpenCow)`);
580287
+ console.log(`${"0.4.9"} (OpenCow)`);
580261
580288
  return;
580262
580289
  }
580263
580290
  if (args.includes("--provider")) {
@@ -580375,4 +580402,4 @@ async function main2() {
580375
580402
  }
580376
580403
  main2();
580377
580404
 
580378
- //# debugId=1F12E9ABEA6E5ED964756E2164756E21
580405
+ //# debugId=56C6FA588ED1DECD64756E2164756E21
package/dist/client.js CHANGED
@@ -116633,6 +116633,7 @@ class ShellCommandImpl {
116633
116633
  #shouldAutoBackground;
116634
116634
  #resultResolver = null;
116635
116635
  #exitCodeResolver = null;
116636
+ #stdioClosedPromise = null;
116636
116637
  #boundAbortHandler = null;
116637
116638
  taskOutput;
116638
116639
  static #handleTimeout(self2) {
@@ -116720,6 +116721,11 @@ class ShellCommandImpl {
116720
116721
  });
116721
116722
  this.#childProcess.once("exit", this.#exitHandler.bind(this));
116722
116723
  this.#childProcess.once("error", this.#errorHandler.bind(this));
116724
+ this.#stdioClosedPromise = new Promise((resolve10) => {
116725
+ this.#childProcess.once("close", () => {
116726
+ resolve10();
116727
+ });
116728
+ });
116723
116729
  this.#timeoutId = setTimeout(ShellCommandImpl.#handleTimeout, this.#timeout, this);
116724
116730
  const exitPromise = new Promise((resolve10) => {
116725
116731
  this.#exitCodeResolver = resolve10;
@@ -116734,6 +116740,9 @@ class ShellCommandImpl {
116734
116740
  if (this.#status === "running" || this.#status === "backgrounded") {
116735
116741
  this.#status = "completed";
116736
116742
  }
116743
+ if (this.taskOutput.stdoutToFile && !this.#backgroundTaskId) {
116744
+ await this.#waitForFileOutputFlush(code);
116745
+ }
116737
116746
  const stdout = await this.taskOutput.getStdout();
116738
116747
  const result = {
116739
116748
  code,
@@ -116762,6 +116771,20 @@ class ShellCommandImpl {
116762
116771
  resultResolver(result);
116763
116772
  }
116764
116773
  }
116774
+ async#waitForFileOutputFlush(code) {
116775
+ const stdioClosedPromise = this.#stdioClosedPromise;
116776
+ if (!stdioClosedPromise) {
116777
+ return;
116778
+ }
116779
+ const graceMs = code === 0 ? OUTPUT_CLOSE_GRACE_MS : ERROR_OUTPUT_CLOSE_GRACE_MS;
116780
+ await Promise.race([
116781
+ stdioClosedPromise,
116782
+ new Promise((resolve10) => {
116783
+ const timeout = setTimeout(resolve10, graceMs);
116784
+ timeout.unref();
116785
+ })
116786
+ ]);
116787
+ }
116765
116788
  #doKill(code) {
116766
116789
  this.#status = "killed";
116767
116790
  if (this.#childProcess.pid) {
@@ -116845,7 +116868,7 @@ function createFailedCommand(preSpawnError) {
116845
116868
  cleanup() {}
116846
116869
  };
116847
116870
  }
116848
- var import_tree_kill, SIGKILL = 137, SIGTERM = 143, SIZE_WATCHDOG_INTERVAL_MS = 5000;
116871
+ var import_tree_kill, SIGKILL = 137, SIGTERM = 143, SIZE_WATCHDOG_INTERVAL_MS = 5000, OUTPUT_CLOSE_GRACE_MS = 100, ERROR_OUTPUT_CLOSE_GRACE_MS = 1000;
116849
116872
  var init_ShellCommand = __esm(() => {
116850
116873
  init_Task();
116851
116874
  init_format2();
@@ -259485,11 +259508,14 @@ ${stderr}` : stdout;
259485
259508
  }
259486
259509
  } while (!generatorResult.done);
259487
259510
  result = generatorResult.value;
259488
- trackGitOperations(input.command, result.code, result.stdout);
259511
+ const stdout2 = result.stdout || "";
259512
+ const stderr = result.stderr || "";
259513
+ const combinedOutput = [stdout2, stderr].filter(Boolean).join(stdout2 && stderr ? EOL : "");
259514
+ trackGitOperations(input.command, result.code, combinedOutput);
259489
259515
  const isInterrupt = result.interrupted && abortController.signal.reason === "interrupt";
259490
- stdoutAccumulator.append((result.stdout || "").trimEnd() + EOL);
259491
- interpretationResult = interpretCommandResult(input.command, result.code, result.stdout || "", "");
259492
- if (result.stdout && result.stdout.includes(".git/index.lock': File exists")) {
259516
+ stdoutAccumulator.append(combinedOutput.trimEnd() + EOL);
259517
+ interpretationResult = interpretCommandResult(input.command, result.code, stdout2, stderr);
259518
+ if (combinedOutput.includes(".git/index.lock': File exists")) {
259493
259519
  logEvent("tengu_git_index_lock_error", {});
259494
259520
  }
259495
259521
  if (interpretationResult.isError && !isInterrupt) {
@@ -259503,7 +259529,8 @@ ${stderr}` : stdout;
259503
259529
  stderrForShellReset = stdErrAppendShellResetMessage("");
259504
259530
  }
259505
259531
  }
259506
- const outputWithSbFailures = SandboxManager3.annotateStderrWithSandboxFailures(input.command, result.stdout || "");
259532
+ const annotatedOutput = SandboxManager3.annotateStderrWithSandboxFailures(input.command, combinedOutput);
259533
+ const outputWithSbFailures = annotatedOutput || combinedOutput;
259507
259534
  if (result.preSpawnError) {
259508
259535
  throw new Error(result.preSpawnError);
259509
259536
  }
@@ -282561,7 +282588,7 @@ function getAnthropicEnvMetadata() {
282561
282588
  function getBuildAgeMinutes() {
282562
282589
  if (false)
282563
282590
  ;
282564
- const buildTime = new Date("2026-06-20T04:27:50.766Z").getTime();
282591
+ const buildTime = new Date("2026-06-23T13:05:35.394Z").getTime();
282565
282592
  if (isNaN(buildTime))
282566
282593
  return;
282567
282594
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -335911,4 +335938,4 @@ export {
335911
335938
  AbortError2 as AbortError
335912
335939
  };
335913
335940
 
335914
- //# debugId=1F8F3CFC5E2DADCB64756E2164756E21
335941
+ //# debugId=D5A0C61CA530F61064756E2164756E21
package/dist/sdk.js CHANGED
@@ -116633,6 +116633,7 @@ class ShellCommandImpl {
116633
116633
  #shouldAutoBackground;
116634
116634
  #resultResolver = null;
116635
116635
  #exitCodeResolver = null;
116636
+ #stdioClosedPromise = null;
116636
116637
  #boundAbortHandler = null;
116637
116638
  taskOutput;
116638
116639
  static #handleTimeout(self2) {
@@ -116720,6 +116721,11 @@ class ShellCommandImpl {
116720
116721
  });
116721
116722
  this.#childProcess.once("exit", this.#exitHandler.bind(this));
116722
116723
  this.#childProcess.once("error", this.#errorHandler.bind(this));
116724
+ this.#stdioClosedPromise = new Promise((resolve10) => {
116725
+ this.#childProcess.once("close", () => {
116726
+ resolve10();
116727
+ });
116728
+ });
116723
116729
  this.#timeoutId = setTimeout(ShellCommandImpl.#handleTimeout, this.#timeout, this);
116724
116730
  const exitPromise = new Promise((resolve10) => {
116725
116731
  this.#exitCodeResolver = resolve10;
@@ -116734,6 +116740,9 @@ class ShellCommandImpl {
116734
116740
  if (this.#status === "running" || this.#status === "backgrounded") {
116735
116741
  this.#status = "completed";
116736
116742
  }
116743
+ if (this.taskOutput.stdoutToFile && !this.#backgroundTaskId) {
116744
+ await this.#waitForFileOutputFlush(code);
116745
+ }
116737
116746
  const stdout = await this.taskOutput.getStdout();
116738
116747
  const result = {
116739
116748
  code,
@@ -116762,6 +116771,20 @@ class ShellCommandImpl {
116762
116771
  resultResolver(result);
116763
116772
  }
116764
116773
  }
116774
+ async#waitForFileOutputFlush(code) {
116775
+ const stdioClosedPromise = this.#stdioClosedPromise;
116776
+ if (!stdioClosedPromise) {
116777
+ return;
116778
+ }
116779
+ const graceMs = code === 0 ? OUTPUT_CLOSE_GRACE_MS : ERROR_OUTPUT_CLOSE_GRACE_MS;
116780
+ await Promise.race([
116781
+ stdioClosedPromise,
116782
+ new Promise((resolve10) => {
116783
+ const timeout = setTimeout(resolve10, graceMs);
116784
+ timeout.unref();
116785
+ })
116786
+ ]);
116787
+ }
116765
116788
  #doKill(code) {
116766
116789
  this.#status = "killed";
116767
116790
  if (this.#childProcess.pid) {
@@ -116845,7 +116868,7 @@ function createFailedCommand(preSpawnError) {
116845
116868
  cleanup() {}
116846
116869
  };
116847
116870
  }
116848
- var import_tree_kill, SIGKILL = 137, SIGTERM = 143, SIZE_WATCHDOG_INTERVAL_MS = 5000;
116871
+ var import_tree_kill, SIGKILL = 137, SIGTERM = 143, SIZE_WATCHDOG_INTERVAL_MS = 5000, OUTPUT_CLOSE_GRACE_MS = 100, ERROR_OUTPUT_CLOSE_GRACE_MS = 1000;
116849
116872
  var init_ShellCommand = __esm(() => {
116850
116873
  init_Task();
116851
116874
  init_format2();
@@ -259485,11 +259508,14 @@ ${stderr}` : stdout;
259485
259508
  }
259486
259509
  } while (!generatorResult.done);
259487
259510
  result = generatorResult.value;
259488
- trackGitOperations(input.command, result.code, result.stdout);
259511
+ const stdout2 = result.stdout || "";
259512
+ const stderr = result.stderr || "";
259513
+ const combinedOutput = [stdout2, stderr].filter(Boolean).join(stdout2 && stderr ? EOL : "");
259514
+ trackGitOperations(input.command, result.code, combinedOutput);
259489
259515
  const isInterrupt = result.interrupted && abortController.signal.reason === "interrupt";
259490
- stdoutAccumulator.append((result.stdout || "").trimEnd() + EOL);
259491
- interpretationResult = interpretCommandResult(input.command, result.code, result.stdout || "", "");
259492
- if (result.stdout && result.stdout.includes(".git/index.lock': File exists")) {
259516
+ stdoutAccumulator.append(combinedOutput.trimEnd() + EOL);
259517
+ interpretationResult = interpretCommandResult(input.command, result.code, stdout2, stderr);
259518
+ if (combinedOutput.includes(".git/index.lock': File exists")) {
259493
259519
  logEvent("tengu_git_index_lock_error", {});
259494
259520
  }
259495
259521
  if (interpretationResult.isError && !isInterrupt) {
@@ -259503,7 +259529,8 @@ ${stderr}` : stdout;
259503
259529
  stderrForShellReset = stdErrAppendShellResetMessage("");
259504
259530
  }
259505
259531
  }
259506
- const outputWithSbFailures = SandboxManager3.annotateStderrWithSandboxFailures(input.command, result.stdout || "");
259532
+ const annotatedOutput = SandboxManager3.annotateStderrWithSandboxFailures(input.command, combinedOutput);
259533
+ const outputWithSbFailures = annotatedOutput || combinedOutput;
259507
259534
  if (result.preSpawnError) {
259508
259535
  throw new Error(result.preSpawnError);
259509
259536
  }
@@ -282561,7 +282588,7 @@ function getAnthropicEnvMetadata() {
282561
282588
  function getBuildAgeMinutes() {
282562
282589
  if (false)
282563
282590
  ;
282564
- const buildTime = new Date("2026-06-20T04:27:50.766Z").getTime();
282591
+ const buildTime = new Date("2026-06-23T13:05:35.394Z").getTime();
282565
282592
  if (isNaN(buildTime))
282566
282593
  return;
282567
282594
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -335911,4 +335938,4 @@ export {
335911
335938
  AbortError2 as AbortError
335912
335939
  };
335913
335940
 
335914
- //# debugId=8D264B0B42FBE9F564756E2164756E21
335941
+ //# debugId=71BD791C80C9F42F64756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencow-ai/opencow-agent-sdk",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "description": "Claude Code opened to any LLM — OpenAI, Gemini, DeepSeek, Ollama, and 200+ models",
5
5
  "type": "module",
6
6
  "main": "./dist/sdk.js",