mirror of https://github.com/garrytan/gstack.git
Page captures with mixed-script Unicode round-trip cleanly to the Claude API. Two new utilities in browse/src/sanitize.ts: stripLoneSurrogates for raw UTF-16 strings, stripLoneSurrogateEscapes for \uXXXX JSON escape text. sanitizeBody picks the right pass based on cr.json. buildCommandResponse is extracted from handleCommand (now exported) and applies sanitization before new Response(). /batch was bypassing this chokepoint via direct JSON.stringify, so it sanitizes each cr.result before pushing AND wraps the envelope with stripLoneSurrogateEscapes. Defense in depth wraps at getCleanText, getCleanTextWithStripping, html, accessibility, and snapshot.ts return points so downstream consumers (datamarking, envelope wrapping) see sanitized text before the response is built. 25 new unit tests across sanitize.test.ts and build-command-response.test.ts. content-security.test.ts updated to accept either pre- or post-sanitize form of the snapshot scoped branch (source-level regression check). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| preamble | ||
| browse.ts | ||
| codex-helpers.ts | ||
| composition.ts | ||
| confidence.ts | ||
| constants.ts | ||
| design.ts | ||
| dx.ts | ||
| gbrain.ts | ||
| index.ts | ||
| learnings.ts | ||
| make-pdf.ts | ||
| model-overlay.ts | ||
| preamble.ts | ||
| question-tuning.ts | ||
| review-army.ts | ||
| review.ts | ||
| testing.ts | ||
| types.ts | ||
| utility.ts | ||