Repository navigation
ToolView: hex byte glyph constants per compiler (fixes TestArgTruncation) - #162
Merged
Merged
Conversation
TestArgTruncation has been red since the unit landed: the `'…'`
literal in Ellipsize and the `'✗'` literal in FormatToolResultLine
get clipped to `?` when concatenated with strings carrying a
different codepage tag. ToolView opens with `{$CODEPAGE UTF8}` so
its literals are tagged CP_UTF8, but JSON-parsed Summary strings
arrive tagged CP_0 (system default); the mixed-codepage concat trap
strips every UTF-8 lead byte that the destination CP can't
represent.
Same class of bug PR #157 fixed for PasClaw.Markdown.Render's
box-drawing glyphs. Same fix shape: replace the literals with
per-compiler hex byte constants that are codepage-agnostic.
FPC mode delphi (string = AnsiString, Char = AnsiChar)
raw UTF-8 byte sequence — bytes go on the wire as-is, no
transcode triggers.
Delphi (string = UnicodeString, Char = WideChar)
single WideChar at the Unicode codepoint — WriteConsoleW
renders it directly, TEncoding.UTF8 encodes it to the same
UTF-8 bytes for redirected stdout.
Glyph table:
TV_CALL_GLYPH U+23FA ⏺ E2 8F BA
TV_RESULT_GLYPH U+23BF ⎿ E2 8E BF
TV_ELLIPSIS U+2026 … E2 80 A6
TV_ERROR_GLYPH U+2717 ✗ E2 9C 97
Promoted the inline `'…'` and `'✗'` literals to named constants
alongside the existing TV_CALL_GLYPH / TV_RESULT_GLYPH so the four
codepoints live in one place and the compiler-split guards aren't
sprinkled through the call sites.
toolview_tests.TestArgTruncation and TestResultError pick their
assertion literal the same way — IFDEF FPC chooses the 3-byte UTF-8
form, ELSE the single WideChar — so the test isn't tied to a
codepage tag either.
Byte-dump on Linux+FPC confirms the wire output is exactly
E2 8F BA / E2 80 A6 / E2 8E BF / E2 9C 97 — no mojibake.
Full make test on Linux/FPC is now ALL GREEN for the first time:
smoke, hashline, toolview, anthropic-server-tools,
openai-server-tools, println-helper, utf8-codepage-tag,
gemini-schema-strip, markdown-render, json-utf8-roundtrip.
6 of 7 tasks
khongten001
pushed a commit
to khongten001/PasClaw
that referenced
this pull request
Jul 13, 2026
Cross-referenced MakerAi's provider list against our 19-entry
catalog. The user-listed model families fall into three buckets:
Already covered as MODEL names within an existing entry —
Claude (anthropic), Gemini (gemini), Mistral (mistral),
Groq (groq), Kimi (moonshot), DeepSeek (deepseek). Operator
sets the specific model on the per-config line; no catalog
change needed for these.
Missing AS PROVIDERS (this commit) — xAI/Grok, Cohere.
Already in the catalog with a stale default — Moonshot's default
was moonshot-v1-32k (Kimi V1 generation, deprecated). Bumped
to kimi-k2 which is what current MakerAi configs use and what
the user listed first under Kimi.
xAI ships a strict OpenAI-compatible chat-completions endpoint at
https://api.x.ai/v1/chat/completions with Bearer auth. The existing
pfOpenAI provider talks to it unchanged — just a new catalog row.
Default model grok-4-fast; operator can override to grok-3 /
grok-code-fast-1 / grok-2 etc. via config or onboarding.
Cohere v2 ships its chat API at https://api.cohere.com/v2/chat —
same Bearer auth as OpenAI but a different URL path
(/v2/chat vs /v1/chat/completions). PasClaw.Providers.OpenAI
hard-codes the OpenAI path, so Cohere can't piggyback without
making the path configurable. Landed as pfPlaceholder so:
- The kind validates in config.json,
- It appears in `pasclaw onboard` like every other provider,
- Selecting it surfaces the existing pfPlaceholder error
("Cohere is in the catalog but its protocol implementation is
not yet bundled in this build") instead of a confusing 404 at
request time.
Future PR can add a dedicated TCohereProvider that mirrors the v2
wire shape (messages array, tool_calls similar to OpenAI but with
the citations / search_queries surfaced on assistant turns).
Also tightened the catalog notes column on three rows where the
displayed model list was outdated next to the user's current
generation (Groq → Llama-4 / Kimi K2 / Qwen3 / compound-beta,
Mistral → Magistral / Devstral / Voxtral added, Gemini → Gemini 3
generation).
Verified:
- Catalog size 21 (was 19).
- LookupProvider('xai') / LookupProvider('cohere') resolve with
the right Kind / Family / DefaultBase / DefaultModel.
- NewProviderFromConfig('xai') constructs a working
TOpenAIProvider with default model grok-4-fast.
- NewProviderFromConfig('cohere') returns False with the clean
pfPlaceholder ErrMsg.
- All unrelated test suites still green (test-hashline,
test-anthropic-server-tools, test-openai-server-tools,
test-println-helper, test-utf8-codepage-tag,
test-gemini-schema-strip, test-markdown-render,
test-json-utf8-roundtrip). test-toolview is the pre-existing
ellipsis-glyph mojibake (fixed in PR FMXExpress#162, not yet merged).
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 the last remaining red test on
make test. After PR #161 fixed JSON UTF-8 byte preservation at the parse boundary, the only failure left wastoolview_tests.TestArgTruncation— the unrelated ellipsis-glyph mojibake noted in #161's PR body.The fault: ToolView opens with
{$CODEPAGE UTF8}so its'…'and'✗'literals are tagged CP_UTF8, but the JSON-parsed Summary strings they get concatenated with arrive tagged CP_0 (system default). FPC's mixed-codepage concat trap strips every UTF-8 lead byte the destination CP can't represent, leaving?characters in the user-visible output. Same exact class as PR #157's box-drawing-glyph fix inPasClaw.Markdown.Render.Fix
Same shape as PR #157 — replace each non-ASCII glyph literal with a per-compiler hex byte constant:
E2 8F BA#$23FAE2 8E BF#$23BFE2 80 A6#$2026E2 9C 97#$2717Promoted the inline
'…'and'✗'literals into namedTV_ELLIPSIS/TV_ERROR_GLYPHconstants alongside the existingTV_CALL_GLYPH/TV_RESULT_GLYPHso all four codepoints live in one place and the IFDEF guards aren't sprinkled through the call sites.Tests pick their assertion literal the same way (
{$IFDEF FPC}three-byte form, else single WideChar) so the assertions are codepage-tag-independent.Test plan
make test-toolview—PASS(wasFAIL: long argument is ellipsized)⏺→E2 8F BA,…→E2 80 A6,⎿→E2 8E BF,✗→E2 9C 97. No mojibake.make testis now fully green for the first time — smoke + hashline + toolview + anthropic-server-tools + openai-server-tools + println-helper + utf8-codepage-tag + gemini-schema-strip + markdown-render + json-utf8-roundtrip all OK.#$23FAetc. are single WideChars natively,WriteConsoleWandTEncoding.UTF8.GetBytesboth handle them losslessly.Generated by Claude Code