FROM python:3.13-slim-bookworm@sha256:e32be0e55814a08977501ca863271d9bd02443710db8f2afaf8372e2c4508530 AS tokenizer
COPY requirements.lock /tmp/requirements.lock
RUN pip install --no-cache-dir -r /tmp/requirements.lock
ENV TIKTOKEN_CACHE_DIR=/opt/tiktoken-cache
RUN python -c 'import tiktoken; tiktoken.get_encoding("o200k_base")'

FROM node:24.21.0-bookworm@sha256:3d27e5c11e5786e309ec3e03f93ae536eb36e6e5eb3714d5eb3300a36157add0
LABEL editorial.task="mcp-token-traversal-fix-20261024"
COPY --from=tokenizer /usr/local/lib/ /usr/local/lib/
COPY --from=tokenizer /usr/local/bin/python3.13 /usr/local/bin/python3.13
COPY --from=tokenizer /opt/tiktoken-cache /opt/tiktoken-cache
ENV LD_LIBRARY_PATH=/usr/local/lib TIKTOKEN_CACHE_DIR=/opt/tiktoken-cache PYTHONDONTWRITEBYTECODE=1
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts --no-audit --no-fund && npm cache clean --force
COPY fixture.mjs expected.json server.mjs wire-proxy.mjs measure.mjs traversal.mjs probe-traversal.mjs count.py requirements.lock Dockerfile README.md ./
COPY skill ./skill
CMD ["node", "measure.mjs", "/out"]
