From cf892265102468b5e6c905f9772bf61af8caff6c Mon Sep 17 00:00:00 2001 From: Tianyi Cui <53024+tianyicui@users.noreply.github.com> Date: Mon, 13 Jul 2026 23:31:26 +0800 Subject: [PATCH] test(pkg): snapshot advanced Python SDK executable flow The existing assertion-only executable smoke proved selected outputs but could not detect drift across the integrated Python SDK, JSON-RPC notification stream, and persisted session shape. Keep this separate from ACP snapshots because it must launch the actual platform-native packaged executable through the Python SDK. The deterministic model drives Cordis dynamic tool mounting, a Code Mode worker dispatch, direct spawn delegation, workflow-worker delegation, plugin disposal, and the parent/child persistence lineage. Commit four portable goldens for the SDK result and three JSONL logs. Normalize timestamps, temporary paths, opaque session and agent identifiers, and bulky request headers while retaining ordering, tool names and arguments, header deltas, results, lineage, and final responses so all native build legs compare the same behavior. Run the comparison in the label-gated executable build workflow and document the current coverage in the paired implemented RFC. --- .../workflows/build-exe-for-python-sdk.yml | 2 +- ...cutable-sdk-runtime-distribution.i18n.yaml | 4 +- ...ile-executable-sdk-runtime-distribution.md | 2 +- ...-executable-sdk-runtime-distribution.zh.md | 2 +- scripts/smoke-python-runtime.py | 419 ++- .../advanced/result.json | 2566 +++++++++++++++++ .../advanced/session.1.jsonl | 13 + .../advanced/session.2.jsonl | 13 + .../advanced/session.jsonl | 66 + 9 files changed, 3068 insertions(+), 19 deletions(-) create mode 100644 scripts/snapshots/python-sdk-single-exe/advanced/result.json create mode 100644 scripts/snapshots/python-sdk-single-exe/advanced/session.1.jsonl create mode 100644 scripts/snapshots/python-sdk-single-exe/advanced/session.2.jsonl create mode 100644 scripts/snapshots/python-sdk-single-exe/advanced/session.jsonl diff --git a/.github/workflows/build-exe-for-python-sdk.yml b/.github/workflows/build-exe-for-python-sdk.yml index 56099cb137..5bf4f7f239 100644 --- a/.github/workflows/build-exe-for-python-sdk.yml +++ b/.github/workflows/build-exe-for-python-sdk.yml @@ -218,7 +218,7 @@ jobs: echo "exe=$exe" >> "$GITHUB_OUTPUT" echo "wheel=$wheel" >> "$GITHUB_OUTPUT" - - name: Full-turn SDK, custom cordis, and direct-binary smoke + - name: Full-turn SDK, executable snapshot, and direct-binary smoke run: >- uv run --python 3.10 --group test --project python/sdk python scripts/smoke-python-runtime.py diff --git a/docs/rfc/implemented/architecture/2026-07-10-single-file-executable-sdk-runtime-distribution.i18n.yaml b/docs/rfc/implemented/architecture/2026-07-10-single-file-executable-sdk-runtime-distribution.i18n.yaml index 8c20314d97..db8c7eb8ee 100644 --- a/docs/rfc/implemented/architecture/2026-07-10-single-file-executable-sdk-runtime-distribution.i18n.yaml +++ b/docs/rfc/implemented/architecture/2026-07-10-single-file-executable-sdk-runtime-distribution.i18n.yaml @@ -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 -2026-07-10-single-file-executable-sdk-runtime-distribution.md: ac392a80310e70c846e80b6660bab22e01acfeb2 -2026-07-10-single-file-executable-sdk-runtime-distribution.zh.md: 021ca6a1c5c4b4214bf9dc16931c5b32a7117c9b +2026-07-10-single-file-executable-sdk-runtime-distribution.md: 4170d9f63773ef998bc5393fabc98a2b9fcba2fa +2026-07-10-single-file-executable-sdk-runtime-distribution.zh.md: 7d80fb572ea36010df4829121fabe8cf66944f6b diff --git a/docs/rfc/implemented/architecture/2026-07-10-single-file-executable-sdk-runtime-distribution.md b/docs/rfc/implemented/architecture/2026-07-10-single-file-executable-sdk-runtime-distribution.md index ac392a8031..4170d9f637 100644 --- a/docs/rfc/implemented/architecture/2026-07-10-single-file-executable-sdk-runtime-distribution.md +++ b/docs/rfc/implemented/architecture/2026-07-10-single-file-executable-sdk-runtime-distribution.md @@ -62,7 +62,7 @@ The exe's "must be explicitly configured" hard semantic is unchanged; the zero-c ## Testing -The verification surface has three tiers. Mechanism tier: the measured conclusions for the `--sea` chain are embedded in the Decision sections (ESM dynamic import inside the VFS, single cordis instance, fail-loud config chain, `node:sqlite`, macOS ad-hoc signing runs). SDK tier: the complete keyless pytest suite covers the client protocol against a fake runtime peer, subprocess cleanup, absolute cwd propagation, dual-carrier launch, and carrier resolution; root CI runs it on Python 3.10. End-to-end tier: every platform build completes a turn against a mock endpoint through the default SDK path, a custom config, and the direct binary protocol, with final text and JSONL checked. The custom config additionally drives `run_code` and a zero-agent `workflow` through their real worker files inside the packaged VFS. Its platform wheel is then installed in a clean venv and run without `runtime_bin`. The JSON-RPC protocol is not part of the ACP snapshot system, so there is no snapshot tier (an explicitly named gap, not an oversight). +The verification surface has three tiers. Mechanism tier: the measured conclusions for the `--sea` chain are embedded in the Decision sections (ESM dynamic import inside the VFS, single cordis instance, fail-loud config chain, `node:sqlite`, macOS ad-hoc signing runs). SDK tier: the complete keyless pytest suite covers the client protocol against a fake runtime peer, subprocess cleanup, absolute cwd propagation, dual-carrier launch, and carrier resolution; root CI runs it on Python 3.10. End-to-end tier: every platform build completes a turn against a mock endpoint through the default SDK path, a custom config, and the direct binary protocol, with final text and JSONL checked. The custom config additionally drives `run_code` and a zero-agent `workflow` through their real worker files inside the packaged VFS. The same build leg runs a committed executable-specific snapshot through the Python SDK: a keyless scripted model mounts a Cordis plugin that registers a tool, invokes that tool from `run_code`, runs a direct spawn subagent and a workflow that starts a second spawn child, then unmounts the plugin. The comparison normalizes the SDK result and notification stream plus the parent and two child JSONL logs. This harness stays separate from ACP's `pnpm run test:snapshot` because the protocols and build artifacts differ. The platform wheel is then installed in a clean venv and run without `runtime_bin`. Manual-driving caveat: the bin treats stdin EOF as "the client is gone" and disposes immediately, so a short-lived pipe aborts an in-flight turn — pipe-driven runs must keep stdin open until the turn ends. diff --git a/docs/rfc/implemented/architecture/2026-07-10-single-file-executable-sdk-runtime-distribution.zh.md b/docs/rfc/implemented/architecture/2026-07-10-single-file-executable-sdk-runtime-distribution.zh.md index 021ca6a1c5..7d80fb572e 100644 --- a/docs/rfc/implemented/architecture/2026-07-10-single-file-executable-sdk-runtime-distribution.zh.md +++ b/docs/rfc/implemented/architecture/2026-07-10-single-file-executable-sdk-runtime-distribution.zh.md @@ -62,7 +62,7 @@ exe 内支持 `dsh-workflow-workerthread` 与 `dsh-code-runtime-worker`。两个 ## 测试 -验证面分三层。机制层:`--sea` 链路的实测结论内嵌在“决策”各节(VFS 内 ESM 动态 `import()`、单一 Cordis 实例、明确报错的配置链路、`node:sqlite`、macOS ad-hoc 签名可运行)。SDK 层:完整的无密钥 pytest 套件以假运行时对端覆盖客户端协议、子进程清理、绝对 `cwd` 传递、双载体启动与载体解析;根 CI 在 Python 3.10 上运行全部用例。端到端层:每个平台构建都通过默认 SDK 路径、自定义配置和直接二进制协议,对模拟端点完成一个轮次,并校验最终文本与 JSONL。自定义配置还会通过打包进 VFS 的真实工作线程文件执行 `run_code` 和不启动 agent 的 `workflow`。随后把平台 wheel 包安装进干净的 venv,并在不传 `runtime_bin` 的情况下运行。JSON-RPC 协议不在 ACP 快照体系内,因此没有快照层(这是明确指出的空缺,并非遗漏)。 +验证面分三层。机制层:`--sea` 链路的实测结论内嵌在“决策”各节(VFS 内 ESM 动态 `import()`、单一 Cordis 实例、明确报错的配置链路、`node:sqlite`、macOS ad-hoc 签名可运行)。SDK 层:完整的无密钥 pytest 套件以假运行时对端覆盖客户端协议、子进程清理、绝对 `cwd` 传递、双载体启动与载体解析;根 CI 在 Python 3.10 上运行全部用例。端到端层:每个平台构建都通过默认 SDK 路径、自定义配置和直接二进制协议,对模拟端点完成一个轮次,并校验最终文本与 JSONL。自定义配置还会通过打包进 VFS 的真实工作线程文件执行 `run_code` 和不启动 agent 的 `workflow`。同一构建任务还会经 Python SDK 运行一组检入的 exe 专用快照:无密钥脚本化模型挂载一个会注册工具的 Cordis 插件,从 `run_code` 调用该工具,运行一个由 spawn 提供方直接启动的 subagent(子 agent)和一个会通过 spawn 启动第二个子 agent 的工作流,随后卸载该插件。比较时会规范化 SDK 结果与通知流,以及父会话和两个子会话的 JSONL 日志。该 harness 与 ACP 的 `pnpm run test:snapshot` 保持独立,因为二者的协议和构建产物不同。随后把平台 wheel 包安装进干净的 venv,并在不传 `runtime_bin` 的情况下运行。 手工驱动注意:`bin` 将 stdin EOF 视为“客户端已离开”并立即 dispose,短命管道会中止进行中的轮次——管道驱动必须保持 stdin 打开,直到轮次结束。 diff --git a/scripts/smoke-python-runtime.py b/scripts/smoke-python-runtime.py index 47de59dd2e..2c61d07c19 100644 --- a/scripts/smoke-python-runtime.py +++ b/scripts/smoke-python-runtime.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 -"""Keyless full-turn smoke for the SDK wrapper and direct NDJSON runtime use.""" +"""Keyless full-turn and snapshot smoke for the Python SDK runtime.""" from __future__ import annotations import argparse +import difflib import json import os import queue @@ -13,7 +14,10 @@ import threading import time from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer from pathlib import Path -from typing import Callable +from typing import TYPE_CHECKING, Callable + +if TYPE_CHECKING: + from deepseek_harness import TurnResult EXPECTED_TEXT = "runtime smoke ok" @@ -21,6 +25,32 @@ CODE_PROMPT = "Use run_code to compute the packaged worker smoke value." CODE_WORKER_TEXT = "code worker smoke ok" WORKFLOW_PROMPT = "Use workflow to compute the packaged worker smoke value without agents." WORKFLOW_WORKER_TEXT = "workflow worker smoke ok" +SNAPSHOT_PROMPT = "Run the advanced packaged-runtime snapshot scenario." +SNAPSHOT_SESSION_ID = "advanced-executable" +SNAPSHOT_DIRECT_CHILD_PROMPT = "Reply with exactly DIRECT_CHILD_OK and nothing else." +SNAPSHOT_WORKFLOW_CHILD_PROMPT = "Reply with exactly WORKFLOW_CHILD_OK and nothing else." +SNAPSHOT_FINAL_TEXT = "ADVANCED_EXECUTABLE_OK" +SNAPSHOT_MOUNT_CODE = """\ +return (ctx) => { + harness.registerTool(ctx, harness.defineTool({ + name: 'snapshot_double', + description: 'Double a number for executable snapshot verification.', + parameters: { value: { type: 'number', required: true } }, + async execute(args) { + return [{ type: 'text', text: String(args.value * 2) }] + } + })) +} +""" +SNAPSHOT_WORKFLOW_SCRIPT = ( + "phase('Delegate')\n" + f"const reply = await agent('{SNAPSHOT_WORKFLOW_CHILD_PROMPT}', {{ label: 'workflow-child' }})\n" + "return { reply }" +) +SNAPSHOT_DIRECTORY = ( + Path(__file__).resolve().parent / "snapshots" / "python-sdk-single-exe" / "advanced" +) +SNAPSHOT_FILENAMES = ("result.json", "session.jsonl", "session.1.jsonl", "session.2.jsonl") CUSTOM_CORDIS = """\ - id: jsonrpc name: '@deepseek-ai/dsh-jsonrpc' @@ -41,17 +71,27 @@ CUSTOM_CORDIS = """\ name: '@deepseek-ai/dsh-code-runtime-worker' - id: subagents name: '@deepseek-ai/dsh-subagent' +- id: subagent-spawn + name: '@deepseek-ai/dsh-subagent-spawn' + config: + providerName: spawn +- id: subagent-tool + name: '@deepseek-ai/dsh-tool-subagent' + config: + provider: spawn - id: workflow-engine name: '@deepseek-ai/dsh-workflow-workerthread' config: provider: spawn - id: workflow-tool name: '@deepseek-ai/dsh-tool-workflow' +- id: cordis-tool + name: '@deepseek-ai/dsh-tool-cordis' """ class MockModelHandler(BaseHTTPRequestHandler): - """Return deterministic text and worker-tool streaming completions.""" + """Return deterministic text, worker, and orchestration completions.""" requests: list[dict[str, object]] = [] @@ -82,8 +122,11 @@ def completion_chunks(body: dict[str, object]) -> list[dict[str, object]]: raise AssertionError(f"model request has an invalid latest message: {body}") if latest.get("role") == "tool": - tool_name = latest_tool_name(messages) - tool_text = json.dumps(latest.get("content")) + call_id, tool_name = latest_tool_call(messages) + tool_text = message_text(latest.get("content")) + advanced = advanced_tool_followup(body, call_id, tool_name, tool_text) + if advanced is not None: + return advanced if "42" not in tool_text: raise AssertionError(f"{tool_name} worker returned no expected value: {latest}") if tool_name == "run_code": @@ -93,6 +136,17 @@ def completion_chunks(body: dict[str, object]) -> list[dict[str, object]]: raise AssertionError(f"unexpected tool follow-up: {tool_name}") prompt = message_text(latest.get("content")) + if prompt == SNAPSHOT_DIRECT_CHILD_PROMPT: + return text_chunks("DIRECT_CHILD_OK") + if prompt == SNAPSHOT_WORKFLOW_CHILD_PROMPT: + return text_chunks("WORKFLOW_CHILD_OK") + if prompt == SNAPSHOT_PROMPT: + assert_advertised_tool(body, "cordis_mount") + return tool_call_chunks( + "advanced-mount", + "cordis_mount", + {"code": SNAPSHOT_MOUNT_CODE}, + ) if prompt == CODE_PROMPT: assert_advertised_tool(body, "run_code") return tool_call_chunks("call-code-worker", "run_code", {"code": "return 6 * 7"}) @@ -112,6 +166,70 @@ def completion_chunks(body: dict[str, object]) -> list[dict[str, object]]: return text_chunks(EXPECTED_TEXT) +def advanced_tool_followup( + body: dict[str, object], + call_id: str, + tool_name: str, + tool_text: str, +) -> list[dict[str, object]] | None: + """Advance the executable snapshot's deterministic parent tool chain.""" + if not call_id.startswith("advanced-"): + return None + if call_id == "advanced-mount" and tool_name == "cordis_mount": + if "mounted dyn-1" not in tool_text: + raise AssertionError(f"cordis_mount returned no mount id: {tool_text}") + assert_advertised_tool(body, "run_code") + assert_advertised_tool(body, "snapshot_double") + return tool_call_chunks( + "advanced-code", + "run_code", + {"code": "return await tools.snapshot_double({ value: 21 })"}, + ) + if call_id == "advanced-code" and tool_name == "run_code": + if "42" not in tool_text: + raise AssertionError(f"run_code returned no dynamic-tool value: {tool_text}") + assert_advertised_tool(body, "subagent") + return tool_call_chunks( + "advanced-direct-child", + "subagent", + { + "description": "Check direct child", + "prompt": SNAPSHOT_DIRECT_CHILD_PROMPT, + }, + ) + if call_id == "advanced-direct-child" and tool_name == "subagent": + if "DIRECT_CHILD_OK" not in tool_text: + raise AssertionError(f"subagent returned no expected child value: {tool_text}") + assert_advertised_tool(body, "workflow") + return tool_call_chunks( + "advanced-workflow", + "workflow", + { + "script": SNAPSHOT_WORKFLOW_SCRIPT, + "meta": { + "name": "advanced-exe-snapshot", + "description": "exercise one packaged workflow child", + }, + }, + ) + if call_id == "advanced-workflow" and tool_name == "workflow": + if "WORKFLOW_CHILD_OK" not in tool_text: + raise AssertionError(f"workflow returned no expected child value: {tool_text}") + assert_advertised_tool(body, "cordis_unmount") + return tool_call_chunks( + "advanced-unmount", + "cordis_unmount", + {"id": "dyn-1"}, + ) + if call_id == "advanced-unmount" and tool_name == "cordis_unmount": + if "unmounted dyn-1" not in tool_text: + raise AssertionError(f"cordis_unmount returned no disposal result: {tool_text}") + if "snapshot_double" in advertised_tool_names(body): + raise AssertionError("snapshot_double remained advertised after cordis_unmount") + return text_chunks(SNAPSHOT_FINAL_TEXT) + raise AssertionError(f"unexpected advanced tool follow-up: {call_id} {tool_name}: {tool_text}") + + def text_chunks(text: str) -> list[dict[str, object]]: """Build a complete streaming text response.""" return [ @@ -147,8 +265,8 @@ def tool_call_chunks(call_id: str, name: str, arguments: dict[str, object]) -> l ] -def latest_tool_name(messages: list[object]) -> str: - """Find the assistant tool call paired with the latest tool result.""" +def latest_tool_call(messages: list[object]) -> tuple[str, str]: + """Find the assistant call id and name paired with the latest tool result.""" for message in reversed(messages[:-1]): if not isinstance(message, dict): continue @@ -159,8 +277,13 @@ def latest_tool_name(messages: list[object]) -> str: if not isinstance(call, dict): continue function = call.get("function") - if isinstance(function, dict) and isinstance(function.get("name"), str): - return function["name"] + call_id = call.get("id") + if ( + isinstance(call_id, str) + and isinstance(function, dict) + and isinstance(function.get("name"), str) + ): + return call_id, function["name"] raise AssertionError(f"tool result has no preceding assistant tool call: {messages}") @@ -177,8 +300,8 @@ def message_text(content: object) -> str: return "" -def assert_advertised_tool(body: dict[str, object], expected: str) -> None: - """Require the packaged deployment to expose the requested tool.""" +def advertised_tool_names(body: dict[str, object]) -> set[str]: + """Return the model-facing tool names advertised on one request.""" tools = body.get("tools") if not isinstance(tools, list): raise AssertionError(f"model request advertised no tools: {body}") @@ -189,6 +312,12 @@ def assert_advertised_tool(body: dict[str, object], expected: str) -> None: function = tool.get("function") if isinstance(function, dict) and isinstance(function.get("name"), str): names.add(function["name"]) + return names + + +def assert_advertised_tool(body: dict[str, object], expected: str) -> None: + """Require the packaged deployment to expose the requested tool.""" + names = advertised_tool_names(body) if expected not in names: raise AssertionError(f"model request did not advertise {expected}: {names}") @@ -211,11 +340,18 @@ class MockModel: def main() -> None: parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("--scenario", choices=("all", "sdk-default", "sdk-custom", "direct"), default="all") + parser.add_argument( + "--scenario", + choices=("all", "sdk-default", "sdk-custom", "sdk-snapshot", "direct"), + default="all", + ) parser.add_argument("--exe", type=Path) + parser.add_argument("--update-snapshots", action="store_true") args = parser.parse_args() - if args.scenario in {"all", "sdk-custom", "direct"} and args.exe is None: - parser.error("--exe is required for custom and direct scenarios") + if args.scenario in {"all", "sdk-custom", "sdk-snapshot", "direct"} and args.exe is None: + parser.error("--exe is required for custom, snapshot, and direct scenarios") + if args.update_snapshots and args.scenario not in {"all", "sdk-snapshot"}: + parser.error("--update-snapshots requires --scenario sdk-snapshot or all") if args.exe is not None and not args.exe.is_file(): parser.error(f"runtime executable does not exist: {args.exe}") @@ -225,6 +361,9 @@ def main() -> None: if args.scenario in {"all", "sdk-custom"}: assert args.exe is not None smoke_sdk_custom(model.url, args.exe.resolve()) + if args.scenario in {"all", "sdk-snapshot"}: + assert args.exe is not None + smoke_sdk_snapshot(model.url, args.exe.resolve(), args.update_snapshots) if args.scenario in {"all", "direct"}: assert args.exe is not None smoke_direct(model.url, args.exe.resolve()) @@ -283,6 +422,49 @@ def smoke_sdk_custom(base_url: str, executable: Path) -> None: assert_session_log(sessions, root, EXPECTED_TEXT, CODE_WORKER_TEXT, WORKFLOW_WORKER_TEXT) +def smoke_sdk_snapshot(base_url: str, executable: Path, update_snapshots: bool) -> None: + """Drive and compare the advanced SDK/executable behavioral snapshot.""" + from deepseek_harness import DeepSeekHarness + + with tempfile.TemporaryDirectory(prefix="dsh-sdk-snapshot-") as temporary: + root = Path(temporary).resolve() + sessions = root / "sessions" + cordis = root / "cordis.yml" + cordis.write_text(CUSTOM_CORDIS) + with DeepSeekHarness( + model="smoke-model", + cwd=str(root), + session_root=str(sessions), + cordis=str(cordis), + runtime_bin=str(executable), + api_key="sk-keyless-smoke", + base_url=base_url, + request_timeout_seconds=60, + ) as harness: + result = harness.run(SNAPSHOT_PROMPT, session_id=SNAPSHOT_SESSION_ID) + + assert result.status == "ok", result + assert result.final_response == SNAPSHOT_FINAL_TEXT, result.final_response + methods = [notification.method for notification in result.notifications] + if methods.count("subagent.started") != 2 or methods.count("subagent.finished") != 2: + raise AssertionError(f"advanced snapshot emitted unexpected subagent lifecycle: {methods}") + if not any(event.get("type") == "tool/code-dispatch" for event in result.events): + raise AssertionError("advanced snapshot emitted no tool/code-dispatch event") + + logs = read_session_logs(sessions) + child_ids = snapshot_child_ids(result) + expected_ids = {SNAPSHOT_SESSION_ID, *child_ids} + if set(logs) != expected_ids: + raise AssertionError(f"advanced snapshot expected parent plus two child logs: {sorted(logs)}") + if "DIRECT_CHILD_OK" not in render_jsonl(logs[child_ids[0]]): + raise AssertionError("first advanced child log has no direct-subagent result") + if "WORKFLOW_CHILD_OK" not in render_jsonl(logs[child_ids[1]]): + raise AssertionError("second advanced child log has no workflow-subagent result") + + files = build_snapshot_files(result, logs, child_ids, root) + compare_snapshot_files(files, update_snapshots) + + def smoke_direct(base_url: str, executable: Path) -> None: with tempfile.TemporaryDirectory(prefix="dsh-direct-") as temporary: root = Path(temporary).resolve() @@ -399,5 +581,214 @@ def assert_session_log(sessions: Path, cwd: Path, *expected_texts: str) -> None: raise AssertionError(f"session log has no {expected!r} response: {logs[0]}") +def read_session_logs(sessions: Path) -> dict[str, list[dict[str, object]]]: + """Parse every persisted JSONL session into a map keyed by header id.""" + logs: dict[str, list[dict[str, object]]] = {} + for path in sorted(sessions.rglob("*.jsonl")): + records = [ + json.loads(line) + for line in path.read_text(encoding="utf-8").splitlines() + if line + ] + if not records or records[0].get("type") != "session": + raise AssertionError(f"session log has no header: {path}") + session_id = records[0].get("id") + if not isinstance(session_id, str): + raise AssertionError(f"session log header has no string id: {path}") + if session_id in logs: + raise AssertionError(f"duplicate persisted session id: {session_id}") + logs[session_id] = records + return logs + + +def snapshot_child_ids(result: "TurnResult") -> list[str]: + """Return the two child session ids in their SDK notification order.""" + child_ids: list[str] = [] + for notification in result.notifications: + if notification.method != "subagent.started": + continue + payload = notification.payload + if payload.get("parentSessionId") != SNAPSHOT_SESSION_ID: + continue + child_id = payload.get("childSessionId") + if isinstance(child_id, str) and child_id not in child_ids: + child_ids.append(child_id) + if len(child_ids) != 2: + raise AssertionError(f"advanced snapshot expected two child session ids: {child_ids}") + return child_ids + + +def build_snapshot_files( + result: "TurnResult", + logs: dict[str, list[dict[str, object]]], + child_ids: list[str], + cwd: Path, +) -> dict[str, str]: + """Render the SDK result and three persisted logs into stable goldens.""" + replacements = [(str(cwd), "{{cwd}}"), (SNAPSHOT_SESSION_ID, "{{parent}}")] + for index, child_id in enumerate(child_ids, start=1): + replacements.append((child_id, f"{{{{child-{index}}}}}")) + agent_id = snapshot_agent_id(result, child_id) + replacements.append((agent_id, f"{{{{agent-{index}}}}}")) + replacements.sort(key=lambda pair: len(pair[0]), reverse=True) + + result_value = { + "session_id": result.session_id, + "status": result.status, + "final_response": result.final_response, + "events": result.events, + "notifications": [ + {"method": notification.method, "payload": notification.payload} + for notification in result.notifications + ], + "session_root": result.session_root, + } + normalized_result = normalize_snapshot_value(result_value, replacements) + files = { + "result.json": json.dumps(normalized_result, indent=2, ensure_ascii=False) + "\n", + "session.jsonl": render_jsonl( + [normalize_snapshot_value(record, replacements) for record in logs[SNAPSHOT_SESSION_ID]] + ), + } + for index, child_id in enumerate(child_ids, start=1): + files[f"session.{index}.jsonl"] = render_jsonl( + [normalize_snapshot_value(record, replacements) for record in logs[child_id]] + ) + if tuple(files) != SNAPSHOT_FILENAMES: + raise AssertionError(f"advanced snapshot file set drifted: {tuple(files)}") + return files + + +def snapshot_agent_id(result: "TurnResult", child_id: str) -> str: + """Find the successful subagent id paired with one child session.""" + for notification in result.notifications: + if notification.method != "subagent.finished": + continue + payload = notification.payload + if payload.get("childSessionId") != child_id: + continue + if payload.get("provider") != "spawn" or payload.get("status") != "ok": + raise AssertionError(f"advanced child did not finish successfully: {payload}") + agent_id = payload.get("agentId") + if isinstance(agent_id, str): + return agent_id + raise AssertionError(f"advanced snapshot has no finished agent for child {child_id}") + + +def normalize_snapshot_value( + value: object, + replacements: list[tuple[str, str]], +) -> object: + """Scrub volatile values and bulky request headers without losing behavior.""" + if isinstance(value, str): + normalized = value + for actual, token in replacements: + normalized = normalized.replace(actual, token) + return normalized + if isinstance(value, list): + return [normalize_snapshot_value(item, replacements) for item in value] + if not isinstance(value, dict): + return value + + normalized = { + key: normalize_snapshot_value(item, replacements) + for key, item in value.items() + } + if normalized.get("type") == "session" and "createdAt" in normalized: + normalized["createdAt"] = 0 + if "seq" in normalized and "time" in normalized: + normalized["time"] = 0 + scrub_snapshot_header(normalized) + return normalized + + +def scrub_snapshot_header(value: dict[object, object]) -> None: + """Tokenize request-header bulk while retaining delta tool names.""" + data = value.get("data") + if not isinstance(data, dict): + return + if value.get("type") == "request/header": + header = data.get("header") + if not isinstance(header, dict): + return + if "system" in header: + header["system"] = "{{system}}" + tools = header.get("tools") + if isinstance(tools, list): + header["tools"] = [ + tool.get("name") if isinstance(tool, dict) else "{{tools}}" + for tool in tools + ] + if isinstance(header.get("messagePrefix"), list): + header["messagePrefix"] = ["{{messagePrefix}}" for _ in header["messagePrefix"]] + return + if value.get("type") != "request/header-delta": + return + system = data.get("system") + if isinstance(system, dict) and isinstance(system.get("insert"), list): + system["insert"] = ["{{system}}" for _ in system["insert"]] + tools = data.get("tools") + if isinstance(tools, dict): + for key in ("added", "changed"): + if isinstance(tools.get(key), list): + tools[key] = [scrub_snapshot_tool_schema(tool) for tool in tools[key]] + if isinstance(data.get("messagePrefix"), list): + data["messagePrefix"] = ["{{messagePrefix}}" for _ in data["messagePrefix"]] + + +def scrub_snapshot_tool_schema(value: object) -> object: + """Keep a changed tool's name while tokenizing its schema bulk.""" + if not isinstance(value, dict): + return value + return { + key: item if key == "name" else "{{tools}}" + for key, item in value.items() + } + + +def render_jsonl(records: list[object]) -> str: + """Render parsed JSON values as compact, newline-terminated JSONL.""" + return "".join( + json.dumps(record, ensure_ascii=False, separators=(",", ":")) + "\n" + for record in records + ) + + +def compare_snapshot_files(files: dict[str, str], update: bool) -> None: + """Write or exactly compare the advanced executable snapshot files.""" + if update: + SNAPSHOT_DIRECTORY.mkdir(parents=True, exist_ok=True) + for name, content in files.items(): + (SNAPSHOT_DIRECTORY / name).write_text(content, encoding="utf-8") + print(f"smoke-python-runtime: updated snapshots in {SNAPSHOT_DIRECTORY}") + + existing = { + path.name + for path in SNAPSHOT_DIRECTORY.iterdir() + if path.is_file() + } if SNAPSHOT_DIRECTORY.is_dir() else set() + expected = set(SNAPSHOT_FILENAMES) + if existing != expected: + raise AssertionError( + "advanced snapshot files differ: " + f"missing={sorted(expected - existing)}, unexpected={sorted(existing - expected)}" + ) + for name, actual in files.items(): + expected_text = (SNAPSHOT_DIRECTORY / name).read_text(encoding="utf-8") + if actual == expected_text: + continue + diff = "".join(difflib.unified_diff( + expected_text.splitlines(keepends=True), + actual.splitlines(keepends=True), + fromfile=f"expected/{name}", + tofile=f"actual/{name}", + )) + raise AssertionError( + f"advanced executable snapshot mismatch in {name}; " + "rerun with --update-snapshots after reviewing the behavior\n" + f"{diff}" + ) + + if __name__ == "__main__": main() diff --git a/scripts/snapshots/python-sdk-single-exe/advanced/result.json b/scripts/snapshots/python-sdk-single-exe/advanced/result.json new file mode 100644 index 0000000000..2ecfc76a2e --- /dev/null +++ b/scripts/snapshots/python-sdk-single-exe/advanced/result.json @@ -0,0 +1,2566 @@ +{ + "session_id": "{{parent}}", + "status": "ok", + "final_response": "ADVANCED_EXECUTABLE_OK", + "events": [ + { + "type": "turn/start", + "seq": 0, + "time": 0, + "data": { + "turn": 1, + "trigger": { + "kind": "message", + "source": { + "kind": "user" + } + } + } + }, + { + "type": "user/message", + "seq": 1, + "time": 0, + "data": { + "content": [ + { + "type": "text", + "text": "Run the advanced packaged-runtime snapshot scenario." + } + ], + "source": { + "kind": "user" + } + }, + "surfaceOp": "append" + }, + { + "type": "step/start", + "seq": 2, + "time": 0, + "data": { + "turn": 1, + "step": 1 + } + }, + { + "type": "request/header", + "seq": 3, + "time": 0, + "data": { + "header": { + "config": { + "model": "smoke-model" + }, + "system": "{{system}}", + "tools": [ + "bash", + "bash_kill", + "bash_output", + "cordis_inspect", + "cordis_mount", + "cordis_unmount", + "run_code", + "skill", + "subagent", + "workflow" + ] + }, + "reason": "initial" + } + }, + { + "type": "assistant/chunk", + "seq": 4, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "chunk": { + "type": "block-start", + "index": 0, + "blockType": "tool-call" + } + } + }, + { + "type": "assistant/chunk", + "seq": 5, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "chunk": { + "type": "tool-call-delta", + "index": 0, + "id": "advanced-mount", + "name": "cordis_mount", + "argumentsDelta": "{\"code\": \"return (ctx) => {\\n harness.registerTool(ctx, harness.defineTool({\\n name: 'snapshot_double',\\n description: 'Double a number for executable snapshot verification.',\\n parameters: { value: { type: 'number', required: true } },\\n async execute(args) {\\n return [{ type: 'text', text: String(args.value * 2) }]\\n }\\n }))\\n}\\n\"}" + } + } + }, + { + "type": "assistant/chunk", + "seq": 6, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "chunk": { + "type": "block-end", + "index": 0, + "block": { + "type": "tool-call", + "id": "advanced-mount", + "name": "cordis_mount", + "arguments": "{\"code\": \"return (ctx) => {\\n harness.registerTool(ctx, harness.defineTool({\\n name: 'snapshot_double',\\n description: 'Double a number for executable snapshot verification.',\\n parameters: { value: { type: 'number', required: true } },\\n async execute(args) {\\n return [{ type: 'text', text: String(args.value * 2) }]\\n }\\n }))\\n}\\n\"}" + } + } + } + }, + { + "type": "assistant/chunk", + "seq": 7, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "chunk": { + "type": "usage", + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + } + } + }, + { + "type": "assistant/chunk", + "seq": 8, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "chunk": { + "type": "finish", + "reason": { + "kind": "tool-calls" + } + } + } + }, + { + "type": "assistant/message", + "seq": 9, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "content": [ + { + "type": "tool-call", + "id": "advanced-mount", + "name": "cordis_mount", + "arguments": "{\"code\": \"return (ctx) => {\\n harness.registerTool(ctx, harness.defineTool({\\n name: 'snapshot_double',\\n description: 'Double a number for executable snapshot verification.',\\n parameters: { value: { type: 'number', required: true } },\\n async execute(args) {\\n return [{ type: 'text', text: String(args.value * 2) }]\\n }\\n }))\\n}\\n\"}" + } + ], + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + }, + "sourceEventSeqs": [ + 4, + 5, + 6, + 7, + 8 + ], + "surfaceOp": "append" + }, + { + "type": "tool/call", + "seq": 10, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "callId": "advanced-mount", + "name": "cordis_mount", + "arguments": "{\"code\": \"return (ctx) => {\\n harness.registerTool(ctx, harness.defineTool({\\n name: 'snapshot_double',\\n description: 'Double a number for executable snapshot verification.',\\n parameters: { value: { type: 'number', required: true } },\\n async execute(args) {\\n return [{ type: 'text', text: String(args.value * 2) }]\\n }\\n }))\\n}\\n\"}" + } + }, + { + "type": "tool/result", + "seq": 11, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "callId": "advanced-mount", + "content": [ + { + "type": "text", + "text": "mounted dyn-1 (plugin \"\", state: active)" + } + ], + "isError": false + }, + "sourceEventSeqs": [ + 10 + ], + "surfaceOp": "append" + }, + { + "type": "step/end", + "seq": 12, + "time": 0, + "data": { + "turn": 1, + "step": 1 + } + }, + { + "type": "step/start", + "seq": 13, + "time": 0, + "data": { + "turn": 1, + "step": 2 + } + }, + { + "type": "request/header", + "seq": 14, + "time": 0, + "data": { + "header": { + "config": { + "model": "smoke-model" + }, + "system": "{{system}}", + "tools": [ + "bash", + "bash_kill", + "bash_output", + "cordis_inspect", + "cordis_mount", + "cordis_unmount", + "run_code", + "skill", + "snapshot_double", + "subagent", + "workflow" + ] + }, + "reason": "fallback" + } + }, + { + "type": "assistant/chunk", + "seq": 15, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "chunk": { + "type": "block-start", + "index": 0, + "blockType": "tool-call" + } + } + }, + { + "type": "assistant/chunk", + "seq": 16, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "chunk": { + "type": "tool-call-delta", + "index": 0, + "id": "advanced-code", + "name": "run_code", + "argumentsDelta": "{\"code\": \"return await tools.snapshot_double({ value: 21 })\"}" + } + } + }, + { + "type": "assistant/chunk", + "seq": 17, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "chunk": { + "type": "block-end", + "index": 0, + "block": { + "type": "tool-call", + "id": "advanced-code", + "name": "run_code", + "arguments": "{\"code\": \"return await tools.snapshot_double({ value: 21 })\"}" + } + } + } + }, + { + "type": "assistant/chunk", + "seq": 18, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "chunk": { + "type": "usage", + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + } + } + }, + { + "type": "assistant/chunk", + "seq": 19, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "chunk": { + "type": "finish", + "reason": { + "kind": "tool-calls" + } + } + } + }, + { + "type": "assistant/message", + "seq": 20, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "content": [ + { + "type": "tool-call", + "id": "advanced-code", + "name": "run_code", + "arguments": "{\"code\": \"return await tools.snapshot_double({ value: 21 })\"}" + } + ], + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + }, + "sourceEventSeqs": [ + 15, + 16, + 17, + 18, + 19 + ], + "surfaceOp": "append" + }, + { + "type": "tool/call", + "seq": 21, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "callId": "advanced-code", + "name": "run_code", + "arguments": "{\"code\": \"return await tools.snapshot_double({ value: 21 })\"}" + } + }, + { + "type": "tool/code-dispatch", + "seq": 22, + "time": 0, + "data": { + "parentCallId": "advanced-code", + "subCallId": "advanced-code:code:1", + "name": "snapshot_double", + "arguments": { + "value": 21 + }, + "isError": false, + "resultSummary": "42" + } + }, + { + "type": "tool/result", + "seq": 23, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "callId": "advanced-code", + "content": [ + { + "type": "text", + "text": "42" + } + ], + "isError": false, + "meta": { + "logs": [], + "dispatches": 1 + } + }, + "sourceEventSeqs": [ + 21 + ], + "surfaceOp": "append" + }, + { + "type": "step/end", + "seq": 24, + "time": 0, + "data": { + "turn": 1, + "step": 2 + } + }, + { + "type": "step/start", + "seq": 25, + "time": 0, + "data": { + "turn": 1, + "step": 3 + } + }, + { + "type": "assistant/chunk", + "seq": 26, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "chunk": { + "type": "block-start", + "index": 0, + "blockType": "tool-call" + } + } + }, + { + "type": "assistant/chunk", + "seq": 27, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "chunk": { + "type": "tool-call-delta", + "index": 0, + "id": "advanced-direct-child", + "name": "subagent", + "argumentsDelta": "{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}" + } + } + }, + { + "type": "assistant/chunk", + "seq": 28, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "chunk": { + "type": "block-end", + "index": 0, + "block": { + "type": "tool-call", + "id": "advanced-direct-child", + "name": "subagent", + "arguments": "{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}" + } + } + } + }, + { + "type": "assistant/chunk", + "seq": 29, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "chunk": { + "type": "usage", + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + } + } + }, + { + "type": "assistant/chunk", + "seq": 30, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "chunk": { + "type": "finish", + "reason": { + "kind": "tool-calls" + } + } + } + }, + { + "type": "assistant/message", + "seq": 31, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "content": [ + { + "type": "tool-call", + "id": "advanced-direct-child", + "name": "subagent", + "arguments": "{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}" + } + ], + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + }, + "sourceEventSeqs": [ + 26, + 27, + 28, + 29, + 30 + ], + "surfaceOp": "append" + }, + { + "type": "tool/call", + "seq": 32, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "callId": "advanced-direct-child", + "name": "subagent", + "arguments": "{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}" + } + }, + { + "type": "tool/result", + "seq": 33, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "callId": "advanced-direct-child", + "content": [ + { + "type": "text", + "text": "DIRECT_CHILD_OK" + } + ], + "isError": false + }, + "sourceEventSeqs": [ + 32 + ], + "surfaceOp": "append" + }, + { + "type": "step/end", + "seq": 34, + "time": 0, + "data": { + "turn": 1, + "step": 3 + } + }, + { + "type": "step/start", + "seq": 35, + "time": 0, + "data": { + "turn": 1, + "step": 4 + } + }, + { + "type": "assistant/chunk", + "seq": 36, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "chunk": { + "type": "block-start", + "index": 0, + "blockType": "tool-call" + } + } + }, + { + "type": "assistant/chunk", + "seq": 37, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "chunk": { + "type": "tool-call-delta", + "index": 0, + "id": "advanced-workflow", + "name": "workflow", + "argumentsDelta": "{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}" + } + } + }, + { + "type": "assistant/chunk", + "seq": 38, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "chunk": { + "type": "block-end", + "index": 0, + "block": { + "type": "tool-call", + "id": "advanced-workflow", + "name": "workflow", + "arguments": "{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}" + } + } + } + }, + { + "type": "assistant/chunk", + "seq": 39, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "chunk": { + "type": "usage", + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + } + } + }, + { + "type": "assistant/chunk", + "seq": 40, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "chunk": { + "type": "finish", + "reason": { + "kind": "tool-calls" + } + } + } + }, + { + "type": "assistant/message", + "seq": 41, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "content": [ + { + "type": "tool-call", + "id": "advanced-workflow", + "name": "workflow", + "arguments": "{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}" + } + ], + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + }, + "sourceEventSeqs": [ + 36, + 37, + 38, + 39, + 40 + ], + "surfaceOp": "append" + }, + { + "type": "tool/call", + "seq": 42, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "callId": "advanced-workflow", + "name": "workflow", + "arguments": "{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}" + } + }, + { + "type": "tool/result", + "seq": 43, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "callId": "advanced-workflow", + "content": [ + { + "type": "text", + "text": "workflow \"advanced-exe-snapshot\" completed (1 agent).\nReturn value:\n{\n \"reply\": \"WORKFLOW_CHILD_OK\"\n}" + } + ], + "isError": false + }, + "sourceEventSeqs": [ + 42 + ], + "surfaceOp": "append" + }, + { + "type": "step/end", + "seq": 44, + "time": 0, + "data": { + "turn": 1, + "step": 4 + } + }, + { + "type": "step/start", + "seq": 45, + "time": 0, + "data": { + "turn": 1, + "step": 5 + } + }, + { + "type": "assistant/chunk", + "seq": 46, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "chunk": { + "type": "block-start", + "index": 0, + "blockType": "tool-call" + } + } + }, + { + "type": "assistant/chunk", + "seq": 47, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "chunk": { + "type": "tool-call-delta", + "index": 0, + "id": "advanced-unmount", + "name": "cordis_unmount", + "argumentsDelta": "{\"id\": \"dyn-1\"}" + } + } + }, + { + "type": "assistant/chunk", + "seq": 48, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "chunk": { + "type": "block-end", + "index": 0, + "block": { + "type": "tool-call", + "id": "advanced-unmount", + "name": "cordis_unmount", + "arguments": "{\"id\": \"dyn-1\"}" + } + } + } + }, + { + "type": "assistant/chunk", + "seq": 49, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "chunk": { + "type": "usage", + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + } + } + }, + { + "type": "assistant/chunk", + "seq": 50, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "chunk": { + "type": "finish", + "reason": { + "kind": "tool-calls" + } + } + } + }, + { + "type": "assistant/message", + "seq": 51, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "content": [ + { + "type": "tool-call", + "id": "advanced-unmount", + "name": "cordis_unmount", + "arguments": "{\"id\": \"dyn-1\"}" + } + ], + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + }, + "sourceEventSeqs": [ + 46, + 47, + 48, + 49, + 50 + ], + "surfaceOp": "append" + }, + { + "type": "tool/call", + "seq": 52, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "callId": "advanced-unmount", + "name": "cordis_unmount", + "arguments": "{\"id\": \"dyn-1\"}" + } + }, + { + "type": "tool/result", + "seq": 53, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "callId": "advanced-unmount", + "content": [ + { + "type": "text", + "text": "unmounted dyn-1 (plugin \"\")" + } + ], + "isError": false + }, + "sourceEventSeqs": [ + 52 + ], + "surfaceOp": "append" + }, + { + "type": "step/end", + "seq": 54, + "time": 0, + "data": { + "turn": 1, + "step": 5 + } + }, + { + "type": "step/start", + "seq": 55, + "time": 0, + "data": { + "turn": 1, + "step": 6 + } + }, + { + "type": "request/header-delta", + "seq": 56, + "time": 0, + "data": { + "system": { + "keepStart": 62, + "keepEnd": 34, + "insert": [] + }, + "tools": { + "added": [], + "removed": [ + "snapshot_double" + ], + "changed": [] + } + } + }, + { + "type": "assistant/chunk", + "seq": 57, + "time": 0, + "data": { + "turn": 1, + "step": 6, + "chunk": { + "type": "block-start", + "index": 0, + "blockType": "text" + } + } + }, + { + "type": "assistant/chunk", + "seq": 58, + "time": 0, + "data": { + "turn": 1, + "step": 6, + "chunk": { + "type": "text-delta", + "index": 0, + "text": "ADVANCED_EXECUTABLE_OK" + } + } + }, + { + "type": "assistant/chunk", + "seq": 59, + "time": 0, + "data": { + "turn": 1, + "step": 6, + "chunk": { + "type": "block-end", + "index": 0, + "block": { + "type": "text", + "text": "ADVANCED_EXECUTABLE_OK" + } + } + } + }, + { + "type": "assistant/chunk", + "seq": 60, + "time": 0, + "data": { + "turn": 1, + "step": 6, + "chunk": { + "type": "usage", + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + } + } + }, + { + "type": "assistant/chunk", + "seq": 61, + "time": 0, + "data": { + "turn": 1, + "step": 6, + "chunk": { + "type": "finish", + "reason": { + "kind": "stop" + } + } + } + }, + { + "type": "assistant/message", + "seq": 62, + "time": 0, + "data": { + "turn": 1, + "step": 6, + "content": [ + { + "type": "text", + "text": "ADVANCED_EXECUTABLE_OK" + } + ], + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + }, + "sourceEventSeqs": [ + 57, + 58, + 59, + 60, + 61 + ], + "surfaceOp": "append" + }, + { + "type": "step/end", + "seq": 63, + "time": 0, + "data": { + "turn": 1, + "step": 6 + } + }, + { + "type": "turn/end", + "seq": 64, + "time": 0, + "data": { + "turn": 1, + "reason": { + "kind": "completed" + } + } + } + ], + "notifications": [ + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "turn/start", + "seq": 0, + "time": 0, + "data": { + "turn": 1, + "trigger": { + "kind": "message", + "source": { + "kind": "user" + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "user/message", + "seq": 1, + "time": 0, + "data": { + "content": [ + { + "type": "text", + "text": "Run the advanced packaged-runtime snapshot scenario." + } + ], + "source": { + "kind": "user" + } + }, + "surfaceOp": "append" + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "step/start", + "seq": 2, + "time": 0, + "data": { + "turn": 1, + "step": 1 + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "request/header", + "seq": 3, + "time": 0, + "data": { + "header": { + "config": { + "model": "smoke-model" + }, + "system": "{{system}}", + "tools": [ + "bash", + "bash_kill", + "bash_output", + "cordis_inspect", + "cordis_mount", + "cordis_unmount", + "run_code", + "skill", + "subagent", + "workflow" + ] + }, + "reason": "initial" + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 4, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "chunk": { + "type": "block-start", + "index": 0, + "blockType": "tool-call" + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 5, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "chunk": { + "type": "tool-call-delta", + "index": 0, + "id": "advanced-mount", + "name": "cordis_mount", + "argumentsDelta": "{\"code\": \"return (ctx) => {\\n harness.registerTool(ctx, harness.defineTool({\\n name: 'snapshot_double',\\n description: 'Double a number for executable snapshot verification.',\\n parameters: { value: { type: 'number', required: true } },\\n async execute(args) {\\n return [{ type: 'text', text: String(args.value * 2) }]\\n }\\n }))\\n}\\n\"}" + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 6, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "chunk": { + "type": "block-end", + "index": 0, + "block": { + "type": "tool-call", + "id": "advanced-mount", + "name": "cordis_mount", + "arguments": "{\"code\": \"return (ctx) => {\\n harness.registerTool(ctx, harness.defineTool({\\n name: 'snapshot_double',\\n description: 'Double a number for executable snapshot verification.',\\n parameters: { value: { type: 'number', required: true } },\\n async execute(args) {\\n return [{ type: 'text', text: String(args.value * 2) }]\\n }\\n }))\\n}\\n\"}" + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 7, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "chunk": { + "type": "usage", + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 8, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "chunk": { + "type": "finish", + "reason": { + "kind": "tool-calls" + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/message", + "seq": 9, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "content": [ + { + "type": "tool-call", + "id": "advanced-mount", + "name": "cordis_mount", + "arguments": "{\"code\": \"return (ctx) => {\\n harness.registerTool(ctx, harness.defineTool({\\n name: 'snapshot_double',\\n description: 'Double a number for executable snapshot verification.',\\n parameters: { value: { type: 'number', required: true } },\\n async execute(args) {\\n return [{ type: 'text', text: String(args.value * 2) }]\\n }\\n }))\\n}\\n\"}" + } + ], + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + }, + "sourceEventSeqs": [ + 4, + 5, + 6, + 7, + 8 + ], + "surfaceOp": "append" + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "tool/call", + "seq": 10, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "callId": "advanced-mount", + "name": "cordis_mount", + "arguments": "{\"code\": \"return (ctx) => {\\n harness.registerTool(ctx, harness.defineTool({\\n name: 'snapshot_double',\\n description: 'Double a number for executable snapshot verification.',\\n parameters: { value: { type: 'number', required: true } },\\n async execute(args) {\\n return [{ type: 'text', text: String(args.value * 2) }]\\n }\\n }))\\n}\\n\"}" + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "tool/result", + "seq": 11, + "time": 0, + "data": { + "turn": 1, + "step": 1, + "callId": "advanced-mount", + "content": [ + { + "type": "text", + "text": "mounted dyn-1 (plugin \"\", state: active)" + } + ], + "isError": false + }, + "sourceEventSeqs": [ + 10 + ], + "surfaceOp": "append" + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "step/end", + "seq": 12, + "time": 0, + "data": { + "turn": 1, + "step": 1 + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "step/start", + "seq": 13, + "time": 0, + "data": { + "turn": 1, + "step": 2 + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "request/header", + "seq": 14, + "time": 0, + "data": { + "header": { + "config": { + "model": "smoke-model" + }, + "system": "{{system}}", + "tools": [ + "bash", + "bash_kill", + "bash_output", + "cordis_inspect", + "cordis_mount", + "cordis_unmount", + "run_code", + "skill", + "snapshot_double", + "subagent", + "workflow" + ] + }, + "reason": "fallback" + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 15, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "chunk": { + "type": "block-start", + "index": 0, + "blockType": "tool-call" + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 16, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "chunk": { + "type": "tool-call-delta", + "index": 0, + "id": "advanced-code", + "name": "run_code", + "argumentsDelta": "{\"code\": \"return await tools.snapshot_double({ value: 21 })\"}" + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 17, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "chunk": { + "type": "block-end", + "index": 0, + "block": { + "type": "tool-call", + "id": "advanced-code", + "name": "run_code", + "arguments": "{\"code\": \"return await tools.snapshot_double({ value: 21 })\"}" + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 18, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "chunk": { + "type": "usage", + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 19, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "chunk": { + "type": "finish", + "reason": { + "kind": "tool-calls" + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/message", + "seq": 20, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "content": [ + { + "type": "tool-call", + "id": "advanced-code", + "name": "run_code", + "arguments": "{\"code\": \"return await tools.snapshot_double({ value: 21 })\"}" + } + ], + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + }, + "sourceEventSeqs": [ + 15, + 16, + 17, + 18, + 19 + ], + "surfaceOp": "append" + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "tool/call", + "seq": 21, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "callId": "advanced-code", + "name": "run_code", + "arguments": "{\"code\": \"return await tools.snapshot_double({ value: 21 })\"}" + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "tool/code-dispatch", + "seq": 22, + "time": 0, + "data": { + "parentCallId": "advanced-code", + "subCallId": "advanced-code:code:1", + "name": "snapshot_double", + "arguments": { + "value": 21 + }, + "isError": false, + "resultSummary": "42" + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "tool/result", + "seq": 23, + "time": 0, + "data": { + "turn": 1, + "step": 2, + "callId": "advanced-code", + "content": [ + { + "type": "text", + "text": "42" + } + ], + "isError": false, + "meta": { + "logs": [], + "dispatches": 1 + } + }, + "sourceEventSeqs": [ + 21 + ], + "surfaceOp": "append" + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "step/end", + "seq": 24, + "time": 0, + "data": { + "turn": 1, + "step": 2 + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "step/start", + "seq": 25, + "time": 0, + "data": { + "turn": 1, + "step": 3 + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 26, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "chunk": { + "type": "block-start", + "index": 0, + "blockType": "tool-call" + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 27, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "chunk": { + "type": "tool-call-delta", + "index": 0, + "id": "advanced-direct-child", + "name": "subagent", + "argumentsDelta": "{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}" + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 28, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "chunk": { + "type": "block-end", + "index": 0, + "block": { + "type": "tool-call", + "id": "advanced-direct-child", + "name": "subagent", + "arguments": "{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}" + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 29, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "chunk": { + "type": "usage", + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 30, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "chunk": { + "type": "finish", + "reason": { + "kind": "tool-calls" + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/message", + "seq": 31, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "content": [ + { + "type": "tool-call", + "id": "advanced-direct-child", + "name": "subagent", + "arguments": "{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}" + } + ], + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + }, + "sourceEventSeqs": [ + 26, + 27, + 28, + 29, + 30 + ], + "surfaceOp": "append" + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "tool/call", + "seq": 32, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "callId": "advanced-direct-child", + "name": "subagent", + "arguments": "{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}" + } + } + } + }, + { + "method": "subagent.started", + "payload": { + "parentSessionId": "{{parent}}", + "childSessionId": "{{child-1}}" + } + }, + { + "method": "subagent.finished", + "payload": { + "provider": "spawn", + "agentId": "{{agent-1}}", + "parentSessionId": "{{parent}}", + "childSessionId": "{{child-1}}", + "status": "ok", + "stopReason": "completed", + "lastAssistantMessage": [ + { + "type": "text", + "text": "DIRECT_CHILD_OK" + } + ] + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "tool/result", + "seq": 33, + "time": 0, + "data": { + "turn": 1, + "step": 3, + "callId": "advanced-direct-child", + "content": [ + { + "type": "text", + "text": "DIRECT_CHILD_OK" + } + ], + "isError": false + }, + "sourceEventSeqs": [ + 32 + ], + "surfaceOp": "append" + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "step/end", + "seq": 34, + "time": 0, + "data": { + "turn": 1, + "step": 3 + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "step/start", + "seq": 35, + "time": 0, + "data": { + "turn": 1, + "step": 4 + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 36, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "chunk": { + "type": "block-start", + "index": 0, + "blockType": "tool-call" + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 37, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "chunk": { + "type": "tool-call-delta", + "index": 0, + "id": "advanced-workflow", + "name": "workflow", + "argumentsDelta": "{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}" + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 38, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "chunk": { + "type": "block-end", + "index": 0, + "block": { + "type": "tool-call", + "id": "advanced-workflow", + "name": "workflow", + "arguments": "{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}" + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 39, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "chunk": { + "type": "usage", + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 40, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "chunk": { + "type": "finish", + "reason": { + "kind": "tool-calls" + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/message", + "seq": 41, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "content": [ + { + "type": "tool-call", + "id": "advanced-workflow", + "name": "workflow", + "arguments": "{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}" + } + ], + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + }, + "sourceEventSeqs": [ + 36, + 37, + 38, + 39, + 40 + ], + "surfaceOp": "append" + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "tool/call", + "seq": 42, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "callId": "advanced-workflow", + "name": "workflow", + "arguments": "{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}" + } + } + } + }, + { + "method": "subagent.started", + "payload": { + "parentSessionId": "{{parent}}", + "childSessionId": "{{child-2}}" + } + }, + { + "method": "subagent.finished", + "payload": { + "provider": "spawn", + "agentId": "{{agent-2}}", + "parentSessionId": "{{parent}}", + "childSessionId": "{{child-2}}", + "status": "ok", + "stopReason": "completed", + "lastAssistantMessage": [ + { + "type": "text", + "text": "WORKFLOW_CHILD_OK" + } + ] + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "tool/result", + "seq": 43, + "time": 0, + "data": { + "turn": 1, + "step": 4, + "callId": "advanced-workflow", + "content": [ + { + "type": "text", + "text": "workflow \"advanced-exe-snapshot\" completed (1 agent).\nReturn value:\n{\n \"reply\": \"WORKFLOW_CHILD_OK\"\n}" + } + ], + "isError": false + }, + "sourceEventSeqs": [ + 42 + ], + "surfaceOp": "append" + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "step/end", + "seq": 44, + "time": 0, + "data": { + "turn": 1, + "step": 4 + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "step/start", + "seq": 45, + "time": 0, + "data": { + "turn": 1, + "step": 5 + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 46, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "chunk": { + "type": "block-start", + "index": 0, + "blockType": "tool-call" + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 47, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "chunk": { + "type": "tool-call-delta", + "index": 0, + "id": "advanced-unmount", + "name": "cordis_unmount", + "argumentsDelta": "{\"id\": \"dyn-1\"}" + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 48, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "chunk": { + "type": "block-end", + "index": 0, + "block": { + "type": "tool-call", + "id": "advanced-unmount", + "name": "cordis_unmount", + "arguments": "{\"id\": \"dyn-1\"}" + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 49, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "chunk": { + "type": "usage", + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 50, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "chunk": { + "type": "finish", + "reason": { + "kind": "tool-calls" + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/message", + "seq": 51, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "content": [ + { + "type": "tool-call", + "id": "advanced-unmount", + "name": "cordis_unmount", + "arguments": "{\"id\": \"dyn-1\"}" + } + ], + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + }, + "sourceEventSeqs": [ + 46, + 47, + 48, + 49, + 50 + ], + "surfaceOp": "append" + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "tool/call", + "seq": 52, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "callId": "advanced-unmount", + "name": "cordis_unmount", + "arguments": "{\"id\": \"dyn-1\"}" + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "tool/result", + "seq": 53, + "time": 0, + "data": { + "turn": 1, + "step": 5, + "callId": "advanced-unmount", + "content": [ + { + "type": "text", + "text": "unmounted dyn-1 (plugin \"\")" + } + ], + "isError": false + }, + "sourceEventSeqs": [ + 52 + ], + "surfaceOp": "append" + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "step/end", + "seq": 54, + "time": 0, + "data": { + "turn": 1, + "step": 5 + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "step/start", + "seq": 55, + "time": 0, + "data": { + "turn": 1, + "step": 6 + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "request/header-delta", + "seq": 56, + "time": 0, + "data": { + "system": { + "keepStart": 62, + "keepEnd": 34, + "insert": [] + }, + "tools": { + "added": [], + "removed": [ + "snapshot_double" + ], + "changed": [] + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 57, + "time": 0, + "data": { + "turn": 1, + "step": 6, + "chunk": { + "type": "block-start", + "index": 0, + "blockType": "text" + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 58, + "time": 0, + "data": { + "turn": 1, + "step": 6, + "chunk": { + "type": "text-delta", + "index": 0, + "text": "ADVANCED_EXECUTABLE_OK" + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 59, + "time": 0, + "data": { + "turn": 1, + "step": 6, + "chunk": { + "type": "block-end", + "index": 0, + "block": { + "type": "text", + "text": "ADVANCED_EXECUTABLE_OK" + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 60, + "time": 0, + "data": { + "turn": 1, + "step": 6, + "chunk": { + "type": "usage", + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/chunk", + "seq": 61, + "time": 0, + "data": { + "turn": 1, + "step": 6, + "chunk": { + "type": "finish", + "reason": { + "kind": "stop" + } + } + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "assistant/message", + "seq": 62, + "time": 0, + "data": { + "turn": 1, + "step": 6, + "content": [ + { + "type": "text", + "text": "ADVANCED_EXECUTABLE_OK" + } + ], + "usage": { + "inputTokens": 3, + "outputTokens": 3 + } + }, + "sourceEventSeqs": [ + 57, + 58, + 59, + 60, + 61 + ], + "surfaceOp": "append" + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "step/end", + "seq": 63, + "time": 0, + "data": { + "turn": 1, + "step": 6 + } + } + } + }, + { + "method": "session.event", + "payload": { + "sessionId": "{{parent}}", + "event": { + "type": "turn/end", + "seq": 64, + "time": 0, + "data": { + "turn": 1, + "reason": { + "kind": "completed" + } + } + } + } + }, + { + "method": "session.finished", + "payload": { + "sessionId": "{{parent}}", + "status": "ok", + "reason": { + "kind": "completed" + } + } + } + ], + "session_root": "{{cwd}}/sessions" +} diff --git a/scripts/snapshots/python-sdk-single-exe/advanced/session.1.jsonl b/scripts/snapshots/python-sdk-single-exe/advanced/session.1.jsonl new file mode 100644 index 0000000000..beb80d3c85 --- /dev/null +++ b/scripts/snapshots/python-sdk-single-exe/advanced/session.1.jsonl @@ -0,0 +1,13 @@ +{"type":"session","version":0,"id":"{{child-1}}","createdAt":0,"cwd":"{{cwd}}","parentSession":"{{parent}}"} +{"type":"turn/start","seq":0,"time":0,"data":{"turn":1,"trigger":{"kind":"message","source":{"kind":"user"}}}} +{"type":"user/message","seq":1,"time":0,"data":{"content":[{"type":"text","text":"Reply with exactly DIRECT_CHILD_OK and nothing else."}],"source":{"kind":"user"}},"surfaceOp":"append"} +{"type":"step/start","seq":2,"time":0,"data":{"turn":1,"step":1}} +{"type":"request/header","seq":3,"time":0,"data":{"header":{"config":{"model":"smoke-model"},"system":"{{system}}","tools":["bash","bash_kill","bash_output","cordis_inspect","cordis_mount","cordis_unmount","run_code","skill","snapshot_double","subagent","workflow"]},"reason":"initial"}} +{"type":"assistant/chunk","seq":4,"time":0,"data":{"turn":1,"step":1,"chunk":{"type":"block-start","index":0,"blockType":"text"}}} +{"type":"assistant/chunk","seq":5,"time":0,"data":{"turn":1,"step":1,"chunk":{"type":"text-delta","index":0,"text":"DIRECT_CHILD_OK"}}} +{"type":"assistant/chunk","seq":6,"time":0,"data":{"turn":1,"step":1,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"DIRECT_CHILD_OK"}}}} +{"type":"assistant/chunk","seq":7,"time":0,"data":{"turn":1,"step":1,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}}} +{"type":"assistant/chunk","seq":8,"time":0,"data":{"turn":1,"step":1,"chunk":{"type":"finish","reason":{"kind":"stop"}}}} +{"type":"assistant/message","seq":9,"time":0,"data":{"turn":1,"step":1,"content":[{"type":"text","text":"DIRECT_CHILD_OK"}],"usage":{"inputTokens":3,"outputTokens":3}},"sourceEventSeqs":[4,5,6,7,8],"surfaceOp":"append"} +{"type":"step/end","seq":10,"time":0,"data":{"turn":1,"step":1}} +{"type":"turn/end","seq":11,"time":0,"data":{"turn":1,"reason":{"kind":"completed"}}} diff --git a/scripts/snapshots/python-sdk-single-exe/advanced/session.2.jsonl b/scripts/snapshots/python-sdk-single-exe/advanced/session.2.jsonl new file mode 100644 index 0000000000..948c835148 --- /dev/null +++ b/scripts/snapshots/python-sdk-single-exe/advanced/session.2.jsonl @@ -0,0 +1,13 @@ +{"type":"session","version":0,"id":"{{child-2}}","createdAt":0,"cwd":"{{cwd}}","parentSession":"{{parent}}"} +{"type":"turn/start","seq":0,"time":0,"data":{"turn":1,"trigger":{"kind":"message","source":{"kind":"user"}}}} +{"type":"user/message","seq":1,"time":0,"data":{"content":[{"type":"text","text":"Reply with exactly WORKFLOW_CHILD_OK and nothing else."}],"source":{"kind":"user"}},"surfaceOp":"append"} +{"type":"step/start","seq":2,"time":0,"data":{"turn":1,"step":1}} +{"type":"request/header","seq":3,"time":0,"data":{"header":{"config":{"model":"smoke-model"},"system":"{{system}}","tools":["bash","bash_kill","bash_output","cordis_inspect","cordis_mount","cordis_unmount","run_code","skill","snapshot_double","subagent","workflow"]},"reason":"initial"}} +{"type":"assistant/chunk","seq":4,"time":0,"data":{"turn":1,"step":1,"chunk":{"type":"block-start","index":0,"blockType":"text"}}} +{"type":"assistant/chunk","seq":5,"time":0,"data":{"turn":1,"step":1,"chunk":{"type":"text-delta","index":0,"text":"WORKFLOW_CHILD_OK"}}} +{"type":"assistant/chunk","seq":6,"time":0,"data":{"turn":1,"step":1,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"WORKFLOW_CHILD_OK"}}}} +{"type":"assistant/chunk","seq":7,"time":0,"data":{"turn":1,"step":1,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}}} +{"type":"assistant/chunk","seq":8,"time":0,"data":{"turn":1,"step":1,"chunk":{"type":"finish","reason":{"kind":"stop"}}}} +{"type":"assistant/message","seq":9,"time":0,"data":{"turn":1,"step":1,"content":[{"type":"text","text":"WORKFLOW_CHILD_OK"}],"usage":{"inputTokens":3,"outputTokens":3}},"sourceEventSeqs":[4,5,6,7,8],"surfaceOp":"append"} +{"type":"step/end","seq":10,"time":0,"data":{"turn":1,"step":1}} +{"type":"turn/end","seq":11,"time":0,"data":{"turn":1,"reason":{"kind":"completed"}}} diff --git a/scripts/snapshots/python-sdk-single-exe/advanced/session.jsonl b/scripts/snapshots/python-sdk-single-exe/advanced/session.jsonl new file mode 100644 index 0000000000..bb0ee1d4d0 --- /dev/null +++ b/scripts/snapshots/python-sdk-single-exe/advanced/session.jsonl @@ -0,0 +1,66 @@ +{"type":"session","version":0,"id":"{{parent}}","createdAt":0,"cwd":"{{cwd}}"} +{"type":"turn/start","seq":0,"time":0,"data":{"turn":1,"trigger":{"kind":"message","source":{"kind":"user"}}}} +{"type":"user/message","seq":1,"time":0,"data":{"content":[{"type":"text","text":"Run the advanced packaged-runtime snapshot scenario."}],"source":{"kind":"user"}},"surfaceOp":"append"} +{"type":"step/start","seq":2,"time":0,"data":{"turn":1,"step":1}} +{"type":"request/header","seq":3,"time":0,"data":{"header":{"config":{"model":"smoke-model"},"system":"{{system}}","tools":["bash","bash_kill","bash_output","cordis_inspect","cordis_mount","cordis_unmount","run_code","skill","subagent","workflow"]},"reason":"initial"}} +{"type":"assistant/chunk","seq":4,"time":0,"data":{"turn":1,"step":1,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}}} +{"type":"assistant/chunk","seq":5,"time":0,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":0,"id":"advanced-mount","name":"cordis_mount","argumentsDelta":"{\"code\": \"return (ctx) => {\\n harness.registerTool(ctx, harness.defineTool({\\n name: 'snapshot_double',\\n description: 'Double a number for executable snapshot verification.',\\n parameters: { value: { type: 'number', required: true } },\\n async execute(args) {\\n return [{ type: 'text', text: String(args.value * 2) }]\\n }\\n }))\\n}\\n\"}"}}} +{"type":"assistant/chunk","seq":6,"time":0,"data":{"turn":1,"step":1,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"advanced-mount","name":"cordis_mount","arguments":"{\"code\": \"return (ctx) => {\\n harness.registerTool(ctx, harness.defineTool({\\n name: 'snapshot_double',\\n description: 'Double a number for executable snapshot verification.',\\n parameters: { value: { type: 'number', required: true } },\\n async execute(args) {\\n return [{ type: 'text', text: String(args.value * 2) }]\\n }\\n }))\\n}\\n\"}"}}}} +{"type":"assistant/chunk","seq":7,"time":0,"data":{"turn":1,"step":1,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}}} +{"type":"assistant/chunk","seq":8,"time":0,"data":{"turn":1,"step":1,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}} +{"type":"assistant/message","seq":9,"time":0,"data":{"turn":1,"step":1,"content":[{"type":"tool-call","id":"advanced-mount","name":"cordis_mount","arguments":"{\"code\": \"return (ctx) => {\\n harness.registerTool(ctx, harness.defineTool({\\n name: 'snapshot_double',\\n description: 'Double a number for executable snapshot verification.',\\n parameters: { value: { type: 'number', required: true } },\\n async execute(args) {\\n return [{ type: 'text', text: String(args.value * 2) }]\\n }\\n }))\\n}\\n\"}"}],"usage":{"inputTokens":3,"outputTokens":3}},"sourceEventSeqs":[4,5,6,7,8],"surfaceOp":"append"} +{"type":"tool/call","seq":10,"time":0,"data":{"turn":1,"step":1,"callId":"advanced-mount","name":"cordis_mount","arguments":"{\"code\": \"return (ctx) => {\\n harness.registerTool(ctx, harness.defineTool({\\n name: 'snapshot_double',\\n description: 'Double a number for executable snapshot verification.',\\n parameters: { value: { type: 'number', required: true } },\\n async execute(args) {\\n return [{ type: 'text', text: String(args.value * 2) }]\\n }\\n }))\\n}\\n\"}"}} +{"type":"tool/result","seq":11,"time":0,"data":{"turn":1,"step":1,"callId":"advanced-mount","content":[{"type":"text","text":"mounted dyn-1 (plugin \"\", state: active)"}],"isError":false},"sourceEventSeqs":[10],"surfaceOp":"append"} +{"type":"step/end","seq":12,"time":0,"data":{"turn":1,"step":1}} +{"type":"step/start","seq":13,"time":0,"data":{"turn":1,"step":2}} +{"type":"request/header","seq":14,"time":0,"data":{"header":{"config":{"model":"smoke-model"},"system":"{{system}}","tools":["bash","bash_kill","bash_output","cordis_inspect","cordis_mount","cordis_unmount","run_code","skill","snapshot_double","subagent","workflow"]},"reason":"fallback"}} +{"type":"assistant/chunk","seq":15,"time":0,"data":{"turn":1,"step":2,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}}} +{"type":"assistant/chunk","seq":16,"time":0,"data":{"turn":1,"step":2,"chunk":{"type":"tool-call-delta","index":0,"id":"advanced-code","name":"run_code","argumentsDelta":"{\"code\": \"return await tools.snapshot_double({ value: 21 })\"}"}}} +{"type":"assistant/chunk","seq":17,"time":0,"data":{"turn":1,"step":2,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"advanced-code","name":"run_code","arguments":"{\"code\": \"return await tools.snapshot_double({ value: 21 })\"}"}}}} +{"type":"assistant/chunk","seq":18,"time":0,"data":{"turn":1,"step":2,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}}} +{"type":"assistant/chunk","seq":19,"time":0,"data":{"turn":1,"step":2,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}} +{"type":"assistant/message","seq":20,"time":0,"data":{"turn":1,"step":2,"content":[{"type":"tool-call","id":"advanced-code","name":"run_code","arguments":"{\"code\": \"return await tools.snapshot_double({ value: 21 })\"}"}],"usage":{"inputTokens":3,"outputTokens":3}},"sourceEventSeqs":[15,16,17,18,19],"surfaceOp":"append"} +{"type":"tool/call","seq":21,"time":0,"data":{"turn":1,"step":2,"callId":"advanced-code","name":"run_code","arguments":"{\"code\": \"return await tools.snapshot_double({ value: 21 })\"}"}} +{"type":"tool/code-dispatch","seq":22,"time":0,"data":{"parentCallId":"advanced-code","subCallId":"advanced-code:code:1","name":"snapshot_double","arguments":{"value":21},"isError":false,"resultSummary":"42"}} +{"type":"tool/result","seq":23,"time":0,"data":{"turn":1,"step":2,"callId":"advanced-code","content":[{"type":"text","text":"42"}],"isError":false,"meta":{"logs":[],"dispatches":1}},"sourceEventSeqs":[21],"surfaceOp":"append"} +{"type":"step/end","seq":24,"time":0,"data":{"turn":1,"step":2}} +{"type":"step/start","seq":25,"time":0,"data":{"turn":1,"step":3}} +{"type":"assistant/chunk","seq":26,"time":0,"data":{"turn":1,"step":3,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}}} +{"type":"assistant/chunk","seq":27,"time":0,"data":{"turn":1,"step":3,"chunk":{"type":"tool-call-delta","index":0,"id":"advanced-direct-child","name":"subagent","argumentsDelta":"{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}"}}} +{"type":"assistant/chunk","seq":28,"time":0,"data":{"turn":1,"step":3,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"advanced-direct-child","name":"subagent","arguments":"{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}"}}}} +{"type":"assistant/chunk","seq":29,"time":0,"data":{"turn":1,"step":3,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}}} +{"type":"assistant/chunk","seq":30,"time":0,"data":{"turn":1,"step":3,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}} +{"type":"assistant/message","seq":31,"time":0,"data":{"turn":1,"step":3,"content":[{"type":"tool-call","id":"advanced-direct-child","name":"subagent","arguments":"{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}"}],"usage":{"inputTokens":3,"outputTokens":3}},"sourceEventSeqs":[26,27,28,29,30],"surfaceOp":"append"} +{"type":"tool/call","seq":32,"time":0,"data":{"turn":1,"step":3,"callId":"advanced-direct-child","name":"subagent","arguments":"{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}"}} +{"type":"tool/result","seq":33,"time":0,"data":{"turn":1,"step":3,"callId":"advanced-direct-child","content":[{"type":"text","text":"DIRECT_CHILD_OK"}],"isError":false},"sourceEventSeqs":[32],"surfaceOp":"append"} +{"type":"step/end","seq":34,"time":0,"data":{"turn":1,"step":3}} +{"type":"step/start","seq":35,"time":0,"data":{"turn":1,"step":4}} +{"type":"assistant/chunk","seq":36,"time":0,"data":{"turn":1,"step":4,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}}} +{"type":"assistant/chunk","seq":37,"time":0,"data":{"turn":1,"step":4,"chunk":{"type":"tool-call-delta","index":0,"id":"advanced-workflow","name":"workflow","argumentsDelta":"{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}"}}} +{"type":"assistant/chunk","seq":38,"time":0,"data":{"turn":1,"step":4,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"advanced-workflow","name":"workflow","arguments":"{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}"}}}} +{"type":"assistant/chunk","seq":39,"time":0,"data":{"turn":1,"step":4,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}}} +{"type":"assistant/chunk","seq":40,"time":0,"data":{"turn":1,"step":4,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}} +{"type":"assistant/message","seq":41,"time":0,"data":{"turn":1,"step":4,"content":[{"type":"tool-call","id":"advanced-workflow","name":"workflow","arguments":"{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}"}],"usage":{"inputTokens":3,"outputTokens":3}},"sourceEventSeqs":[36,37,38,39,40],"surfaceOp":"append"} +{"type":"tool/call","seq":42,"time":0,"data":{"turn":1,"step":4,"callId":"advanced-workflow","name":"workflow","arguments":"{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}"}} +{"type":"tool/result","seq":43,"time":0,"data":{"turn":1,"step":4,"callId":"advanced-workflow","content":[{"type":"text","text":"workflow \"advanced-exe-snapshot\" completed (1 agent).\nReturn value:\n{\n \"reply\": \"WORKFLOW_CHILD_OK\"\n}"}],"isError":false},"sourceEventSeqs":[42],"surfaceOp":"append"} +{"type":"step/end","seq":44,"time":0,"data":{"turn":1,"step":4}} +{"type":"step/start","seq":45,"time":0,"data":{"turn":1,"step":5}} +{"type":"assistant/chunk","seq":46,"time":0,"data":{"turn":1,"step":5,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}}} +{"type":"assistant/chunk","seq":47,"time":0,"data":{"turn":1,"step":5,"chunk":{"type":"tool-call-delta","index":0,"id":"advanced-unmount","name":"cordis_unmount","argumentsDelta":"{\"id\": \"dyn-1\"}"}}} +{"type":"assistant/chunk","seq":48,"time":0,"data":{"turn":1,"step":5,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"advanced-unmount","name":"cordis_unmount","arguments":"{\"id\": \"dyn-1\"}"}}}} +{"type":"assistant/chunk","seq":49,"time":0,"data":{"turn":1,"step":5,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}}} +{"type":"assistant/chunk","seq":50,"time":0,"data":{"turn":1,"step":5,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}} +{"type":"assistant/message","seq":51,"time":0,"data":{"turn":1,"step":5,"content":[{"type":"tool-call","id":"advanced-unmount","name":"cordis_unmount","arguments":"{\"id\": \"dyn-1\"}"}],"usage":{"inputTokens":3,"outputTokens":3}},"sourceEventSeqs":[46,47,48,49,50],"surfaceOp":"append"} +{"type":"tool/call","seq":52,"time":0,"data":{"turn":1,"step":5,"callId":"advanced-unmount","name":"cordis_unmount","arguments":"{\"id\": \"dyn-1\"}"}} +{"type":"tool/result","seq":53,"time":0,"data":{"turn":1,"step":5,"callId":"advanced-unmount","content":[{"type":"text","text":"unmounted dyn-1 (plugin \"\")"}],"isError":false},"sourceEventSeqs":[52],"surfaceOp":"append"} +{"type":"step/end","seq":54,"time":0,"data":{"turn":1,"step":5}} +{"type":"step/start","seq":55,"time":0,"data":{"turn":1,"step":6}} +{"type":"request/header-delta","seq":56,"time":0,"data":{"system":{"keepStart":62,"keepEnd":34,"insert":[]},"tools":{"added":[],"removed":["snapshot_double"],"changed":[]}}} +{"type":"assistant/chunk","seq":57,"time":0,"data":{"turn":1,"step":6,"chunk":{"type":"block-start","index":0,"blockType":"text"}}} +{"type":"assistant/chunk","seq":58,"time":0,"data":{"turn":1,"step":6,"chunk":{"type":"text-delta","index":0,"text":"ADVANCED_EXECUTABLE_OK"}}} +{"type":"assistant/chunk","seq":59,"time":0,"data":{"turn":1,"step":6,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"ADVANCED_EXECUTABLE_OK"}}}} +{"type":"assistant/chunk","seq":60,"time":0,"data":{"turn":1,"step":6,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}}} +{"type":"assistant/chunk","seq":61,"time":0,"data":{"turn":1,"step":6,"chunk":{"type":"finish","reason":{"kind":"stop"}}}} +{"type":"assistant/message","seq":62,"time":0,"data":{"turn":1,"step":6,"content":[{"type":"text","text":"ADVANCED_EXECUTABLE_OK"}],"usage":{"inputTokens":3,"outputTokens":3}},"sourceEventSeqs":[57,58,59,60,61],"surfaceOp":"append"} +{"type":"step/end","seq":63,"time":0,"data":{"turn":1,"step":6}} +{"type":"turn/end","seq":64,"time":0,"data":{"turn":1,"reason":{"kind":"completed"}}}