agent-runtime/testcases/counter_state.md
Nico 3f8886cbd2 v0.10.4: stateful UI engine — TDD counter test green (36/36)
RED->GREEN->REFACTOR cycle:
- UI node has state store (key-value), action bindings (op/var), and
  local action handlers (inc/dec/set/toggle — no LLM round-trip)
- Thinker self-model: knows its environment, that ACTIONS create real
  buttons, that UI handles state locally. Emits var/op payload for
  stateful actions.
- Thinker's context includes UI state so it can report current values
- /api/clear resets UI state, bindings, and controls
- Test runner: action_match for fuzzy action names, persistent actions
  across steps, _stream_text restored
- Counter test: 16/16 passed (create, read, inc, inc, dec, verify)
- Pub test: 20/20 passed (conversation, language switch, tool use, mood)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 15:50:37 +01:00

986 B

Counter State

Tests that Thinker can instruct UI to create stateful controls, and that UI handles local actions without round-tripping to Thinker.

Setup

  • clear history

Steps

1. Create counter

  • send: create a counter starting at 0 with increment and decrement buttons
  • expect_response: contains "counter" or "count"
  • expect_actions: length >= 2
  • expect_actions: any action contains "increment" or "inc"
  • expect_actions: any action contains "decrement" or "dec"

2. Check state

  • expect_state: topic contains "counter" or "count" or "button"

3. Ask for current value

  • send: what is the current count?
  • expect_response: contains "0"

4. Increment

  • action: first matching "inc"
  • expect_response: contains "1"

5. Increment again

  • action: first matching "inc"
  • expect_response: contains "2"

6. Decrement

  • action: first matching "dec"
  • expect_response: contains "1"

7. Verify memorizer tracks it

  • expect_state: topic contains "count"