[codex] Handle rich ACP prompt content#36
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds first-class handling for rich ACP prompt content (text, resource links, and images) by persisting structured prompt parts in session logs, generating deterministic fallback text renderings, and forwarding image parts to the model when enabled.
Changes:
- Introduces structured prompt/content types in
@fledgling/commonand updates context building/token estimation to support structured message content. - Adds ACP prompt conversion utilities in
agent-coreto persist structured content while producing deterministic fallback text + model-ready content. - Adds configurable image prompt capability (via env/config) and updates agent replay/session loading to reconstruct rich user history.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents the new image prompt input env toggle and updated rich prompt limitation notes. |
| packages/context-builder/src/token-estimator.ts | Estimates tokens from structured message content by projecting it to fallback text. |
| packages/context-builder/src/context-builder.test.ts | Adds coverage for building replay context from structured user content. |
| packages/context-builder/src/build-context.ts | Converts stored rich user events into model-ready context content with deterministic fallbacks. |
| packages/common/src/session-events.ts | Adds structured content types and extends user message events to persist structured prompt content. |
| packages/agent-core/src/prompt-content.ts | Implements normalization/rendering/model conversion for ACP prompt parts (text/resource_link/image/unsupported). |
| packages/agent-core/src/prompt-content.test.ts | Adds tests for rich prompt conversion, image forwarding behavior, and unsupported blocks. |
| packages/agent-core/src/interfaces.ts | Adds optional prompt content capability flags (imageInput) to dependencies. |
| packages/agent-core/src/agent.ts | Persists structured user content, forwards images when enabled, and advertises prompt image capability. |
| packages/acp-agent/src/prompt-content.ts | Removes legacy prompt flattening utilities (now handled in agent-core). |
| packages/acp-agent/src/agent.ts | Enables image prompt input by default (env-toggleable) in the Node agent dependencies. |
| packages/acp-agent/src/agent-prompt-cancellation.test.ts | Adds tests for prompt capability advertisement, rich prompt persistence, and session reload behavior. |
| common/reviews/common.public.api.md | Updates public API surface for structured message content types. |
| common/reviews/agent-core.public.api.md | Updates public API surface for new prompt conversion utilities and options. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #10.
Validation