{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "headless-api-starter",
  "title": "Headless API Starter",
  "description": "Drive an agent with curl or eve/client — no chat UI. Demos the default HTTP session protocol.",
  "dependencies": ["eve@^0.24.6"],
  "devDependencies": ["@types/node@24.x", "typescript@^5.9.3"],
  "files": [
    {
      "path": "catalog/agents/headless-api-starter/.env.example",
      "content": "# No channel credentials. Point scripts at the running agent with EVE_HOST.\n# EVE_HOST=http://127.0.0.1:3000\n\n# Model access follows your eve setup (Vercel AI Gateway or a provider key).\n",
      "type": "registry:file",
      "target": ".env.example"
    },
    {
      "path": "catalog/agents/headless-api-starter/.gitignore",
      "content": "node_modules/\n.eve/\nvar/\n.env\n.env.local\n*.tsbuildinfo\n",
      "type": "registry:file",
      "target": ".gitignore"
    },
    {
      "path": "catalog/agents/headless-api-starter/README.md",
      "content": "# Headless API Starter\n\nDrive an eve agent with `curl` or `eve/client` — no Slack, Telegram, or chat UI. The default eve HTTP channel is the product.\n\nDemos: the session protocol (`POST /eve/v1/session`, stream, continue).\n\n## Layout\n\n```text\nheadless-api-starter/\n├── package.json\n├── agent/\n│   ├── agent.ts\n│   └── instructions.md\n├── examples/\n│   ├── curl.sh          # three curls\n│   └── chat.mjs         # eve/client script\n├── evals/\n```\n\n## Run\n\n```bash\nnpm install\nnpm run dev\n```\n\nIn another terminal:\n\n```bash\nbash examples/curl.sh\n# or\nnpm run chat\n```\n\n## Make it yours\n\nReplace `agent/instructions.md` with your backend agent's job. Embed the same `Client` pattern from `examples/chat.mjs` in your service.\n\n## Verify\n\n```bash\nnpm run eval\n```\n\n## License\n\nMIT\n",
      "type": "registry:file",
      "target": "README.md"
    },
    {
      "path": "catalog/agents/headless-api-starter/SETUP.md",
      "content": "# Set up Headless API Starter\n\n## 1. Install and run\n\n```bash\nnpm install\nnpm run dev\n```\n\nLocal route auth is open by default. Deployed apps may require Vercel OIDC or a bearer — see eve's auth docs and pass credentials to `Client`.\n\n## 2. Three curls\n\n```bash\n# health\ncurl http://127.0.0.1:3000/eve/v1/health\n\n# start a session\ncurl -X POST http://127.0.0.1:3000/eve/v1/session \\\n  -H 'content-type: application/json' \\\n  -d '{\"message\":\"Hello from curl\"}'\n\n# stream events (use sessionId from the create response)\ncurl http://127.0.0.1:3000/eve/v1/session/<sessionId>/stream\n```\n\nOr run `bash examples/curl.sh` / `npm run chat`.\n\n## Verify\n\n```bash\nnpm run eval\n```\n",
      "type": "registry:file",
      "target": "SETUP.md"
    },
    {
      "path": "catalog/agents/headless-api-starter/agent/agent.ts",
      "content": "import { defineAgent } from \"eve\";\n\nexport default defineAgent({\n  model: \"openai/gpt-5.4-mini\",\n});\n",
      "type": "registry:file",
      "target": "agent/agent.ts"
    },
    {
      "path": "catalog/agents/headless-api-starter/agent/instructions.md",
      "content": "# Identity\n\nYou are a headless agent reached only over eve's HTTP session API (`curl`, scripts, or `eve/client`). Keep replies short and concrete so they are easy to parse from an NDJSON stream.\n\n# Rules\n\n- Answer the user's question directly in a few sentences.\n- Prefer plain text. Avoid Markdown headings unless asked.\n- If you need more information, ask one clarifying question.\n",
      "type": "registry:file",
      "target": "agent/instructions.md"
    },
    {
      "path": "catalog/agents/headless-api-starter/evals/evals.config.ts",
      "content": "import { defineEvalConfig } from \"eve/evals\";\n\nexport default defineEvalConfig({\n  maxConcurrency: 1,\n  timeoutMs: 120_000,\n});\n",
      "type": "registry:file",
      "target": "evals/evals.config.ts"
    },
    {
      "path": "catalog/agents/headless-api-starter/evals/smoke.eval.ts",
      "content": "import { defineEval } from \"eve/evals\";\n\nexport default defineEval({\n  description: \"Agent answers over the default eve HTTP session protocol.\",\n  async test(t) {\n    await t.send(\"In one short sentence, what can you do?\");\n    t.succeeded();\n  },\n});\n",
      "type": "registry:file",
      "target": "evals/smoke.eval.ts"
    },
    {
      "path": "catalog/agents/headless-api-starter/examples/chat.mjs",
      "content": "/**\n * Minimal eve/client script: start a session, print the reply, send a follow-up.\n *\n * Usage (with `npm run dev` in another terminal):\n *   npm run chat\n *   EVE_HOST=http://127.0.0.1:3000 node examples/chat.mjs \"Your question\"\n */\nimport { Client } from \"eve/client\";\n\nconst host = process.env.EVE_HOST ?? \"http://127.0.0.1:3000\";\nconst first =\n  process.argv.slice(2).join(\" \").trim() || \"In one sentence, what can you do?\";\n\nconst client = new Client({ host });\n\nconst health = await client.health();\nconsole.log(\"health:\", health.status);\n\nconst session = client.session();\nconst turn = await session.send(first);\nconsole.log(\"sessionId:\", turn.sessionId);\nconsole.log(\"continuationToken:\", turn.continuationToken);\n\nconst result = await turn.result();\nconsole.log(\"\\nassistant:\", result.message ?? \"(no reply)\");\nconsole.log(\"status:\", result.status);\n\nconst followUp = await session.send(\"Repeat that even more briefly.\");\nconst followResult = await followUp.result();\nconsole.log(\"\\nfollow-up:\", followResult.message ?? \"(no reply)\");\n",
      "type": "registry:file",
      "target": "examples/chat.mjs"
    },
    {
      "path": "catalog/agents/headless-api-starter/examples/curl.sh",
      "content": "#!/usr/bin/env bash\n# Three curls against a local eve dev server (npm run dev).\nset -euo pipefail\n\nHOST=\"${EVE_HOST:-http://127.0.0.1:3000}\"\n\necho \"== 1. health ==\"\ncurl -sS \"$HOST/eve/v1/health\"\necho\n\necho \"== 2. create session ==\"\nCREATE=$(curl -sS -X POST \"$HOST/eve/v1/session\" \\\n  -H 'content-type: application/json' \\\n  -d '{\"message\":\"Say hello in one short sentence.\"}')\necho \"$CREATE\"\nSESSION_ID=$(node -e \"const j=JSON.parse(process.argv[1]); if(!j.sessionId) process.exit(1); process.stdout.write(j.sessionId)\" \"$CREATE\")\nTOKEN=$(node -e \"const j=JSON.parse(process.argv[1]); process.stdout.write(j.continuationToken||'')\" \"$CREATE\")\n\necho\necho \"== 3. stream (first ~20 events, then Ctrl-C if it hangs) ==\"\ncurl -sSN \"$HOST/eve/v1/session/$SESSION_ID/stream\" | head -n 20\n\nif [[ -n \"$TOKEN\" ]]; then\n  echo\n  echo \"== 4. continue session ==\"\n  curl -sS -X POST \"$HOST/eve/v1/session/$SESSION_ID\" \\\n    -H 'content-type: application/json' \\\n    -d \"{\\\"message\\\":\\\"Thanks.\\\",\\\"continuationToken\\\":$(node -e \"process.stdout.write(JSON.stringify(process.argv[1]))\" \"$TOKEN\")}\"\n  echo\nfi\n",
      "type": "registry:file",
      "target": "examples/curl.sh"
    },
    {
      "path": "catalog/agents/headless-api-starter/examples/sample-input.md",
      "content": "# Example request\n\nIn one short sentence, what can you do?\n\n# Expected behavior\n\nA brief plain-text answer suitable for reading from an NDJSON stream or `eve/client` `result().message`.\n",
      "type": "registry:file",
      "target": "examples/sample-input.md"
    },
    {
      "path": "catalog/agents/headless-api-starter/package.json",
      "content": "{\n  \"name\": \"headless-api-starter\",\n  \"version\": \"1.0.0\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"eve dev\",\n    \"build\": \"eve build\",\n    \"start\": \"eve start\",\n    \"eval\": \"eve eval\",\n    \"typecheck\": \"tsc\",\n    \"chat\": \"node examples/chat.mjs\"\n  },\n  \"dependencies\": {\n    \"eve\": \"^0.24.6\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"24.x\",\n    \"typescript\": \"^5.9.3\"\n  },\n  \"engines\": {\n    \"node\": \"24.x\"\n  }\n}\n",
      "type": "registry:file",
      "target": "package.json"
    },
    {
      "path": "catalog/agents/headless-api-starter/tsconfig.json",
      "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"module\": \"esnext\",\n    \"moduleResolution\": \"bundler\",\n    \"types\": [\"node\"],\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"skipLibCheck\": true,\n    \"noEmit\": true\n  },\n  \"include\": [\"agent/**/*.ts\", \"evals/**/*.ts\"]\n}\n",
      "type": "registry:file",
      "target": "tsconfig.json"
    }
  ],
  "meta": {
    "runtime": "eve",
    "layout": "eve-app",
    "version": "1.0.0",
    "license": "MIT",
    "category": "starters",
    "integrations": ["eve"]
  },
  "categories": ["starters"],
  "type": "registry:block"
}
