A description was emitted above the `async def`, where Python treats the first string as the `Tools` class docstring and every later one as a dead expression — leaving each method undocumented in the model's only source of tool semantics. Emit it as the first statement of the method body instead. Also names the known languages in the run_code flavor guard (the reachable rejection, symmetric with the SDK_RENDERERS guard) and corrects three doc claims: the code-runtime group README no longer calls the generated SDK TypeScript, the base Code Mode note states its serial dispatch in past tense, and the tools README points at the rationale the language-dispatch note actually carries.
1.4 KiB
1.4 KiB
code-runtime/:代码执行能力家族
English | 中文
代码执行能力 seam(参见能力 seam):一个抽象运行时接口,用于针对宿主提供的异步绑定执行一段模型编写的程序,并捕获程序打印和返回的内容。消费方是工具注册表的 Code Mode(tools: { mode: code },即 run_code 工具与按所加载运行时 language 生成的 SDK);设计记录在 Code Mode Agent Note 中。这些都是产品包。
| 包 | 职责 | ctx 键 |
|---|---|---|
code-runtime/ |
抽象代码执行 seam(接口 + 词汇) | ctx.codeRuntime |
code-runtime-worker/ |
worker 线程后端:每次运行使用全新 worker,由宿主侧剥离 TypeScript 类型(类型注解仅供参考,绝不执行类型检查)、端口桥接绑定、预算/堆限制 | 注册 ctx.codeRuntime |
接口位于 code-runtime/code-runtime/,随附的后端位于 code-runtime/code-runtime-worker/。不同后端可以采用不同执行基底(worker 线程、进程、容器)与源语言;二者都是服务上的只读描述符。后端注册 ctx.codeRuntime,无需修改接口或消费方;正是这种拆分,使未来可以直接换入加固后端。