Skip to content

Return Pi TUI Text component for villani-result to prevent crash#412

Merged
mmprotest merged 1 commit into
mmprotest/implement-pi-integration-as-external-adapterfrom
mmprotest/fix-pi-villani-final-message-renderer-crash
Jun 28, 2026
Merged

Return Pi TUI Text component for villani-result to prevent crash#412
mmprotest merged 1 commit into
mmprotest/implement-pi-integration-as-external-adapterfrom
mmprotest/fix-pi-villani-final-message-renderer-crash

Conversation

@mmprotest

Copy link
Copy Markdown
Owner

Motivation

  • The Pi custom renderer for villani-result returned a plain string which caused Pi to crash with child.render is not a function when Pi tried to render the final message.
  • The goal is to make the final durable message renderable by returning a Pi TUI component while preserving the structured durable message payload and existing bridge/proxy logic.

Description

  • Import Text from @earendil-works/pi-tui and change renderVillaniResultMessage to return a Text component instead of a raw string in integrations/pi-villani/src/render.ts.
  • Add extractVillaniResultText(message) to safely extract final text from string, text-part arrays, and object shapes, and prepend a themed label when theme.fg is provided.
  • Keep sendDurableVillaniMessage unchanged in payload shape so durable messages remain structured with customType: "villani-result" and content: [{type:"text", text: ...}] for Pi compatibility.
  • Add @earendil-works/pi-tui as a peerDependency and pin it as a devDependency for build/test resolution in integrations/pi-villani/package.json (and update lockfile).
  • Expand Node tests in integrations/pi-villani/src/extension.test.ts to assert the renderer returns an object with a render() method, handle string and array content shapes, and ensure final rendering does not throw.

Testing

  • Ran cd integrations/pi-villani && npm run build and the TypeScript build succeeded.
  • Ran cd integrations/pi-villani && npm test and the test suite passed (77 tests passed, 0 failures).
  • All new/modified tests for renderVillaniResultMessage and sendDurableVillaniMessage passed.

Codex Task

@mmprotest mmprotest merged commit ba816a9 into mmprotest/implement-pi-integration-as-external-adapter Jun 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant