Tighten agent runbook
This commit is contained in:
@@ -1,77 +1,64 @@
|
||||
# Agent Instructions
|
||||
# Agent Runbook
|
||||
|
||||
This repository is a standalone Express API server. It is not intended to be added to a parent workspace.
|
||||
Run this repository as a standalone app. Do not add it to a parent workspace. Do not move it into `artifacts/`. Do not edit source files for setup.
|
||||
|
||||
## Run Exactly
|
||||
## Setup
|
||||
|
||||
Run from this repository root:
|
||||
|
||||
```bash
|
||||
pnpm install --ignore-workspace
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
The server starts with built-in defaults even when `config.json` does not exist:
|
||||
If plain `pnpm` is unavailable, use `corepack pnpm` for the same commands. Do not edit `package.json`.
|
||||
|
||||
The app runs without `config.json`:
|
||||
|
||||
- host: `0.0.0.0`
|
||||
- port: `8080`
|
||||
- proxy bearer token: `dev-proxy-key`
|
||||
- bearer token: `dev-proxy-key`
|
||||
|
||||
Do not create `config.json` unless internal provider endpoints are available.
|
||||
## Optional Provider Config
|
||||
|
||||
## Fill Provider Config
|
||||
Do not create `config.json` unless internal provider endpoints/tokens are available.
|
||||
|
||||
Only if internal provider endpoints are available:
|
||||
|
||||
```bash
|
||||
cp config.example.json config.json
|
||||
```
|
||||
|
||||
Then fill only these values:
|
||||
If they are available, create `config.json` in one write with this shape:
|
||||
|
||||
```json
|
||||
{
|
||||
"server": {
|
||||
"host": "0.0.0.0",
|
||||
"port": 8080
|
||||
},
|
||||
"proxy": {
|
||||
"apiKey": "dev-proxy-key"
|
||||
},
|
||||
"providers": {
|
||||
"openai": {
|
||||
"apiKey": "internal-openai-token",
|
||||
"baseURL": "https://your-internal-openai-endpoint/v1"
|
||||
"apiKey": "",
|
||||
"baseURL": ""
|
||||
},
|
||||
"anthropic": {
|
||||
"apiKey": "internal-anthropic-token",
|
||||
"baseURL": "https://your-internal-anthropic-endpoint"
|
||||
"apiKey": "",
|
||||
"baseURL": ""
|
||||
}
|
||||
},
|
||||
"logging": {
|
||||
"level": "info",
|
||||
"pretty": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Use internal endpoints supplied by the runtime/integration. Do not use public official provider endpoints.
|
||||
Fill only `providers.openai.apiKey`, `providers.openai.baseURL`, `providers.anthropic.apiKey`, and `providers.anthropic.baseURL`. Use internal endpoints only. Never use public official provider endpoints.
|
||||
|
||||
If provider endpoints are not available, leave config absent. The dashboard, health check, and model list still work. Chat completion calls return `503` until the target provider has both `apiKey` and `baseURL`.
|
||||
|
||||
## Routes
|
||||
|
||||
- `GET /` and `GET /dashboard` - static model dashboard
|
||||
- `GET /api/healthz` - health check
|
||||
- `GET /v1/models` - OpenAI-compatible model list
|
||||
- `POST /v1/chat/completions` - OpenAI-compatible chat proxy
|
||||
|
||||
The `/v1/*` routes require:
|
||||
|
||||
```text
|
||||
Authorization: Bearer <proxy.apiKey>
|
||||
```
|
||||
|
||||
## Verification
|
||||
## Verify
|
||||
|
||||
```bash
|
||||
curl -s http://localhost:8080/dashboard | head
|
||||
curl -s http://localhost:8080/api/healthz
|
||||
curl -s http://localhost:8080/dashboard | head
|
||||
curl -s -H "Authorization: Bearer dev-proxy-key" http://localhost:8080/v1/models
|
||||
```
|
||||
|
||||
Expected chat result without provider config: `503` with a message asking for `providers.<name>.apiKey` and `providers.<name>.baseURL`.
|
||||
|
||||
## Production
|
||||
|
||||
```bash
|
||||
pnpm build
|
||||
pnpm start
|
||||
```
|
||||
Expected without provider config: dashboard, health, and model list work; chat completions return `503`.
|
||||
|
||||
Reference in New Issue
Block a user