Files
cursor-agent-api-proxy/entrypoint.sh
T
Ubuntu 95e6a5f97e feat: warm-pool ACP sessions and stage TTFT timings
Pre-bootstrap two cursor-agent processes so createSession skips spawn/initialize on the hot path, open SSE before session setup, and log per-stage durations for first-token diagnosis.
2026-11-06 08:32:36 +00:00

26 lines
1.1 KiB
Bash

#!/bin/bash
# Container entrypoint: run cursor-agent bootstrap, then start the proxy.
set -euo pipefail
# Enforce the sandbox cli-config (force-rewrites runtime/PVC drift back to
# the deny-all policy on every boot) and verify the cursor-agent binary.
/app/scripts/bootstrap-cursor.sh
# Ensure the sandboxed agent HOME exists and is writable by uid 65533
# (the agent children run with a dedicated uid when supported). Best-effort:
# in Kubernetes the emptyDir is fsGroup-chowned; in local docker the image's
# ownership applies only if the directory was not replaced by a volume.
if [[ -n "${CURSOR_AGENT_HOME:-}" ]]; then
mkdir -p "${CURSOR_AGENT_HOME}" 2>/dev/null || true
chmod 777 "${CURSOR_AGENT_HOME}" 2>/dev/null || true
fi
# Session workdirs and MCP sockets live in /tmp (readOnlyRootFilesystem
# deployments mount an emptyDir there). Same best-effort widening for the
# agent child processes.
chmod 1777 /tmp 2>/dev/null || true
# The HTTP server. A warm pool keeps bootstrapped ACP processes ready;
# each request still opens session/new with request-specific MCP tools.
exec node /app/src/server.mjs