# anthropic-manager's runtime: the tool runtime, carrying this module's compiled code.
#
# **Built from this module's own directory and nothing else.** The sdk and the tool runtime are in
# the base images, published like any other artifact — which is what makes this buildable by the
# mesh from a repository and a path (novox/hq ADR 0069) rather than only on a workstation that
# happens to have the siblings.
#
# Two bases, named rather than pinned (novox/hq issue 044): the image this is COMPILED in and the
# image it RUNS in — the second must not carry a compiler. Declared in module.json's `build.on`.
ARG BUILD_BASE
ARG RUNTIME_BASE

FROM ${BUILD_BASE} AS build
WORKDIR /app/modules/anthropic-manager
COPY . .
# This module's own third-party dependencies, installed beside its compiled code so Node
# resolves them from the module and falls back to the shared tree for everything common.
RUN npm install --omit=dev --no-save --no-package-lock --ignore-scripts "tweetnacl@^1.0.3" "tweetnacl-sealedbox-js@^1.2.0"
RUN node /app/node_modules/typescript/bin/tsc client.ts adopt/index.ts refresh/index.ts \
      --module NodeNext --moduleResolution NodeNext --target ES2022 --outDir dist

FROM ${RUNTIME_BASE}
COPY --from=build /app/modules/anthropic-manager/dist /app/modules/anthropic-manager/dist
COPY --from=build /app/modules/anthropic-manager/node_modules /app/modules/anthropic-manager/node_modules
# No serve-time entrypoints: every container of this module names its command (`run` on a
# schedule), so nothing here serves — deliberately no MESH_TOOL_MODULES.
