By: lcnbr <im@lcnbr.ch>
fix portable Spenso Typst display
Restore structured manual-math leaves in the native Typst tensor printer,
route built-in metrics through the same attachment layout, make declaration
equality semantic rather than provenance-dependent, and preserve precise
collision diagnostics. Rebuild the committed Tydenso bundle with the fixes.
User prompt:
PLEASE IMPLEMENT THIS PLAN:
# Split Tymbolica and Tydenso into Their Owning Repositories
## Summary
- Keep Tymbolica, Rubi, and the shared `tymbolica-atom-payload` crate in `lcnbr/tymbolica`.
- Move all Tydenso Rust code, Typst files, documentation, examples, Wasm build tooling, and compressed artifacts into GammaLoop.
- Make the dependency strictly one-way: GammaLoop depends on `tymbolica-atom-payload`; Tymbolica has no Spenso, Idenso, or GammaLoop dependency.
- Continue GammaLoop work in the existing JJ workspace on top of `simplify-spenso-api`.
## Repository and dependency changes
- Merge `tymbolica-typst-ast` into `tymbolica_atom_payload::typst_ast`, leaving one shared Git dependency.
- In both repositories, declare `symbolica = { version = "2.2", default-features = false }` and patch `symbolica`, `numerica`, and `graphica` to the same exact official `dev` revision. Resolve current `dev` once and pin that SHA in every root patch; currently this is `ec19eeb211685aa216dbd28a4df547cd4c6baca1`.
- Remove Tymbolica’s `vendor/symbolica-wasm` adapter and the `lcnbr/symbolica` pin. Official `dev` now contains the generalized partial-import remapping fix.
- Tymbolica’s plugins select `symbolica/wasm`; ensure `symbolica-integrate` disables Symbolica default features so Rubi cannot pull GMP or native code generation into Wasm.
- GammaLoop references the pushed Tymbolica commit exactly:
```toml
tymbolica-atom-payload = {
git = "https://github.com/lcnbr/tymbolica",
rev = "<exact-tymbolica-commit>",
default-features = false,
}
```
- Give the payload and reusable GammaLoop crates explicit `native` and `wasm` feature forwarding. Native selects `integer-gmp` and `float-mpfr`; Wasm selects `symbolica/wasm`. Keep native code generation separate and native-only.
- Regenerate GammaLoop’s Hakari workspace-hack data for Symbolica’s renamed features.
- Give Tydenso a nested Cargo workspace under `tydenso/`, with its own lockfile and identical Symbolica patches. This prevents native workspace builds from unifying GMP/native-code-generation features into the Wasm graph.
## Shared Atom contract
- Keep `tymbolica-atom-payload` Symbolica-dependent. It owns native Atom export/import, attachments, generic render trees, and Parsely-CBOR-to-Atom conversion.
- Replace the envelope in place without legacy public `V1`/`V2` APIs or compatibility readers:
- retain magic, internal envelope version, native Atom bytes, and schema-keyed attachments;
- remove the embedded Git SHA, `build.rs`, `SYMBOLICA_REVISION`, and revision-mismatch errors;
- preflight the native Atom header before exposing attachments or mutating Spenso state, accepting the pinned writer format only: Symbolica magic `0x37871367` and export format `5`.
- Symbolica’s native export remains responsible for names, namespaces, tags, user data, and exact Atom structure.
- Portable attachments carry Spenso representation and manual math-display declarations. Typst head/call customization remains external notation, never symbol content.
- Move the `spenso.representation` and `spenso.math-display` codecs and registration logic into an optional Spenso portable-payload module, shared by Tydenso and Spynso.
## Tydenso and Spynso
- Move the Tydenso plugin, its local inflater/compressor, complete `tydenso/` Typst package, manual, tests, examples, and committed Wasm bundles into GammaLoop.
- Preserve `wasm-opt`, zlib compression, reproducible manual generation, and the hard compressed-size limit below 10 MiB.
- Update repository links and replace sibling-relative Tymbolica imports with local-package imports resolved against the exact pinned Tymbolica commit in CI.
- Bundle Tydenso’s `render.typ` and `notation.typ` directly into Spynso with `include_str!`; Python rendering must not invoke the Tydenso Wasm plugin.
- Add `DisplaySettings` with the existing ports layout plus Schoonschip and call layouts, dimension display, parentheses, commas, symbol scripts, and spacing controls.
- Extend existing display methods compatibly:
- preserve positional calls such as `to_typst(True)` and `formatted(True)`;
- add `to_html`, `to_svg`, semantic `_repr_html_`, and trusted `notation_source` overrides;
- keep `TensorNetwork.__str__` as DOT and add explicit `to_dot`;
- do not incompatibly override Symbolica’s inherited `to_latex`.
- Provide Typst rendering through the optional `gammaloop[typst-display]` extra using `typst>=0.15,<0.16`. Explicit HTML/SVG calls raise an install-guidance `ImportError` when absent; notebook display silently falls back to existing LaTeX/text.
- Direct Idenso functions continue returning normal Symbolica expressions. Rich display is obtained through Spenso objects, `spenso.formatted(expression)`, or `spenso.as_tensor(expression)`.
## Tests and rollout
- Test payload round-trips between native Spynso, Tydenso Wasm, and Tymbolica, including attachments, nested function remapping, malformed headers, trailing bytes, and rejection before registry mutation.
- Assert both repositories resolve one identical Symbolica source revision.
- Verify Tymbolica core and Rubi contain no Spenso/Idenso dependencies.
- Verify the Tydenso Wasm graph contains neither GMP/MPFR nor GammaLoop’s native workspace hack.
- Compile every Tymbolica, Rubi, and Tydenso example, test document, and manual; test semantic MathML output, SVG output, Typst HTML phantom alignment, notation overrides, and optional-renderer fallback.
- Copy Tydenso into GammaLoop first, then finalize and push the Tymbolica cleanup to `main`. Finally replace GammaLoop’s temporary local dependency with that exact pushed commit and validate the GammaLoop change atop `simplify-spenso-api`.
- Preserve the MIT license throughout.