@browsercash/chase 1.2.0 → 1.3.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/cli.js +14 -7
- package/dist/iterative-tester.js +3 -1
- package/dist/server.js +12 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -222,6 +222,12 @@ async function commandGenerate(task, flags) {
|
|
|
222
222
|
if (flags.country) {
|
|
223
223
|
body.browserOptions = { ...(body.browserOptions || {}), country: flags.country };
|
|
224
224
|
}
|
|
225
|
+
if (flags['max-iterations']) {
|
|
226
|
+
body.maxIterations = parseInt(flags['max-iterations'], 10);
|
|
227
|
+
}
|
|
228
|
+
if (flags['max-turns']) {
|
|
229
|
+
body.maxTurns = parseInt(flags['max-turns'], 10);
|
|
230
|
+
}
|
|
225
231
|
let taskId = null;
|
|
226
232
|
let result = null;
|
|
227
233
|
await streamRequest('/generate/stream', body, (type, data) => {
|
|
@@ -438,13 +444,14 @@ EXAMPLES:
|
|
|
438
444
|
chase task task-xyz789
|
|
439
445
|
|
|
440
446
|
OPTIONS:
|
|
441
|
-
--country <code>
|
|
442
|
-
--adblock
|
|
443
|
-
--captcha
|
|
444
|
-
--max-turns <n>
|
|
445
|
-
--
|
|
446
|
-
--
|
|
447
|
-
--
|
|
447
|
+
--country <code> Use a browser from specific country (e.g., US, DE, JP)
|
|
448
|
+
--adblock Enable ad-blocking
|
|
449
|
+
--captcha Enable CAPTCHA solving
|
|
450
|
+
--max-turns <n> Max Claude turns (automate: default 30, generate fix: capped at 15)
|
|
451
|
+
--max-iterations <n> Max fix iterations for generate (default: 5)
|
|
452
|
+
--quiet Reduce output verbosity
|
|
453
|
+
--skip-test Skip script testing (generate only)
|
|
454
|
+
--help Show this help message
|
|
448
455
|
|
|
449
456
|
ENVIRONMENT:
|
|
450
457
|
BROWSER_CASH_API_KEY Your Browser.cash API key (required)
|
package/dist/iterative-tester.js
CHANGED
|
@@ -176,7 +176,9 @@ async function askClaudeToFix(originalTask, scriptContent, errorOutput, failedLi
|
|
|
176
176
|
}
|
|
177
177
|
};
|
|
178
178
|
// Call Claude to fix the script - allow Bash so it can inspect the DOM
|
|
179
|
-
|
|
179
|
+
// Use maxTurns from config (default 30) for fix attempts, capped at 15 to avoid excessive costs
|
|
180
|
+
const fixTurns = Math.min(config.maxTurns, 15);
|
|
181
|
+
const shellCmd = `cat "${promptFile}" | claude -p --model ${config.model} --max-turns ${fixTurns} --allowedTools "Bash" --output-format stream-json --verbose`;
|
|
180
182
|
const claude = spawn('bash', ['-c', shellCmd], {
|
|
181
183
|
env: { ...process.env, CDP_URL: config.cdpUrl },
|
|
182
184
|
stdio: ['ignore', 'pipe', 'pipe'],
|
package/dist/server.js
CHANGED
|
@@ -568,11 +568,13 @@ server.post('/generate/stream', {
|
|
|
568
568
|
},
|
|
569
569
|
},
|
|
570
570
|
skipTest: { type: 'boolean', default: false },
|
|
571
|
+
maxIterations: { type: 'integer', minimum: 1, maximum: 20 },
|
|
572
|
+
maxTurns: { type: 'integer', minimum: 1, maximum: 30 },
|
|
571
573
|
},
|
|
572
574
|
},
|
|
573
575
|
},
|
|
574
576
|
}, async (request, reply) => {
|
|
575
|
-
const { task, browserCashApiKey, cdpUrl, browserOptions, skipTest } = request.body;
|
|
577
|
+
const { task, browserCashApiKey, cdpUrl, browserOptions, skipTest, maxIterations, maxTurns } = request.body;
|
|
576
578
|
// Validate that either browserCashApiKey or cdpUrl is provided
|
|
577
579
|
if (!browserCashApiKey && !cdpUrl) {
|
|
578
580
|
reply.raw.writeHead(400, { 'Content-Type': 'application/json' });
|
|
@@ -658,11 +660,20 @@ server.post('/generate/stream', {
|
|
|
658
660
|
cdpUrl: effectiveCdpUrl,
|
|
659
661
|
taskDescription: task,
|
|
660
662
|
});
|
|
663
|
+
// Override settings if provided in request
|
|
664
|
+
if (maxIterations) {
|
|
665
|
+
config.maxFixIterations = maxIterations;
|
|
666
|
+
}
|
|
667
|
+
if (maxTurns) {
|
|
668
|
+
config.maxTurns = Math.min(maxTurns, 30); // Cap at 30 for safety
|
|
669
|
+
}
|
|
661
670
|
sendEvent('start', {
|
|
662
671
|
taskId,
|
|
663
672
|
task,
|
|
664
673
|
model: config.model,
|
|
665
674
|
skipTest,
|
|
675
|
+
maxIterations: config.maxFixIterations,
|
|
676
|
+
maxTurns: config.maxTurns,
|
|
666
677
|
browserSessionId: browserSession?.sessionId,
|
|
667
678
|
});
|
|
668
679
|
// Run streaming script generation
|