#!/usr/bin/env node /** * Standalone smoke-test for pointing each Codeman-supported harness CLI at a * custom OpenAI-compatible endpoint — local (llama.cpp, Ollama, vLLM, ...) or * cloud (Azure AI Foundry's OpenAI-compatible endpoint, OpenRouter, a * self-hosted gateway, ...). Anything that answers GET /v1/models and POST * /v1/chat/completions in the standard shape qualifies; --base-url is not * assumed to be a LAN address. * * This is intentionally OUTSIDE the npm test suite and outside Codeman's own * session/tmux machinery: it spawns each real CLI binary directly, one-shot, * with the env vars / config files that CLI's own docs say redirect it to a * custom endpoint, and checks it can answer "hello world". * * Cloud endpoints often differ from a bare llama.cpp box in two ways this * script accounts for: (1) auth may be an `api-key` header (Azure's * convention) rather than `Authorization: Bearer` — the baseline check in * Step 0 sends both, since an extra header is harmless to servers that * ignore it; each CLI's OWN auth convention (set via its env vars/config, * not this script) still needs to match what that endpoint expects. (2) a * cloud endpoint's "model" may actually be a deployment name distinct from * the model family (Azure AI Foundry deployments) — always pass --model * explicitly for those rather than relying on GET /v1/models discovery. * * IMPORTANT CONFIDENCE NOTE: only claude/opencode/codex recipes are verified * (Devvyn confirmed them by hand). gemini/pi/grok/deepseek/omp are best * guesses from public docs, not verified against this repo or against real * binaries. antigravity has no known CLI/env mechanism at all and is always * skipped. Read a harness's UNCONFIRMED/FAIL output before trusting it — use * --probe-help to read that binary's real --help and fix the guessed flag. * * Usage: * node scripts/test-local-llm-harnesses.mjs --base-url http://192.168.1.50:8080 [options] * node scripts/test-local-llm-harnesses.mjs --base-url https://.services.ai.azure.com/openai/v1 --model --api-key $AZURE_AI_KEY * * Options: * --base-url Required. Root URL of the OpenAI-compatible endpoint (local or cloud). * --model Model/deployment id to request. Default: first from GET /v1/models. * --api-key API key to send. Default: local-dummy-key (fine for llama.cpp; required for most cloud endpoints). * --auth-style