merge: resolve conflicts with origin/main

Adopt main's refactored prepareMockAgentDataHome that returns
platform-aware env vars via candidateInstallDirs, and use the
returned agentEnv in integration tests. Remove duplicate
installDirsForDataHome helper.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nathan Flurry 2026-03-05 17:55:11 -08:00
commit d8d0884d0a
3 changed files with 32 additions and 30 deletions

View file

@ -14,15 +14,16 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@main
- uses: Swatinem/rust-cache@v2
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install
- run: npm install -g tsx
- name: Run checks
run: ./scripts/release/main.ts --version 0.0.0 --check
run: ./scripts/release/main.ts --version 0.0.0 --only-steps run-ci-checks
- name: Run ACP v1 server tests
run: |
cargo test -p sandbox-agent-agent-management
@ -31,5 +32,3 @@ jobs:
cargo test -p sandbox-agent --lib
- name: Run SDK tests
run: pnpm --dir sdks/typescript test
- name: Run Inspector browser E2E
run: pnpm --filter @sandbox-agent/inspector test:agent-browser

View file

@ -1,7 +1,30 @@
import { chmodSync, mkdirSync, writeFileSync } from "node:fs";
import { join } from "node:path";
export function prepareMockAgentDataHome(dataHome: string): void {
function candidateInstallDirs(dataHome: string): string[] {
const dirs = [join(dataHome, "sandbox-agent", "bin")];
if (process.platform === "darwin") {
dirs.push(join(dataHome, "Library", "Application Support", "sandbox-agent", "bin"));
} else if (process.platform === "win32") {
dirs.push(join(dataHome, "AppData", "Roaming", "sandbox-agent", "bin"));
}
return dirs;
}
export function prepareMockAgentDataHome(dataHome: string): Record<string, string> {
const runtimeEnv: Record<string, string> = {};
if (process.platform === "darwin") {
runtimeEnv.HOME = dataHome;
runtimeEnv.XDG_DATA_HOME = join(dataHome, ".local", "share");
} else if (process.platform === "win32") {
runtimeEnv.USERPROFILE = dataHome;
runtimeEnv.APPDATA = join(dataHome, "AppData", "Roaming");
runtimeEnv.LOCALAPPDATA = join(dataHome, "AppData", "Local");
} else {
runtimeEnv.HOME = dataHome;
runtimeEnv.XDG_DATA_HOME = dataHome;
}
const nodeScript = String.raw`#!/usr/bin/env node
const { createInterface } = require("node:readline");
@ -115,7 +138,7 @@ rl.on("line", (line) => {
});
`;
for (const installDir of installDirsForDataHome(dataHome)) {
for (const installDir of candidateInstallDirs(dataHome)) {
const processDir = join(installDir, "agent_processes");
mkdirSync(processDir, { recursive: true });
@ -138,20 +161,6 @@ rl.on("line", (line) => {
chmodSync(runner, 0o755);
}
}
}
function installDirsForDataHome(dataHome: string): string[] {
const candidates = new Set<string>([
join(dataHome, "sandbox-agent", "bin"),
]);
if (process.platform === "darwin") {
candidates.add(join(dataHome, "Library", "Application Support", "sandbox-agent", "bin"));
}
if (process.platform === "win32") {
candidates.add(join(dataHome, "AppData", "Roaming", "sandbox-agent", "bin"));
}
return [...candidates];
return runtimeEnv;
}

View file

@ -173,19 +173,13 @@ describe("Integration: TypeScript SDK flat session API", () => {
beforeAll(async () => {
dataHome = mkdtempSync(join(tmpdir(), "sdk-integration-"));
prepareMockAgentDataHome(dataHome);
const agentEnv = prepareMockAgentDataHome(dataHome);
handle = await spawnSandboxAgent({
enabled: true,
log: "silent",
timeoutMs: 30000,
env: {
XDG_DATA_HOME: dataHome,
HOME: dataHome,
USERPROFILE: dataHome,
APPDATA: join(dataHome, "AppData", "Roaming"),
LOCALAPPDATA: join(dataHome, "AppData", "Local"),
},
env: agentEnv,
});
baseUrl = handle.baseUrl;
token = handle.token;