village-builder

VB-1405: Share work candidates and track queued verbs through explicit outcomes

Status: done (2026-11-23) Priority: 3 Size: M Arch: life Phase: implement Design ref: design.md, Parity of command; docs/architecture/target-v2.md, sections 3.2 and 4.1 Goal: Implement shared work selection and explicit completion of queued commands for the existing verb, job and player queue systems. Acceptance criteria:

Notes:

Implementation brief

Today sim/opportunities builds player-facing work rows using eligibility, fit and verb checks. sim/jobs separately searches candidates and directly issues work to the matcher’s chosen pawn. Player choices enter a FIFO in sim/player. sim/commands.issue calls the registered check and run, discards the run result, and returns true or a reason. sim/player.LASTS then infers duration from mutable pawn state. Its work predicate reads the main job even though sim/agents can also claim partial and background work.

Start with src/sim/opportunities.js (work), src/sim/jobs.js (fit and the work issuers), src/sim/commands.js (issue), src/sim/agents.js (the registered work verb, hold and release), and src/sim/player.js (LASTS, queue, playerStep and unqueue). Trace the save path and the callers of issue before changing the return contract. Existing tests/commands.js, tests/opportunities.js, tests/player.js and tests/attention.js exercise the public entry points.

Keep candidate evaluation separate from selection policy. The player chooses and the matcher ranks. Share the job-level logic at the point where each already has a candidate. Building every UI row for every simulated pawn would add work to the matcher. Preserve UI-only previews for work that has yet to be posted.

Let each domain register or supply its own completion semantics. The dispatcher stays independent of job and pawn modules. Only the queue needs to retain a pending reference, and the assignment owner remains the authority on whether it is live. A completed job and an interrupted assignment both release the queue. Other participants may still be working. Preserve full-work replacement and side-work coexistence when moving the current interruption logic out of LASTS.

Limit the patch to verbs, posted jobs, assignments and queue integration. Project selection, offer or gift lifecycles, and a player-facing workflow editor are outside this task.