Repository navigation
Add Prompt and Cost tabs to the playground - #92
Merged
Merged
Conversation
Prompt shows safePrompt on a template with an {{input}} slot, marking
each escaped tag; Cost prices a pasted usage or reply with toUsage and
estimateCost. Chunks gains the tokenizer option, and its note no longer
says Claude counts 1.5x: the presets replaced that advice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F61ff7dDPwJn5kuD25LtiS
3 of 4 tasks
Merged
nightlightmare
added a commit
that referenced
this pull request
Oct 27, 2026
Releases 0.6.0. ## What ships From `CHANGELOG.md`, three new modules, all **minor**: - `llmmend/prompt`: `safePrompt`, `trusted`, `escapeTags`: untrusted text can't close or forge a prompt's own tags (#89). - `llmmend/cost`: `estimateCost`, `toUsage`: the cost of a call by part from its usage and prices per million tokens (#91). - `llmmend/retry`: `classifyError`: eleven provider-neutral error kinds, `retryable` and the Provider's `retryAfter` (#94). One **patch**: stream `usage` events leave out a count the Provider sent as `null`; the four adapters now share one usage conversion with `toUsage` (#91). Added to the changelog by hand, since #91's changeset described only the new module. The playground's Prompt, Cost and Errors tabs (#92, #94) are already live on Pages. ## Before release - **Provider adapters** changed in #91 (the shared usage conversion), so the providers were re-recorded and compared with the fixtures, then restored: - **Anthropic** (via Bedrock), all seven cases: same payload fields, LLM event types, usage fields, stop reasons; `responseId` set in all. - **Gemini**: `text`, `thinking`, `max-tokens` the same on every count. `tool-calls-parallel` got HTTP 503 `UNAVAILABLE` (high demand), which `classifyError` reads as `overloaded`, retryable. - **Drift:** the Ollama drift check passes on main at f3af34c, after the adapter change ([run](https://github.com/nightlightmare/llmmend/actions/runs/40589829344)). - **Size:** within limits. `prompt` 582 B, `cost` 689 B, `retry` 1.39 of 1.5 kB; the existing bundles did not grow (`collectText` 6.78 kB, `streamToolCalls` 6.92 kB). - **Local checks:** tests (911), docs, size, smoke on all seven subpaths, and `check:publish` pass. CI on main is green at f3af34c. ## After merge `release.yml` stages 0.6.0 with `npm stage publish` and creates the tag and GitHub release; approve the staged version on npmjs.com with 2FA. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01F61ff7dDPwJn5kuD25LtiS Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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
/prompt/,/cost/,/ru/…,/zh-CN/…), with their own titles, descriptions and sitemap entries.<instructions>, and code witha < b,<system>andList<Document>that stays as written.usage/usageMetadata. Examples: Anthropic with a cache read, OpenAI Chat Completions, Gemini long context, a cut-off stream with no output count.llms.txtmention the new tabs.Evidence
Checked in the built site (
vite preview):Tags escaped: 4; the result has</document>,<instructions>…</instructions>,<document>inside the real<document>.Total: $0.0276(input $0.0036, cache read $0.012, output $0.012); LlmUsageinputTokens: 41200.Missing from the usage, costed as 0: output.Before: the price field
id="input"collided with the input textarea, which left the cost tab blank; caught in the preview, fixed by prefixing the price ids withprice-.After: all tabs render; typecheck, lint, format, docs checks and 875 tests pass.
Merge Danger
Door: two-way
Blast Radius: playground
Site only: nothing in the package changes. The Chunks share links of earlier versions still open (a missing
tokenizerfalls back too200k).🤖 Generated with Claude Code
https://claude.ai/code/session_01F61ff7dDPwJn5kuD25LtiS