diff --git a/README.md b/README.md index 150f822..2b3114a 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ This repo is the community ecosystem around OpenShell -- a hub for contributed s | `sandboxes/gemini/` | Gemini CLI workflows | | `sandboxes/nvidia-gpu/` | GPU-enabled VM sandbox image with NVIDIA userspace tooling | | `sandboxes/ollama/` | Ollama for local and cloud LLMs with Claude Code, Codex, OpenCode pre-installed | +| `sandboxes/omp/` | OMP coding agent workflows | | `sandboxes/pi/` | [Pi](https://pi.dev) pre-installed | | `sandboxes/sdg/` | Synthetic data generation workflows | diff --git a/sandboxes/omp/Dockerfile b/sandboxes/omp/Dockerfile new file mode 100644 index 0000000..6390967 --- /dev/null +++ b/sandboxes/omp/Dockerfile @@ -0,0 +1,52 @@ +# syntax=docker/dockerfile:1.4 + +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# OMP Coding Agent sandbox image for OpenShell +# +# Builds on the community base sandbox and adds OMP with Bun. +# Build: docker build -t openshell-omp:latest --build-arg BASE_IMAGE=openshell-base . +# Run locally: openshell sandbox create --from openshell-omp:latest + +ARG BASE_IMAGE=ghcr.io/nvidia/openshell-community/sandboxes/base:latest +FROM ${BASE_IMAGE} + +ARG BUN_VERSION=1.3.14 +ARG OMP_VERSION=17.4.0 + +ENV BUN_INSTALL=/opt/bun \ + PATH="/opt/bun/bin:${PATH}" + +USER root + +# Install Bun and its unzip dependency. +RUN apt-get update && apt-get install -y --no-install-recommends \ + unzip \ + && rm -rf /var/lib/apt/lists/* \ + && curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}" \ + && test "$(/opt/bun/bin/bun --version)" = "${BUN_VERSION}" + +# Install the published OMP package in a controlled application directory. +RUN mkdir -p /opt/omp \ + && printf '{\n "private": true,\n "dependencies": {\n "@oh-my-pi/pi-coding-agent": "%s"\n }\n}\n' "${OMP_VERSION}" > /opt/omp/package.json \ + && cd /opt/omp \ + && /opt/bun/bin/bun install --production --linker hoisted \ + && test -f /opt/omp/node_modules/@oh-my-pi/pi-coding-agent/dist/cli.js + +# Keep the runtime and package paths explicit for the sandbox policy. +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' \ + > /usr/local/bin/omp \ + && chown root:root /usr/local/bin/omp \ + && chmod 755 /usr/local/bin/omp + +# Keep Bun on PATH for login shells as well as the container environment. +RUN printf 'export PATH="/opt/bun/bin:/sandbox/.venv/bin:/usr/local/bin:/usr/bin:/bin"\n' \ + >> /sandbox/.bashrc + +# Copy the complete OMP-specific sandbox policy. +COPY policy.yaml /etc/openshell/policy.yaml + +USER sandbox + +ENTRYPOINT ["/bin/bash"] diff --git a/sandboxes/omp/README.md b/sandboxes/omp/README.md new file mode 100644 index 0000000..80cf03a --- /dev/null +++ b/sandboxes/omp/README.md @@ -0,0 +1,56 @@ +# OMP Sandbox + +OpenShell sandbox image pre-configured with [OMP](https://github.com/can1357/oh-my-pi) — a terminal coding agent. + +## What's Included + +- **OMP** (`@oh-my-pi/pi-coding-agent@17.4.0`) — coding agent CLI +- **Bun** 1.3.14 — pinned JavaScript runtime +- Everything from the [base sandbox](../base/README.md) + +## Build + +From this directory: + +```bash +docker build -t openshell-omp:latest . +``` + +To build against a specific base image: + +```bash +docker build -t openshell-omp:latest --build-arg BASE_IMAGE=ghcr.io/nvidia/openshell-community/sandboxes/base:latest . +``` + +## Usage + +A gateway is required for OpenShell sandbox creation. +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. + +### Create a sandbox + +```bash +openshell sandbox create --from openshell-omp:latest +``` + +### Start OMP directly + +```bash +openshell sandbox create --from openshell-omp:latest -- omp +``` + +### Attach an OpenShell provider + +Use an already-created provider instance to attach credentials without putting a raw secret in the command line: + +```bash +openshell sandbox create --from openshell-omp:latest --name omp-dev --provider my-nvidia -- omp +``` + +`--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. + +## Network policy + +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. + +Other providers and endpoints are denied until they are intentionally added to the policy and the image is rebuilt. diff --git a/sandboxes/omp/policy.yaml b/sandboxes/omp/policy.yaml new file mode 100644 index 0000000..56cdd1f --- /dev/null +++ b/sandboxes/omp/policy.yaml @@ -0,0 +1,161 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +version: 1 + +# --- Sandbox setup configuration (queried once at startup) --- + +filesystem_policy: + include_workdir: true + read_only: + - /usr + - /lib + - /proc + - /dev/urandom + - /app + - /etc + - /var/log + - /opt + read_write: + - /sandbox + - /tmp + - /dev/null + +landlock: + compatibility: best_effort + +process: + run_as_user: sandbox + run_as_group: sandbox + +# --- Network policies (queried per-CONNECT request) --- +# +# Each named policy maps a set of allowed (binary, endpoint) pairs. +# Binary identity is resolved via /proc/net/tcp inode lookup + /proc/{pid}/exe. +# Ancestors (/proc/{pid}/status PPid walk) and cmdline paths are also matched. +# SHA256 integrity is enforced in Rust via trust-on-first-use, not here. + +network_policies: + omp: + name: omp + endpoints: + # API-key providers + - { host: api.anthropic.com, port: 443 } + - { host: api.openai.com, port: 443 } + - { host: api.deepseek.com, port: 443 } + - { host: generativelanguage.googleapis.com, port: 443 } + - { host: api.mistral.ai, port: 443 } + - { host: api.groq.com, port: 443 } + - { host: api.cerebras.ai, port: 443 } + - { host: api.x.ai, port: 443 } + - { host: openrouter.ai, port: 443 } + - { host: zenmux.ai, port: 443 } + - { host: ai-gateway.vercel.sh, port: 443 } + - { host: router.huggingface.co, port: 443 } + - { host: api.fireworks.ai, port: 443 } + - { host: api.together.ai, port: 443 } + - { host: api.kimi.com, port: 443 } + - { host: api.moonshot.ai, port: 443 } + - { host: api.moonshot.cn, port: 443 } + - { host: api.minimax.io, port: 443 } + - { host: api.minimaxi.com, port: 443 } + - { host: api.xiaomimimo.com, port: 443 } + - { host: token-plan-cn.xiaomimimo.com, port: 443 } + - { host: token-plan-ams.xiaomimimo.com, port: 443 } + - { host: token-plan-sgp.xiaomimimo.com, port: 443 } + - { host: api.z.ai, port: 443 } + - { host: opencode.ai, port: 443 } + # Cloud providers + - { host: bedrock-runtime.us-east-1.amazonaws.com, port: 443 } + - { host: bedrock-runtime.eu-central-1.amazonaws.com, port: 443 } + - { host: api.cloudflare.com, port: 443 } + - { host: gateway.ai.cloudflare.com, port: 443 } + # Subscription login / token refresh endpoints + - { host: claude.ai, port: 443 } + - { host: platform.claude.com, port: 443 } + - { host: auth.openai.com, port: 443 } + - { host: chatgpt.com, port: 443 } + # Google OAuth and Cloud Code Assist + - { host: accounts.google.com, port: 443 } + - { host: oauth2.googleapis.com, port: 443 } + - { host: cloudcode-pa.googleapis.com, port: 443 } + - { host: daily-cloudcode-pa.googleapis.com, port: 443 } + # xAI OAuth + - { host: auth.x.ai, port: 443 } + - { host: cli-chat-proxy.grok.com, port: 443 } + # NVIDIA + - { host: integrate.api.nvidia.com, port: 443 } + # GitHub, Copilot, and source-reading endpoints + - { host: github.com, port: 443 } + - { host: api.github.com, port: 443 } + - { host: raw.githubusercontent.com, port: 443 } + - { host: release-assets.githubusercontent.com, port: 443 } + - { host: api.githubcopilot.com, port: 443 } + - { host: api.individual.githubcopilot.com, port: 443 } + - { host: api.business.githubcopilot.com, port: 443 } + - { host: api.enterprise.githubcopilot.com, port: 443 } + - { host: copilot-proxy.githubusercontent.com, port: 443 } + - { host: default.exp-tas.com, port: 443 } + binaries: + - { path: /usr/local/bin/omp } + - { path: /opt/bun/bin/bun } + - { path: /opt/omp/node_modules/@oh-my-pi/pi-coding-agent/dist/cli.js } + - { path: /usr/bin/curl } + + github_ssh_over_https: + name: github-ssh-over-https + endpoints: + - host: github.com + port: 443 + protocol: rest + enforcement: enforce + rules: + # Git Smart HTTP read-only: allow clone, fetch, pull + # Discovery (query string is included in path matching) + - allow: + method: GET + path: "/**/info/refs*" + # Data transfer for reads (all repos) + - allow: + method: POST + path: "/**/git-upload-pack" + # Data transfer for writes + # - allow: + # method: POST + # path: "/**/git-receive-pack" + binaries: + - { path: /usr/bin/git } + + # --- GitHub REST API (read-only) --- + github_rest_api: + name: github-rest-api + endpoints: + - host: api.github.com + port: 443 + protocol: rest + enforcement: enforce + access: read-only + binaries: + - { path: /usr/bin/gh } + + pypi: + name: pypi + endpoints: + - { host: pypi.org, port: 443 } + - { host: files.pythonhosted.org, port: 443 } + # uv python install downloads from python-build-standalone on GitHub + - { host: github.com, port: 443 } + - { host: objects.githubusercontent.com, port: 443 } + # uv resolves python-build-standalone release metadata via the GitHub API + - { host: api.github.com, port: 443 } + - { host: downloads.python.org, port: 443 } + binaries: + - { path: /sandbox/.venv/bin/python } + - { path: /sandbox/.venv/bin/python3 } + - { path: /sandbox/.venv/bin/pip } + - { path: /app/.venv/bin/python } + - { path: /app/.venv/bin/python3 } + - { path: /app/.venv/bin/pip } + - { path: /usr/local/bin/uv } + # Managed Python installations from uv python install + - { path: "/sandbox/.uv/python/**" }