mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 07:02:29 +01:00
The web app's local-runtime paths (RUNTIME_AVAILABLE=true, the laptop's own server) still fell back to zellij wherever no owned PTY was found: inject-core gated on "is the tab open in Zellij" and typed into a tab by name, the control poll and stream listed zellij tabs as the fleet, switch-agent quit agents with keystrokes and /proc scans, /api/control/agent restarted projects with `zellij action write-chars`, clear-context typed "/clear" into a tab, and a focus-tab route moved the operator's terminal from the browser. Each was a second definition of "where an agent runs", and each is where a dispatch could land in a tab named "Tab #9". Now there is one definition: the owned workspace registry. - src/lib/agent-execution/owned.ts — listOwnedTabs (the fleet's open tabs on this runtime), ownedWorkspaceFor, injectOwned, NoLiveSessionError. - inject-core: no tab gate, no typing-hook check. A live owned PTY is written to directly; a tab with no PTY QUEUES a dispatch (executeInject.queueOnly) so the runner cold-starts the agent — visible in Control, never a keystroke into a guessed terminal. - /api/control + /api/control/stream + /api/control/open-tabs: open tabs are owned PTYs. The API field `zellijTabs` is renamed `liveTabs` end to end. - /api/orchestration/run: prompts go to the owned PTY; the codex/gemini task script runs as its own owned process (argument vector, no shell line). - switch-agent, /api/control/agent (apply to open tabs): terminate the owned PTY and provision the new agent; projects with no live session are skipped. - clear-context: 409 "no running agent" instead of typing at nothing. - /api/control/focus-tab deleted with its Control buttons and the deep-link focus call; the terminal is the web terminal. - control-fast-state no longer reads ZELLIJ_PANE_ID from /proc; the pane→tab join and tab-by-cwd are gone. - Deleted: src/lib/zellij.ts, src/lib/terminals/*, src/lib/agent-runtime.ts, home/worker.ts (the retired bash-daemon consumer), src/lib/ansi.ts and buildAgentLaunchCommand (dead once their last zellij caller went). - shellEscape moves to src/lib/shell-escape.ts; it was never about zellij. Verified: tsc, eslint, 144/144 unit files, 130/130 home self-tests. Claude-Session: https://claude.ai/code/session_01WSNERoZZqW2TgqbAGHSQZf Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
64 lines
2.4 KiB
Bash
Executable File
64 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run every inline self-test suite under home/. Each suite is a single
|
|
# tsx invocation with no external test runner — see home/README.md for
|
|
# the per-module breakdown. Exits non-zero on the first failure.
|
|
#
|
|
# Use: npm run test:home
|
|
# bash scripts/test-home.sh
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
|
|
# Module → invocation. Modules with --self-test gate their boot path on
|
|
# the flag; the others (state/decide/projects/render) run their suite
|
|
# when invoked directly with no args.
|
|
declare -A SUITES=(
|
|
[state]="home/state.ts"
|
|
[decide]="home/decide.ts"
|
|
[projects]="home/projects.ts"
|
|
[render]="home/render.ts"
|
|
[emit]="home/emit.ts --self-test"
|
|
[log]="home/log.ts --self-test"
|
|
[watcher]="home/watcher.ts --self-test"
|
|
[calendar-drain]="home/calendar-drain.ts --self-test"
|
|
[action-extract]="src/lib/actions/extract-proposal.ts --self-test"
|
|
[checkin-proposal]="src/lib/actions/checkin-proposal.ts --self-test"
|
|
[operator-context]="src/lib/dispatch-operator-context-format.ts --self-test"
|
|
)
|
|
|
|
# Stable order so the output reads top-to-bottom predictably.
|
|
SUITES_ORDER=(state decide projects render emit log watcher calendar-drain action-extract checkin-proposal operator-context)
|
|
|
|
cd "$REPO_ROOT"
|
|
|
|
total_pass=0
|
|
total_fail=0
|
|
for name in "${SUITES_ORDER[@]}"; do
|
|
cmd="${SUITES[$name]}"
|
|
printf '\n→ %s\n' "$name"
|
|
# Capture full output so we can extract the N/M passed footer.
|
|
output=$(npx tsx $cmd 2>&1) || {
|
|
echo "$output"
|
|
echo "✗ $name suite failed"
|
|
exit 1
|
|
}
|
|
echo "$output"
|
|
# Parse "N/M" from the final line — most suites print "N/M passed"
|
|
# but render.ts uses "N/M intents render". Match the count tokens only.
|
|
footer=$(printf '%s' "$output" | tail -1)
|
|
if [[ "$footer" =~ ^([0-9]+)/([0-9]+) ]]; then
|
|
total_pass=$(( total_pass + ${BASH_REMATCH[1]} ))
|
|
total_fail=$(( total_fail + ${BASH_REMATCH[2]} - ${BASH_REMATCH[1]} ))
|
|
fi
|
|
done
|
|
|
|
echo
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
printf '✓ %d total tests passed across %d home/ self-test suites\n' "$total_pass" "${#SUITES[@]}"
|
|
if (( total_fail > 0 )); then
|
|
printf '✗ %d failures\n' "$total_fail"
|
|
exit 1
|
|
fi
|