Skip to content

Commit 9275f36

Browse files
authored
[Experimental] Add Sandboxy binary (#607)
Sandboxy is an example tool to run isolated coding agents.
1 parent e1e31b7 commit 9275f36

33 files changed

Lines changed: 5132 additions & 4 deletions

.github/workflows/containerization-build-template.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ jobs:
5050
make protos
5151
if ! git diff --quiet ; then echo the following files require formatting or license headers: ; git diff --name-only ; false ; fi
5252
53-
- name: Make containerization and docs
53+
- name: Make containerization, examples, and docs
5454
run: |
55-
make clean containerization docs
55+
make clean containerization examples docs
5656
tar cfz _site.tgz _site
5757
env:
5858
BUILD_CONFIGURATION: ${{ inputs.release && 'release' || 'debug' }}

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ swift-fmt:
203203
@$(SWIFT) format --recursive --configuration .swift-format -i $(SWIFT_SRC)
204204

205205
swift-fmt-check:
206-
@echo Checking code formatting compliance...
207-
@$(SWIFT) format lint --recursive --strict --configuration .swift-format-nolint $(SWIFT_SRC)
206+
@echo Checking code formatting compliance...
207+
@$(SWIFT) format lint --recursive --strict --configuration .swift-format-nolint $(SWIFT_SRC)
208208

209209
.PHONY: update-licenses
210210
update-licenses:
@@ -246,6 +246,14 @@ cleancontent:
246246
@echo Cleaning the content...
247247
@rm -rf ~/Library/Application\ Support/com.apple.containerization
248248

249+
.PHONY: examples
250+
examples:
251+
@echo Building examples...
252+
@mkdir -p bin
253+
@"$(MAKE)" -C examples/sandboxy build BUILD_CONFIGURATION=$(BUILD_CONFIGURATION)
254+
@install examples/sandboxy/bin/sandboxy ./bin/
255+
@codesign --force --sign - --timestamp=none --entitlements=signing/vz.entitlements bin/sandboxy
256+
249257
.PHONY: clean
250258
clean:
251259
@echo Cleaning build files...

examples/sandboxy/Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright © 2026 Apple Inc. and the Containerization project authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
BUILD_CONFIGURATION ?= debug
16+
SWIFT = /usr/bin/swift
17+
SWIFT_STRIP := $(if $(filter release,$(BUILD_CONFIGURATION)),-Xlinker -s)
18+
BUILD_BIN_DIR = $(shell $(SWIFT) build -c $(BUILD_CONFIGURATION) --show-bin-path)
19+
20+
.PHONY: all build clean run fmt
21+
22+
all: build
23+
24+
build:
25+
$(SWIFT) build -c $(BUILD_CONFIGURATION) $(SWIFT_STRIP)
26+
@mkdir -p bin
27+
@install "$(BUILD_BIN_DIR)/sandboxy" ./bin/
28+
codesign --force --sign - --entitlements sandboxy.entitlements ./bin/sandboxy
29+
30+
clean:
31+
$(SWIFT) package clean
32+
rm -rf bin
33+
34+
run: build
35+
./bin/sandboxy
36+
37+
fmt:
38+
$(SWIFT) format --in-place --recursive Sources/

examples/sandboxy/Package.resolved

Lines changed: 249 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/sandboxy/Package.swift

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// swift-tools-version: 6.2
2+
//===----------------------------------------------------------------------===//
3+
// Copyright © 2026 Apple Inc. and the Containerization project authors.
4+
//
5+
// Licensed under the Apache License, Version 2.0 (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// https://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
//===----------------------------------------------------------------------===//
17+
18+
import PackageDescription
19+
20+
let containerizationVersion = "0.26.5"
21+
22+
let package = Package(
23+
name: "sandboxy",
24+
platforms: [
25+
.macOS("26.0")
26+
],
27+
products: [
28+
.executable(
29+
name: "sandboxy",
30+
targets: ["sandboxy"]
31+
)
32+
],
33+
dependencies: [
34+
.package(url: "https://github.com/apple/containerization.git", from: "0.30.0"),
35+
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.3.0"),
36+
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
37+
.package(url: "https://github.com/apple/swift-nio.git", from: "2.65.0"),
38+
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.20.1"),
39+
],
40+
targets: [
41+
.executableTarget(
42+
name: "sandboxy",
43+
dependencies: [
44+
.product(name: "Containerization", package: "containerization"),
45+
.product(name: "ContainerizationExtras", package: "containerization"),
46+
.product(name: "ContainerizationOS", package: "containerization"),
47+
.product(name: "ContainerizationArchive", package: "containerization"),
48+
.product(name: "AsyncHTTPClient", package: "async-http-client"),
49+
.product(name: "NIOCore", package: "swift-nio"),
50+
.product(name: "NIOPosix", package: "swift-nio"),
51+
.product(name: "NIOHTTP1", package: "swift-nio"),
52+
.product(name: "ArgumentParser", package: "swift-argument-parser"),
53+
.product(name: "Logging", package: "swift-log"),
54+
],
55+
)
56+
]
57+
)

0 commit comments

Comments
 (0)