refactor(app): share session state, screen and transcript reading in packages/core

PU
8d ago
+12568-869

First of the phone app's PRs. The iPhone app (#209, stacked on this one) reads sessions, screens, transcripts and pairing links the way the desktop app does, so that code moves into packages/core.

What changes

  • packages/core/src: derive, format, net, screen, transcript, the pure half of questions, the agent half of state-model (state.ts), the conversation list helpers (conversation.ts, taken out of conversation-store.ts) and pairing.ts (pairingLink, plus a new parsePairing with its own base64url/UTF-8, since React Native lacks some globals).
  • Plain TypeScript: only relative ./x.ts imports and import type from the plugin SDK, no DOM. Vite, Metro and node --test all load it as it is.
  • app/src/lib/<name>.ts re-exports each file, so no app import changes.
  • check:core (in CI's app job and AGENTS.md) rejects imports from outside the package and runs tsc with no DOM lib.
  • Tests moved with their code; pnpm test also globs ../packages/core/src/**/*.test.ts. New tests for parsePairing.
  • Vite's fs.allow includes packages/core (checked: the dev server serves it).

No user-visible change.

Checks: typecheck:plugins, check:titles/type/grid/csp/themes/core, pnpm test (632 pass), pnpm build, tsc -p e2e.

šŸ¤– Generated with Claude Code