Skip to content
Open
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
6 changes: 6 additions & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ OUTPUT_DIR=/Users/deanocalver/Documents/Projects/Spider/e2e/out/manual-computer-
bash /Users/deanocalver/Documents/Projects/Spider/e2e/test-macos-computer-browser-node.sh
```

Default timestamped run directories are now treated as transient and removed automatically after a successful run. Set `KEEP_OUTPUT=1` when you want to keep a generated run directory, or provide an explicit `OUTPUT_DIR` when you want to preserve artifacts in a known location.

### Prerequisites

- macOS
Expand All @@ -50,6 +52,8 @@ Each run writes a timestamped artifact directory under:

`/Users/deanocalver/Documents/Projects/Spider/e2e/out/`

Successful runs clean up those auto-generated directories by default. Failed runs are preserved for debugging, and you can keep successful artifacts too with `KEEP_OUTPUT=1` or an explicit `OUTPUT_DIR`.

Important artifacts:

- `artifacts/providers.before-bind.json`
Expand Down Expand Up @@ -97,6 +101,8 @@ Each run writes a timestamped artifact directory under:

`/Users/deanocalver/Documents/Projects/Spider/e2e/out/`

Successful runs clean up those auto-generated directories by default. Failed runs are preserved for debugging, and `KEEP_OUTPUT=1` keeps successful artifacts too.

Important artifacts:

- `artifacts/control_handoff.json`
Expand Down
41 changes: 41 additions & 0 deletions e2e/output-cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

e2e_is_truthy() {
case "${1:-}" in
1|true|TRUE|yes|YES|on|ON)
return 0
;;
*)
return 1
;;
esac
}

e2e_cleanup_output_dir() {
local exit_code="$1"
local output_dir="$2"
local output_dir_was_explicit="${3:-0}"
local keep_output="${4:-}"

if [[ ! -d "$output_dir" ]]; then
return 0
fi

if e2e_is_truthy "$keep_output"; then
echo "[INFO] Preserving E2E artifacts at $output_dir because KEEP_OUTPUT is enabled"
return 0
fi

if [[ "$exit_code" -ne 0 ]]; then
echo "[INFO] Preserving failed E2E artifacts at $output_dir"
return 0
fi

if [[ "$output_dir_was_explicit" == "1" ]]; then
echo "[INFO] Preserving E2E artifacts at $output_dir because OUTPUT_DIR was set explicitly"
return 0
fi

rm -rf "$output_dir"
echo "[INFO] Removed transient E2E artifacts at $output_dir"
}
5 changes: 5 additions & 0 deletions e2e/test-cross-platform-agent-relay.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ $WindowsReviewerPrompt = Join-Path $RootDir "e2e/prompts/agent-relay-windows-rev
$Validator = Join-Path $RootDir "e2e/validate_agent_relay.py"
$RelayRunner = Join-Path $RootDir "e2e/agent_relay_runner.py"

$OutputDirWasExplicit = Test-Path Env:OUTPUT_DIR
$OutputDir = if ($env:OUTPUT_DIR) { $env:OUTPUT_DIR } else { New-RunDirectory "cross-platform-agent-relay-windows" }
$OutputDir = Ensure-RunDirectoryUnderRepo $OutputDir
$RunDirRel = Get-RunDirectoryRelative $OutputDir
Expand Down Expand Up @@ -45,6 +46,7 @@ $LocalRemoteNodeLog = Join-Path $LogDir "windows-remote-node.log"
$LocalRemoteNodeErrLog = Join-Path $LogDir "windows-remote-node.stderr.log"
$LocalRemoteNode = $null
$script:HelperEnv = $null
$script:RunSucceeded = $false

function Cleanup {
if ($null -ne $script:LocalRemoteNode -and -not $script:LocalRemoteNode.HasExited) {
Expand Down Expand Up @@ -289,6 +291,9 @@ try {
Write-Host " $RelayValidationJson"
Write-Host " $LinuxWorkerLast"
Write-Host " $WindowsReviewerLast"
$script:RunSucceeded = $true
} finally {
Cleanup
$exitCode = if ($script:RunSucceeded) { 0 } else { 1 }
Remove-RunDirectoryIfTransient -ExitCode $exitCode -Path $OutputDir -WasExplicit $OutputDirWasExplicit
}
10 changes: 9 additions & 1 deletion e2e/test-cross-platform-agent-relay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
set -euo pipefail

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "$ROOT_DIR/e2e/output-cleanup.sh"
LINUX_HELPER="$ROOT_DIR/e2e/run_linux_spiderweb_host.sh"
REMOTE_TEMPLATE_DIR="$ROOT_DIR/e2e/fixtures/agent-relay"
LINUX_WORKER_PROMPT="$ROOT_DIR/e2e/prompts/agent-relay-linux-worker.txt"
MACOS_REVIEWER_PROMPT="$ROOT_DIR/e2e/prompts/agent-relay-macos-reviewer.txt"
VALIDATOR="$ROOT_DIR/e2e/validate_agent_relay.py"

OUTPUT_DIR="${OUTPUT_DIR:-$ROOT_DIR/e2e/out/cross-platform-agent-relay-$(date +%Y%m%d-%H%M%S)-$$}"
OUTPUT_DIR_WAS_EXPLICIT=0
if [[ -n "${OUTPUT_DIR+x}" ]]; then
OUTPUT_DIR_WAS_EXPLICIT=1
else
OUTPUT_DIR="$ROOT_DIR/e2e/out/cross-platform-agent-relay-$(date +%Y%m%d-%H%M%S)-$$"
fi
case "$OUTPUT_DIR" in
"$ROOT_DIR"/*) RUN_DIR_REL="${OUTPUT_DIR#"$ROOT_DIR/"}" ;;
*)
Expand Down Expand Up @@ -38,6 +44,7 @@ REMOTE_NODE_PORT="${REMOTE_NODE_PORT:-28952}"
REMOTE_NODE_NAME="${REMOTE_NODE_NAME:-cross-macos-review-node}"
REMOTE_EXPORT_NAME="${REMOTE_EXPORT_NAME:-remote-smoke}"
REMOTE_BIND_PATH="/remote"
KEEP_OUTPUT="${KEEP_OUTPUT:-}"

LINUX_WORKER_JSONL="$LOG_DIR/linux-worker-codex.jsonl"
LINUX_WORKER_STDERR="$LOG_DIR/linux-worker-codex.stderr.log"
Expand Down Expand Up @@ -192,6 +199,7 @@ cleanup() {
if [[ -f "$LINUX_HELPER" ]] && command -v orbctl >/dev/null 2>&1; then
orb_run cleanup >/dev/null 2>&1 || true
fi
e2e_cleanup_output_dir "$exit_code" "$OUTPUT_DIR" "$OUTPUT_DIR_WAS_EXPLICIT" "$KEEP_OUTPUT"
exit "$exit_code"
}
trap cleanup EXIT
Expand Down
10 changes: 9 additions & 1 deletion e2e/test-cross-platform-computer-browser-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
set -euo pipefail

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "$ROOT_DIR/e2e/output-cleanup.sh"
LINUX_HELPER="$ROOT_DIR/e2e/run_linux_cross_platform_computer_browser_host.sh"
FIXTURE_DIR="$ROOT_DIR/e2e/fixtures/macos-computer-browser"
FIXTURE_SWIFT="$FIXTURE_DIR/ComputerFixtureApp.swift"
BROWSER_FIXTURE_DIR="$FIXTURE_DIR/browser_fixture"
WRITE_CAPABILITY_MANIFESTS="$ROOT_DIR/e2e/write_capability_manifests.py"

OUTPUT_DIR="${OUTPUT_DIR:-$ROOT_DIR/e2e/out/cross-platform-computer-browser-demo-$(date +%Y%m%d-%H%M%S)-$$}"
OUTPUT_DIR_WAS_EXPLICIT=0
if [[ -n "${OUTPUT_DIR+x}" ]]; then
OUTPUT_DIR_WAS_EXPLICIT=1
else
OUTPUT_DIR="$ROOT_DIR/e2e/out/cross-platform-computer-browser-demo-$(date +%Y%m%d-%H%M%S)-$$"
fi
case "$OUTPUT_DIR" in
"$ROOT_DIR"/*) RUN_DIR_REL="${OUTPUT_DIR#"$ROOT_DIR/"}" ;;
*)
Expand Down Expand Up @@ -37,6 +43,7 @@ LOCAL_WORKSPACE_NODE_PORT="${LOCAL_WORKSPACE_NODE_PORT:-}"
REMOTE_NODE_PORT="${REMOTE_NODE_PORT:-}"
REMOTE_NODE_NAME="${REMOTE_NODE_NAME:-cross-macos-computer-browser-node}"
REMOTE_EXPORT_NAME="${REMOTE_EXPORT_NAME:-macos-demo-export}"
KEEP_OUTPUT="${KEEP_OUTPUT:-}"

MACOS_BROWSER_FIXTURE_PORT="${MACOS_BROWSER_FIXTURE_PORT:-}"
MACOS_BROWSER_URL=""
Expand Down Expand Up @@ -226,6 +233,7 @@ cleanup() {
if [[ -f "$LINUX_HELPER" ]] && command -v orbctl >/dev/null 2>&1; then
orb_run cleanup >/dev/null 2>&1 || true
fi
e2e_cleanup_output_dir "$exit_code" "$OUTPUT_DIR" "$OUTPUT_DIR_WAS_EXPLICIT" "$KEEP_OUTPUT"
exit "$exit_code"
}
trap cleanup EXIT
Expand Down
5 changes: 5 additions & 0 deletions e2e/test-cross-platform-node-workspace.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ $RootDir = $script:RepoRoot
$RemoteFixtureDir = Join-Path $RootDir "e2e/fixtures/remote-smoke"
$LinuxHelper = Join-Path $RootDir "e2e/run_linux_spiderweb_host.sh"

$OutputDirWasExplicit = Test-Path Env:OUTPUT_DIR
$OutputDir = if ($env:OUTPUT_DIR) { $env:OUTPUT_DIR } else { New-RunDirectory "cross-platform-node-workspace-windows" }
$OutputDir = Ensure-RunDirectoryUnderRepo $OutputDir
$RunDirRel = Get-RunDirectoryRelative $OutputDir
Expand All @@ -30,6 +31,7 @@ $LocalRemoteNodeLog = Join-Path $LogDir "windows-remote-node.log"
$LocalRemoteNodeErrLog = Join-Path $LogDir "windows-remote-node.stderr.log"
$LocalRemoteNode = $null
$script:HelperEnv = $null
$script:RunSucceeded = $false

function Cleanup {
if ($null -ne $script:LocalRemoteNode -and -not $script:LocalRemoteNode.HasExited) {
Expand Down Expand Up @@ -142,6 +144,9 @@ try {
Write-Host " $handoffFile"
Write-Host " $resultFile"
Write-Host " $remoteSmokeFile"
$script:RunSucceeded = $true
} finally {
Cleanup
$exitCode = if ($script:RunSucceeded) { 0 } else { 1 }
Remove-RunDirectoryIfTransient -ExitCode $exitCode -Path $OutputDir -WasExplicit $OutputDirWasExplicit
}
10 changes: 9 additions & 1 deletion e2e/test-cross-platform-node-workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
set -euo pipefail

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "$ROOT_DIR/e2e/output-cleanup.sh"
LINUX_HELPER="$ROOT_DIR/e2e/run_linux_spiderweb_host.sh"
REMOTE_FIXTURE_DIR="$ROOT_DIR/e2e/fixtures/remote-smoke"

OUTPUT_DIR="${OUTPUT_DIR:-$ROOT_DIR/e2e/out/cross-platform-node-workspace-$(date +%Y%m%d-%H%M%S)-$$}"
OUTPUT_DIR_WAS_EXPLICIT=0
if [[ -n "${OUTPUT_DIR+x}" ]]; then
OUTPUT_DIR_WAS_EXPLICIT=1
else
OUTPUT_DIR="$ROOT_DIR/e2e/out/cross-platform-node-workspace-$(date +%Y%m%d-%H%M%S)-$$"
fi
case "$OUTPUT_DIR" in
"$ROOT_DIR"/*) RUN_DIR_REL="${OUTPUT_DIR#"$ROOT_DIR/"}" ;;
*)
Expand All @@ -31,6 +37,7 @@ LOCAL_WORKSPACE_NODE_PORT="${LOCAL_WORKSPACE_NODE_PORT:-28911}"
REMOTE_NODE_PORT="${REMOTE_NODE_PORT:-28912}"
REMOTE_NODE_NAME="${REMOTE_NODE_NAME:-cross-macos-remote-node}"
REMOTE_EXPORT_NAME="${REMOTE_EXPORT_NAME:-remote-smoke}"
KEEP_OUTPUT="${KEEP_OUTPUT:-}"

LOCAL_REMOTE_NODE_LOG="$LOG_DIR/macos-remote-node.log"
LOCAL_REMOTE_NODE_PID=""
Expand Down Expand Up @@ -118,6 +125,7 @@ cleanup() {
if [[ -f "$LINUX_HELPER" ]] && command -v orbctl >/dev/null 2>&1; then
orb_run cleanup >/dev/null 2>&1 || true
fi
e2e_cleanup_output_dir "$exit_code" "$OUTPUT_DIR" "$OUTPUT_DIR_WAS_EXPLICIT" "$KEEP_OUTPUT"
exit "$exit_code"
}
trap cleanup EXIT
Expand Down
13 changes: 9 additions & 4 deletions e2e/test-macos-computer-browser-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
set -euo pipefail

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "$ROOT_DIR/e2e/output-cleanup.sh"
SPIDERWEB_DIR="$ROOT_DIR/Spiderweb"

FIXTURE_DIR="$ROOT_DIR/e2e/fixtures/macos-computer-browser"
FIXTURE_SWIFT="$FIXTURE_DIR/ComputerFixtureApp.swift"
BROWSER_FIXTURE_DIR="$FIXTURE_DIR/browser_fixture"

OUTPUT_DIR="${OUTPUT_DIR:-$ROOT_DIR/e2e/out/macos-computer-browser-node-$(date +%Y%m%d-%H%M%S)-$$}"
OUTPUT_DIR_WAS_EXPLICIT=0
if [[ -n "${OUTPUT_DIR+x}" ]]; then
OUTPUT_DIR_WAS_EXPLICIT=1
else
OUTPUT_DIR="$ROOT_DIR/e2e/out/macos-computer-browser-node-$(date +%Y%m%d-%H%M%S)-$$"
fi
LOG_DIR="$OUTPUT_DIR/logs"
STATE_DIR="$OUTPUT_DIR/state"
ARTIFACT_DIR="$OUTPUT_DIR/artifacts"
Expand All @@ -26,6 +32,7 @@ BROWSER_FIXTURE_PORT="${BROWSER_FIXTURE_PORT:-}"
CONTROL_URL=""

KEEP_TEMP="${KEEP_TEMP:-0}"
KEEP_OUTPUT="${KEEP_OUTPUT:-$KEEP_TEMP}"
SKIP_BUILD="${SKIP_BUILD:-0}"
COMPUTER_INCLUDE_SCREENSHOT="${COMPUTER_INCLUDE_SCREENSHOT:-0}"
BROWSER_INCLUDE_SCREENSHOT="${BROWSER_INCLUDE_SCREENSHOT:-0}"
Expand Down Expand Up @@ -663,9 +670,7 @@ cleanup() {
kill "$SPIDERWEB_PID" >/dev/null 2>&1 || true
wait "$SPIDERWEB_PID" >/dev/null 2>&1 || true
fi
if [[ "$KEEP_TEMP" != "1" && -d "$OUTPUT_DIR" ]]; then
rm -rf "$OUTPUT_DIR"
fi
e2e_cleanup_output_dir "$exit_code" "$OUTPUT_DIR" "$OUTPUT_DIR_WAS_EXPLICIT" "$KEEP_OUTPUT"
exit "$exit_code"
}
trap cleanup EXIT
Expand Down
10 changes: 9 additions & 1 deletion e2e/test-mcp-bridge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@
set -euo pipefail

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "$ROOT_DIR/e2e/output-cleanup.sh"
SPIDERWEB_DIR="$ROOT_DIR/Spiderweb"

OUTPUT_DIR="${OUTPUT_DIR:-$ROOT_DIR/e2e/out/mcp-bridge-$(date +%Y%m%d-%H%M%S)-$$}"
OUTPUT_DIR_WAS_EXPLICIT=0
if [[ -n "${OUTPUT_DIR+x}" ]]; then
OUTPUT_DIR_WAS_EXPLICIT=1
else
OUTPUT_DIR="$ROOT_DIR/e2e/out/mcp-bridge-$(date +%Y%m%d-%H%M%S)-$$"
fi
LOG_DIR="$OUTPUT_DIR/logs"
ARTIFACT_DIR="$OUTPUT_DIR/artifacts"
KEEP_OUTPUT="${KEEP_OUTPUT:-}"

MCP_BRIDGE="$SPIDERWEB_DIR/zig-out/bin/spiderweb-mcp-bridge"
# On Windows the binary has an .exe extension
Expand Down Expand Up @@ -145,6 +152,7 @@ cleanup() {
if [[ -n "${FIXTURE_DIR:-}" && -d "$FIXTURE_DIR" ]]; then
rm -rf "$FIXTURE_DIR"
fi
e2e_cleanup_output_dir "$exit_code" "$OUTPUT_DIR" "$OUTPUT_DIR_WAS_EXPLICIT" "$KEEP_OUTPUT"
exit "$exit_code"
}
trap cleanup EXIT
Expand Down
46 changes: 46 additions & 0 deletions e2e/windows-e2e-common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ function New-RunDirectory {
return Join-Path $script:RepoRoot ("e2e/out/{0}-{1}-{2}" -f $Prefix, $stamp, $PID)
}

function Test-TruthyString {
param([AllowNull()][string]$Value)

if ($null -eq $Value) {
return $false
}

switch ($Value.Trim().ToLowerInvariant()) {
"1" { return $true }
"true" { return $true }
"yes" { return $true }
"on" { return $true }
default { return $false }
}
}

function Ensure-RunDirectoryUnderRepo {
param([string]$Path)

Expand All @@ -54,6 +70,36 @@ function Get-RunDirectoryRelative {
return $full.Substring($repo.Length + 1).Replace("\", "/")
}

function Remove-RunDirectoryIfTransient {
param(
[int]$ExitCode,
[string]$Path,
[bool]$WasExplicit = $false
)

if (-not (Test-Path -LiteralPath $Path)) {
return
}

if (Test-TruthyString $env:KEEP_OUTPUT -or Test-TruthyString $env:KEEP_TEMP) {
Write-Info "Preserving E2E artifacts at $Path because KEEP_OUTPUT is enabled"
return
}

if ($ExitCode -ne 0) {
Write-Info "Preserving failed E2E artifacts at $Path"
return
}

if ($WasExplicit) {
Write-Info "Preserving E2E artifacts at $Path because OUTPUT_DIR was set explicitly"
return
}

Remove-Item -LiteralPath $Path -Recurse -Force
Write-Info "Removed transient E2E artifacts at $Path"
}

function Wait-ForFile {
param(
[string]$Path,
Expand Down
23 changes: 23 additions & 0 deletions themes/zsc_modern_ai/layouts/workspace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"schema_version": 1,
"desktop": {
"open_panels": ["control", "chat", "debug"],
"focused_panel": "chat",
"close_others": false
},
"phone": {
"open_panels": ["control"],
"focused_panel": "control",
"close_others": false
},
"tablet": {
"open_panels": ["control", "chat"],
"focused_panel": "chat",
"close_others": false
},
"fullscreen": {
"open_panels": ["control", "chat"],
"focused_panel": "chat",
"close_others": false
}
}
Loading