Skip to content

Commit b497761

Browse files
committed
fix: add docker-setup action, runtime Dockerfile, and align release workflow
- Add .github/actions/docker-setup composite action (from rivet) - Add docker/runtime/Dockerfile for Docker image builds - Update release.yaml to match rivet patterns: - Use corepack enable instead of pnpm/action-setup - Add reuse_engine_version input - Add Docker job with Depot runners - Use --no-frozen-lockfile for pnpm install - Add id-token permission for setup job
1 parent f053893 commit b497761

File tree

82 files changed

+1399
-2414
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1399
-2414
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 'Docker Setup'
2+
description: 'Set up Docker Buildx and log in to Docker Hub'
3+
inputs:
4+
docker_username:
5+
description: 'Docker Hub username'
6+
required: true
7+
docker_password:
8+
description: 'Docker Hub password'
9+
required: true
10+
github_token:
11+
description: 'GitHub token'
12+
required: true
13+
runs:
14+
using: 'composite'
15+
steps:
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v3
18+
19+
- name: Log in to Docker Hub
20+
uses: docker/login-action@v3
21+
with:
22+
username: ${{ inputs.docker_username }}
23+
password: ${{ inputs.docker_password }}
24+
25+
# This will be used as a secret to authenticate with Git repo pulls
26+
- name: Create .netrc file
27+
run: |
28+
echo "machine github.com" > ${{ runner.temp }}/netrc
29+
echo "login x-access-token" >> ${{ runner.temp }}/netrc
30+
echo "password ${{ inputs.github_token }}" >> ${{ runner.temp }}/netrc
31+
shell: bash

.github/workflows/release.yaml

Lines changed: 94 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: "Version (e.g. 0.1.0 or v0.1.0)"
7+
description: 'Version'
88
required: true
99
type: string
1010
latest:
11-
description: "Latest"
11+
description: 'Latest'
1212
required: true
1313
type: boolean
1414
default: true
15+
reuse_engine_version:
16+
description: 'Reuse artifacts from this version (skips building)'
17+
required: false
18+
type: string
1519

1620
defaults:
1721
run:
@@ -27,28 +31,40 @@ jobs:
2731
name: "Setup"
2832
runs-on: ubuntu-24.04
2933
permissions:
34+
# Allow pushing to GitHub
3035
contents: write
36+
# Allows authentication
37+
id-token: write
3138
steps:
3239
- uses: actions/checkout@v4
3340
with:
3441
fetch-depth: 0
3542

3643
- uses: dtolnay/rust-toolchain@stable
3744

38-
- uses: pnpm/action-setup@v4
39-
4045
- uses: actions/setup-node@v4
4146
with:
4247
node-version: 20
43-
cache: pnpm
48+
49+
- run: corepack enable
4450

4551
- name: Setup
4652
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4754
R2_RELEASES_ACCESS_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }}
4855
R2_RELEASES_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
4956
run: |
57+
# Configure Git
58+
git config --global user.name "github-actions[bot]"
59+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
60+
61+
# Authenticate with NPM
62+
cat << EOF > ~/.npmrc
63+
//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
64+
EOF
65+
5066
# Install dependencies
51-
pnpm install
67+
pnpm install --no-frozen-lockfile
5268
5369
# Install tsx globally
5470
npm install -g tsx
@@ -60,84 +76,126 @@ jobs:
6076
CMD="$CMD --no-latest"
6177
fi
6278
79+
if [ -n "${{ inputs.reuse_engine_version }}" ]; then
80+
CMD="$CMD --reuse-engine-version \"${{ inputs.reuse_engine_version }}\""
81+
fi
82+
6383
eval "$CMD"
6484
6585
binaries:
6686
name: "Build & Upload Binaries"
6787
needs: [setup]
88+
if: ${{ !inputs.reuse_engine_version }}
6889
strategy:
6990
matrix:
7091
include:
7192
- platform: linux
93+
runner: depot-ubuntu-24.04-8
7294
target: x86_64-unknown-linux-musl
7395
binary_ext: ""
7496
arch: x86_64
7597
- platform: windows
98+
runner: depot-ubuntu-24.04-8
7699
target: x86_64-pc-windows-gnu
77100
binary_ext: ".exe"
78101
arch: x86_64
79102
- platform: macos
103+
runner: depot-ubuntu-24.04-8
80104
target: x86_64-apple-darwin
81105
binary_ext: ""
82106
arch: x86_64
83107
- platform: macos
108+
runner: depot-ubuntu-24.04-8
84109
target: aarch64-apple-darwin
85110
binary_ext: ""
86111
arch: aarch64
87-
runs-on: ubuntu-24.04
112+
runs-on: ${{ matrix.runner }}
88113
steps:
89114
- uses: actions/checkout@v4
90115
with:
91116
fetch-depth: 0
92117

93-
- uses: pnpm/action-setup@v4
94-
95-
- uses: actions/setup-node@v4
96-
with:
97-
node-version: 20
98-
cache: pnpm
99-
100-
- name: Build inspector frontend
101-
run: |
102-
pnpm install
103-
SANDBOX_AGENT_SKIP_INSPECTOR=1 pnpm --filter @sandbox-agent/inspector build
104-
105118
- name: Set up Docker Buildx
106119
uses: docker/setup-buildx-action@v3
107120

108121
- name: Build binary
109122
run: |
123+
# Use Docker BuildKit
124+
export DOCKER_BUILDKIT=1
125+
126+
# Build the binary using our Dockerfile
110127
docker/release/build.sh ${{ matrix.target }}
128+
129+
# Make sure dist directory exists and binary is there
111130
ls -la dist/
112131
113132
- name: Upload to R2
114133
env:
115134
AWS_ACCESS_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }}
116135
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
117136
run: |
118-
# Install AWS CLI
137+
# Install dependencies for AWS CLI
119138
sudo apt-get update
120139
sudo apt-get install -y unzip curl
121140
141+
# Install AWS CLI
122142
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
123143
unzip awscliv2.zip
124144
sudo ./aws/install --update
125145
126146
COMMIT_SHA_SHORT="${GITHUB_SHA::7}"
127147
BINARY_PATH="dist/sandbox-agent-${{ matrix.target }}${{ matrix.binary_ext }}"
128148
129-
# Upload to commit directory for later promotion
149+
# Must specify --checksum-algorithm for compatibility with R2
130150
aws s3 cp \
131151
"${BINARY_PATH}" \
132152
"s3://rivet-releases/sandbox-agent/${COMMIT_SHA_SHORT}/binaries/sandbox-agent-${{ matrix.target }}${{ matrix.binary_ext }}" \
133153
--region auto \
134154
--endpoint-url https://2a94c6a0ced8d35ea63cddc86c2681e7.r2.cloudflarestorage.com \
135155
--checksum-algorithm CRC32
136156
157+
docker:
158+
name: "Build & Push Docker Images"
159+
needs: [setup]
160+
if: ${{ !inputs.reuse_engine_version }}
161+
strategy:
162+
matrix:
163+
include:
164+
- platform: linux/arm64
165+
runner: depot-ubuntu-24.04-arm-8
166+
arch_suffix: -arm64
167+
- platform: linux/amd64
168+
runner: depot-ubuntu-24.04-8
169+
arch_suffix: -amd64
170+
runs-on: ${{ matrix.runner }}
171+
steps:
172+
- uses: actions/checkout@v4
173+
with:
174+
fetch-depth: 0
175+
176+
- name: Set outputs
177+
id: vars
178+
run: echo "sha_short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
179+
180+
- uses: ./.github/actions/docker-setup
181+
with:
182+
docker_username: ${{ secrets.DOCKER_CI_USERNAME }}
183+
docker_password: ${{ secrets.DOCKER_CI_ACCESS_TOKEN }}
184+
github_token: ${{ secrets.GITHUB_TOKEN }}
185+
186+
- name: Build & Push
187+
uses: docker/build-push-action@v4
188+
with:
189+
context: .
190+
push: true
191+
tags: rivetdev/sandbox-agent:${{ steps.vars.outputs.sha_short }}${{ matrix.arch_suffix }}
192+
file: docker/runtime/Dockerfile
193+
platforms: ${{ matrix.platform }}
194+
137195
complete:
138196
name: "Complete"
139-
needs: [setup, binaries]
140-
if: ${{ always() && !cancelled() && needs.setup.result == 'success' && needs.binaries.result == 'success' }}
197+
needs: [setup, docker, binaries]
198+
if: ${{ always() && !cancelled() && needs.setup.result == 'success' && (needs.docker.result == 'success' || needs.docker.result == 'skipped') && (needs.binaries.result == 'success' || needs.binaries.result == 'skipped') }}
141199
runs-on: ubuntu-24.04
142200
steps:
143201
- uses: actions/checkout@v4
@@ -146,17 +204,21 @@ jobs:
146204

147205
- uses: dtolnay/rust-toolchain@stable
148206

149-
- uses: pnpm/action-setup@v4
150-
151207
- uses: actions/setup-node@v4
152208
with:
153209
node-version: 20
154210
registry-url: "https://registry.npmjs.org"
155-
cache: pnpm
211+
212+
- run: corepack enable
213+
214+
- uses: ./.github/actions/docker-setup
215+
with:
216+
docker_username: ${{ secrets.DOCKER_CI_USERNAME }}
217+
docker_password: ${{ secrets.DOCKER_CI_ACCESS_TOKEN }}
218+
github_token: ${{ secrets.GITHUB_TOKEN }}
156219

157220
- name: Complete
158221
env:
159-
# https://cli.github.com/manual/gh_help_environment
160222
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
161223
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
162224
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -169,7 +231,7 @@ jobs:
169231
EOF
170232
171233
# Install dependencies
172-
pnpm install
234+
pnpm install --no-frozen-lockfile
173235
174236
# Install tsx globally
175237
npm install -g tsx
@@ -181,4 +243,8 @@ jobs:
181243
CMD="$CMD --no-latest"
182244
fi
183245
246+
if [ -n "${{ inputs.reuse_engine_version }}" ]; then
247+
CMD="$CMD --reuse-engine-version \"${{ inputs.reuse_engine_version }}\""
248+
fi
249+
184250
eval "$CMD"

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ members = ["server/packages/*"]
55
[workspace.package]
66
version = "0.1.0"
77
edition = "2021"
8-
authors = ["Sandbox Agent Contributors"]
8+
authors = [ "Rivet Gaming, LLC <developer@rivet.gg>" ]
99
license = "Apache-2.0"
1010
repository = "https://github.com/rivet-dev/sandbox-agent"
11-
description = "Universal agent API for AI coding assistants"
11+
description = "Universal API for automatic coding agents in sandboxes. Supprots Claude Code, Codex, OpenCode, and Amp."
1212

1313
[workspace.dependencies]
1414
# Internal crates

docker/runtime/Dockerfile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# syntax=docker/dockerfile:1.10.0
2+
3+
# Build stage - compile the binary
4+
FROM rust:1.88.0 AS builder
5+
6+
ENV DEBIAN_FRONTEND=noninteractive
7+
RUN apt-get update && apt-get install -y \
8+
musl-tools \
9+
musl-dev \
10+
pkg-config \
11+
ca-certificates \
12+
git && \
13+
apt-get clean && \
14+
rm -rf /var/lib/apt/lists/*
15+
16+
RUN rustup target add x86_64-unknown-linux-musl
17+
18+
WORKDIR /build
19+
COPY . .
20+
21+
# Build static binary
22+
RUN --mount=type=cache,target=/usr/local/cargo/registry \
23+
--mount=type=cache,target=/usr/local/cargo/git \
24+
--mount=type=cache,target=/build/target \
25+
SANDBOX_AGENT_SKIP_INSPECTOR=1 \
26+
RUSTFLAGS="-C target-feature=+crt-static" \
27+
cargo build -p sandbox-agent --release --target x86_64-unknown-linux-musl && \
28+
cp target/x86_64-unknown-linux-musl/release/sandbox-agent /sandbox-agent
29+
30+
# Runtime stage - minimal image
31+
FROM debian:bookworm-slim
32+
33+
RUN apt-get update && apt-get install -y \
34+
ca-certificates \
35+
curl \
36+
git && \
37+
rm -rf /var/lib/apt/lists/*
38+
39+
# Copy the binary from builder
40+
COPY --from=builder /sandbox-agent /usr/local/bin/sandbox-agent
41+
RUN chmod +x /usr/local/bin/sandbox-agent
42+
43+
# Create non-root user
44+
RUN useradd -m -s /bin/bash sandbox
45+
USER sandbox
46+
WORKDIR /home/sandbox
47+
48+
EXPOSE 2468
49+
50+
ENTRYPOINT ["sandbox-agent"]
51+
CMD ["--host", "0.0.0.0", "--port", "2468"]

docs/building-chat-ui.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Capabilities tell you which features are supported for the selected agent:
2121
- `tool_calls` and `tool_results` indicate tool execution events.
2222
- `questions` and `permissions` indicate HITL flows.
2323
- `plan_mode` indicates that the agent supports plan-only execution.
24+
- `reasoning` and `status` indicate that the agent can emit reasoning/status content parts.
2425

2526
Use these to enable or disable UI affordances (tool panels, approval buttons, etc.).
2627

docs/openapi.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"title": "sandbox-agent",
55
"description": "",
66
"contact": {
7-
"name": "Sandbox Agent Contributors"
7+
"name": "Rivet Gaming, LLC",
8+
"email": "developer@rivet.gg"
89
},
910
"license": {
1011
"name": "Apache-2.0"
@@ -662,6 +663,7 @@
662663
"sessionLifecycle",
663664
"errorEvents",
664665
"reasoning",
666+
"status",
665667
"commandExecution",
666668
"fileChanges",
667669
"mcpTools",
@@ -706,6 +708,9 @@
706708
"type": "boolean",
707709
"description": "Whether this agent uses a shared long-running server process (vs per-turn subprocess)"
708710
},
711+
"status": {
712+
"type": "boolean"
713+
},
709714
"streamingDeltas": {
710715
"type": "boolean"
711716
},

0 commit comments

Comments
 (0)