fix(agent): bundle the codex/gemini runners + python helpers in /api/agent/daemon

The 4-file bundle that 02c2551 shipped is enough for a new customer
running the Claude agent — but agent-hook-bridge.sh references seven
more sibling files at $SCRIPT_DIR, and absence is silent failure:

  • run-codex-task.sh / run-gemini-task.sh — HARD fail when dispatching
    those agents (the bridge invokes `bash $SCRIPT_DIR/run-<agent>-task.sh
    ...` with no fallback path; tab gets the command but the runner
    doesn't exist)
  • beacon.py (+ _beacon_config.py import) — audio beacon silently no-op
  • get-idle-secs.py — X11 idle detection falls back to "always idle"
  • notify-choice.py — zenity prompt silently fails
  • sync-agent-runtime-config.py — silent no-op

Each Python helper is wrapped in `|| true` / `2>/dev/null` in the
bridge so the daemon doesn't crash, but the feature degrades and the
user has no signal why. The codex/gemini runners DO crash dispatch
for those agents.

Two-file change: add the 7 missing files to FILES in route.ts and to
outputFileTracingIncludes in next.config.ts. All cross-references in
the added files resolve within the bundle (run-*.sh call back into
agent-hook-bridge.sh; beacon.py imports _beacon_config — both shipped).
Bundle grows from 4 files / ~20 KB compressed to 11 files / ~28 KB —
still under one HTTP round trip.

Verified locally with the same pure-Node ustar builder the route uses
(scripts/test-tar-v2.mjs equivalent): all 11 files extract at the
destination root, bytes-identical to repo source, 0755 mode, valid
under system `tar -tz`. Tsc + eslint clean.

After this lands, a new customer's daemon supports Claude, Codex, AND
Gemini agent dispatch end-to-end without a repo clone.
This commit is contained in:
g-but committed 2026-05-25 00:57:09 +02:00
1 parent b2bc97fd2c
commit f3a08fde2b
2 files changed
+26 -3

No files matched your search

+11 -3
View File
@@ -10,14 +10,22 @@ const nextConfig: NextConfig = {
// isn't published to npm yet and the repo is private). Without explicit
// tracing, Vercel would tree-shake the file out of the deployment bundle.
"/api/agent/install": ["./packages/agent/bin/**"],
// Serves the bash daemon bundle (4 scripts ~1500 lines) so a new
// customer can install the local execution surface without cloning
// the repo. Same tree-shaking concern as /install above.
// Serves the bash + python daemon bundle so a new customer can install
// the full local execution surface without cloning the repo. Keep this
// list in sync with FILES in src/app/api/agent/daemon/route.ts —
// anything not traced here gets tree-shaken out of the deployment.
"/api/agent/daemon": [
"./scripts/cockpit-daemon.sh",
"./scripts/_brand.sh",
"./scripts/agent-hook-lib.sh",
"./scripts/agent-hook-bridge.sh",
"./scripts/run-codex-task.sh",
"./scripts/run-gemini-task.sh",
"./scripts/beacon.py",
"./scripts/_beacon_config.py",
"./scripts/get-idle-secs.py",
"./scripts/notify-choice.py",
"./scripts/sync-agent-runtime-config.py",
],
},
};
+15
View File
@@ -29,10 +29,25 @@ import path from "node:path";
* outputFileTracingIncludes so they land in the Vercel deployment bundle.
*/
const FILES = [
// Core daemon + shared brand/zellij helpers + bridge entry point.
"cockpit-daemon.sh",
"_brand.sh",
"agent-hook-lib.sh",
"agent-hook-bridge.sh",
// Per-agent task runners. Claude uses an inline command (no runner); codex
// and gemini require these wrappers — without them the daemon hard-fails
// when dispatching either agent. The bridge expects $SCRIPT_DIR/run-X-task.sh.
"run-codex-task.sh",
"run-gemini-task.sh",
// Python helpers referenced by agent-hook-bridge.sh. All are wrapped in
// `|| true` / `2>/dev/null` in the bridge so absence degrades gracefully —
// but real customers want the full experience (audio beacon, idle detection,
// notifications). beacon imports _beacon_config so both ship together.
"beacon.py",
"_beacon_config.py",
"get-idle-secs.py",
"notify-choice.py",
"sync-agent-runtime-config.py",
] as const;
export async function GET() {