Files
chatkit/eslint.config.mjs
CatoandClaude Opus 5.5 58cb5c691f feat(pdf): read a PDF someone attaches, as text or as pictures of its pages (0.20.0) (#46)
* feat(pdf): read a PDF someone attaches, as text or as pictures of its pages

No model on a free chain reads a PDF file, so a PDF never leaves the device
as one. @bitbaum/chatkit/pdf reads it in the browser with pdf.js:

- a PDF with a text layer comes back as text, page markers kept;
- one without (slides exported as pictures, a scan) comes back as its pages,
  four to a sheet at 784px a page, for a model that can see.

chatkit-copy-pdf-assets copies pdf.js's worker and decoders into the app's
static folder; readPdf takes their URL. Without the decoders, JPEG 2000
pages (macOS's "reduce file size" export) draw blank. The legacy build is
used so older iPhones read PDFs too; pdf.js loads only on the first PDF.

Found on OrangeCat 2026-10-27: a 17-slide investor deck (no text layer,
JPEG 2000 images) could not be shared with the Cat at all. Checked in
Chromium against that deck: 5 sheets, every slide legible.

Release 0.20.0.

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

* docs(pdf): describe the app's static folder without naming it as a chatkit path; chain the copy into build (pnpm skips prebuild)

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-27 17:00:54 +01:00

28 lines
1.1 KiB
JavaScript

// Flat config. Recommended presets only: a bespoke rule set would be a second
// opinion to maintain for no benefit. The floor is "lint runs and can fail", not "lint encodes
// taste".
import js from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
export default tseslint.config(
{
// dist/ is generated by `tsc`; demo/dist/ by esbuild for the visual check.
ignores: ["dist/**", "demo/dist/**", "demo/pdfjs/**", "node_modules/**"],
},
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ["**/*.ts", "**/*.tsx"],
// Client islands touch browser APIs; the parser and server components
// run under Node. Both global sets, one config.
languageOptions: { globals: { ...globals.node, ...globals.browser } },
},
{
// Tests and bin/ are plain Node (tests under `node --test`).
files: ["test/**/*.js", "test/**/*.mjs", "bin/**/*.mjs"],
// browser.mjs is Node driving a browser: page.evaluate bodies run there.
languageOptions: { globals: { ...globals.node, ...globals.nodeBuiltin, ...globals.browser } },
},
);