Publish a follow-up through the task's read-only input mount.
Sealed tasks use this same narrow live input channel. Legacy containers
must be recreated instead of copying through a task-controlled pathname.
Source code in src/terok_executor/container/inject.py
| def inject_prompt(container_name: str, prompt_text: str) -> None:
"""Publish a follow-up through the task's read-only input mount.
Sealed tasks use this same narrow live input channel. Legacy containers
must be recreated instead of copying through a task-controlled pathname.
"""
if len(prompt_text.encode("utf-8")) > MAX_PROMPT_BYTES:
raise ValueError(f"Prompt exceeds the {MAX_PROMPT_BYTES // 1024} KiB limit")
container = Sandbox().runtime.container(container_name)
require_task_input_protocol(container)
for source, destination in container.mounts:
if destination == CONTAINER_AGENT_INPUTS:
write_untrusted_text(Path(source) / "prompt.txt", prompt_text)
return
raise RuntimeError("Task has no read-only input mount; rebuild images and recreate the task")
|