Skip to content

feat(coding-agent): add built-in message renderer transforms - #40

Merged
quick-ricon merged 4 commits into
mainfrom
quick/builtin-message-renderers-20260804
Aug 5, 2026
Merged

feat(coding-agent): add built-in message renderer transforms#40
quick-ricon merged 4 commits into
mainfrom
quick/builtin-message-renderers-20260804

Conversation

@quick-ricon

@quick-ricon quick-ricon commented Aug 5, 2026

Copy link
Copy Markdown

Summary

  • add a typed registerBuiltInMessageRenderer("user" | "assistant", transform) extension API
  • compose renderer transforms once in extension load order, with later transforms wrapping earlier ones
  • pass complete role-specific messages and live render options while preserving Pi's transcript lifecycle roots
  • support native (default) and extension-owned (self) card shells with guarded fallback
  • isolate extension-facing message snapshots so renderer mutations cannot alter session or model context
  • document the API and include a compiled example

This is a display-only extension point. It does not alter persisted messages or model context, and it deliberately excludes viewport/follow-mode behavior.

Validation

  • initial focused renderer, user-message, assistant-message, and extension-runner tests: 60/60 passed
  • final-head renderer, user-message, and assistant-message tests: 22/22 passed, including the nested-mutation regression from fix: isolate built-in renderer messages #41
  • focused TypeScript check: passed
  • scoped Biome check: passed
  • git diff --check: passed
  • signed commit and push preflights: passed

Local broad-gate degradation

npm run check reaches root TypeScript and then fails on two unrelated model IDs already broken on a clean origin/main worktree:

  • packages/ai/test/context-overflow.test.ts:130 references removed github-copilot/gemini-2.5-pro
  • packages/ai/test/openai-completions-tool-choice.test.ts:199 references removed groq/qwen/qwen3-32b

./test.sh also could not provide a clean local broad-suite result because isolated child fd/rg calls hit the local untrusted-mise boundary and spawned CLI tests expect missing dist artifacts. The repository contract forbids generating those artifacts with a build. No renderer-focused test failed.

Hosted CI run 31017590014 confirmed the same two clean-main TypeScript failures and therefore stopped before its test phase.

No changelog entry is included because CONTRIBUTING.md says not to edit the changelog in pull requests.

@junior-ricon junior-ricon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change request

packages/coding-agent/src/modes/interactive/components/built-in-message-renderer.ts:56 passes the live AgentMessage object directly into extension transforms. Those are the same objects retained by the agent/session path, and assistant streaming copies are shallow, so a transform that assigns nested content mutates persisted transcript/model context despite this API's display-only contract. I reproduced this by changing UserMessage.content[0].text inside a transform; the source message changed. Please merge or adapt #41, which snapshots messages before entering the transform chain and adds the nested-mutation regression.

Adversarial coverage

I read the exact diff before the PR body, then checked existing discussion and CI. I stress-tested role typing, extension registration/load and composition order, stable composition state, default/self ownership, invalid/throwing transforms, streaming/final/restored and expansion updates, resize behavior, outer OSC lifecycle roots, exports, docs, and test evidence.

The focused renderer, user-message, and assistant-message suites pass (22/22, including the fix-it regression). The extension-runner suite remains locally uncollectable because the Git archive lacks generated packages/ai/src/providers/data/amazon-bedrock.json. Hosted CI failed on the disclosed clean-main model-data TypeScript errors before tests; I found no additional PR-head-specific CI failure.

@quick-ricon
quick-ricon merged commit 6044948 into main Aug 5, 2026
1 check failed
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.

2 participants