← Back to Pull requests

feat(runtime): add LLVM Wasm plugin runtime and Rust Arrow example #6069

Open
unknown opened this pull request with 632 lines diff across 7 files
View on GitHub
unknown unknown commented on Oct 11, 2026 14:25 UTC
Author

Summary

This PR adds an experimental language-neutral core-Wasm plugin path to Maka and uses a Rust Apache Arrow Compute plugin as the first real example.

The current JavaScript/TypeScript plugin loader remains unchanged. A package opts into the new path with runtime.format = "wasm" and runtime.abi = "maka:plugin/runtime@1".

Why LLVM makes Rust plugins possible

Maka does not need to understand Rust source code or embed a Rust runtime. Rust code is compiled by rustc, whose backend lowers the program through LLVM to wasm32-unknown-unknown. The resulting Wasm core module exports the small Maka ABI:

  • linear memory

  • manifest pointer and length

  • guest allocator and free functions

  • JSON Tool invocation returning a packed pointer/length i64
  • The Runtime Host validates the manifest, starts the module in a worker with no imports, enforces memory/input/output/time limits, and adapts each manifest contribution into the existing PluginToolService. The resulting Tool is indistinguishable from a JavaScript plugin Tool to the rest of Maka.

    Rust + Arrow Compute
            | rustc / LLVM backend
            v
    wasm32-unknown-unknown core module
            | maka:plugin/runtime@1
            v
    WasmPluginRuntime worker
            | existing Tool adapter
            v
    PluginToolService -> Maka Tool
    

    This is why the approach extends beyond Rust: C, C++, Zig, Swift, or another LLVM frontend can target the same Wasm ABI. LLVM is the compilation and audit layer; it is not a Runtime Host dependency.

    Arrow example

    experiments/llvm-plugin/arrow-data-analysis is a complete Rust plugin package:

  • summary builds an Arrow Float64Array and computes sum, min, max, mean, and null statistics.

  • group_sum builds Arrow numeric/string arrays and computes per-group aggregates.

  • maka.extension.json declares the Wasm runtime.

  • maka.composition.yml installs the arrow_analyze Tool at profile scope.

  • e2e.mjs installs the package through the real HostPluginPlatform, invokes it, and uninstalls it.

  • deepseek-e2e.mjs optionally exercises DeepSeek function calling through the same Tool. It only reads DEEPSEEK_API_KEY from the environment and never prints it.
  • The local DeepSeek run completed successfully: DeepSeek selected group_sum, the Arrow plugin returned east = 120 and west = 280, and DeepSeek generated a follow-up explanation from the Tool result.

    Package boundary change

    The hard 256-file plugin package limit is removed. The package store still enforces:

  • 8 MiB per file

  • 16 MiB total package bytes

  • canonical safe paths

  • no symlinks or unsupported filesystem entries
  • A regression test installs a package with 300 files successfully.

    Design and scope

  • Experimental core-Wasm transport only; this is not yet the Wasm Component Model.

  • Tool contributions only; Executor, LSP, UI, and other high-authority capabilities are intentionally not exposed by this ABI.

  • No host imports are available to guest modules. Filesystem, network, Context, and Node access require a future explicit capability ABI.

  • Existing JavaScript package loading and Tool composition behavior remain supported.

  • Rust SDK, C ABI header, and Rust/C/Zig templates are included for follow-up language support.
  • Verification

  • npm --workspace @maka/runtime-host run typecheck — passed

  • npm --workspace @maka/runtime-host run build — passed

  • node --test --test-name-pattern="loads the versioned Wasm tool ABI" packages/runtime-host/dist/__tests__/wasm-plugin-runtime.test.js — passed

  • node --test --test-name-pattern="Plugin packages do not impose a file-count cap" packages/runtime-host/dist/__tests__/plugin-platform.test.js — passed

  • cargo check --manifest-path experiments/llvm-plugin/arrow-data-analysis/Cargo.toml — passed

  • cd experiments/llvm-plugin && node sdk/build.mjs rust ../arrow-data-analysis — produced dist/plugin.wasm

  • node experiments/llvm-plugin/arrow-data-analysis/e2e.mjs — passed summary and group_sum installation/invocation/uninstall flow

  • node experiments/llvm-plugin/arrow-data-analysis/deepseek-e2e.mjs — passed with the local DeepSeek API key

  • node scripts/asf-license-headers.mjs check — passed

  • git diff --check and targeted Biome checks — passed
  • The full Runtime Host suite was not used as the acceptance gate because the existing checkout has unrelated baseline failures in ACP/deep-research fixtures and hosted execution metadata.

    AI use

  • No generative tool made a substantive contribution

  • Generative tooling made a substantive contribution
  • Tool(s) and scope: OpenAI Codex authored the implementation, tests, architecture documentation, and verification commands under human direction. The commit retains Generated-by: Codex.

    Checklist

  • Tests cover the change and fail without it

  • Lint, format, typecheck and the affected suites pass locally
  • Does this PR entail a change in behavior?

  • Yes — Maka can now load experimental core-Wasm Tool plugins; the behavior and limitations are described above.

  • No
  • Diff: 632 lines (+474 / -158) across 7 files Reviewer: M4n5ter Review duration: 19234m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.50) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 632 lines diff across 7 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.386
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #6069"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 50.4% (MEDIUM) · Higher = larger blast radius
    50.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 26.9% · Safe to merge
    26.9%
    Repository