Files
loki/scripts/test/widget-ascii-bundle.ts
CatoandClaude Opus 5.5 44def109a9 feat(widget): a spoken walk read as a list, whole sentences, talk from the launcher, per-page builds (#1302)
* feat(widget): one Talk bar, status header, read-back, per-page builds

- One Talk to Loki bar above a one-line message box; the box shows its
  tools only once used. The second Talk button in the thread is gone.
- The owner's header is the status (Watching / 2 to look at), Pause, close:
  no second logo, no page line. Opening on a phone no longer raises the
  keyboard.
- A spoken note is read back as a list per part of the page, with Read it
  back (speech) and Edit.
- Build all starts saved notes as one build per page (dispatchFeedbackBatch,
  shared with the project batch route).
- Regex literals use \u escapes; a test fails on non-ASCII in the bundle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E1qoQ9syUYXCRNbyrpqPGa

* feat(widget): a walk read as a list, whole sentences, talk from the launcher

- Loki's read of a spoken note is a list: one change or question per line,
  with where it applies, editable, ✕ to drop. The part on screen is
  background; a line names a part only when it was pointed at.
- Save files each change as its own note, with only the moments it came
  from, on the page it was said on. Questions stay on the card for Ask.
- Whisper's segments are joined into whole sentences before they are placed
  under a heading, so a sentence is never cut across two parts.
- The owner can start talking from a microphone beside the launcher without
  opening the panel (widget/quick-talk.ts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E1qoQ9syUYXCRNbyrpqPGa

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-18 10:34:38 +02:00

30 lines
1.1 KiB
TypeScript

// widget.js runs on other people's pages, and not every page declares its
// encoding. A script served without a charset is then read in the page's
// encoding, and any raw non-ASCII byte in it means something else. esbuild
// escapes strings for us; it keeps regex literals as typed — so a “ or → in a
// pattern silently stopped matching on such a page (found 2026-10-18: the
// voice note's read-back saw no parts). Write \u201C, not “, in a regex.
// Run: npx tsx scripts/test/widget-ascii-bundle.ts
import assert from "node:assert/strict";
import { build } from "esbuild";
async function main() {
const out = await build({
entryPoints: ["widget/main.ts"],
bundle: true,
format: "iife",
minify: true,
write: false,
logLevel: "silent",
});
const js = out.outputFiles[0].text;
const raw = [...js.matchAll(/.{0,40}[^\x00-\x7F]+.{0,10}/g)].map((m) => m[0]);
assert.deepEqual(
raw,
[],
`widget.js carries raw non-ASCII (escape it, e.g. \\u2192):\n${raw.join("\n")}`,
);
console.log("✓ widget-ascii-bundle: widget.js is pure ASCII");
}
void main();