Sign in

    edgeflow

    Composable text-pipeline skeleton for on-device LLM applications, in pure MoonBit

    pipeline
    llm
    edge
    Download zip
    Author
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    6 hours ago
    Downloads
    1

    Dependencies

    #soehi/edgeflow

    Composable text-pipeline skeleton for on-device LLM applications, in pure MoonBit. No FFI, no third-party dependencies; builds and tests on native and wasm-gc.

    The unit of work is an Item — text plus string metadata — that moves through an ordered list of Stages. Sources produce items, sinks consume them, and nothing in the skeleton reads a file, opens a socket, or loads a model. That is the point: the composition rules can be tested and pinned before any behavior worth the name is attached.

    #Scope

    • Stage composition. Pipeline::new().then(a).then(b) runs a then b on one Item, synchronously and in order, stopping at the first failure. The error names the stage that failed, from the pipeline's own reading of Stage::name, so a stage is always located even when its error text is terse.
    • In-memory source. memory_source(items) turns plain strings into Items. The shape any real source will match later; it carries no provenance yet because nothing consumes one.
    • Text transforms. trim, uppercase, replace over Item::text, preserving meta. A stage maps one item to one item — it cannot drop or duplicate — which is what keeps run a straight loop rather than a scheduler.
    • Engine wrapper (thin, planned). The intended integration is a pipeline stage that calls a MoonLM Engine: encode, generate, decode, back into an Item. No sampling policy, no context management, no model loading — those are the engine's. The skeleton ships without it: this phase deliberately imports no inference API, so the wrapper is the first thing a later phase adds, not a silent stub pretending to exist.
    • Result aggregation. Sinks collect items and render them as JSON.

    #Non-goals

    • Streaming and distributed engines. No async, no futures, no fan-out. The model is one item through one list of stages. A scheduler is a different object with different correctness questions.
    • Visualization. No graphs, no dashboards. A pipeline is data, not a diagram.
    • Plugin DSL. Stages are MoonBit types implementing one trait. A user-facing pipeline language would need a parser, a type checker, and a versioned grammar — none of which a skeleton has earned.
    • Embedding training. No vector store, no fine-tuning. If retrieval is added it will call something that already exists, not train one.
    • Agent orchestration. The agent loop, tool-call parsing, schema validation, and sandboxing live in soehi/moonlm. edgeflow pipes text; it does not decide what to call or what is allowed.
    • Model-loading details. GGUF parsing, dequantization and the forward pass are soehi/gguf and soehi/moonlm. An edgeflow stage receives an already-loaded engine and never opens a file.

    #Development

    Dependencies resolve from the MoonBit registry. soehi/moonlm@0.1.0 and soehi/gguf@0.1.0 are both published, so a clone of this directory builds on its own — no workspace file, no sibling checkout.

    cd edgeflow moon update moon check --target native && moon check --target wasm-gc moon test --target native && moon test --target wasm-gc

    While developing against an unreleased change in moonlm, point the dependency at the local tree instead with a moon.work in the parent directory:

    cd .. # the directory containing both modules moon work init && moon work use ./moonlm ./edgeflow

    That is a local-development convenience, not a requirement: without it the registry versions above are used, which is what CI does.

    #Layout

    PathContents
    src/pipeline/Item, Stage, StageError, Pipeline, and the test stages (trim, uppercase, replace, always-fail).
    src/source/memory_source.
    src/sink/collect and to_json.

    #License

    Apache-2.0. See LICENSE.