// 子进程:启动 run,download.submit 执行中挂起;父进程收到 SUBMIT_STARTED 后 SIGKILL 本进程。 import { createFakeRuntime } from "../../src/index.ts"; import { makeFixture, settings } from "../helpers.ts"; import { crashScript, RUN_ID } from "./crash-script.ts"; const sessionDir = process.argv[2]!; const fx = makeFixture({ slowMs: 60_000 }); fx.grants.set("user:1", new Set(["download.submit"])); const { runtime } = createFakeRuntime({ registry: fx.registry, scripts: [crashScript], onEvent: (e) => { if (e.type === "tool_call_start" && e.capabilityId === "download.submit") process.stdout.write("SUBMIT_STARTED\n"); }, }); const run = await runtime.createRun({ runId: RUN_ID, goal: "把 Dune 1080p 收进来", systemPrompt: "媒体库助手", capabilities: ["inventory.query", "download.submit"], settings: settings(), sessionDir, actor: { actorId: "user:1", taskId: "task:crash", scopeIds: [] }, }); await run.prompt(); process.stdout.write("UNEXPECTED_FINISH\n");