diff options
| author | Ben Sima <ben@bensima.com> | 2025-11-24 13:59:34 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-11-24 13:59:34 -0500 |
| commit | ea466775a6b12dce67b789aa98d2c40a9c913a97 (patch) | |
| tree | cf021707fc1afb974ae5d4ff582273ca5a0b1659 /Omni/Agent | |
| parent | 5ddaf58a46c832b2f937cebac1ec2a9368bd51e9 (diff) | |
Simplify agent command
I think the cd'ing and stuff was messing with the direnv assumptions.
Diffstat (limited to 'Omni/Agent')
| -rwxr-xr-x | Omni/Agent/monitor.sh | 75 | ||||
| -rwxr-xr-x | Omni/Agent/start-worker.sh | 69 |
2 files changed, 0 insertions, 144 deletions
diff --git a/Omni/Agent/monitor.sh b/Omni/Agent/monitor.sh deleted file mode 100755 index e57611f..0000000 --- a/Omni/Agent/monitor.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env bash -# Omni/Agent/monitor.sh -# Monitor the logs of a worker agent -# Usage: ./Omni/Agent/monitor.sh [--raw] [worker-name] - -set -e - -RAW_MODE=false -WORKER="omni-worker-1" - -# Parse arguments -while [[ "$#" -gt 0 ]]; do - case $1 in - --raw) RAW_MODE=true ;; - *) WORKER="$1" ;; - esac - shift -done - -REPO_ROOT="$(git rev-parse --show-toplevel)" -WORKER_DIR="$REPO_ROOT/../$WORKER" -LOG_FILE="$WORKER_DIR/_/llm/amp.log" - -if [ ! -d "$WORKER_DIR" ]; then - echo "Error: Worker directory '$WORKER_DIR' not found." - echo "Usage: $0 [--raw] [worker-name]" - exit 1 -fi - -echo "Monitoring worker: $WORKER" -echo "Watching log: $LOG_FILE" -if [ "$RAW_MODE" = true ]; then - echo "Mode: RAW output" -else - echo "Mode: FORMATTED output" -fi -echo "---------------------------------------------------" - -# Wait for log file to appear -if [ ! -f "$LOG_FILE" ]; then - echo "Waiting for log file at $LOG_FILE..." - while [ ! -f "$LOG_FILE" ]; do - sleep 1 - done -fi - -if [ "$RAW_MODE" = true ]; then - tail -f "$LOG_FILE" -else - # Tail the log and use jq to parse/filter relevant events - tail -f "$LOG_FILE" | grep --line-buffered "^{" | jq -R -r ' - try ( - fromjson | - if .message == "executing 1 tools in 1 batch(es)" then - "🤖 THOUGHT: Planning tool execution (" + (.batches[0][0] // "unknown") + ")" - elif .message == "Tool Bash - checking permissions" then - empty - elif .message == "Tool Bash permitted - action: allow" then - "🔧 TOOL: Bash command executed" - elif .toolName != null and .message == "Processing tool completion for ledger" then - "✅ TOOL: " + .toolName + " completed" - elif .message == "ide-fs" and .method == "readFile" then - "📂 READ: " + .path - elif .message == "System prompt build complete (no changes)" then - "🧠 THINKING..." - elif .message == "System prompt build complete (first build)" then - "🚀 STARTING new task context" - elif .level == "error" then - "❌ ERROR: " + .message - else - empty - end - ) catch empty - ' -fi diff --git a/Omni/Agent/start-worker.sh b/Omni/Agent/start-worker.sh deleted file mode 100755 index 457c83c..0000000 --- a/Omni/Agent/start-worker.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Omni/Agent/start-worker.sh -# Launches an Amp worker agent in the specified worktree in a loop. -# Usage: ./Omni/Agent/start-worker.sh [worker-directory-name-or-path] -# Example: ./Omni/Agent/start-worker.sh omni-worker-1 - -TARGET="${1:-omni-worker-1}" - -# 1. Find the Main Repo (where node_modules lives) -# The first worktree listed is always the main one -MAIN_REPO="$(git worktree list --porcelain | grep '^worktree ' | head -n 1 | cut -d ' ' -f 2)" -AMP_BIN="$MAIN_REPO/node_modules/.bin/amp" -TASK_BIN="$MAIN_REPO/_/bin/task" - -# 2. Resolve Worker Path -if [ -d "$TARGET" ]; then - WORKER_PATH="$(realpath "$TARGET")" -elif [ -d "$MAIN_REPO/../$TARGET" ]; then - WORKER_PATH="$(realpath "$MAIN_REPO/../$TARGET")" -else - echo "Error: Worker directory for '$TARGET' not found." - exit 1 -fi - -if [ ! -x "$AMP_BIN" ]; then - echo "Error: Amp binary not found at '$AMP_BIN'." - exit 1 -fi - -# Ensure task binary is built/available -if [ ! -x "$TASK_BIN" ]; then - echo "Warning: Task binary not found at '$TASK_BIN'. Assuming it's in path or build it first." -fi - -# Ensure worker has local task and agent binaries -mkdir -p "$WORKER_PATH/_/bin" - -echo "Syncing worker repo..." -if ! (cd "$WORKER_PATH" && git sync); then - echo "Error: Failed to run 'git sync' in worker directory." - exit 1 -fi - -echo "Building 'task' in worker..." -if ! (cd "$WORKER_PATH" && bild Omni/Task.hs); then - echo "Error: Failed to build 'task' in worker directory." - exit 1 -fi - -echo "Building 'agent' in worker..." -if ! (cd "$WORKER_PATH" && bild Omni/Agent.hs); then - echo "Error: Failed to build 'agent' in worker directory." - exit 1 -fi - -echo "Starting Worker Agent (Haskell)" -echo " Worker Path: $WORKER_PATH" -echo " Agent Bin: $WORKER_PATH/_/bin/agent" -echo " Log File: $WORKER_PATH/_/llm/amp.log" -echo " Monitor: ./Omni/Agent/monitor.sh $TARGET" -echo " Press Ctrl+C to stop." - -# Add amp to PATH so the agent can find it -export PATH="$MAIN_REPO/node_modules/.bin:$PATH" - -# Run the agent -"$WORKER_PATH/_/bin/agent" start "$TARGET" --path "$WORKER_PATH" |
