Skip to content

Latest commit

 

History

History
72 lines (51 loc) · 2.36 KB

File metadata and controls

72 lines (51 loc) · 2.36 KB

Project Notes for Codex

Editing

  • Prefer apply_patch for source edits.
  • Keep changes scoped to the gateway, Docker packaging, and docs unless the task explicitly asks otherwise.
  • Do not commit gateway/node_modules/; it is intentionally ignored for local development.

Gateway

  • Main server: gateway/server.mjs
  • Unit tests: gateway/test/server.test.mjs
  • Package manager: npm, using gateway/package-lock.json
  • Run tests from gateway/:
npm test
  • Syntax check from repo root:
node --check gateway/server.mjs

CodeBuddy SDK Notes

  • The gateway uses @tencent-ai/agent-sdk.
  • In Docker, CODEBUDDY_CODE_PATH must point at the real npm package bin:
/usr/local/lib/node_modules/@tencent-ai/codebuddy-code/bin/codebuddy
  • Do not point SDK startup at /usr/local/bin/codebuddy; the SDK resolves dist/codebuddy-headless.js relative to the provided path and the symlink path resolves incorrectly.
  • Treat request model codebuddy as a gateway alias. Do not pass it through to the CodeBuddy CLI as a model id.
  • REST API built-in CodeBuddy tools are disabled by default. External OpenAI-style tools are exposed as request-scoped SDK MCP tools and returned to clients as OpenAI-compatible tool_calls.
  • /v1/models uses bounded SDK model discovery and falls back to the gateway default model list after CODEBUDDY_GATEWAY_MODELS_TIMEOUT.

Docker Verification

Build:

docker build -t codebuddy-gateway:custom-tool-supported .

Run a disposable test container using the existing authenticated volume:

docker rm -f codebuddy-gateway-custom-tool-test 2>/dev/null || true
docker run -d --name codebuddy-gateway-custom-tool-test \
  -p 11532:10532 \
  -e SSH_PASSWORD=codebuddy \
  -e CODEBUDDY_GATEWAY_TOOLS= \
  -v codebuddy-home:/home/codebuddy \
  codebuddy-gateway:custom-tool-supported

Verify:

curl -s http://127.0.0.1:11532/health

Then test /v1/models, /v1/chat/completions with model: "codebuddy" and a simple exact-response prompt, and a streaming chat response. For custom tools, verify the first response returns finish_reason: "tool_calls" and an OpenAI-compatible message.tool_calls array, then send the external tool result back as a role: "tool" message.

Clean up only the disposable container, not the auth volume:

docker rm -f codebuddy-gateway-custom-tool-test