feat(ptc): present provider execution guidance in logged program schema
This commit is contained in:
1 parent
c6b959783a
commit
2a08bf6ab9
17 files changed
+36
-15
No files matched your search
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write packages/code-runtime/code-runtime-node/README.md
|
||||
README.md: 4897656b6b42a7a5b38401576506088130d7b92a
|
||||
README.zh.md: 83c17be7c1d3a0c9b6d1ac5b7e1c2dd647006914
|
||||
README.md: a5285ae296b4f3380d8fc593f54f12fd68355a7a
|
||||
README.zh.md: 762e5912497d1ce3388305655514eb5faa2b4540
|
||||
@@ -65,7 +65,7 @@ Direct filesystem, network and subprocess operations remain Node operations, sub
|
||||
|
||||
### Deadlines and cancellation
|
||||
|
||||
The PTC consumer exposes per-call timeout and approved sandbox choices as described in [dsh-tools](../../core/tools/README.md#ptc-mode). The runtime's readonly `timeout` descriptor reports its effective default and maximum to that consumer.
|
||||
The PTC consumer exposes per-call timeout and approved sandbox choices as described in [dsh-tools](../../core/tools/README.md#ptc-mode). The runtime's readonly `timeout` descriptor reports its effective default and maximum to that consumer. Its `executionInstructions` describes fresh Node state, direct Node APIs, the empty program environment and file policy in the model-visible schema.
|
||||
|
||||
The elapsed deadline covers runtime setup and execution, including time awaiting nested tools or approval. It is not a CPU meter. Timeout or cancellation stops a synchronous loop through the host's managed process owner; successful completion also cleans that managed range. The timer stops when an outcome is selected, before cleanup, so the returned call can take longer than its execution deadline while cleanup settles.
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ kind: "package-reference"
|
||||
|
||||
### 截止时间与取消
|
||||
|
||||
PTC 消费方按 [dsh-tools](../../core/tools/README.zh.md#ptc-mode) 的说明公开逐次超时与经审批的沙箱选择。运行时只读 `timeout` 描述符向该消费方报告有效默认值与上限。
|
||||
PTC 消费方按 [dsh-tools](../../core/tools/README.zh.md#ptc-mode) 的说明公开逐次超时与经审批的沙箱选择。运行时只读 `timeout` 描述符向该消费方报告有效默认值与上限。 其 `executionInstructions` 在面向模型的 schema 中说明全新 Node 状态、直接 Node API、空程序环境和文件策略。
|
||||
|
||||
经过时间截止覆盖运行时准备和执行,包括等待嵌套工具或审批的时间。它不是 CPU 计量器。超时或取消通过 Host 的受管进程所有者停止同步循环;成功完成也会清理该受管范围。选择结果后、清理前停止计时器,因此调用可能要在执行截止之后等待清理结算才返回。
|
||||
|
||||
|
||||
@@ -64,6 +64,9 @@ export class NodeCodeRuntime extends CodeRuntime {
|
||||
})
|
||||
readonly language = 'typescript'
|
||||
readonly isolation = 'process'
|
||||
override get executionInstructions(): string {
|
||||
return 'Each call runs in a fresh Node process. Node APIs are available through await import(...). Relative paths use the supplied working directory; process.env starts empty. Direct filesystem access follows this execution\'s sandbox policy.'
|
||||
}
|
||||
private readonly config: ResolvedConfig
|
||||
private readonly live = new Set<LiveRun>()
|
||||
private disposed = false
|
||||
|
||||
@@ -132,6 +132,7 @@ describe('Node program process', () => {
|
||||
|
||||
it('uses the default deadline and caps explicit requests', async () => {
|
||||
const { runtime } = await setup()
|
||||
expect(runtime.executionInstructions).toBe('Each call runs in a fresh Node process. Node APIs are available through await import(...). Relative paths use the supplied working directory; process.env starts empty. Direct filesystem access follows this execution\'s sandbox policy.')
|
||||
expect(runtime.resolve({ program: '', bindings: [] }).timeoutMs).toBe(120_000)
|
||||
expect(runtime.resolve({ program: '', bindings: [], timeoutMs: 900_000 }).timeoutMs).toBe(600_000)
|
||||
for (const timeoutMs of [0, -1, NaN, Infinity]) expect(() => runtime.resolve({ program: '', bindings: [], timeoutMs })).toThrow()
|
||||
|
||||
Reference in new issue
Block a user