Status: done (2026-11-26) Priority: 2 Size: M Arch: plans Phase: implement Design ref: design.md section 15, The API by pawn and body; A controller for any pawn; docs/plans/four-scales/README.md, 3.6 (The Sim API) and 3.10 step 2; docs/review-jobs-2026-11-25/README.md, section 6 (the API row; point 3) Touches: sim/playerplan (plan, planDay, planBegun, today, empty); sim/agenda (agenda, planGaps, buildMenu); sim/planview (planView); sim/plannext (nextOf, waitsOf); sim/player (head); sim/controller; sim/saves; sim/planchains; sim/camp; sim/upgrade; sim/chores; sim/building; sim/ladder; sim/outlook; sim/scenarios; page/ui2plan; page/ui2day; page/ui2hud; page/ui2build; page/ui2land; page/plan; page/day; page/actbar; page/play; page/gift; page/swap; page/drawer; page/tileinfo; page/ui2wood; tests/agenda.js; tests/plan.js Goal: An external agent can read and drive any pawn’s plan through the same calls the page uses for the played pawn Acceptance criteria:
Sim facade take the pawn (or body) they are about: Sim.queue, Sim.plan, Sim.head, Sim.agenda, Sim.planView, Sim.planGaps, Sim.buildMenu, Sim.waits, Sim.setAuto, Sim.wish; none reads st.player to find its pawn; the page passes the played pawn. The PR lists each old and new signature.st.player.plan: routine, sleep, tasks, chains) is the controller’s of the pawn it was made for, its owner and @state moved to sim/controller; its feeder (sim/plannext nextOf) runs for any pawn whose controller holds a plan. FORMAT raised (sim/saves): a save of an older build is refused, as docs/architecture/modules.md (Saves) says; no migration is written. (Not met: its @state is moved and its feeder runs for any pawn, but its owner in src/owners.json stays sim/playerplan, whose ops and feeder write it; VB-1754 removes sim/playerplan and makes the plan the plan record’s steps, which carries the owner. Review of VB-1746, F2.)st.player is the frame: {pawn, view} and the played line’s record for the page (left, ended, last, days), each field with its reason in its @state; VB-1689’s list of st.player’s fields agrees. (VB-1689 not built yet: its list is to be FRAME of tests/lib/invariants.js, pawn, left, ended, last, days.)tests/agenda.js and tests/plan.js drive an unplayed pawn’s plan through the keyed calls and get what the played pawn gets; node tests/smoke.js and the browser tests of the Plan tab and the day strip pass. (The plan’s own chain rule no longer asks who is played, review F1; the household rules that still do, outlook handOf, upgrade handAt, building, ladder, camp, are VB-1753’s and VB-1776’s: Sim.fireView may differ until then.)npm run verify passes; unplayed runs are unchanged (node tools/same.js --base REF prints same).
Notes:st (Sim.plan(st, pawn, op, args), …; new Sim.waits(st, pawn)); a bad id is refused (‘there is no pawn X’), a view gives null or []. Source ‘player’ for every facade call, whoever the pawn: the facade is a controller’s input.pawn.control.plan (@state in sim/controller); its contents’ writer stays sim/playerplan until VB-1754. The feeder loops planners(st) (counter planFeed); household rules read plansIn(st, hid), so unplayed runs (no st.controlled) do no work: same.js prints same.view field in the frame: the player’s view is actorView(st, pawn), derived, and a stored copy would drift; since dropped, nothing read it. FORMAT 9, older saves refused.headPlans), not when the head is played; tests/plan.js section 11 drives a plant task at an unmarked tile on the twins. F6 declined: inhabit and leaving start a fresh controller (VB-1745’s review), so a plan made by another controller is dropped then. F4, F5: VB-1834.