Skip to content

megahal-cli-v0.2.0

Choose a tag to compare

@tgies tgies released this 22 May 18:55
· 15 commits to main since this release
7cdfbd3

First release on crates.io. Renames the inner bidirectional Markov crate from markov-chain to megahal-markov to avoid a name conflict, exposes new APIs in the facade, and fixes four algorithm bugs relative to the C reference.

Added

  • MegaHal::save_brain_to_writer / load_brain_from_reader for
    in-memory brain serialization without filesystem I/O.
  • MegaHal::train_from_reader for training from any BufRead source.
  • MegaHal::generate: a no-learn variant of respond.
  • MegaHal::set_fallback_reply / set_fallback_greeting for replacing
    the hardcoded "I don't know enough..." and "Hello!" messages.
  • MegaHalError for reader and writer errors.
  • megahal-cli crate with cargo install megahal-cli for the megahal
    binary, extracted from the workspace root. cargo binstall megahal-cli
    also works, pulling the prebuilt binary from the matching GitHub release.
  • Runnable examples under crates/megahal/examples: chatbot (stdin
    loop), game_hud (no-learn generate with a tight iteration budget),
    and brain_persist (save/load via reader/writer).

Changed

  • Renamed the markov-chain crate to megahal-markov. The name
    markov-chain is held on crates.io by an unrelated 2017 crate.
  • SymbolId's tuple-struct field is no longer public; construct via
    SymbolId::new(value). The symbol-core crate's API is documented as
    unstable; consumers should depend on the megahal facade.
  • Expanded the megahal crate-level rustdoc with an API tour, concepts
    section, brain-file format note, and a recipe for shipping a
    pre-trained brain via include_bytes!.
  • Running megahal without --brain now defaults to persisting the brain
    to the user's data directory instead of running with no persistence.
  • MegaHal::train_from_file now streams the file line-by-line, meaning
    a mid-file UTF-8 decoding error leaves the model partially trained
    instead of validating UTF-8 upfront.

Fixed

  • capitalize no longer upper-cases the letter after a !/./? when
    no whitespace follows (e.g. a.b.c now correctly produces A.b.c).
  • Reply generation no longer echoes the user's input when that was the
    only thing the model could produce; falls back to the canned reply
    instead.
  • The backward generation phase now runs even when the forward phase
    produces no tokens, matching the C reference behavior.
  • babble no longer panics when a context node's usage count is zero;
    treats that case as sentence-terminating.