Expand description
Explicit, repeatable migration between Pi and Ultron sessions (ultron/migration.ts): import_pi_session
copies a whole Pi session tree into a new native format-4 session, export_native_session_to_pi writes a native
session’s whole tree back as a Pi session (rollback). Nothing here reads Pi’s data directory implicitly: every
source path is given by the caller.
Pi entry mapping (Pi entry ids are kept as native entry ids, parents are unchanged):
message,compaction,branch_summary,custom-> the native entry of the same type;custom_message-> a nativemessageentry with acustomrole message;- every other Pi entry type -> a native
customentrypi-session:<type>whose data is the Pi entry withouttype/id/parentId/timestamp; - at the end: the
maintip is the Pi leaf, labels are Pi’s resolved labels, the name is Pi’s name, and themainlane configuration carries the model and thinking level Pi resolves at the leaf; - a
context_editdominated by its target is baked into the target (replacement or omission); one that only some branches carry is applied per branch on copies (<id>~<editId>, recorded inultron.pi.copyOf); - Pi-reported usage becomes the usage ledger’s imported historical root
import:pi:<piSessionId>; - an entry the native form cannot reproduce exactly keeps its Pi original in
ultron.pi.original.
The native file is byte-for-byte what the TypeScript product writes for the same Pi file
(fixtures/migration/migration.json).
Structs§
- Export
Result - What an export wrote (
ExportNativeSessionToPiResult). - Import
Result - What an import wrote (
ImportPiSessionResult).
Enums§
Constants§
- PI_
COPY_ OF - PI_
ENTRY_ CUSTOM_ TYPE_ PREFIX - PI_
LEAF_ MARKER_ CUSTOM_ TYPE - PI_
OMITTED_ MESSAGE_ CUSTOM_ TYPE - PI_
ORIGINAL
Functions§
- export_
native_ session_ to_ pi exportNativeSessionToPi: the native session atsession_path(in<sessionsRoot>/<cwd-dir>/) written whole as a Pi session atoutput_path, which must not exist. Pi resumes at its last entry, the nativemaintip; labels, the name, and themainlane’s model and thinking level that differ from what the entries say are appended after it.- import_
pi_ session importPiSession: the whole tree of the Pi session atpi_session_pathas a new native session undersessions_root(entry ids, parents and timestamps kept; themaintip is the Pi leaf). A failed import leaves no session file behind.- import_
pi_ session_ with import_pi_sessionwith a hook before each commit.- native_
session_ id_ for_ pi_ session nativeSessionIdForPiSession: a UUID-shaped (version 8) digest of the Pi session id.- pi_
import_ usage_ root
Type Aliases§
- Commit
Hook - Called before each commit of an import with its 1-based number; an error fails that commit (the TypeScript tests
make
session.mutatefail the same way).