#!/usr/bin/env node /** * Phase 1 smoke: POST /agent/start on local Goose v1.49 candidate. */ import { execFileSync } from 'node:child_process'; const port = process.env.GOOSE_V149_PORT || '18049'; const host = process.env.GOOSE_V149_HOST || '127.0.0.1'; const secret = process.env.GOOSE_SERVER__SECRET_KEY || 'local-v149-dev-secret'; const workingDir = process.env.GOOSE_V149_WORKING_DIR || process.cwd(); const blockedHosts = ['58.38.22.103', '120.26.184.105']; if (blockedHosts.includes(host)) { console.error(`GOOSE_V149_AGENT_START_FAIL: refusing production host ${host}`); process.exit(1); } try { const body = execFileSync( 'curl', [ '-sk', '--connect-timeout', '10', '-X', 'POST', '-H', 'Content-Type: application/json', '-H', `X-Secret-Key: ${secret}`, '-d', JSON.stringify({ working_dir: workingDir }), `https://${host}:${port}/agent/start`, ], { encoding: 'utf8' }, ).trim(); const session = JSON.parse(body); if (!session?.id) { console.error(`GOOSE_V149_AGENT_START_FAIL: missing session id: ${body}`); process.exit(1); } console.log(`GOOSE_V149_AGENT_START_OK: session=${session.id}`); } catch (error) { console.error(`GOOSE_V149_AGENT_START_FAIL: ${error.message}`); process.exit(1); }