#!/usr/bin/env node /** * Smoke: platform/web extension (web_search, fetch_url) on local Goose v1.49. */ import { createV149Client } from './goose-v149-sse.mjs'; const client = createV149Client(); const workingDir = process.env.GOOSE_V149_WORKING_DIR || process.cwd(); const pollMs = Number(process.env.GOOSE_V149_WEB_POLL_MS || 500); const timeoutMs = Number(process.env.GOOSE_V149_WEB_TIMEOUT_MS || 15_000); async function waitForWebTools(sessionId) { const deadline = Date.now() + timeoutMs; while (Date.now() < deadline) { const response = await client.apiFetch( `/agent/tools?session_id=${encodeURIComponent(sessionId)}&extension_name=web`, ); const text = await response.text(); if (!response.ok) { throw new Error(`/agent/tools ${response.status}: ${text.slice(0, 400)}`); } const tools = JSON.parse(text); const names = tools.map((tool) => tool.name); const hasSearch = names.some((name) => name === 'web__web_search' || name === 'web_search'); const hasFetch = names.some((name) => name === 'web__fetch_url' || name === 'fetch_url'); if (hasSearch && hasFetch) { return names; } await new Promise((resolve) => setTimeout(resolve, pollMs)); } throw new Error(`platform/web tools not ready within ${timeoutMs}ms`); } async function main() { const session = await client.apiJson('/agent/start', { working_dir: workingDir, extension_overrides: [ { type: 'platform', name: 'web', description: 'Web search and fetch (v1.49 smoke)', display_name: 'Web', bundled: false, available_tools: ['web_search', 'fetch_url'], }, { type: 'platform', name: 'skills', description: 'skills', available_tools: [], }, ], }); if (!session?.id) throw new Error('missing session id'); const toolNames = await waitForWebTools(session.id); console.log( `GOOSE_V149_WEB_OK: session=${session.id} tools=${toolNames.length}`, ); } main().catch((error) => { console.error(`GOOSE_V149_WEB_FAIL: ${error.message}`); process.exit(1); });