Skip to content

[codex] add agent response views#29

Merged
HappySean2845 merged 1 commit into
mainfrom
codex/agent-views
Jun 12, 2026
Merged

[codex] add agent response views#29
HappySean2845 merged 1 commit into
mainfrom
codex/agent-views

Conversation

@HappySean2845

Copy link
Copy Markdown
Contributor

Summary

Adds opt-in agent-friendly response views to surf-cli so instant-mode prompts can avoid brittle jq projections over raw API envelopes.

What changed

  • Adds hidden global flags:
    • --agent-view <view> for stable compact command-specific JSON views.
    • --shape for a JSON response shape summary with sample data and suggested views.
  • Adds a CLI-side response transform registry for:
    • search-web --agent-view results
    • project-detail --agent-view contracts
    • market-tge --agent-view summary
  • Keeps default output unchanged unless one of the new opt-in flags is passed.
  • Preserves existing onchain-tx hex quantity decimal enrichment.

Why

Recent instant eval batches showed jq failures mostly came from variable raw response shapes, not from missing prompt instructions. These views move common envelope parsing into deterministic CLI code while leaving API contracts and default CLI behavior untouched.

Impact

This is client-side and opt-in. Existing surf ... --json behavior is unchanged, so downstream Surf services, NER, spotlight, and existing scripts are unaffected unless they explicitly start using --agent-view or --shape.

Validation

  • go test ./cli -run 'TestTransformResponseForCommand|TestMakeRequestAndFormatTransformsOnchainTxResponse'
  • go test ./cli -skip '^TestRequestRetryAfter$'
  • go test ./cmd/surf -run '^$'

Note: full go test ./cli still hangs on existing TestRequestRetryAfter, which sleeps until the package timeout. I skipped only that existing slow test for broader CLI validation.

@HappySean2845
HappySean2845 marked this pull request as ready for review June 12, 2026 08:29
@HappySean2845
HappySean2845 merged commit 77c69e6 into main Jun 12, 2026
3 checks passed
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