41 lines
4.8 KiB
Markdown
41 lines
4.8 KiB
Markdown
# LazyBoy product
|
||
|
||
LazyBoy is a general-purpose local CLI agent: **observe → decide → act → verify → respond**. The model chooses the next action from the current environment and user objective. Scenario playbooks are optional guidance, never a fixed task router.
|
||
|
||
The interaction rules below describe legacy single-session mode. Named-agent mode keeps new chat separate from background work and uses task-specific controls.
|
||
|
||
## 人類與 agent 接手原則
|
||
|
||
這是通用任務規則,不限登入或特定網站:agent 先使用可行工具;某個步驟需要人類處理時,說明阻礙並交接最小必要操作,保留 task、計畫與資源 session。人類完成後重新觀察,再繼續工作。仍有阻礙時提供具體替代路線與停止選項,不把單一步驟卡住直接當成整份任務不能做,也不重複無效嘗試。
|
||
|
||
主 agent 會收到背景 worker 的實際工具清單,因此知道它可以交辦瀏覽器/檔案/指令工作。舊對話中的「沒有瀏覽器能力」不會被當成目前能力的依據。登入憑證在工具瀏覽器由人類輸入,不在聊天收集。
|
||
|
||
## Interaction
|
||
|
||
- For action tasks, the first action is `send_message`, then tools. Multi-stage work uses a short `update_plan` checklist.
|
||
- `send_message` is the only user-visible voice. Plain assistant text is a scratchpad. A no-tool response ends the turn (Grok Bot loop). `report_progress` is a text `send_message` alias and continues.
|
||
- Commands background after `block_until_ms` (default 30s). Jobs are not killed on `answer`/`done`.
|
||
- Path ladder (runtime): try MCP/files → `web_fetch`/`web_search` → `browser_*` → pixels; `computerUse` needs a lower rung or `force=true`. See [CORE-GAPS](CORE-GAPS.md).
|
||
- `spawn_subagent` returns immediately. If the model yields while a subagent or command is still running, the runtime waits and injects a revival (Grok Bot background completion). `check_subagent` / `message_subagent` / `stop_subagent` manage live children; do not poll for completion.
|
||
- Human questions, confirmations and handoff **end the turn**. The next user message is the answer; there is no timeout-and-continue.
|
||
- In the REPL, background commands/subagents return the prompt. Completion injects a revival and continues automatically; typed input meanwhile is steering. `lazyboy run` still waits in-process so the job is not lost when the process exits.
|
||
- Ctrl-C or `/stop` cancels a running turn and preserves resumable state. The REPL remains open; a one-shot run exits 130.
|
||
|
||
## Runtime
|
||
|
||
Model requests are bounded by `LAZYBOY_MAX_ROUNDS_TOTAL` (default 5000). `LAZYBOY_MAX_ROUNDS` only controls local progress frequency. A 20-second heartbeat identifies the operation actually being awaited.
|
||
|
||
Two identical action/result rounds inject a reminder; three stop as blocked. Empty model responses retry up to three times. File reads/search/`web_fetch`/`send_message` in one batch run in parallel; commands, writes and browser tools stay serial. Successful controlled waits use their own deadlines rather than the identical-output guard.
|
||
|
||
The core publishes typed events through `Runtime::set_event_handler`; CLI formatting lives in the binary. Tool output, not narrative promises, drives the next request. Process output is streamed to local files and returned incrementally, with one foreground process group per session.
|
||
|
||
Checkpoint before and after tools, retain plan/pending questions/command metadata/browser URL, and pair every call with a result. On recovery, missing outcomes become explicit unknown results; never replay automatically. Persistent browser profiles include session cookies. Context trimming operates on request copies, preserving stored history, system instructions and user constraints.
|
||
|
||
## Boundaries
|
||
|
||
Current target: macOS CLI plus a split web stack — Rust `lazyboy serve` is JSON/SSE API for **named Agents** (not session files); the Vite/React app in `web/` is the Grok Bot-shaped shell (agent sidebar, conversation, composer, computer overlay, PWA). Optional Playwright DOM browser and Docker box desktop. Not an Electron clone. Persistent named agents use a local daemon, private memory and a background task scheduler; see [TEAM](TEAM.md). Desktop pixel control is a `computerUse` subagent (`computer` via xdotool); the parent cannot click. No separate search key, Electron UI, PTY, CUA, or per-agent virtual monitors in this version. Browser-only canvas apps and arbitrary natural-language task correctness remain outside what this MVP can guarantee.
|
||
|
||
Legacy `chat` stays a no-tools streaming chat. `shell` stays available with a 30-second deadline. Synchronous human-wait library helpers are retained for AUTO/offline compatibility; interactive callers must supply the runtime input broker.
|
||
|
||
See [CLI-FLOW](CLI-FLOW.md) for the implementation contract and [ACCEPTANCE](ACCEPTANCE.md) for tests.
|