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>
39 lines
979 B
TOML
39 lines
979 B
TOML
# Standalone Cargo.toml — targets wasm32-wasip2, NOT a workspace member.
|
|
#
|
|
# Build with:
|
|
# cargo build --release --target wasm32-wasip2
|
|
|
|
[package]
|
|
name = "orchestrator_llm"
|
|
version = "0.2.0"
|
|
edition = "2024"
|
|
authors = ["Dr. Stefan Flemming <platform@flemming.ai>"]
|
|
license = "Apache-2.0"
|
|
publish = false
|
|
description = "F∆I orchestrator module — turns natural-language goals into structured execution plans"
|
|
repository = "https://git.flemming.ws/fai-modules/orchestrator-llm"
|
|
|
|
[lib]
|
|
crate-type = ["cdylib", "rlib"]
|
|
|
|
[dependencies]
|
|
wit-bindgen = "0.36"
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
thiserror = "2"
|
|
|
|
# WASI-0.2 HTTP client. Only compiled into the wasm32-wasip2 build.
|
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
|
waki = "0.5"
|
|
|
|
[dev-dependencies]
|
|
serde_yaml = "0.9"
|
|
|
|
[profile.release]
|
|
opt-level = "s"
|
|
lto = true
|
|
codegen-units = 1
|
|
strip = "symbols"
|
|
|
|
[workspace]
|
|
# Empty workspace table so this package is NOT picked up by a parent.
|