tuna-agent 0.1.94 → 0.1.96
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.
|
@@ -434,9 +434,13 @@ export async function launchChrome(opts = {}) {
|
|
|
434
434
|
if (!isExistingProfile) {
|
|
435
435
|
args.push('--disable-blink-features=AutomationControlled');
|
|
436
436
|
}
|
|
437
|
-
//
|
|
438
|
-
if (process.platform === 'linux')
|
|
437
|
+
// Password/cookie storage: avoid OS keychain prompts during automation
|
|
438
|
+
if (process.platform === 'linux') {
|
|
439
439
|
args.push('--password-store=basic');
|
|
440
|
+
}
|
|
441
|
+
else if (process.platform === 'darwin') {
|
|
442
|
+
args.push('--use-mock-keychain');
|
|
443
|
+
}
|
|
440
444
|
if (opts.headless) {
|
|
441
445
|
args.push('--headless=new', '--disable-gpu');
|
|
442
446
|
}
|
package/dist/utils/claude-cli.js
CHANGED
|
@@ -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 {
|