feat(codemode): replace Yaegi with Expr
Merged
RA
2mo ago+661+661+012345678901234567890123456789-2423-2423-0123456789012345678901234567890123456789
Replace the Go/Yaegi CodeMode runtime with Expr on feat/expr-codemode.
- execute CodeMode as Expr expressions
- expose only the
codemoderuntime API - preserve exact tool whitelist validation and orchestration
- support sequential tool chaining with
let - collect streaming results through
CallToolStream - remove Yaegi-specific tests and docs
- add Expr runtime tests
Summary by cubic
Replaces the CodeMode Go/Yaegi interpreter with expr-lang/expr, so generated workflows are now Expr expressions instead of Go-like snippets. Code that relied on __out, imports, type assertions, or manual stream loops must be rewritten; tool whitelist validation and orchestration caching stay unchanged.
- Adds
github.com/expr-lang/exprv1.17.8, dropsgithub.com/traefik/yaegi, and makes the orchestrator fully Expr-native. - Extracts the plan JSON from model output even when wrapped in prose or markdown, then validates snippets with Expr before execution.
- The planner prompt now signals the Expr contract explicitly so generated programs are unambiguously non-Go.
- Generated programs see only the
codemodeAPI object, with no Go imports or Yaegi stdlib. codemode.CallToolStreamcollects streaming chunks into an array instead of a manual iterator.- Removes Yaegi benchmarks and preprocessing tests; replaces them with Expr runtime coverage.
Migration
- Rewrite generated code as
let-bound sequential expressions where the last expression is the result. - Read tool-result fields with
codemode.Getinstead of Go type assertions. - Replace
return/__outpatterns with the expression-oriented result model.