Ubuntu b467998ba4
build-and-push / build (push) Successful in 4m59s
feat(api): enforce OpenAI tool_choice contract (required/named/none)
- normalizeToolChoice maps OpenAI tool_choice values to internal shapes
- required/named: prepend a mandatory-tool directive block; buffer text
  deltas and only flush when a tool call actually arrives; on plain-text
  turn, retry in-process with a nudge block (max 2 retries) instead of
  emitting the violating text (streaming + non-streaming paths)
- none: prepend a no-tools directive
- unit tests for all new mapping/directive helpers (32 passing)

Verified live against cursor-agent ACP with model=auto: image+required
yields clean tool_calls chunks with no text pollution; follow-up turns
resolve parked MCP tool calls and retry on invalid observations.
2026-09-27 12:02:40 +00:00

cursor-agent-api-proxy

OpenAI-compatible HTTP API wrapping cursor-agent via ACP (agent acp). Deployed on node4-k3s.

  • Image: dcr.trinitysan.by/infra/cursor-agent-api-proxy
  • Deploy: deploy/ (PVC, Deployment, Service, ServiceExport)
  • Flux image automation: flux/ (ImageRepository / ImagePolicy / ImageUpdateAutomation)

Infra on node4 keeps thin Flux glue (Namespace, SecretAdapters, GitRepository, Kustomizations) in infrastructure/node4-k3s/131-cursor-agent-api.yaml. Public HTTPS + Authentik live on node2 (245-authentik-cursor-agent-api).

Access

Endpoint Detail
Public https://cursor-api.trinitysan.by (Authentik outpost on node2)
In-cluster / MCS cursor-agent-api.cursor-agent-api.svc.clusterset.local:4646
Health GET /health

CI

Gitea Actions (.gitea/workflows/build-and-push.yaml) on master and workflow_dispatch pushes:

Tag Purpose
:latest Convenience
:<git-sha> Immutable full SHA
:<run_number>-<git-sha> Sortable; elected by Flux ImagePolicy

Repo secrets (required): DCR_USERNAME, DCR_PASSWORD. Onboarding contract: infra docs/how-to/onboard-repo-into-deployment-infra.md.

Local build / E2E

docker build -t cursor-agent-api-proxy:latest .
# Requires CURSOR_API_KEY in env or .env
./scripts/e2e-docker.sh

Flux update flow

  1. CI pushes run_number-sha to DCR
  2. ImageRepository scans; ImagePolicy picks highest run_number
  3. ImageUpdateAutomation commits the new tag into deploy/010-cursor-agent-api.yaml
  4. Kustomization applies; Deployment rolls

Requires a Gitea PAT with read+write on this repo (GITEA_CURSOR_AGENT_API_GITOPS_TOKEN on node4, see infra 060-external-secrets.yaml.template).

S
Description
No description provided
Readme
94 KiB
Languages
JavaScript 86.2%
Shell 11%
Dockerfile 2.8%