refactor(content,core,app,editor,learn): Learn's content in pure Dart, for its agent

ADR 0044's D49 (amended in building it): what reads and seals Learn's
content moves out of the Flutter packages, so Learn's agent, which runs
without Flutter, shares it rather than repeating the privacy rules.

packages/halkyon_content (new, pure Dart) takes from halkyon_app the
envelope and its cipher, SealedFile, UnlockedAccountKeys, shared
spaces' gateway with SharedKeys and KeyPins, FileCache and
FileServerGateway, with their fakes and tests; halkyon_app exports it,
so no app changes. Its rich_text.dart takes RichContent from
halkyon_editor, which exports it. newAccountKeys makes an agent's key
pair. halkyon_core takes DelayedDeletions and gains SyncRequests, what a
synced gateway asks of the sync, which SyncService implements.

apps/learn/halkyon_learn_core (new, pure Dart) takes Learn's privacy,
sync, payloads and the models, codecs, gateways and repositories of
studysets, cards, notes, tags and feedback, with what they reach of
files, learning paths, citations and study options; the app imports them
from there. A subject's icon, colour and name stay in the app
(SubjectLook); what only the app shows (progress, exam coverage, the
card browser, deletions' waits) stays too. Nothing changes for people
using the apps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-11 21:24:30 +01:00
commit d09625d43e
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -268,6 +268,42 @@ member reads everything in the space.
Explore, and new cards and notes for the studyset or one of its topics; deleting is
asked for with a report. A suggestion may name the files the studyset holds; new
files it would bring come later.
- **D49.** **What the agent needs moves, the rest later** (decided 11 Nov 2026, the
agent's recommendation): `packages/halkyon_content` (pure Dart) takes halkyon_app's
envelope (`PayloadEnvelope`, `ContentCipher`) and the shared keys (`SharedKeys`,
`KeyPins`), which halkyon_app re-exports; `apps/learn/halkyon_learn_core` (pure Dart)
takes Learn's privacy, sync, content and the models, codecs, gateways and
repositories of studysets, cards, notes, tags and feedback, which the app imports
from there. Paths, PDFs and files follow when the agent needs them. Over moving
every Flutter-free data layer at once (a larger move than the agent asks for), and
over one package for both (Todo and Train would depend on Learn's).
**Amended 11 Nov 2026, in building it**: what Learn's data layer reaches went too, all
pure Dart already and re-exported where it was: rich text (`RichContent`, from
halkyon_editor into halkyon_content's `rich_text.dart`), people's files on the device
and the module's store (`FileCache`, `FileServerGateway`, from halkyon_app),
`DelayedDeletions` into halkyon_core, and of Learn's what feedback and privacy take:
the files' repository, learning paths' models and repository, citations, study
options. The synced gateways take halkyon_core's `SyncRequests` in place of
halkyon_app's `SyncService`, which implements it; a subject's icon, colour and name
stay in the app (`SubjectLook`), its ID and group in the core.
- **D50.** **The agent keeps its keys in files only its user reads** (decided 11 Nov
2026, the agent's recommendation): `$XDG_CONFIG_HOME/halkyon-agent/<instance>/`,
mode 0700, its files 0600: the token, the key pair, the pins and the local sync
database. The agent runs as a user of its own (D7), whose boundary protects them,
and starts unattended; `halkyon-agent sign-in` takes the token once from stdin.
Over a passphrase sealing the key (which helps only where it is kept apart from the
files) and over a system keyring (none unlocked for a headless user).
- **D51.** **Claude Code reaches it as a stdio MCP server on `dart_mcp`** (decided 11
Nov 2026, the agent's recommendation): one executable, `halkyon-agent sign-in |
sync | mcp`; its tools list the shared studysets, read a studyset's cards and notes,
search cards, suggest a change or a new card or note, report something to delete,
list a studyset's suggestions and reply, syncing before reading and after writing.
Over JSON-RPC by hand (MCP's revisions to keep up with) and over a CLI alone.
- **D52.** **Built on the laptop, copied by hand** (decided 11 Nov 2026, the agent's
recommendation): `dart build cli` bundles libsodium and SQLite as native assets,
and a script beside the agent copies the bundle to its user on the host, which has
no Dart SDK. The release tool takes it on once it has settled. Over a release of its
own now, and over a container (D7 runs it without Docker).
## Steps
@ -347,7 +383,8 @@ member reads everything in the space.
Suggestions, where its Owner and Editors accept or decline. New cards
and notes are suggested through the repository (the agent, step 6c);
the app offers a Viewer no button for them yet.
c. The agent itself, its CLI and MCP server, on a pure-Dart core (D7, D41).
c. The agent itself, its CLI and MCP server, on a pure-Dart core (D7, D41, D49 to
D52).
## Open questions, before building