Skip to content

feat(studio): show planner decisions as switchable rows on the plan card - #76

Open
jm-rivera wants to merge 2 commits into
devfrom
feat/studio-decision-switch
Open

jm-rivera wants to merge 2 commits into
devfrom
feat/studio-decision-switch

Conversation

@jm-rivera

Copy link
Copy Markdown
Contributor

The Studio harness now sends planner decisions the user can switch (for example reading "major donors" as DAC countries' total or as the top 10 donors) as plan-card rows with choice_id decision:<slot> and one option per label, the same shape as scope rows. The existing ChoiceRow controls already render and post them; this change makes the card read right for them.

src/lib/studio/plan.ts ledgerSections splits the ledger into scope rows under "Counted as" and planner rows under "Choices the plan made", each shown only when it has rows. A decision switch runs a planner replan of tens of seconds, so its option shows "Replanning" and the chat line "Replanning with " until the harness answers (switchLine, switchPendingText); the page sets no deadline of its own. A refused or stopped decision switch reads "The plan keeps ." switch_failed and Stop go through the scope switch's paths unchanged. The wire.ts comments describe both choice_id shapes.

What a reviewer should weigh: the logic lives in pure functions in plan.ts with node tests, since the repo has no component test runner, so PlanLedger.tsx rendering is untested; approved plans list every choice under "Counted as", because PlanApproved.choices carries no choice_id. Merge after the harness change ships (DevelopmentFinanceObservatory/ai#95); before it, no decision: rows arrive and the card is unchanged.

Testing: node --test src/lib/studio/test/*.test.ts (617 passed), pnpm exec tsc --noEmit, eslint, prettier and stylelint on the touched files.

The harness sends a planner decision the user can switch as a plan-card
row with choice_id decision:<slot>. The ledger groups those rows under
"Choices the plan made", apart from the scope rows under "Counted as",
and a decision switch shows "Replanning" until the harness answers,
since it runs a planner replan. switch_failed and Stop take the scope
switch's paths.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant