The platform repo froze its WIT contract at v1.0 and a
matching update is required here so the orchestrator-llm
component links against the same package version the hub
provides at runtime.
The wit/world.wit copy in this repo is a byte-for-byte
mirror of fai/platform :: wit/world.wit. Once the planned
fai-module-sdk crate ships, the mirror disappears — modules
will pull WIT bindings transitively through the SDK.
Bumps the module patch version 0.2.0 -> 0.2.1.
Signed-off-by: flemming-it <sf@flemming.it>
The dead-code lint Stefan flagged was a real signal — pretending
otherwise with #[allow(dead_code)] would have hidden a future
genuinely-dead helper. Two structural changes:
1. Gate `mod llm;` in lib.rs to `cfg(any(target_arch = "wasm32",
test))`. The LLM client only has callers on wasm32 (WakiClient)
and in the host test harness; on a host non-test build the
module is genuinely unreachable, so we don't compile it.
2. Add a test that covers every LlmError Display message so the
`Status` and `MissingInput` variants are constructed in the
test build (they were used by WakiClient on wasm32 but never
touched by host tests). The test doubles as a regression net
for the user-facing error strings.
18 host tests green (was 17). Drops the previous
allow(dead_code) escape hatch entirely.
Signed-off-by: flemming-it <sf@flemming.it>
Same suppression as in fai/platform's modules/echo: wit_bindgen
0.36's export! macro expands into unsafe fns whose bodies call
further unsafe fns without explicit unsafe blocks, and Rust 2024
makes that an error under -D warnings. Drop once wit_bindgen
ships a fix.
Gated on target_arch wasm32 so the host build (tests, plan
validation) stays strict.
Signed-off-by: flemming-it <sf@flemming.it>
Mirrors the workflow in fai/platform: Linux x86_64 only, manual
checkout via the external URL to bypass DinD network isolation,
fmt/clippy/build/test on host, plus an explicit wasm32-wasip2
release build to confirm the module still produces a valid WASM
component.
See fai/platform docs/architecture/ci.md for the rationale on
why we don't use actions/checkout.
Signed-off-by: flemming-it <sf@flemming.it>
The orchestrator now calls a configured Ollama-compatible LLM
endpoint over wasi-http and emits the LLM-generated plan back
to the hub. When llm_endpoint is empty, the v0.1.0 deterministic
stub is preserved as fallback (useful for tests and air-gapped
environments).
- module.yaml: bump to 0.2.0; new inputs llm_endpoint,
llm_model, llm_api_key; net: permissions for OpenAI,
Anthropic, localhost, 127.0.0.1 (Ollama defaults)
- src/llm.rs: LlmClient trait, OllamaParams, build_user_prompt,
build_ollama_body, extract_ollama_content, generate_plan;
9 unit tests for prompt-building and response-parsing
- src/plan.rs: tagged enum with Explain/SaveFlow/RunFlow/
InstallModule variants; parse_and_validate; build_stub_plan
(renamed from build_plan); validate(); 6 unit tests
- src/lib.rs: WakiClient implementing LlmClient over the waki
WASI-0.2 HTTP crate (wasm32-only); empty endpoint → stub
- Cargo.toml: 0.2.0; thiserror dep; waki dep gated on wasm32
17 host-side tests pass. WASM bundle is 386KB (was 74KB; the
delta is wasi-http via waki, expected). The deny path is
exercised by the platform-side integration test in
fai_platform/crates/fai_hub/tests/orchestrator_llm_path.rs.
Signed-off-by: flemming-it <sf@flemming.it>
The orchestrator-llm module turns a goal text into a Plan JSON
that the F∆I hub can apply. v0.1.0 is a deterministic stub —
it always emits a three-step plan (explain, explain-stub-notice,
save_flow with debug.echo) regardless of the goal.
Why ship a stub: it validates the module → plan → apply pipeline
end-to-end before adding LLM integration. The output is a
structurally valid Plan that round-trips cleanly through
fai_hub::plan::Plan deserialization.
v0.2.0 will replace the stub body with an actual LLM call once
the F∆I platform exposes outbound HTTP to permitted modules via
wasi-http.
Files:
- module.yaml — capability orchestrator.plan@0.1.0, no permissions
- wit/world.wit — copy of fai:platform@0.1.0
- src/lib.rs — wit_bindgen Guest impl that delegates to plan.rs
- src/plan.rs — pure plan-builder (host + WASM compatible)
- tests/plan_compatibility.rs — plan JSON shape assertions
- rust-toolchain.toml — pin to Rust 1.86 with wasm32-wasip2 target
- README.md — usage and status
Signed-off-by: flemming-it <sf@flemming.it>