LazyBoy2/docs/ACCEPTANCE.md

5.5 KiB
Raw Blame History

GrokBoy acceptance

P0 — streaming chat

  • Cargo workspace grokboy-core + grokboy
  • Env: GROKBOY_API_KEY / XAI_API_KEY / OPENAI_API_KEY
  • Default base https://api.x.ai/v1
  • grokboy chat streams assistant tokens
  • cargo test passes without API key

P1 — tools + ReAct

  • shell, list_dir, read_file, write_file
  • Multi-step tool loop
  • Sessions under ~/.grokboy/sessions/
  • grokboy run / grokboy smoke
  • Default model grok-4.6

P2 — completion contract

  • report_done / report_blocked stop the loop with a clear verdict
  • Loop guard (identical tool rounds ×3 → blocked)
  • Context truncation (GROKBOY_CONTEXT_CHARS, default ~100k)
  • Offline smoke/tests cover P2 without API key

P3 — browser

  • Playwright DOM path (no screenshot-first)
  • Tools: browser_navigate, browser_snapshot, browser_click, browser_type, browser_eval
  • Thin Node helper under tools/playwright/ (JSONL / one-shot JSON)
  • Fail closed with install hint when Node/Playwright/Chromium missing
  • cargo test / grokboy smoke pass without Playwright browsers installed

P4 — human browser handoff

  • Spec: docs/PRODUCT.md (north star, P0P3, P4, non-goals)
  • Tool browser_handoff (reason required, optional timeout_secs)
  • Headed Chromium for handoff (handoff_prepare; relaunch if was headless)
  • Bilingual (繁中 + EN) terminal instructions; Enter continue / abort / timeout → fail-closed
  • After resume: DOM snapshot returned as tool result
  • Env docs: GROKBOY_BROWSER_HEADED, GROKBOY_HANDOFF_AUTO
  • Wired into tool defs + agent system prompt; fail-closed if no browser
  • Offline tests / smoke without API key or interactive stdin (GROKBOY_HANDOFF_AUTO)
  • README status table updated

P5 — interactive multi-turn agent

  • grokboy agent REPL: read line → ReAct with tools → print verdict → save session
  • /exit /quit leave; /session show id; empty line ignored
  • --session <id> resume; auto-create + print session id when omitted
  • Keep run one-shot; keep chat streaming no-tools
  • Same tool-capable system prompt (AGENT_SYSTEM); Traditional Chinese welcome
  • Docs: ACCEPTANCE P5, PRODUCT.md note, README commands/status
  • Offline smoke/tests: agent parses / help lists it; multi-turn session plumbing without API
  • cargo test green without API key

P6 — scenario playbooks + confirm-before-post

  • Reusable pattern docs: docs/scenarios/README.md, docs/SCENARIO-TEMPLATE.md
  • Template prompts: prompts/templates/phase-a.txt, phase-b.txt (placeholders)
  • Example (not sole path): Shopee→Threads under docs/scenarios/examples/ + prompts/examples/
  • Tool request_user_confirm (reason, optional prompt, optional timeout_secs)
  • Bilingual banner; yes/y/Enter approve; no/abort deny; timeout = deny (fail-closed)
  • Env: GROKBOY_CONFIRM_AUTO (fallback GROKBOY_HANDOFF_AUTO)
  • AGENT_SYSTEM: never irreversible public social publish without explicit approval this turn or confirm approved; prefer draft → confirm → act; handoff for auth only
  • Wired in tools.rs / confirm.rs; offline unit + smoke
  • PRODUCT.md / README pointer to scenario playbooks
  • cargo test / grokboy smoke green without API key

P7 slice — agent UX polish

  • AGENT_SYSTEM: natural text for greetings/small talk/no-tools; report_done only for finished tool workflows; report_blocked when stuck
  • Max-rounds: progress summary via final no-tools complete (fallback to bare message); offline injectable completer covered in unit tests
  • Env GROKBOY_MAX_ROUNDS (default 12) used by CLI run/agent; keep DEFAULT_MAX_ROUNDS = 12
  • CLI Blocked recovery hint (Traditional Chinese) for run and agent; agent REPL stays open on blocked
  • Docs note in PRODUCT.md / ACCEPTANCE; cargo test / grokboy smoke green without API key

P8 — auto-continue chunks like Grok Bot

  • GROKBOY_MAX_ROUNDS = rounds per chunk (default 12); auto-continue another chunk in same run_agent when chunk ends without completion
  • Progress summary between chunks (no-tools); stderr live progress unless GROKBOY_PROGRESS=0
  • Absolute ceiling GROKBOY_MAX_ROUNDS_TOTAL (default 48) → Blocked + progress + exhausted note
  • Loop guard / identical tool rounds ×3 still Blocked without auto-continue
  • AGENT_SYSTEM: large work may continue in chunks; still report_done when finished; don't stop early to "save rounds"
  • CLI run/agent use per-chunk budget; recovery hint only on true stop (loop / total ceiling)
  • Offline tests: >chunk then Done; total ceiling Blocked; loop guard unchanged
  • Docs PRODUCT / ACCEPTANCE / README; cargo test / grokboy smoke green without API key

Live terminal progress + conclusion only when done

  • Stderr progress always on unless GROKBOY_PROGRESS=0: 〔開始〕 / 〔思考中〕 / 〔工具〕 / 〔完成〕|〔失敗〕 / 〔進度|尚未完成〕〔續跑〕 / 〔結束〕 (flushed; no long blank waits)
  • AGENT_SYSTEM: no mid-task report_done or final wrap-up; keep tools while researching; partial mid-flight text only if needed; report_done = final delivery
  • CLI: Done/Answer → blank line + 〔結論〕; Blocked keeps recovery hint; chunk progress is stderr-only (not the final answer)
  • Offline unit test: progress callback invoked on rounds; cargo test / grokboy smoke green without API key