feat(web): Luke hands slow work to a background worker subagent

Merged
CH
13d ago
+402-63

First PR of the subagents stack. Luke can hand slow or separate work to a subagent that runs in the background while he keeps talking.

What changes

  • A general worker subagent (apps/web/eve/subagents/worker/). It's a declared subagent, built on eve 0.53.1's own support. eve runs each call as a background task and returns { status: "working", taskId, agentId } at once.
    • It gets every read a background session can carry: search_web, read_web_page, and run_in_repository.
    • It gets nothing that speaks or shows. queue_question and show_code reach the developer only through the planning turn the voice follows. draw_on_board would replace Luke's own drawing.
    • Its instructions, kept in planning.ts: never speak to the developer, return a short summary with sources or paths, and never put the private folder's text into a public search.
    • It has its own token budget (eve limits, 600k in and 40k out). task_update is disabled, because each update would wake Luke for a paid turn.
  • task_cancel is back, re-exported from eve.
  • The hosted tool set names worker and task_cancel with eve's declared inputs, so the writer keeps Luke's delegation call on the journal.
  • Admission. eve hands a dynamic resolver only the session's id and auth, never its lineage. So the worker's model and tools resolvers admit it on ownership alone (admitDelegated). Its tool calls are still checked in runTool against the root eve names there (parent.rootSessionId). The root's resolvers are reused through brainModel(admit) and hostedTools(names, admit), so there are no new edge files.
  • Planning prompt. "Working in parallel": Luke hands off anything beyond a lookup or two, briefs each worker fully, never waits on it or guesses its result, and runs at most three at once.

Tests

  • hosted-brain-host-ownership.test.ts:
    • A worker's tool call lands while its root is the conversation's session. It's refused after the conversation rotates, for another account, or with no lineage.
    • Resolvers admit a child on ownership alone and refuse another account.
  • hosted-brain-host-relay.test.ts: a turn that delegates keeps the worker call on its journal.
  • hosted-brain-host-agent.test.ts: the tool set names the planning tools plus eve's delegation tools.
  • eve build registers worker and task_cancel. ./scripts/check.sh passes.
  • The end-to-end eval (a worker runs to completion and wakes Luke) comes later in the stack.

This is a web-only change, with no Mac or UI changes.

šŸ¤– Generated with Claude Code