Files
codex/codex-rs/code-mode-runtime/BUILD.bazel
T
Channing Conger 28a264fbc7 Add promise settlement streaming helpers to code mode (#51126)
## What changed

Expose two JavaScript globals for consuming results as inputs settle:

- `as_settled(promises)` returns an async iterator of fulfilled and rejected records in settlement order, preserving queued results while the consumer is busy.
- `stream_settled(promises, emit)` delivers those records to a callback, awaiting each invocation and propagating callback errors.

Records include an `index`, a `status`, and either a `value` or a `reason`. Iterable inputs use positional indices; `Map` inputs retain their keys. Both helpers accept promises, thenables, and plain values.

## Testing

Add runtime coverage for ordering, input types, object identity, callback behavior, early iteration exit, and termination. Add stdio and gRPC host tests for partial results across waits, plus a scenario snapshot verifying fulfilled and rejected records reach the model.

GitOrigin-RevId: cddc9f3679ae04f2421e154caa0417afb15f550d
2026-10-05 16:58:29 +00:00

8 lines
184 B
Python

load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "code-mode-runtime",
compile_data = ["src/runtime/settled.js"],
crate_name = "codex_code_mode_runtime",
)