@agent-foundry/replay-server 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.env DELETED
@@ -1,30 +0,0 @@
1
- # Replay Server Environment Variables
2
-
3
- # Server port
4
- PORT=3001
5
-
6
- # Default game URL (fallback when no bundleId specified)
7
- GAME_URL=http://localhost:3000
8
-
9
- # Directory containing game bundles
10
- BUNDLES_DIR=./bundles
11
-
12
- # Directory for rendered video output
13
- OUTPUT_DIR=./output
14
-
15
- # Puppeteer executable path (for containerized environments)
16
- PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
17
-
18
- # =============================================================================
19
- # Bundle Download Configuration
20
- # =============================================================================
21
-
22
- # BFF API URL for STS credentials (required for dynamic bundle downloads)
23
- BFF_BASE_URL=http://localhost:11001
24
-
25
- # Service-to-service auth token for BFF (REQUIRED for bundle downloads)
26
- # Set this to the value of SUPABASE_JWT_SECRET from BFF's .env file
27
- BFF_SERVICE_TOKEN=ijwt8jbx3Kkf2XDE8bR3AViGJchA5VppbOwpBFTF
28
-
29
- # Maximum bundle cache size in bytes (default: 10GB = 10737418240)
30
- MAX_CACHE_SIZE=10737418240
package/Dockerfile DELETED
@@ -1,162 +0,0 @@
1
- # Dockerfile for Aliyun Function Compute
2
- # Build from the project root: docker build -f packages/replay-server/Dockerfile -t replay-server .
3
- #
4
- # This multi-stage build:
5
- # 1. Builds the game bundle (game-life-restart)
6
- # 2. Builds the replay-server
7
- # 3. Creates a minimal runtime image with both
8
-
9
- # =============================================================================
10
- # Stage 1: Build game bundle
11
- # =============================================================================
12
- FROM node:18-bullseye-slim AS game-builder
13
-
14
- RUN npm install -g pnpm@9.1.0
15
-
16
- WORKDIR /app
17
-
18
- # Copy monorepo config for workspace resolution
19
- COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
20
-
21
- # Copy package.json files for dependencies
22
- COPY packages/replay-shared/package.json ./packages/replay-shared/
23
- COPY repo/game-life-restart/package.json ./repo/game-life-restart/
24
-
25
- # Install dependencies
26
- RUN pnpm install --frozen-lockfile
27
-
28
- # Copy source files
29
- COPY packages/replay-shared/tsconfig.json ./packages/replay-shared/
30
- COPY packages/replay-shared/src ./packages/replay-shared/src
31
- COPY repo/game-life-restart/tsconfig.json ./repo/game-life-restart/
32
- COPY repo/game-life-restart/tsconfig.node.json ./repo/game-life-restart/
33
- COPY repo/game-life-restart/vite.config.ts ./repo/game-life-restart/
34
- COPY repo/game-life-restart/tailwind.config.js ./repo/game-life-restart/
35
- COPY repo/game-life-restart/postcss.config.js ./repo/game-life-restart/
36
- COPY repo/game-life-restart/index.html ./repo/game-life-restart/
37
- COPY repo/game-life-restart/src ./repo/game-life-restart/src
38
- COPY repo/game-life-restart/public ./repo/game-life-restart/public
39
-
40
- # Build replay-shared first (dependency)
41
- WORKDIR /app/packages/replay-shared
42
- RUN pnpm run build
43
-
44
- # Build game with correct base path for bundle serving
45
- WORKDIR /app/repo/game-life-restart
46
- ENV VITE_BASE_PATH=/bundles/game-life-restart/
47
- RUN pnpm run build
48
-
49
- # =============================================================================
50
- # Stage 2: Build replay-server
51
- # =============================================================================
52
- FROM node:18-bullseye-slim AS server-builder
53
-
54
- RUN npm install -g pnpm@9.1.0
55
-
56
- WORKDIR /app
57
-
58
- # Copy monorepo config
59
- COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
60
-
61
- # Copy package.json files
62
- COPY packages/replay-shared/package.json ./packages/replay-shared/
63
- COPY packages/replay-server/package*.json ./packages/replay-server/
64
-
65
- # Install dependencies
66
- RUN pnpm install --frozen-lockfile
67
-
68
- # Copy source files
69
- COPY packages/replay-shared/tsconfig.json ./packages/replay-shared/
70
- COPY packages/replay-shared/src ./packages/replay-shared/src
71
- COPY packages/replay-server/tsconfig.json ./packages/replay-server/
72
- COPY packages/replay-server/src ./packages/replay-server/src
73
-
74
- # Build shared package first
75
- WORKDIR /app/packages/replay-shared
76
- RUN pnpm run build
77
-
78
- # Build replay-server
79
- WORKDIR /app/packages/replay-server
80
- RUN pnpm run build
81
-
82
- # =============================================================================
83
- # Stage 3: Runtime
84
- # =============================================================================
85
- FROM node:18-bullseye-slim AS runtime
86
-
87
- # Install FFmpeg, Chromium dependencies, Chinese fonts, and pnpm
88
- RUN apt-get update && apt-get install -y \
89
- ffmpeg \
90
- chromium \
91
- chromium-sandbox \
92
- libnss3 \
93
- libatk1.0-0 \
94
- libatk-bridge2.0-0 \
95
- libcups2 \
96
- libdrm2 \
97
- libxkbcommon0 \
98
- libxcomposite1 \
99
- libxdamage1 \
100
- libxrandr2 \
101
- libgbm1 \
102
- libasound2 \
103
- libxss1 \
104
- libgtk-3-0 \
105
- fonts-noto-cjk \
106
- fonts-noto-cjk-extra \
107
- fonts-wqy-zenhei \
108
- fontconfig \
109
- && rm -rf /var/lib/apt/lists/*
110
-
111
- # Install pnpm globally
112
- RUN npm install -g pnpm@9.1.0
113
-
114
- # Set Puppeteer to use system Chromium
115
- ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
116
- ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
117
-
118
- WORKDIR /app
119
-
120
- # Copy monorepo configuration files
121
- COPY --from=server-builder /app/package.json /app/pnpm-workspace.yaml /app/pnpm-lock.yaml ./
122
-
123
- # Copy package.json files for both packages
124
- COPY --from=server-builder /app/packages/replay-shared/package.json ./packages/replay-shared/
125
- COPY --from=server-builder /app/packages/replay-server/package.json ./packages/replay-server/
126
-
127
- # Install production dependencies
128
- RUN pnpm install --frozen-lockfile --prod
129
-
130
- # Copy built artifacts from server-builder
131
- COPY --from=server-builder /app/packages/replay-shared/dist ./packages/replay-shared/dist
132
- COPY --from=server-builder /app/packages/replay-server/dist ./packages/replay-server/dist
133
-
134
- # Copy game bundle from game-builder
135
- COPY --from=game-builder /app/repo/game-life-restart/dist ./packages/replay-server/bundles/game-life-restart
136
-
137
- # Create output directory
138
- RUN mkdir -p /app/packages/replay-server/output
139
-
140
- # Set working directory to replay-server
141
- WORKDIR /app/packages/replay-server
142
-
143
- # Environment variables
144
- ENV PORT=9000
145
- ENV BUNDLES_DIR=/app/packages/replay-server/bundles
146
- ENV OUTPUT_DIR=/app/packages/replay-server/output
147
- # BFF API URL for STS credentials (required for dynamic bundle downloads)
148
- ENV BFF_BASE_URL=http://localhost:11001
149
- # Optional: Service-to-service auth token for BFF
150
- # ENV BFF_SERVICE_TOKEN=
151
- # Maximum cache size in bytes (default: 10GB)
152
- ENV MAX_CACHE_SIZE=10737418240
153
-
154
- # Expose port
155
- EXPOSE 9000
156
-
157
- # Health check
158
- HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
159
- CMD node -e "require('http').get('http://localhost:${PORT:-9000}/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
160
-
161
- # Start server
162
- CMD ["node", "dist/server/index.js"]
package/bundles/.gitkeep DELETED
@@ -1,2 +0,0 @@
1
- # This directory contains pre-built game bundles for replay rendering.
2
- # Bundle contents are git-ignored; only the directory structure is tracked.
@@ -1,39 +0,0 @@
1
- version: '3.8'
2
-
3
- # Local development Docker Compose for replay-server
4
- #
5
- # Usage:
6
- # cd packages/replay-server
7
- # docker-compose -f docker-compose.local.yml up --build
8
- #
9
- # This will:
10
- # 1. Build the replay-server with embedded game-life-restart bundle
11
- # 2. Start the server on port 3001
12
- # 3. Mount ./output for video files
13
-
14
- services:
15
- replay-server:
16
- extra_hosts:
17
- - "host.docker.internal:host-gateway"
18
- build:
19
- context: ../..
20
- dockerfile: packages/replay-server/Dockerfile
21
- ports:
22
- - "3001:3001"
23
- environment:
24
- - PORT=3001
25
- - BUNDLES_DIR=/app/packages/replay-server/bundles
26
- - OUTPUT_DIR=/app/packages/replay-server/output
27
- # BFF API URL for STS credentials (required for dynamic bundle downloads)
28
- - BFF_BASE_URL=http://host.docker.internal:11001
29
- # Service-to-service auth token for BFF
30
- - BFF_SERVICE_TOKEN=ijwt8jbx3Kkf2XDE8bR3AViGJchA5VppbOwpBFTF
31
- # Maximum cache size in bytes (default: 10GB)
32
- - MAX_CACHE_SIZE=10737418240
33
- volumes:
34
- # Mount output directory for easy access to rendered videos
35
- - ./output:/app/packages/replay-server/output
36
- # Mount bundles directory for local game testing
37
- # - ./bundles:/app/packages/replay-server/bundles
38
- # Increase shared memory for Chromium
39
- shm_size: '2gb'
package/env.example DELETED
@@ -1,30 +0,0 @@
1
- # Replay Server Environment Variables
2
-
3
- # Server port
4
- PORT=3001
5
-
6
- # Default game URL (fallback when no bundleId specified)
7
- GAME_URL=http://localhost:5173
8
-
9
- # Directory containing game bundles
10
- BUNDLES_DIR=./bundles
11
-
12
- # Directory for rendered video output
13
- OUTPUT_DIR=./output
14
-
15
- # Puppeteer executable path (for containerized environments)
16
- PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
17
-
18
- # =============================================================================
19
- # Bundle Download Configuration
20
- # =============================================================================
21
-
22
- # BFF API URL for STS credentials (required for dynamic bundle downloads)
23
- BFF_BASE_URL=http://localhost:11001
24
-
25
- # Service-to-service auth token for BFF (REQUIRED for bundle downloads)
26
- # Set this to the value of SUPABASE_JWT_SECRET from BFF's .env file
27
- # BFF_SERVICE_TOKEN=your-supabase-jwt-secret-from-bff
28
-
29
- # Maximum bundle cache size in bytes (default: 10GB = 10737418240)
30
- MAX_CACHE_SIZE=10737418240
package/restart.sh DELETED
@@ -1,5 +0,0 @@
1
- docker compose -f docker-compose.local.yml down
2
-
3
- docker compose -f docker-compose.local.yml build
4
-
5
- docker compose -f docker-compose.local.yml up -d