Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/sandbox-agent-writes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"kilo-code": minor
---

Confine agent shell and file-tool writes to project and Kilo state directories with the optional macOS sandbox.
Confine agent shell and file-tool writes to project and Kilo state directories with the optional macOS and Linux sandboxes.
24 changes: 22 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ jobs:

- uses: ./.github/actions/setup-bun

# kilocode_change start
- name: Setup Zig for Linux sandbox helpers
run: |
curl --fail --location --retry 3 \
https://ziglang.org/download/0.14.0/zig-linux-x86_64-0.14.0.tar.xz \
--output "$RUNNER_TEMP/zig.tar.xz"
echo "473ec26806133cf4d1918caf1a410f8403a13d979726a9045b421b685031a982 $RUNNER_TEMP/zig.tar.xz" | sha256sum --check --status
tar -xJf "$RUNNER_TEMP/zig.tar.xz" -C "$RUNNER_TEMP"
echo "$RUNNER_TEMP/zig-linux-x86_64-0.14.0" >> "$GITHUB_PATH"
# kilocode_change end
- name: Build
id: build
run: |
Expand Down Expand Up @@ -179,6 +189,14 @@ jobs:
smoke_host() {
binary="$1"
"$binary" --version
helper="$(dirname "$binary")/bwrap"
if [[ "${{ matrix.target }}" == linux-* ]]; then
test -x "$helper"
grep -q '^SPDX-License-Identifier: LGPL-2.0-or-later$' "$(dirname "$binary")/licenses/bubblewrap/NOTICE"
"$helper" --version
"$helper" --unshare-user --disable-userns --unshare-pid --die-with-parent --new-session \
--ro-bind / / --dev /dev --proc /proc -- "$helper" --version
fi
root="$(mktemp -d)"
trap 'rm -rf "$root"' RETURN
(
Expand Down Expand Up @@ -212,8 +230,10 @@ jobs:
# as optional packages and must be installed for any Bun-compiled musl binary to run.
apk add --no-cache libstdc++ libgcc
# kilocode_change end
binary="/dist/$PACKAGE/bin/kilo"
"$binary" --version
binary="/dist/$PACKAGE/bin/kilo" # kilocode_change
"$binary" --version # kilocode_change
"/dist/$PACKAGE/bin/bwrap" --version # kilocode_change
grep -q '^SPDX-License-Identifier: LGPL-2.0-or-later$' "/dist/$PACKAGE/bin/licenses/bubblewrap/NOTICE" # kilocode_change
root="$(mktemp -d)"
trap '\''rm -rf "$root"'\'' EXIT
unset KILO_MODELS_PATH KILO_MODELS_URL KILO_CONFIG KILO_CONFIG_DIR
Expand Down
23 changes: 21 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,23 @@ jobs:
- name: Setup Bun
uses: ./.github/actions/setup-bun

# kilocode_change start
- name: Setup Zig for Linux sandbox helper
if: runner.os == 'Linux'
run: |
curl --fail --location --retry 3 \
https://ziglang.org/download/0.14.0/zig-linux-x86_64-0.14.0.tar.xz \
--output "$RUNNER_TEMP/zig.tar.xz"
echo "473ec26806133cf4d1918caf1a410f8403a13d979726a9045b421b685031a982 $RUNNER_TEMP/zig.tar.xz" | sha256sum --check --status
tar -xJf "$RUNNER_TEMP/zig.tar.xz" -C "$RUNNER_TEMP"
echo "$RUNNER_TEMP/zig-linux-x86_64-0.14.0" >> "$GITHUB_PATH"

- name: Build Linux sandbox helper
if: runner.os == 'Linux'
run: |
bun packages/opencode/script/kilocode/bubblewrap.ts --arch x64 --output "$RUNNER_TEMP/bwrap"
echo "KILO_BWRAP_PATH=$RUNNER_TEMP/bwrap" >> "$GITHUB_ENV"
# kilocode_change end
- name: Configure git identity
run: |
git config --global user.email "kilo-maintainer[bot]@users.noreply.github.com"
Expand All @@ -83,12 +100,14 @@ jobs:
KILO_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }}
KILO_TEST_PROFILE: ${{ runner.os == 'macOS' && github.event_name == 'pull_request' && 'darwin' || '' }} # kilocode_change

# kilocode_change start
- name: Run HttpApi exerciser gates
if: runner.os == 'Linux' # kilocode_change
if: runner.os == 'Linux'
working-directory: packages/opencode
run: bun run test:httpapi
# kilocode_change end

- name: Publish unit reports
- name: Publish unit reports # kilocode_change
if: always()
uses: mikepenz/action-junit-report@bccf2e31636835cf0874589931c4116687171386 # v6.4.0
with:
Expand Down
5 changes: 4 additions & 1 deletion nix/kilo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
stdenvNoCC,
callPackage,
bun,
bubblewrap,
nodejs,
sysctl,
makeBinaryWrapper,
Expand Down Expand Up @@ -39,6 +40,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {

env.MODELS_DEV_API_JSON = "${models-dev}/dist/_api.json";
env.KILO_DISABLE_MODELS_FETCH = true;
env.KILO_SKIP_BUNDLED_BWRAP = "1";
env.KILO_VERSION = finalAttrs.version;
env.KILO_CHANNEL = "local";

Expand All @@ -59,6 +61,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
install -Dm644 schema.json $out/share/kilo/schema.json

wrapProgram $out/bin/kilo \
${lib.optionalString stdenvNoCC.hostPlatform.isLinux "--set KILO_BWRAP_PATH ${bubblewrap}/bin/bwrap"} \
--prefix PATH : ${
lib.makeBinPath (
[
Expand Down Expand Up @@ -97,7 +100,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
meta = {
description = "AI-powered development tool";
homepage = "https://kilo.ai/";
license = lib.licenses.mit;
license = [ lib.licenses.mit ] ++ lib.optional stdenvNoCC.hostPlatform.isLinux lib.licenses.lgpl2Plus;
mainProgram = "kilo";
inherit (node_modules.meta) platforms;
};
Expand Down
Loading
Loading