feat(codemode): replace Yaegi with Expr

Merged
RA
2mo ago
+661-2423

Replace the Go/Yaegi CodeMode runtime with Expr on feat/expr-codemode.

  • execute CodeMode as Expr expressions
  • expose only the codemode runtime 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/expr v1.17.8, drops github.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 codemode API object, with no Go imports or Yaegi stdlib.
  • codemode.CallToolStream collects 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.Get instead of Go type assertions.
  • Replace return/__out patterns with the expression-oriented result model.