fix(codemode): return final top-level expression (#35759)

Co-authored-by: Kit Langton <kit.langton@gmail.com>
This commit is contained in:
opencode-agent[bot] 2026-07-07 11:44:50 -05:00 committed by GitHub
commit d0733f83bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 26 additions and 37 deletions

View file

@ -62,7 +62,7 @@ const result =
`result` is always a `CodeMode.Result`. Program, validation, limit, and tool failures are returned as diagnostics rather than failing the Effect. Host interruption remains interruption.
Successful result values are JSON-safe data. A program that returns `undefined`, including by reaching the end without `return`, produces `null`; nested `undefined` values are normalized to `null` as well.
Successful result values are JSON-safe data. An explicit `return` produces the program result; when it is omitted, the final executable top-level expression is returned as a model-friendly REPL convenience. Otherwise reaching the end produces `null`. Returned `undefined` and nested `undefined` values are normalized to `null` as well.
## API