tuna-agent 0.1.94 → 0.1.95

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.
@@ -1,6 +1,28 @@
1
- import { spawn, execSync } from 'child_process';
1
+ import { spawn, execSync, spawnSync } from 'child_process';
2
2
  import { StringDecoder } from 'string_decoder';
3
3
  import { getMcpConfigPath } from '../mcp/setup.js';
4
+ /**
5
+ * Kill any orphaned Chrome processes launched by tuna-browser.
6
+ * Matches Chrome processes using --user-data-dir containing 'tuna-browser'.
7
+ */
8
+ function killOrphanedTunaBrowserChrome() {
9
+ try {
10
+ // Find Chrome main process PIDs with tuna-browser profile
11
+ const result = spawnSync('pgrep', ['-f', 'remote-debugging-port.*tuna-browser'], {
12
+ encoding: 'utf-8',
13
+ timeout: 3000,
14
+ });
15
+ const pids = (result.stdout || '').trim().split('\n').filter(Boolean);
16
+ for (const pid of pids) {
17
+ try {
18
+ process.kill(Number(pid), 'SIGTERM');
19
+ console.log(`[claude-cli] Killed orphaned tuna-browser Chrome (PID: ${pid})`);
20
+ }
21
+ catch { }
22
+ }
23
+ }
24
+ catch { }
25
+ }
4
26
  /** Cached absolute path to `claude` binary, resolved once at first use */
5
27
  let _claudeBinPath = null;
6
28
  function getClaudeBinPath() {
@@ -227,6 +249,8 @@ export function runClaude(options) {
227
249
  clearTimeout(timeoutTimer);
228
250
  const totalMs = Date.now() - spawnTime;
229
251
  console.log(`[claude-cli] ⏱ process closed: ${totalMs}ms total (first stdout: ${firstStdoutTime ? firstStdoutTime - spawnTime : '?'}ms, first stream: ${firstStreamEventTime ? firstStreamEventTime - spawnTime : 'none'}ms)`);
252
+ // Kill orphaned Chrome after Claude session ends (browser MCP cleanup may have failed)
253
+ killOrphanedTunaBrowserChrome();
230
254
  // Flush remaining buffer
231
255
  if (options.onStreamLine && buffer.trim()) {
232
256
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuna-agent",
3
- "version": "0.1.94",
3
+ "version": "0.1.95",
4
4
  "description": "Tuna Agent - Run AI coding tasks on your machine",
5
5
  "bin": {
6
6
  "tuna-agent": "dist/cli/index.js"