Skip to content
This repository was archived by the owner on Oct 7, 2026. It is now read-only.

Commit beacecf

Browse files
committed
add omp sandbox support
Signed-off-by: Steven Hostetler <steven.hostetler@gmail.com>
1 parent fffb6b2 commit beacecf

3 files changed

Lines changed: 269 additions & 0 deletions

File tree

‎sandboxes/omp/Dockerfile‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# syntax=docker/dockerfile:1.4
2+
3+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
# OMP Coding Agent sandbox image for OpenShell
7+
#
8+
# Builds on the community base sandbox and adds OMP with Bun.
9+
# Build: docker build -t openshell-omp:latest --build-arg BASE_IMAGE=openshell-base .
10+
# Run locally: openshell sandbox create --from openshell-omp:latest
11+
12+
ARG BASE_IMAGE=ghcr.io/nvidia/openshell-community/sandboxes/base:latest
13+
FROM ${BASE_IMAGE}
14+
15+
ARG BUN_VERSION=1.3.14
16+
ARG OMP_VERSION=17.4.0
17+
18+
ENV BUN_INSTALL=/opt/bun \
19+
PATH="/opt/bun/bin:${PATH}"
20+
21+
USER root
22+
23+
# Install Bun and its unzip dependency.
24+
RUN apt-get update && apt-get install -y --no-install-recommends \
25+
unzip \
26+
&& rm -rf /var/lib/apt/lists/* \
27+
&& curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}" \
28+
&& test "$(/opt/bun/bin/bun --version)" = "${BUN_VERSION}"
29+
30+
# Install the published OMP package in a controlled application directory.
31+
RUN mkdir -p /opt/omp \
32+
&& printf '{\n "private": true,\n "dependencies": {\n "@oh-my-pi/pi-coding-agent": "%s"\n }\n}\n' "${OMP_VERSION}" > /opt/omp/package.json \
33+
&& cd /opt/omp \
34+
&& /opt/bun/bin/bun install --production --linker hoisted \
35+
&& test -f /opt/omp/node_modules/@oh-my-pi/pi-coding-agent/dist/cli.js
36+
37+
# Keep the runtime and package paths explicit for the sandbox policy.
38+
RUN printf '#!/bin/sh\nexport HOME=/sandbox\nexec /opt/bun/bin/bun /opt/omp/node_modules/@oh-my-pi/pi-coding-agent/dist/cli.js "$@"\n' \
39+
> /usr/local/bin/omp \
40+
&& chown root:root /usr/local/bin/omp \
41+
&& chmod 755 /usr/local/bin/omp
42+
43+
# Keep Bun on PATH for login shells as well as the container environment.
44+
RUN printf 'export PATH="/opt/bun/bin:/sandbox/.venv/bin:/usr/local/bin:/usr/bin:/bin"\n' \
45+
>> /sandbox/.bashrc
46+
47+
# Copy the complete OMP-specific sandbox policy.
48+
COPY policy.yaml /etc/openshell/policy.yaml
49+
50+
USER sandbox
51+
52+
ENTRYPOINT ["/bin/bash"]

‎sandboxes/omp/README.md‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# OMP Sandbox
2+
3+
OpenShell sandbox image pre-configured with [OMP](https://github.com/can1357/oh-my-pi) — a terminal coding agent.
4+
5+
## What's Included
6+
7+
- **OMP** (`@oh-my-pi/pi-coding-agent@17.4.0`) — coding agent CLI
8+
- **Bun** 1.3.14 — pinned JavaScript runtime
9+
- Everything from the [base sandbox](../base/README.md)
10+
11+
## Build
12+
13+
From this directory:
14+
15+
```bash
16+
docker build -t openshell-omp:latest .
17+
```
18+
19+
To build against a specific base image:
20+
21+
```bash
22+
docker build -t openshell-omp:latest --build-arg BASE_IMAGE=ghcr.io/nvidia/openshell-community/sandboxes/base:latest .
23+
```
24+
25+
## Usage
26+
27+
A gateway is required for OpenShell sandbox creation.
28+
The commands below use the locally built `openshell-omp:latest` image. The selected gateway must use the same Docker daemon. To use the published sandbox instead, replace `openshell-omp:latest` with `omp`; remote gateways require a pushed registry image.
29+
30+
### Create a sandbox
31+
32+
```bash
33+
openshell sandbox create --from openshell-omp:latest
34+
```
35+
36+
### Start OMP directly
37+
38+
```bash
39+
openshell sandbox create --from openshell-omp:latest -- omp
40+
```
41+
42+
### Attach an OpenShell provider
43+
44+
Use an already-created provider instance to attach credentials without putting a raw secret in the command line:
45+
46+
```bash
47+
openshell sandbox create --from openshell-omp:latest --name omp-dev --provider my-nvidia -- omp
48+
```
49+
50+
`--provider` attaches OpenShell-managed credentials as opaque placeholders that resolve inside the sandbox. Do not pass raw API keys through `--env`. See the [OpenShell Providers v2 documentation](https://docs.nvidia.com/openshell/sandboxes/providers-v2) for provider profile setup and credential handling.
51+
52+
## Network policy
53+
54+
The initial OMP policy permits the Anthropic, OpenAI/ChatGPT, Google Gemini, Groq, OpenRouter, Mistral, xAI, and NVIDIA endpoints listed in [`policy.yaml`](policy.yaml), plus the listed GitHub, GitHub Copilot, and source-reading endpoints. It also permits read-only Git Smart HTTP, the GitHub REST API, and the base Python package-management endpoints.
55+
56+
Other providers and endpoints are denied until they are intentionally added to the policy and the image is rebuilt.

‎sandboxes/omp/policy.yaml‎

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
version: 1
5+
6+
# --- Sandbox setup configuration (queried once at startup) ---
7+
8+
filesystem_policy:
9+
include_workdir: true
10+
read_only:
11+
- /usr
12+
- /lib
13+
- /proc
14+
- /dev/urandom
15+
- /app
16+
- /etc
17+
- /var/log
18+
- /opt
19+
read_write:
20+
- /sandbox
21+
- /tmp
22+
- /dev/null
23+
24+
landlock:
25+
compatibility: best_effort
26+
27+
process:
28+
run_as_user: sandbox
29+
run_as_group: sandbox
30+
31+
# --- Network policies (queried per-CONNECT request) ---
32+
#
33+
# Each named policy maps a set of allowed (binary, endpoint) pairs.
34+
# Binary identity is resolved via /proc/net/tcp inode lookup + /proc/{pid}/exe.
35+
# Ancestors (/proc/{pid}/status PPid walk) and cmdline paths are also matched.
36+
# SHA256 integrity is enforced in Rust via trust-on-first-use, not here.
37+
38+
network_policies:
39+
omp:
40+
name: omp
41+
endpoints:
42+
# API-key providers
43+
- { host: api.anthropic.com, port: 443 }
44+
- { host: api.openai.com, port: 443 }
45+
- { host: api.deepseek.com, port: 443 }
46+
- { host: generativelanguage.googleapis.com, port: 443 }
47+
- { host: api.mistral.ai, port: 443 }
48+
- { host: api.groq.com, port: 443 }
49+
- { host: api.cerebras.ai, port: 443 }
50+
- { host: api.x.ai, port: 443 }
51+
- { host: openrouter.ai, port: 443 }
52+
- { host: zenmux.ai, port: 443 }
53+
- { host: ai-gateway.vercel.sh, port: 443 }
54+
- { host: router.huggingface.co, port: 443 }
55+
- { host: api.fireworks.ai, port: 443 }
56+
- { host: api.together.ai, port: 443 }
57+
- { host: api.kimi.com, port: 443 }
58+
- { host: api.moonshot.ai, port: 443 }
59+
- { host: api.moonshot.cn, port: 443 }
60+
- { host: api.minimax.io, port: 443 }
61+
- { host: api.minimaxi.com, port: 443 }
62+
- { host: api.xiaomimimo.com, port: 443 }
63+
- { host: token-plan-cn.xiaomimimo.com, port: 443 }
64+
- { host: token-plan-ams.xiaomimimo.com, port: 443 }
65+
- { host: token-plan-sgp.xiaomimimo.com, port: 443 }
66+
- { host: api.z.ai, port: 443 }
67+
- { host: opencode.ai, port: 443 }
68+
# Cloud providers
69+
- { host: bedrock-runtime.us-east-1.amazonaws.com, port: 443 }
70+
- { host: bedrock-runtime.eu-central-1.amazonaws.com, port: 443 }
71+
- { host: api.cloudflare.com, port: 443 }
72+
- { host: gateway.ai.cloudflare.com, port: 443 }
73+
# Subscription login / token refresh endpoints
74+
- { host: claude.ai, port: 443 }
75+
- { host: platform.claude.com, port: 443 }
76+
- { host: auth.openai.com, port: 443 }
77+
- { host: chatgpt.com, port: 443 }
78+
# Google OAuth and Cloud Code Assist
79+
- { host: accounts.google.com, port: 443 }
80+
- { host: oauth2.googleapis.com, port: 443 }
81+
- { host: cloudcode-pa.googleapis.com, port: 443 }
82+
- { host: daily-cloudcode-pa.googleapis.com, port: 443 }
83+
# xAI OAuth
84+
- { host: auth.x.ai, port: 443 }
85+
- { host: cli-chat-proxy.grok.com, port: 443 }
86+
# NVIDIA
87+
- { host: integrate.api.nvidia.com, port: 443 }
88+
# GitHub, Copilot, and source-reading endpoints
89+
- { host: github.com, port: 443 }
90+
- { host: api.github.com, port: 443 }
91+
- { host: raw.githubusercontent.com, port: 443 }
92+
- { host: release-assets.githubusercontent.com, port: 443 }
93+
- { host: api.githubcopilot.com, port: 443 }
94+
- { host: api.individual.githubcopilot.com, port: 443 }
95+
- { host: api.business.githubcopilot.com, port: 443 }
96+
- { host: api.enterprise.githubcopilot.com, port: 443 }
97+
- { host: copilot-proxy.githubusercontent.com, port: 443 }
98+
- { host: default.exp-tas.com, port: 443 }
99+
binaries:
100+
- { path: /usr/local/bin/omp }
101+
- { path: /opt/bun/bin/bun }
102+
- { path: /opt/omp/node_modules/@oh-my-pi/pi-coding-agent/dist/cli.js }
103+
- { path: /usr/bin/curl }
104+
105+
github_ssh_over_https:
106+
name: github-ssh-over-https
107+
endpoints:
108+
- host: github.com
109+
port: 443
110+
protocol: rest
111+
enforcement: enforce
112+
rules:
113+
# Git Smart HTTP read-only: allow clone, fetch, pull
114+
# Discovery (query string is included in path matching)
115+
- allow:
116+
method: GET
117+
path: "/**/info/refs*"
118+
# Data transfer for reads (all repos)
119+
- allow:
120+
method: POST
121+
path: "/**/git-upload-pack"
122+
# Data transfer for writes
123+
# - allow:
124+
# method: POST
125+
# path: "/**/git-receive-pack"
126+
binaries:
127+
- { path: /usr/bin/git }
128+
129+
# --- GitHub REST API (read-only) ---
130+
github_rest_api:
131+
name: github-rest-api
132+
endpoints:
133+
- host: api.github.com
134+
port: 443
135+
protocol: rest
136+
enforcement: enforce
137+
access: read-only
138+
binaries:
139+
- { path: /usr/bin/gh }
140+
141+
pypi:
142+
name: pypi
143+
endpoints:
144+
- { host: pypi.org, port: 443 }
145+
- { host: files.pythonhosted.org, port: 443 }
146+
# uv python install downloads from python-build-standalone on GitHub
147+
- { host: github.com, port: 443 }
148+
- { host: objects.githubusercontent.com, port: 443 }
149+
# uv resolves python-build-standalone release metadata via the GitHub API
150+
- { host: api.github.com, port: 443 }
151+
- { host: downloads.python.org, port: 443 }
152+
binaries:
153+
- { path: /sandbox/.venv/bin/python }
154+
- { path: /sandbox/.venv/bin/python3 }
155+
- { path: /sandbox/.venv/bin/pip }
156+
- { path: /app/.venv/bin/python }
157+
- { path: /app/.venv/bin/python3 }
158+
- { path: /app/.venv/bin/pip }
159+
- { path: /usr/local/bin/uv }
160+
# Managed Python installations from uv python install
161+
- { path: "/sandbox/.uv/python/**" }

0 commit comments

Comments
 (0)