Skip to content

Help agents with Response shapes#24

Merged
alexanderatallah merged 8 commits into
mainfrom
alex/26-04-13/response-shapes
Apr 18, 2026
Merged

Help agents with Response shapes#24
alexanderatallah merged 8 commits into
mainfrom
alex/26-04-13/response-shapes

Conversation

@alexanderatallah
Copy link
Copy Markdown
Member

This pull request updates documentation for the OpenRouter skills, focusing on clarifying API response formats, improving usage examples, and adding helpful references. The main changes enhance developer understanding of API shapes, usage patterns, and available documentation resources.

API Response and Output Format Documentation:

  • Added a new "API Response Shapes" section to skills/openrouter-images/SKILL.md, detailing the structure of image generation responses, including the image_generation_call output item type and its usage alongside standard message outputs.
  • Expanded the "API Response Shapes" section in skills/openrouter-models/SKILL.md to explain the structure and fields returned by the models API, provide tips for working with the response, and clarify the differences between raw API fields and script output formats.

Code Example and Usage Improvements:

  • Updated the example API call in skills/openrouter-oauth/SKILL.md to use the correct endpoint (/api/v1/responses) and payload shape (using input instead of messages) for chat completions, ensuring consistency with the latest API.

Documentation Resource Additions:

  • Added a link to the API authentication guide in the resources section of skills/openrouter-oauth/SKILL.md for easier access to API key and Bearer token setup documentation.

alexanderatallah and others added 5 commits April 13, 2026 12:37
- openrouter-models: document full model object (including canonical_slug,
  hugging_face_id, default_parameters, knowledge_cutoff, links), server-side
  query params (?category, ?supported_parameters), and raw endpoints API shape
- openrouter-images: document Responses API request/response for image
  generation and editing (modalities, image_config, image_generation_call)
- openrouter-oauth: add /auth/key and /credits response shapes, switch
  example from chat/completions to Responses API

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
- openrouter-models: replace inline JSON examples with links to API
  reference docs for list-models, get-a-model, get-model-endpoints;
  keep query param table and non-obvious tips
- openrouter-images: remove request examples (script handles that),
  keep only image_generation_call output shape (non-obvious)
- openrouter-oauth: remove inline /auth/key and /credits shapes,
  add link to authentication API reference in Resources

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
- models: point direct API callers to OpenAPI spec instead of guide page
- oauth: fix auth reference description to match what the page covers

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
- Add `{ data: Model[] }` wrapper note for GET /models
- Add `{ data: { id, name, endpoints: Endpoint[] } }` for endpoints
- Point direct API callers to OpenAPI spec for field names
- Note formatModel() drops fields; call API directly if needed

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@perry-the-pr-reviewer perry-the-pr-reviewer Bot left a comment

Choose a reason for hiding this comment

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

Perry's Review

Adds API response shape documentation to the images, models, and oauth skills — the images section documents the wrong endpoint and output format, and the oauth example uses an incorrect input array shape for the Responses API.

Verdict: 🔁 Needs changes

Details

CI: no CI configured on this branch

Findings (see inline comments for full context):

  • 🔴 skills/openrouter-images/SKILL.md:100 — Documents /api/v1/responses + image_generation_call but actual scripts use /api/v1/chat/completions + message.images
  • 🔴 skills/openrouter-oauth/SKILL.md:200 — Changed example to /api/v1/responses but the endpoint has a different input array schema than what's shown
  • 🔴 skills/openrouter-oauth/SKILL.md:208input: [{ role, content }] is the Chat Completions messages shape; Responses API requires type:"message" + content:[{type:"input_text",text:...}]

Codex (openai/gpt-5.4): confirmed the images endpoint/shape mismatch; also surfaced pre-existing issues in compare-models and list-models (outside this PR's scope — separate concerns)

Research:

  • Confirmed via OpenRouter Responses API Basic Usage: input array requires {type:"message", role, content:[{type:"input_text",text:...}]}, not bare {role, content}
  • Confirmed via skills/openrouter-images/scripts/lib.ts and generate.ts: actual image generation calls go to /api/v1/chat/completions and read choices[0].message.images[], not output[].type==image_generation_call
  • image_generation_call is an OpenAI Responses API item type; OpenRouter images use the Chat Completions message.images extension
  • links.details field confirmed valid in OpenRouter OpenAPI spec
  • model.architecture.input_modalities / output_modalities field names confirmed via scripts (search-models.ts uses these)

Test coverage: docs-only PR, no tests

Unresolved threads: none

* docs: add API response shapes across skills (#10)

* docs: add API response shapes across skills

- openrouter-models: document full model object (including canonical_slug,
  hugging_face_id, default_parameters, knowledge_cutoff, links), server-side
  query params (?category, ?supported_parameters), and raw endpoints API shape
- openrouter-images: document Responses API request/response for image
  generation and editing (modalities, image_config, image_generation_call)
- openrouter-oauth: add /auth/key and /credits response shapes, switch
  example from chat/completions to Responses API

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: address PR review — link to API docs instead of duplicating shapes

- openrouter-models: replace inline JSON examples with links to API
  reference docs for list-models, get-a-model, get-model-endpoints;
  keep query param table and non-obvious tips
- openrouter-images: remove request examples (script handles that),
  keep only image_generation_call output shape (non-obvious)
- openrouter-oauth: remove inline /auth/key and /credits shapes,
  add link to authentication API reference in Resources

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: use verified working URLs for API reference links

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: correct misleading link descriptions in models and oauth skills

- models: point direct API callers to OpenAPI spec instead of guide page
- oauth: fix auth reference description to match what the page covers

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: add { data } response wrapper shapes to models skill

Agents calling the API directly need to know the response is wrapped
in { data: ... } — without this, they write data.models instead of
data.data or json.data.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>
@perry-the-pr-reviewer perry-the-pr-reviewer Bot dismissed their stale review April 18, 2026 19:28

Superseded by updated Perry review

Copy link
Copy Markdown

@perry-the-pr-reviewer perry-the-pr-reviewer Bot left a comment

Choose a reason for hiding this comment

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

Perry's Review

Adds API response shape documentation to the images, models, and OAuth skills.

Verdict: 🔁 Needs changes

Details

CI: no checks configured on this branch

Findings (see inline comments for full context):

  • 🔴 skills/openrouter-images/SKILL.md:100 — Documents /api/v1/responses + image_generation_call but actual scripts use /api/v1/chat/completions + choices[0].message.images
  • 🔴 skills/openrouter-oauth/SKILL.md:200 — Switched to /api/v1/responses but uses incorrect input array format (missing type: "message", content must be [{type: "input_text", text}] not a string)

Codex (openai/gpt-5.4): confirmed the images endpoint/shape mismatch; also surfaced several pre-existing issues outside the PR diff (compare-models sort labelling, OAuth key-validation, replaceState hash stripping) — not blocking this PR but worth filing separately

Research:

  • Confirmed via OpenRouter Responses API Basic Usage docs: structured array input requires {type: "message", role, content: [{type: "input_text", text}]} — bare {role, content} object is not a valid item type
  • Confirmed via skills/openrouter-images/scripts/lib.ts:47 and generate.ts: images use POST /api/v1/chat/completions and parse choices[0].message.images[], not output[].image_generation_call
  • OpenRouter docs confirm image generation works on both Chat Completions and Responses APIs — image_generation_call is valid for the Responses API path, but the bundled scripts only use Chat Completions
  • { data: Model[] } wrapper, query params table, links.details → /models/{author}/{slug}/endpoints → { data: { id, name, endpoints } }, and endpoint status 0 = operational all confirmed accurate via OpenAPI spec and scripts

Test coverage: documentation-only PR; no runnable tests possible

Unresolved threads: none

The Responses API structured array format requires type: "message"
on each input item per the OpenAPI spec.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
@perry-the-pr-reviewer perry-the-pr-reviewer Bot dismissed their stale review April 18, 2026 20:26

Superseded by updated Perry review

Copy link
Copy Markdown

@perry-the-pr-reviewer perry-the-pr-reviewer Bot left a comment

Choose a reason for hiding this comment

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

Perry's Review

Adds API response shape documentation to the images, models, and OAuth skills — good direction for helping agents understand the API surfaces they're calling.

Verdict: 🔁 Needs changes

Details

CI: no checks configured on this branch

Findings (see inline comments for full context):

  • 🔴 skills/openrouter-images/SKILL.md:100 — Section documents /api/v1/responses + image_generation_call but the bundled scripts use /api/v1/chat/completions and parse choices[0].message.images[]
  • 🟡 skills/openrouter-oauth/SKILL.md:208content: "Hello!" is a bare string; Responses API structured array format expects content as a typed-parts array

Codex (openai/gpt-5.4): no output (sandbox restriction)

Research:

  • Confirmed via skills/openrouter-images/scripts/lib.ts:47: image scripts POST to /api/v1/chat/completions via postChatCompletion(), not /api/v1/responses
  • Confirmed via generate.ts:34–43: response parsed as json.choices[0].message.images[]image_generation_call does not appear here; that shape is from OpenAI's Responses API for GPT Image models
  • OpenRouter docs + web search confirm images via Chat Completions return message.images[].image_url.url (data URL), not an output[] array
  • Responses API Basic Usage docs: structured array input requires {type: "message", role, content: [{type: "input_text", text}]}; bare string content may work via server leniency but is not the documented contract
  • Models SKILL additions ({ data: Model[] } wrapper, query params, tips, endpoints shape) all verified accurate against OpenAPI spec and scripts

Test coverage: documentation-only PR; no runnable tests applicable

Unresolved threads from prior review: the type: "message" thread (from commit beb8667) was addressed in 3f43be6 ✅ — residual: content string vs typed-parts array (see inline)

Keep { data: Model[] } wrapper, {author}/{slug}/endpoints shape,
type: message in Responses API example, and formatModel() note.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
@alexanderatallah alexanderatallah merged commit 98e138e into main Apr 18, 2026
Copy link
Copy Markdown

@perry-the-pr-reviewer perry-the-pr-reviewer Bot left a comment

Choose a reason for hiding this comment

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

Perry's Review

Adds { data: Model[] } and { data: { id, name, endpoints: Endpoint[] } } response shape documentation to the models skill, clarifies formatModel() drop list, and updates the OAuth skill example to use the Responses API with type: "message" — all accurate and helpful for agent callers.

Verdict: 🔁 Needs changes

Details

CI: no checks configured on this branch

Findings (see inline comments for full context):

  • 🟡 skills/openrouter-oauth/SKILL.md:208content: "Hello!" is a bare string; Responses API structured array format requires a typed-parts array per spec

Codex (openai/gpt-5.4): 8 findings surfaced — 7 are pre-existing (not introduced by this PR's diff): localStorage key storage security, --sort throughput sorting by max_completion_tokens vs actual throughput, compare-models.ts partial-match fallback undocumented, handleOAuthCallback verifier deletion before exchange confirmation, history.replaceState dropping deep-link params, missing URL cleanup after exchange, default callbackUrl losing search/hash. None of these are in the diff; noting for awareness only.

Research: OpenRouter Responses API Basic Usage — structured array format requires content: [{ type: "input_text", text: "..." }], not a bare string. Simple input: "Hello!" top-level string also valid. The { data: Model[] } wrapper and GET /api/v1/models/{author}/{slug}/endpoints → { data: { id, name, endpoints: Endpoint[] } } shapes verified against list-endpoints API reference.

Test coverage: documentation-only PR; no runnable tests applicable.

Unresolved threads: both prior threads resolved ✅ — type: "message" was addressed; residual content string issue noted as inline comment below.

Nits (batched): The description of --sort throughput as "highest throughput models" / "most output capacity" is technically about max_completion_tokens not live throughput speed — pre-existing, but worth clarifying in a follow-up. The compare-models.ts docs say "exact ID matching" but the script silently falls back to partial match with a stderr warning — also pre-existing.

body: JSON.stringify({
model: "openai/gpt-4o-mini",
input: [{ role: "user", content: "Hello!" }],
input: [{ type: "message", role: "user", content: "Hello!" }],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[suggestion] content: "Hello!" — bare string in structured array input; Responses API spec requires a typed-parts array here

Details

Why: The PR correctly adds type: "message" to the input item, but content is still a bare string. The Responses API structured array format (per Basic Usage docs) requires content as a typed-parts array:

content: [{ type: "input_text", text: "Hello!" }]

A bare string in content may work today via server-side leniency, but it contradicts the documented contract and will mislead developers building against the spec. The type: "message" field signals "this is a structured message item" — mixing it with unstructured string content is inconsistent.

Fix: Either use the simple top-level string shorthand (avoids the inconsistency entirely):

body: JSON.stringify({
  model: "openai/gpt-4o-mini",
  input: "Hello!",
})

Or use the fully-structured form per spec:

body: JSON.stringify({
  model: "openai/gpt-4o-mini",
  input: [{ type: "message", role: "user", content: [{ type: "input_text", text: "Hello!" }] }],
})

Ref: OpenRouter Responses API Basic Usage

alexanderatallah added a commit that referenced this pull request Apr 23, 2026
* Help agents with Response shapes (#24)

* docs: add API response shapes across skills

- openrouter-models: document full model object (including canonical_slug,
  hugging_face_id, default_parameters, knowledge_cutoff, links), server-side
  query params (?category, ?supported_parameters), and raw endpoints API shape
- openrouter-images: document Responses API request/response for image
  generation and editing (modalities, image_config, image_generation_call)
- openrouter-oauth: add /auth/key and /credits response shapes, switch
  example from chat/completions to Responses API

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: address PR review — link to API docs instead of duplicating shapes

- openrouter-models: replace inline JSON examples with links to API
  reference docs for list-models, get-a-model, get-model-endpoints;
  keep query param table and non-obvious tips
- openrouter-images: remove request examples (script handles that),
  keep only image_generation_call output shape (non-obvious)
- openrouter-oauth: remove inline /auth/key and /credits shapes,
  add link to authentication API reference in Resources

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: use verified working URLs for API reference links

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: correct misleading link descriptions in models and oauth skills

- models: point direct API callers to OpenAPI spec instead of guide page
- oauth: fix auth reference description to match what the page covers

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: add { data } wrapper shapes and OpenAPI spec link

- Add `{ data: Model[] }` wrapper note for GET /models
- Add `{ data: { id, name, endpoints: Endpoint[] } }` for endpoints
- Point direct API callers to OpenAPI spec for field names
- Note formatModel() drops fields; call API directly if needed

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* response shape wrappers (#26)

* docs: add API response shapes across skills (#10)

* docs: add API response shapes across skills

- openrouter-models: document full model object (including canonical_slug,
  hugging_face_id, default_parameters, knowledge_cutoff, links), server-side
  query params (?category, ?supported_parameters), and raw endpoints API shape
- openrouter-images: document Responses API request/response for image
  generation and editing (modalities, image_config, image_generation_call)
- openrouter-oauth: add /auth/key and /credits response shapes, switch
  example from chat/completions to Responses API

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: address PR review — link to API docs instead of duplicating shapes

- openrouter-models: replace inline JSON examples with links to API
  reference docs for list-models, get-a-model, get-model-endpoints;
  keep query param table and non-obvious tips
- openrouter-images: remove request examples (script handles that),
  keep only image_generation_call output shape (non-obvious)
- openrouter-oauth: remove inline /auth/key and /credits shapes,
  add link to authentication API reference in Resources

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: use verified working URLs for API reference links

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: correct misleading link descriptions in models and oauth skills

- models: point direct API callers to OpenAPI spec instead of guide page
- oauth: fix auth reference description to match what the page covers

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: add { data } response wrapper shapes to models skill

Agents calling the API directly need to know the response is wrapped
in { data: ... } — without this, they write data.models instead of
data.data or json.data.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: add type: message to Responses API example in oauth skill

The Responses API structured array format requires type: "message"
on each input item per the OpenAPI spec.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: replace generic system prompt with coding agent prompt

The default system prompt was "You are a helpful assistant with access
to tools" which caused the model to ask clarifying questions instead of
proactively using tools to explore the codebase.

New prompt instructs proactive tool use, injects CWD via {cwd}
placeholder, and sets behavioral guidelines drawn from Codex and Pi.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>
alexanderatallah added a commit that referenced this pull request Apr 24, 2026
* feat: add building-agent-harness skill

New skill that generates a working minimal agent harness in TypeScript
using @openrouter/agent. Draws production patterns from pi-mono,
Claude Code, and Codex architectures.

Features an interactive tool checklist (server tools, file ops, shell,
grep, glob + optional modules like session persistence, compaction,
approval flow) and progressive disclosure via reference files to stay
under the 500-line SKILL.md best practice limit.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: address PR review — security, type safety, and integration fixes

- Restrict CORS to configurable origin (was wildcard)
- Add request body size limit (1MB) to prevent OOM
- Wrap JSON.parse calls in try/catch with descriptive errors
- Widen runAgent input type to string | unknown[] for session/compaction
- Fix session resume integration to pass message history to agent
- Fix compaction integration snippet to reference correct variables
- Validate env var numbers (NaN guard on maxSteps/maxCost)
- Fix .env reference in error message (no dotenv loader)
- Use glob npm package instead of Node 22+ fs.glob

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* feat: rename to agent-harness, add README and working sample

- Rename skill from building-agent-harness to agent-harness
- Add README with sections: what/when/customize/SDK coverage
- Add sample/ with complete working harness and clean TUI
- Remove ComeOnOliver/claude-code-analysis repo reference
- Add screenshot of the sample TUI

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* feat(agent-harness): add ASCII logo banner as optional config step

* feat(agent-harness): add showBanner field to AgentConfig

* feat(agent-harness): add src/banner.ts with OpenRouter ASCII logo

* feat(agent-harness): wire showBanner into cli.ts startup

* fix: remove all as any, use serverTool(), styled TUI, PR review fixes

- Use serverTool() for server tools — fully type-safe, no as any
- Use Item[] cast for chat messages — removes last as any
- Replace hardcoded package versions with npm install commands
- Styled TUI in SKILL.md: ANSI colors, banner, spinner, token display
- Customizable ASCII banner (asks for project name, not hardcoded)
- PR review fixes: CORS auth ordering, request validation, session
  error handling, requireApproval for dangerous-only, SSRF warning
- Bump sample to @openrouter/agent v0.4.0

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* feat: update sample banner to "My Harness" with block characters

- Replace OpenRouter ASCII art with "MY HARNESS" block-letter banner
- Enable showBanner by default in sample config
- Update screenshot

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* feat(agent-harness): rich TUI with tool-call display, /model command

- Replace onText callback with onEvent emitting AgentEvent union
  (text, tool_call, tool_result, reasoning) via getItemsStream()
- Show tool calls inline: ⚡ name arg=value / ✓ name (0.3s)
- Add dot spinner between inference rounds (re-enables after tool results)
- Add DisplayConfig (compact/verbose/hidden) for tool calls and results
- Add /model slash command to switch models via OpenRouter API mid-session
- Add TuiRenderer class in references/tui.md with per-tool colors/formatters
- Regenerate sample harness from skill spec with all new features

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* feat(agent-harness): slash commands, input features, styled prompt

- Add slash command registry with /model, /new, /help (ON by default)
  plus /compact, /session, /export (OFF, opt-in)
- Add harness modules: @-file references, ! shell shortcut, multi-line input
- Add styled input prompt with background color (inputStyle: styled|plain)
- Add showPrompt() with cwd display on second line for styled mode
- Refactor sample cli.ts to use command registry instead of inline /model
- Create references/slash-commands.md with registry pattern and command specs

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: replace generic system prompt with coding agent prompt (#27)

* Help agents with Response shapes (#24)

* docs: add API response shapes across skills

- openrouter-models: document full model object (including canonical_slug,
  hugging_face_id, default_parameters, knowledge_cutoff, links), server-side
  query params (?category, ?supported_parameters), and raw endpoints API shape
- openrouter-images: document Responses API request/response for image
  generation and editing (modalities, image_config, image_generation_call)
- openrouter-oauth: add /auth/key and /credits response shapes, switch
  example from chat/completions to Responses API

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: address PR review — link to API docs instead of duplicating shapes

- openrouter-models: replace inline JSON examples with links to API
  reference docs for list-models, get-a-model, get-model-endpoints;
  keep query param table and non-obvious tips
- openrouter-images: remove request examples (script handles that),
  keep only image_generation_call output shape (non-obvious)
- openrouter-oauth: remove inline /auth/key and /credits shapes,
  add link to authentication API reference in Resources

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: use verified working URLs for API reference links

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: correct misleading link descriptions in models and oauth skills

- models: point direct API callers to OpenAPI spec instead of guide page
- oauth: fix auth reference description to match what the page covers

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: add { data } wrapper shapes and OpenAPI spec link

- Add `{ data: Model[] }` wrapper note for GET /models
- Add `{ data: { id, name, endpoints: Endpoint[] } }` for endpoints
- Point direct API callers to OpenAPI spec for field names
- Note formatModel() drops fields; call API directly if needed

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* response shape wrappers (#26)

* docs: add API response shapes across skills (#10)

* docs: add API response shapes across skills

- openrouter-models: document full model object (including canonical_slug,
  hugging_face_id, default_parameters, knowledge_cutoff, links), server-side
  query params (?category, ?supported_parameters), and raw endpoints API shape
- openrouter-images: document Responses API request/response for image
  generation and editing (modalities, image_config, image_generation_call)
- openrouter-oauth: add /auth/key and /credits response shapes, switch
  example from chat/completions to Responses API

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: address PR review — link to API docs instead of duplicating shapes

- openrouter-models: replace inline JSON examples with links to API
  reference docs for list-models, get-a-model, get-model-endpoints;
  keep query param table and non-obvious tips
- openrouter-images: remove request examples (script handles that),
  keep only image_generation_call output shape (non-obvious)
- openrouter-oauth: remove inline /auth/key and /credits shapes,
  add link to authentication API reference in Resources

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: use verified working URLs for API reference links

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: correct misleading link descriptions in models and oauth skills

- models: point direct API callers to OpenAPI spec instead of guide page
- oauth: fix auth reference description to match what the page covers

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: add { data } response wrapper shapes to models skill

Agents calling the API directly need to know the response is wrapped
in { data: ... } — without this, they write data.models instead of
data.data or json.data.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: add type: message to Responses API example in oauth skill

The Responses API structured array format requires type: "message"
on each input item per the OpenAPI spec.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix: replace generic system prompt with coding agent prompt

The default system prompt was "You are a helpful assistant with access
to tools" which caused the model to ask clarifying questions instead of
proactively using tools to explore the codebase.

New prompt instructs proactive tool use, injects CWD via {cwd}
placeholder, and sets behavioral guidelines drawn from Codex and Pi.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>

* feat(agent-harness): adaptive input box with raw mode, OSC 11 detection

- Replace readline with raw stdin for styled input mode — gives full
  control over the 3-line input box (top pad + prompt + bottom pad)
- Add terminal-bg.ts: detects terminal BG via OSC 11, alpha-blends
  white 12% (dark) or black 4% (light) for adaptive input BG color
- styledReadLine() redraws prompt in-place on each keystroke (no growth)
- Status line renders below input box on default BG after submit
- Remove cyan from assistant text (user messages distinguished by BG box)
- Add TUI test plan (test-tui.md) and Playwright test script
- Update references/tui.md with full styledReadLine and terminal-bg specs

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* chore(agent-harness): gitignore package-lock.json, clean up test artifacts

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix(agent-harness): re-add package-lock.json, remove from gitignore

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* feat(create-agent-tui): rename from agent-harness, add visual customization showcase

Rename skill from agent-harness to create-agent-tui (CAT) for better
discoverability — echoes the create-react-app pattern.

Revamp README to lead with visual showcase: tool display screenshots
(emoji, grouped, minimal), input style descriptions (block, bordered,
plain), and ASCII banner explanation. Move customization options above
the feature tables so the first thing you see is what you get.

Also includes parallel work: input styles reference (block/bordered/plain),
tool display reference (emoji/grouped/minimal/hidden with TuiRenderer),
demo script, Playwright screenshot automation, and trimmed tui.md.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* feat(create-agent-tui): visual customization, bug fixes, loader animations

Visual customization:
- Default toolDisplay changed from emoji to grouped
- Three loader animations: gradient (shimmer, default), spinner (braille),
  minimal (trailing dots) — configurable text and style
- Terminal markdown rendering: bold, inline code, headers, code blocks
- Input style and tool display screenshots (9 total)
- Visual Customization section in SKILL.md with "Other" option for each

CLI improvements:
- --banner, --model, --input, --tool-display flags
- name field in AgentConfig for banner customization
- Deep-merge config.display from file and overrides (fixes partial display bug)
- Default model changed to anthropic/claude-haiku-4.5

Bug fixes:
- /model crash: resume stdin before rl.question
- Block input backspace: redraw bottom padding on every keystroke
- Bordered input submit: keep bottom border visible
- Tool call ordering: emit on first sight, not just completed status

Docs:
- README: Quickstart section at top, all 9 screenshots, CLI usage examples
- references/loader.md: full loader animation reference
- test-tui.md: rewritten as agent-friendly guide with ttyd+Playwright pipeline
- Screenshot pipeline extended for input styles and loader animations

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix(create-agent-tui): retina-quality screenshots via deviceScaleFactor: 2

Screenshots were blurry at 1x resolution. Key changes:
- Set deviceScaleFactor: 2 for crisp retina PNGs
- Use headless: false (required for ttyd WebSocket rendering)
- Shrink viewport to 540x360 so content fills the frame
- Remove CSS injection — ttyd renders natively
- Fresh browser per screenshot to prevent state leaks
- Add demo-input.ts with async sleep delays for ttyd streaming
- Add input style screenshots (block, bordered, plain)

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* refactor(create-agent-tui): use real CLI for screenshots, add --demo flag

Replace 4 separate demo scripts with a --demo flag on the real CLI that
replays scripted events without calling the model. Screenshots now capture
the actual CLI experience — banner, input styles, tool displays, loaders —
all with retina quality (deviceScaleFactor: 2).

- Add --demo mode to cli.ts with scripted tool call + text replay
- Add --loader-style flag for loader customization
- Delete demo-tools.ts, demo-input.ts, demo-banner.ts, demo-loader.ts
- Simplify screenshot-demos.ts to just CLI flag combinations
- Regenerate all 10 screenshots at 2x retina quality
- Add banner.png screenshot to README hero position

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* fix(create-agent-tui): address PR review blockers

- grep.ts: err.status → err.code for ripgrep exit code detection
- grep.ts: add -- before pattern to prevent flag injection (--pre RCE)
- agent.ts: wrap JSON.parse(item.arguments) in try/catch for partial streaming args
- cli.ts: fall back to plain readline when stdin is not a TTY
- config.ts: add skipApiKey option so --demo works without OPENROUTER_API_KEY
- server-entry-points.md + modules.md: fix onText → onEvent callback
- package-lock.json: regenerate clean, remove phantom node-pty dep

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* chore(create-agent-tui): change default loader from gradient to spinner

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>
Co-authored-by: perry-the-pr-maintainer[bot] <276291302+perry-the-pr-maintainer[bot]@users.noreply.github.com>
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