From 99c73e310aa3b4e6ed24fdce8ca8ef470d2bfe59 Mon Sep 17 00:00:00 2001 From: _Kerman Date: Wed, 21 Oct 2026 15:59:31 +0800 Subject: [PATCH] test(ptc): reuse shared Script snapshot configuration --- .../ptc-script-fresh/cordis.snapshot.yml | 58 ----- snapshots/session/ptc-script-fresh/cordis.yml | 41 ---- .../ptc-script-fresh/replay.override.json | 137 ------------ .../ptc-script-fresh/runtime.cordis.yml | 4 + .../session/ptc-script-fresh/snapshot.yml | 4 +- .../ptc-script-retained/cordis.snapshot.yml | 66 ------ .../session/ptc-script-retained/cordis.yml | 49 ----- .../ptc-script-retained/replay.override.json | 203 ------------------ .../ptc-script-retained/runtime.cordis.yml | 12 ++ .../session/ptc-script-retained/snapshot.yml | 4 +- 10 files changed, 18 insertions(+), 560 deletions(-) delete mode 100644 snapshots/session/ptc-script-fresh/cordis.snapshot.yml delete mode 100644 snapshots/session/ptc-script-fresh/cordis.yml delete mode 100644 snapshots/session/ptc-script-fresh/replay.override.json create mode 100644 snapshots/session/ptc-script-fresh/runtime.cordis.yml delete mode 100644 snapshots/session/ptc-script-retained/cordis.snapshot.yml delete mode 100644 snapshots/session/ptc-script-retained/cordis.yml delete mode 100644 snapshots/session/ptc-script-retained/replay.override.json create mode 100644 snapshots/session/ptc-script-retained/runtime.cordis.yml diff --git a/snapshots/session/ptc-script-fresh/cordis.snapshot.yml b/snapshots/session/ptc-script-fresh/cordis.snapshot.yml deleted file mode 100644 index e32772357d..0000000000 --- a/snapshots/session/ptc-script-fresh/cordis.snapshot.yml +++ /dev/null @@ -1,58 +0,0 @@ -# Keyless PTC mode combines the runtime/registry changes with the -# DeepSeek-to-replay swap in one profile patch. -- insert: - - id: literal-sdk - name: '../../../packages/core/tools/tests/fixtures/literal-sdk.ts' - -- id: llm-deepseek - name: '@deepseek-ai/dsh-llm-deepseek-api-key' - disabled: true - -- id: plugin-package-inventory-deepseek - disabled: true - -- id: agent-default-model - name: '@deepseek-ai/dsh-agent-default-model' - config: - provider: deepseek-official - model: deepseek-v4-flash - -- id: session-persistence-jsonl - name: '@deepseek-ai/dsh-session-persistence-jsonl' - config: - root: !!js dshHomePath('sessions') - compression: none - -- id: agent-instructions - name: '@deepseek-ai/dsh-agent-instructions' - config: - maxBytes: 65536 - -- id: tools - name: '@deepseek-ai/dsh-tools' - config: - mode: ptc - -- id: system-prompt - name: '@deepseek-ai/dsh-system-prompt' - config: - personaPrefix: | - You are a coding assistant powered by the {{model}} model. - - Verify your work by running the code or tests. Keep answers brief and factual. - -- insert: - - id: llm-replay - name: '@deepseek-ai/dsh-llm-replay' - config: - providers: - - id: deepseek-official - name: DeepSeek - models: - - id: deepseek-v4-flash - - id: deepseek-v4-pro - -- id: ptc-runtime - config: - executionMode: vm-script - scriptPersistence: false diff --git a/snapshots/session/ptc-script-fresh/cordis.yml b/snapshots/session/ptc-script-fresh/cordis.yml deleted file mode 100644 index 3bbcc76fe0..0000000000 --- a/snapshots/session/ptc-script-fresh/cordis.yml +++ /dev/null @@ -1,41 +0,0 @@ -# PTC mode adds `ctx.ptcRuntime` and changes the registry to one wire tool, -# `run_code`, plus its generated TypeScript SDK prompt. The demo and snapshot -# recorder apply this profile patch; replay applies its sibling patch. -- insert: - - id: literal-sdk - name: '../../../packages/core/tools/tests/fixtures/literal-sdk.ts' - -- id: agent-default-model - name: '@deepseek-ai/dsh-agent-default-model' - config: - provider: deepseek-official - model: deepseek-v4-pro - -- id: session-persistence-jsonl - name: '@deepseek-ai/dsh-session-persistence-jsonl' - config: - root: !!js dshHomePath('sessions') - compression: !!js 'process.env.DSH_SNAPSHOT === undefined ? ''zstd'' : ''none''' - -- id: agent-instructions - name: '@deepseek-ai/dsh-agent-instructions' - config: - maxBytes: 65536 - -- id: tools - name: '@deepseek-ai/dsh-tools' - config: - mode: ptc - -- id: system-prompt - name: '@deepseek-ai/dsh-system-prompt' - config: - personaPrefix: | - You are a coding assistant powered by the {{model}} model. - - Verify your work by running the code or tests. Keep answers brief and factual. - -- id: ptc-runtime - config: - executionMode: vm-script - scriptPersistence: false diff --git a/snapshots/session/ptc-script-fresh/replay.override.json b/snapshots/session/ptc-script-fresh/replay.override.json deleted file mode 100644 index 0791296c69..0000000000 --- a/snapshots/session/ptc-script-fresh/replay.override.json +++ /dev/null @@ -1,137 +0,0 @@ -[ - { - "kind": "chunks", - "chunks": [ - { - "type": "block-start", - "index": 0, - "blockType": "tool-call" - }, - { - "type": "block-end", - "index": 0, - "block": { - "type": "tool-call", - "id": "script_declare", - "name": "run_code", - "arguments": "{\"code\":\"let counter: number = 1; const alias = { value: counter }; function increment() { return ++counter }; class Box { [await Promise.resolve(\\\"read\\\")]() { return counter } };\",\"description\":\"Declare Script state with computed await\"}" - } - }, - { - "type": "usage", - "usage": { - "inputTokens": 10, - "outputTokens": 5 - } - }, - { - "type": "finish", - "reason": { - "kind": "tool-calls" - } - } - ] - }, - { - "kind": "chunks", - "chunks": [ - { - "type": "block-start", - "index": 0, - "blockType": "tool-call" - }, - { - "type": "block-end", - "index": 0, - "block": { - "type": "tool-call", - "id": "script_fresh", - "name": "run_code", - "arguments": "{\"code\":\"({ previous: typeof counter, answer: await(Promise.resolve(42)) })\",\"description\":\"Verify the next Script call starts fresh\"}" - } - }, - { - "type": "usage", - "usage": { - "inputTokens": 10, - "outputTokens": 5 - } - }, - { - "type": "finish", - "reason": { - "kind": "tool-calls" - } - } - ] - }, - { - "kind": "chunks", - "chunks": [ - { - "type": "block-start", - "index": 0, - "blockType": "tool-call" - }, - { - "type": "block-end", - "index": 0, - "block": { - "type": "tool-call", - "id": "script_binding", - "name": "run_code", - "arguments": "{\"code\":\"const result = await tools.bash({command:\\\"pwd\\\",description:\\\"Read working directory\\\"}); result.stdout.text.trim() === process.cwd()\",\"description\":\"Call a host binding from a fresh Script\"}" - } - }, - { - "type": "usage", - "usage": { - "inputTokens": 10, - "outputTokens": 5 - } - }, - { - "type": "finish", - "reason": { - "kind": "tool-calls" - } - } - ] - }, - { - "kind": "chunks", - "chunks": [ - { - "type": "block-start", - "index": 0, - "blockType": "text" - }, - { - "type": "text-delta", - "index": 0, - "text": "Verified Script completion, host bindings, and fresh state between calls." - }, - { - "type": "block-end", - "index": 0, - "block": { - "type": "text", - "text": "Verified Script completion, host bindings, and fresh state between calls." - } - }, - { - "type": "usage", - "usage": { - "inputTokens": 10, - "outputTokens": 2 - } - }, - { - "type": "finish", - "reason": { - "kind": "stop" - } - } - ] - } -] diff --git a/snapshots/session/ptc-script-fresh/runtime.cordis.yml b/snapshots/session/ptc-script-fresh/runtime.cordis.yml new file mode 100644 index 0000000000..6516bef024 --- /dev/null +++ b/snapshots/session/ptc-script-fresh/runtime.cordis.yml @@ -0,0 +1,4 @@ +- id: ptc-runtime + config: + executionMode: vm-script + scriptPersistence: false diff --git a/snapshots/session/ptc-script-fresh/snapshot.yml b/snapshots/session/ptc-script-fresh/snapshot.yml index 3c1fb0a723..171e268f7d 100644 --- a/snapshots/session/ptc-script-fresh/snapshot.yml +++ b/snapshots/session/ptc-script-fresh/snapshot.yml @@ -1,11 +1,9 @@ version: 1 scenario: ptc-script-fresh profile: headless -composition: ptc-script-fresh +composition: ptc recording: authored header: class: ptc-script-fresh pin: true -replay: - override: true permission: workspace-write diff --git a/snapshots/session/ptc-script-retained/cordis.snapshot.yml b/snapshots/session/ptc-script-retained/cordis.snapshot.yml deleted file mode 100644 index 8587db6304..0000000000 --- a/snapshots/session/ptc-script-retained/cordis.snapshot.yml +++ /dev/null @@ -1,66 +0,0 @@ -# Keyless PTC mode combines the runtime/registry changes with the -# DeepSeek-to-replay swap in one profile patch. -- insert: - - id: literal-sdk - name: '../../../packages/core/tools/tests/fixtures/literal-sdk.ts' - -- id: llm-deepseek - name: '@deepseek-ai/dsh-llm-deepseek-api-key' - disabled: true - -- id: plugin-package-inventory-deepseek - disabled: true - -- id: agent-default-model - name: '@deepseek-ai/dsh-agent-default-model' - config: - provider: deepseek-official - model: deepseek-v4-flash - -- id: session-persistence-jsonl - name: '@deepseek-ai/dsh-session-persistence-jsonl' - config: - root: !!js dshHomePath('sessions') - compression: none - -- id: agent-instructions - name: '@deepseek-ai/dsh-agent-instructions' - config: - maxBytes: 65536 - -- id: tools - name: '@deepseek-ai/dsh-tools' - config: - mode: ptc - -- id: system-prompt - name: '@deepseek-ai/dsh-system-prompt' - config: - personaPrefix: | - You are a coding assistant powered by the {{model}} model. - - Verify your work by running the code or tests. Keep answers brief and factual. - -- insert: - - id: llm-replay - name: '@deepseek-ai/dsh-llm-replay' - config: - providers: - - id: deepseek-official - name: DeepSeek - models: - - id: deepseek-v4-flash - - id: deepseek-v4-pro - -- id: ptc-runtime - config: - executionMode: vm-script - scriptPersistence: true - -- insert: - - id: computer-use - name: '@deepseek-ai/dsh-computer-use' - - id: cua-script-guidance - name: './cua-guidance.mjs' - config: - agentPreset: false diff --git a/snapshots/session/ptc-script-retained/cordis.yml b/snapshots/session/ptc-script-retained/cordis.yml deleted file mode 100644 index 1326c1d3e4..0000000000 --- a/snapshots/session/ptc-script-retained/cordis.yml +++ /dev/null @@ -1,49 +0,0 @@ -# PTC mode adds `ctx.ptcRuntime` and changes the registry to one wire tool, -# `run_code`, plus its generated TypeScript SDK prompt. The demo and snapshot -# recorder apply this profile patch; replay applies its sibling patch. -- insert: - - id: literal-sdk - name: '../../../packages/core/tools/tests/fixtures/literal-sdk.ts' - -- id: agent-default-model - name: '@deepseek-ai/dsh-agent-default-model' - config: - provider: deepseek-official - model: deepseek-v4-pro - -- id: session-persistence-jsonl - name: '@deepseek-ai/dsh-session-persistence-jsonl' - config: - root: !!js dshHomePath('sessions') - compression: !!js 'process.env.DSH_SNAPSHOT === undefined ? ''zstd'' : ''none''' - -- id: agent-instructions - name: '@deepseek-ai/dsh-agent-instructions' - config: - maxBytes: 65536 - -- id: tools - name: '@deepseek-ai/dsh-tools' - config: - mode: ptc - -- id: system-prompt - name: '@deepseek-ai/dsh-system-prompt' - config: - personaPrefix: | - You are a coding assistant powered by the {{model}} model. - - Verify your work by running the code or tests. Keep answers brief and factual. - -- id: ptc-runtime - config: - executionMode: vm-script - scriptPersistence: true - -- insert: - - id: computer-use - name: '@deepseek-ai/dsh-computer-use' - - id: cua-script-guidance - name: './cua-guidance.mjs' - config: - agentPreset: false diff --git a/snapshots/session/ptc-script-retained/replay.override.json b/snapshots/session/ptc-script-retained/replay.override.json deleted file mode 100644 index 9e6ae3268b..0000000000 --- a/snapshots/session/ptc-script-retained/replay.override.json +++ /dev/null @@ -1,203 +0,0 @@ -[ - { - "kind": "chunks", - "chunks": [ - { - "type": "block-start", - "index": 0, - "blockType": "tool-call" - }, - { - "type": "block-end", - "index": 0, - "block": { - "type": "tool-call", - "id": "script_declare", - "name": "run_code", - "arguments": "{\"code\":\"let counter: number = 1; const alias = { value: counter }; function increment() { return ++counter }; class Box { [await Promise.resolve(\\\"read\\\")]() { return counter } };\",\"description\":\"Declare Script state with computed await\"}" - } - }, - { - "type": "usage", - "usage": { - "inputTokens": 10, - "outputTokens": 5 - } - }, - { - "type": "finish", - "reason": { - "kind": "tool-calls" - } - } - ] - }, - { - "kind": "chunks", - "chunks": [ - { - "type": "block-start", - "index": 0, - "blockType": "tool-call" - }, - { - "type": "block-end", - "index": 0, - "block": { - "type": "tool-call", - "id": "script_reuse", - "name": "run_code", - "arguments": "{\"code\":\"counter++; console.log(\\\"retained\\\", new Box().read()); ({ count: increment(), alias: alias.value, answer: await(Promise.resolve(42)) })\",\"description\":\"Reuse retained Script declarations\"}" - } - }, - { - "type": "usage", - "usage": { - "inputTokens": 10, - "outputTokens": 5 - } - }, - { - "type": "finish", - "reason": { - "kind": "tool-calls" - } - } - ] - }, - { - "kind": "chunks", - "chunks": [ - { - "type": "block-start", - "index": 0, - "blockType": "tool-call" - }, - { - "type": "block-end", - "index": 0, - "block": { - "type": "tool-call", - "id": "script_binding", - "name": "run_code", - "arguments": "{\"code\":\"const cwdResult = await tools.bash({command:\\\"pwd\\\",description:\\\"Read working directory\\\"}); ({ sameDirectory: cwdResult.stdout.text.trim() === process.cwd(), count: counter })\",\"description\":\"Call a host binding from Script\"}" - } - }, - { - "type": "usage", - "usage": { - "inputTokens": 10, - "outputTokens": 5 - } - }, - { - "type": "finish", - "reason": { - "kind": "tool-calls" - } - } - ] - }, - { - "kind": "chunks", - "chunks": [ - { - "type": "block-start", - "index": 0, - "blockType": "tool-call" - }, - { - "type": "block-end", - "index": 0, - "block": { - "type": "tool-call", - "id": "script_exit", - "name": "run_code", - "arguments": "{\"code\":\"process.exit(7)\",\"description\":\"End the Script process\"}" - } - }, - { - "type": "usage", - "usage": { - "inputTokens": 10, - "outputTokens": 5 - } - }, - { - "type": "finish", - "reason": { - "kind": "tool-calls" - } - } - ] - }, - { - "kind": "chunks", - "chunks": [ - { - "type": "block-start", - "index": 0, - "blockType": "tool-call" - }, - { - "type": "block-end", - "index": 0, - "block": { - "type": "tool-call", - "id": "script_recover", - "name": "run_code", - "arguments": "{\"code\":\"({ previous: typeof counter, recreated: await Promise.resolve(4) })\",\"description\":\"Verify Script state was cleared\"}" - } - }, - { - "type": "usage", - "usage": { - "inputTokens": 10, - "outputTokens": 5 - } - }, - { - "type": "finish", - "reason": { - "kind": "tool-calls" - } - } - ] - }, - { - "kind": "chunks", - "chunks": [ - { - "type": "block-start", - "index": 0, - "blockType": "text" - }, - { - "type": "text-delta", - "index": 0, - "text": "Verified Script completion, host bindings, and state retention and recovery." - }, - { - "type": "block-end", - "index": 0, - "block": { - "type": "text", - "text": "Verified Script completion, host bindings, and state retention and recovery." - } - }, - { - "type": "usage", - "usage": { - "inputTokens": 10, - "outputTokens": 2 - } - }, - { - "type": "finish", - "reason": { - "kind": "stop" - } - } - ] - } -] diff --git a/snapshots/session/ptc-script-retained/runtime.cordis.yml b/snapshots/session/ptc-script-retained/runtime.cordis.yml new file mode 100644 index 0000000000..bfdd205f76 --- /dev/null +++ b/snapshots/session/ptc-script-retained/runtime.cordis.yml @@ -0,0 +1,12 @@ +- id: ptc-runtime + config: + executionMode: vm-script + scriptPersistence: true + +- insert: + - id: computer-use + name: '@deepseek-ai/dsh-computer-use' + - id: cua-script-guidance + name: './cua-guidance.mjs' + config: + agentPreset: false diff --git a/snapshots/session/ptc-script-retained/snapshot.yml b/snapshots/session/ptc-script-retained/snapshot.yml index f1e4ffc7fa..93d45aa34e 100644 --- a/snapshots/session/ptc-script-retained/snapshot.yml +++ b/snapshots/session/ptc-script-retained/snapshot.yml @@ -1,13 +1,11 @@ version: 1 scenario: ptc-script-retained profile: headless -composition: ptc-script-retained +composition: ptc recording: authored header: class: ptc-script-retained pin: true -replay: - override: true permission: workspace-write workspace: setup: cua-script-guidance