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> |
||
|---|---|---|
| src | ||
| tests | ||
| wit | ||
| .gitignore | ||
| Cargo.toml | ||
| LICENSE | ||
| module.yaml | ||
| README.md | ||
| rust-toolchain.toml | ||
orchestrator-llm
F∆I orchestrator module — turns natural-language goals into
structured execution plans (fai_hub::plan::Plan JSON).
Status
v0.1.0 — deterministic stub. Always returns a structurally
valid plan that creates a single debug.echo flow regardless of
the goal. Useful as a smoke test for the full module → plan →
fai plan apply path.
v0.2.0 (next) — replaces the stub with an actual LLM call to a
configured endpoint (Ollama or OpenAI-compatible) once the F∆I
platform exposes outbound HTTP to permitted modules via wasi-http.
Capability
orchestrator.plan@0.1.0
Inputs
| Name | Type | Description |
|---|---|---|
goal |
text | Natural-language goal |
available_capabilities |
text (JSON list) | Optional. Capabilities currently installed in the hub. |
store_capabilities |
text (JSON list) | Optional. All capabilities the hub knows about. |
Outputs
| Name | Type | Description |
|---|---|---|
plan |
json | Plan JSON deserializable by fai_hub::plan::Plan |
Permissions
None. The deterministic stub does not call out. v0.2.0 will
declare net: <llm-endpoint> once the platform supports it.
Build
cargo build --release --target wasm32-wasip2
The built WASM lands at
target/wasm32-wasip2/release/orchestrator_llm.wasm.
Test
Host-side unit and integration tests exercise the pure plan-building logic (no WASM build required for tests):
cargo test
Use from a flow
schema_version: 1
name: plan-from-goal
inputs:
goal: text
steps:
- id: orchestrate
use: orchestrator.plan@^0
with:
goal: $inputs.goal
outputs:
plan: $orchestrate.plan
The plan output is JSON — pipe it through fai plan apply -
to execute it.
License
Apache-2.0. See LICENSE.