Skip to content

Latest commit

 

History

History
132 lines (105 loc) · 6.61 KB

development.md

File metadata and controls

132 lines (105 loc) · 6.61 KB

Development

npm install        # only for typecheck and tests; nothing is needed at runtime
npm run typecheck
npm test

node_modules exists so tsc and node --test have the SDK, zod and react to look at. The daemon supplies all of those to the plugin itself and runs no package manager — plugins are source only.

Reloading after a change

Nothing is hot-reloaded, and both halves must be reloaded: the daemon and the client hold separate bundles, so reloading only the daemon leaves the old interface running against new handlers.

/Applications/Paseo.app/Contents/Resources/bin/paseo plugin reload voice

then reload the Paseo client itself.

The CLI is not on PATH; it lives inside the application bundle. The subcommand is plugin ls, not plugin list.

Whether it actually loaded is in the daemon log, not in the CLI's output, which reports running either way:

grep -a '"pluginId":"voice"' ~/.paseo/daemon.log | tail -3

A good load prints Loaded plugin with the list of registered RPC methods, then Plugin ready. A failure prints a stack trace there and shows as an error card in the interface — and that card is sticky: it can survive a fix and a reload. Trust the log over the screen.

A changed paseo-plugin.json needs plugin remove voice then plugin add with an absolute path. The daemon caches the manifest from install time and a reload will not re-read it.

Conventions

Files are named by where they run. .server.ts runs in the daemon subprocess, .client.tsx in the panel, .shared.ts in both. That is how the bundler decides what goes where, and it is not optional.

Both contribute() functions must be synchronous. Anything async is started inside and allowed to settle later.

Code, comments and documentation are in English. The interface is in seven languages, from shared/i18n/. No sentence a person reads is written into code: the panel looks its words up, and the server sends statuses and errors as msg(key, values) for the panel to say. Messages that only ever reach a log are English.

Tests state what is true, not what is called. the fingerprint catches an edit that kept the file's size rather than test fingerprintOf. A test name is the one piece of documentation that cannot go stale without going red.

What the tests cover

198 of them, all node:test, no framework and no mocking library.

The ones worth knowing about:

  • asar.test.ts builds an archive by hand, byte by byte. The header is two nested pickles and reading the JSON four bytes early yields a parse error on what looks like valid data — this test is what pins that down.
  • patches.test.ts carries the real shape of the functions being corrected, as Paseo compiles them, and proves that a missing anchor and a doubled anchor are both refusals rather than guesses. It also checks the installed Paseo against the verified hashes, so an update that changed a corrected file fails here first.
  • pcm.test.ts measures the low-pass rather than trusting it.
  • usage.test.ts covers the billing arithmetic, including the month boundary.
  • whisper.test.ts restarts the dictation engine against a stand-in whisper-server that takes a moment to load and a moment to go, as the real one does: one engine on the port after a restart, after two overlapping ones, and none after a stop during a start; its log on stderr is not a failure while it runs, and a death while loading fails the start with the reason it gave. The stand-in reads its arguments as the real one does — one it does not know ends it with its usage and an exit code of 0, which is how a flag whisper.cpp 1.8.3 dropped went unseen — and a second one stands for the builds before, which list --no-context: the flag must reach that one and not the other. An engine that refuses an argument fails the start with the refusal rather than the end of its help, and a stdout nobody reads does not stop it. Every stand-in writes down its pid and the file kills whatever is left, so a lost process fails the test instead of hanging it.

There is no test that needs a Google key or a network.

End to end, the phone's own voice code runs against a simulated daemon (npm run e2e) and against the real one through the relay (npm run e2e:live). Those need the patched iOS checkout and are kept out of npm test; see e2e/README.md. npm run e2e also compiles the phone's Opus encoder for this Mac, which needs Xcode's command-line tools; the live runs encode with opusscript, a development dependency.

Adding a language

One to speak and hear. A row in shared/languages.shared.ts: Google's accents (check which have Chirp 3 HD — listVoices for the accent), Whisper's code, the local engine's name for it or null, a short audition line, and the speaking rate, measured the way the table's comment says. Then a case in e2e/live/languages.live.ts: a question with a one-word answer, the regexes that catch both, and a sentence to dictate. Check that Parakeet v3, Paseo's recogniser in voice mode outside Russian, knows the language — it covers twenty-five European ones.

One to read the panel in. A file in shared/i18n/ exporting a Dictionary, its id and native name in shared/i18n/languages.ts, and a branch in pluralOf if its plurals follow neither English nor Slavic rules. TypeScript refuses a dictionary with a key missing; shared/i18n/i18n.test.ts refuses one with a placeholder missing or the wrong plural forms. Terms are taken from Paseo's own translation of its interface where it has one, so the panel speaks the same language as the app.

Things known and not done

  • A stress dictionary has no interface. The customPronunciations plumbing is in google.server.ts and the list is always sent empty. See voices.md.
  • Issues worth filing upstream, each reproduced: the silently dropped TTS segments (a forty-line repro exists), mute never ending a turn, daemon.mcp.injectIntoAgents being off by default when voice mode cannot work without it, and the three e2e/live/listening.live.ts keeps red on a stock daemon — the recogniser fed the whole room, the voice detector never reconnected after the speech worker dies, and the agent's voice left aborted after an empty turn. And a wish rather than a bug: audio crosses the relay uncompressed both ways.
  • build.sh installs on a phone only when devicectl calls it "connected". A phone it lists as "available (paired)" — plugged in or on the network — is not picked up, and step 7 ends as if there were none; install by hand, as troubleshooting.md shows.