Auto-create claw-apply proxy if it doesn't exist

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 16:06:47 -08:00
parent df9c790a0e
commit f248e8573f

View File

@@ -40,7 +40,7 @@ export async function createBrowser(settings, profileNameOrKey) {
const opts = { stealth: true };
if (profileName) opts.profile = { name: profileName };
// Proxy: look up by name "claw-apply", fall back to settings proxy_id
// Proxy: look up by name "claw-apply", create if missing
try {
for await (const proxy of kernel.proxies.list()) {
if (proxy.name === 'claw-apply' && proxy.status === 'available') {
@@ -48,10 +48,11 @@ export async function createBrowser(settings, profileNameOrKey) {
break;
}
}
} catch {}
if (!opts.proxy && kernelConfig.proxy_id) {
opts.proxy = { id: kernelConfig.proxy_id };
if (!opts.proxy) {
const newProxy = await kernel.proxies.create({ name: 'claw-apply', type: 'residential', country: 'US' });
opts.proxy = { id: newProxy.id };
}
} catch {}
let kb;
try {