feat(foreign): support raw stdin and per-cell inputs

Session eval now carries raw stdin, and the Python/Node workers temporarily replace program stdin during evaluation. foreign.session accepts an inputs table; view exposes per-cell stdin and Run All sends a per-cell input map. Stateless and persistent cells share the same input semantics.
This commit is contained in:
cflmy committed 2026-10-18 14:36:47 +08:00
1 parent a7266185b2
commit c85f1a2829
8 files changed
+303 -19

No files matched your search

+3 -2
View File
@@ -1053,7 +1053,7 @@ impl HostFn {
"concurrency",
],
Self::ForeignSessionOpen => &["cmd", "env", "cwd", "timeout"],
Self::ForeignSessionEval => &["code", "source", "input", "timeout"],
Self::ForeignSessionEval => &["code", "source", "input", "stdin", "timeout"],
Self::ForeignSessionSet
| Self::ForeignSessionGet
| Self::ForeignSessionNames
@@ -1512,12 +1512,13 @@ pub fn call_host(
HostFn::ForeignSessionEval => {
#[cfg(feature = "exec-host")]
{
crate::host::foreign_session::eval(
crate::host::foreign_session::eval_with_stdin(
ctx,
require(bound, "id")?,
bound.get("code"),
bound.get("source"),
bound.get("input"),
bound.get("stdin").and_then(|v| v.reveal_text()),
bound.get("timeout"),
)
}