conversation-session-subagent-cross-host.test.ts 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. // 原因:本用例的回放 Provider 只声明 high/max;保留两个不同合法档位验证配置更新与隔离。
  2. import { subagentUpdateCursor } from "#e2e/helpers/subagent-snapshot-wait";
  3. import { exerciseSubagentHostBranches } from "#e2e/helpers/subagent-host-branches";
  4. import {
  5. openSubagentHostWindow,
  6. setHostFaults,
  7. waitForHostBoundary,
  8. } from "#e2e/helpers/subagent-host-window";
  9. import { writeFile, mkdir, stat, readFile, rename, rm } from "node:fs/promises";
  10. import { join } from "node:path";
  11. import { clearAppData, getE2EAppDataPaths } from "#e2e/helpers/desktop-app";
  12. import { openWorkspaceDraftFromSidebar } from "#e2e/helpers/workspace-agent-warmup";
  13. import {
  14. prepareV4ConversationE2E,
  15. getV4PaneSnapshot,
  16. sendV4PromptAndWaitAccepted,
  17. sendV4Prompt,
  18. } from "#e2e/helpers/v4-conversation";
  19. import {
  20. useEnglishSubagentSettings,
  21. finishSubagentTurn,
  22. } from "#e2e/helpers/subagent-refresh-conversation";
  23. import { saveRefreshProfile, type RefreshProfile } from "#e2e/helpers/subagent-refresh-settings";
  24. import {
  25. waitForSubagentRequest,
  26. readSubagentCapture,
  27. assertSubagentProfile,
  28. readChildSessionIds,
  29. boundaryRpcReads,
  30. assertChildTrajectory,
  31. } from "#e2e/helpers/subagent-refresh-capture";
  32. import {
  33. UPSTREAM_MODEL,
  34. UPSTREAM_PROVIDER_ID,
  35. UPSTREAM_ALTERNATE_MODEL,
  36. UPSTREAM_ALTERNATE_PROVIDER_ID,
  37. selectUpstreamModel,
  38. selectUpstreamThoughtLevel,
  39. } from "#e2e/helpers/upstream-provider";
  40. import {
  41. assertProviderPrefix,
  42. assertRequestCacheBreakpoint,
  43. type CapturedPrompt,
  44. } from "#e2e/helpers/provider-prefix";
  45. import { exportPromptTrajectory } from "#e2e/helpers/prompt-trajectory-export";
  46. const old: RefreshProfile = {
  47. name: "e2e-host-reviewer",
  48. description: "Host refresh",
  49. prompt: "E2E_SHI_PROFILE_OLD",
  50. model: UPSTREAM_MODEL,
  51. provider: UPSTREAM_PROVIDER_ID,
  52. effort: "high",
  53. tools: ["Read"],
  54. };
  55. const updated: RefreshProfile = {
  56. ...old,
  57. prompt: "E2E_SHI_PROFILE_NEW",
  58. model: UPSTREAM_ALTERNATE_MODEL,
  59. provider: UPSTREAM_ALTERNATE_PROVIDER_ID,
  60. effort: "max",
  61. tools: ["Grep"],
  62. };
  63. describe("Subagent 跨真实 Host 失效", () => {
  64. after(async () => {
  65. await browser.electron.restoreAllMocks();
  66. await clearAppData();
  67. });
  68. it("SHR22: 双 Host 消费大小写不同目录的更新及项目目录首次创建、重建", async function () {
  69. this.timeout(300000);
  70. await prepareV4ConversationE2E();
  71. await useEnglishSubagentSettings();
  72. const storage = getE2EAppDataPaths().storageRoot;
  73. const probe = join(storage, "CaseProbe");
  74. await mkdir(probe);
  75. try {
  76. const actual = await stat(probe);
  77. const alias = await stat(join(storage, "caseprobe")).catch((error: NodeJS.ErrnoException) => {
  78. if (error.code === "ENOENT") return undefined;
  79. throw error;
  80. });
  81. if (!alias || actual.dev !== alias.dev || actual.ino !== alias.ino) this.skip();
  82. } finally {
  83. await rm(probe, { recursive: true });
  84. }
  85. const profile = { ...old, name: "e2e-path-reviewer", prompt: "E2E_SHP_PROFILE_OLD" };
  86. const next = { ...profile, prompt: "E2E_SHP_PROFILE_NEW" };
  87. await saveRefreshProfile(profile);
  88. const initialHandle = await browser.getWindowHandle();
  89. const projectRoot = join(getE2EAppDataPaths().workspace, ".zcode", "agents");
  90. await rm(projectRoot, { recursive: true, force: true });
  91. const root = join(storage, "agents");
  92. // 两步更名确保实际目录项变为大写;随后启动的 Host 必须从真实目录建立监听。
  93. await rename(root, root + "-case-tmp");
  94. await rename(root + "-case-tmp", join(storage, "AGENTS"));
  95. const nestedName = "e2e-nested-ignored";
  96. const nestedRoot = join(root, "nested");
  97. await mkdir(nestedRoot);
  98. await writeFile(
  99. join(nestedRoot, `${nestedName}.md`),
  100. `---\nname: ${nestedName}\ndescription: Nested profile\n---\nNested profile must not be listed.`,
  101. );
  102. const windows: Array<Awaited<ReturnType<typeof openSubagentHostWindow>>> = [];
  103. const sessions: Array<{
  104. side: string;
  105. sessionId: string;
  106. hostPid: number;
  107. cliPid: number;
  108. handle: string;
  109. }> = [];
  110. try {
  111. for (const side of ["A", "B"]) {
  112. const window = await openSubagentHostWindow();
  113. windows.push(window);
  114. // 新窗口可能恢复全局草稿;显式选择项目,才能验证项目配置的跨 Host 传播。
  115. await openWorkspaceDraftFromSidebar(getE2EAppDataPaths().workspace);
  116. await selectUpstreamModel();
  117. await selectUpstreamThoughtLevel();
  118. const marker = `E2E_SHP_${side}_SEED`;
  119. await sendV4PromptAndWaitAccepted(`${marker}: Remember this session.`, marker, marker);
  120. await finishSubagentTurn(`${marker}_DONE`, 60000);
  121. const sessionId = (await getV4PaneSnapshot()).sessionId!;
  122. const rpc = (await boundaryRpcReads()).find(
  123. (r) => r.sessionId === sessionId && r.kind === "read",
  124. )!;
  125. expect(rpc).toBeTruthy();
  126. sessions.push({
  127. side,
  128. sessionId,
  129. hostPid: rpc.hostPid,
  130. cliPid: rpc.pid,
  131. handle: window.handle,
  132. });
  133. const seed = await waitForSubagentRequest(`shp-${side.toLowerCase()}-seed`);
  134. expect(JSON.stringify(seed.requestJson)).toContain(profile.name);
  135. expect(JSON.stringify(seed.requestJson)).not.toContain(nestedName);
  136. }
  137. expect(sessions[0]!.hostPid).not.toBe(sessions[1]!.hostPid);
  138. expect(sessions[0]!.cliPid).not.toBe(sessions[1]!.cliPid);
  139. await browser.switchToWindow(sessions[0]!.handle);
  140. await useEnglishSubagentSettings();
  141. const published = await subagentUpdateCursor();
  142. let publicationError: string | undefined;
  143. try {
  144. await saveRefreshProfile(next, profile.name);
  145. await published(
  146. sessions.map((s) => s.hostPid),
  147. [`${profile.name}.md`],
  148. );
  149. } catch (error) {
  150. // 仅保留缓存发布超时用于归因,UI 保存失败仍立即失败。后续必须断言新配置。
  151. if (!String(error).includes("Host 未完成配置文件更新")) throw error;
  152. publicationError = String(error);
  153. }
  154. const disk = await readFile(join(storage, "AGENTS", `${profile.name}.md`), "utf8");
  155. expect(disk).toContain(next.prompt);
  156. const children: Array<{
  157. capture: Awaited<ReturnType<typeof waitForSubagentRequest>>;
  158. profile: RefreshProfile;
  159. }> = [];
  160. const stages = ["NEXT", "CREATED", "REBUILT"] as const;
  161. for (const [stageIndex, stage] of stages.entries()) {
  162. const expected = stage === "NEXT" ? next : { ...next, prompt: `E2E_SHP_PROFILE_${stage}` };
  163. if (stage !== "NEXT") {
  164. await browser.switchToWindow(sessions[0]!.handle);
  165. if (stage === "REBUILT") {
  166. const removed = await subagentUpdateCursor();
  167. await rm(projectRoot, { recursive: true });
  168. await removed(
  169. sessions.map((s) => s.hostPid),
  170. [projectRoot],
  171. );
  172. }
  173. // 两个 Host 从启动起观察缺失的项目目录;真实 Settings 创建触发目录切换。
  174. const created = await subagentUpdateCursor();
  175. await saveRefreshProfile(expected, undefined, {
  176. workspacePath: getE2EAppDataPaths().workspace,
  177. });
  178. await created(
  179. sessions.map((s) => s.hostPid),
  180. [projectRoot],
  181. );
  182. expect(await readFile(join(projectRoot, `${profile.name}.md`), "utf8")).toContain(
  183. expected.prompt,
  184. );
  185. }
  186. for (const session of sessions) {
  187. await browser.switchToWindow(session.handle);
  188. const marker = `E2E_SHP_${session.side}_${stage}`;
  189. await sendV4PromptAndWaitAccepted(`${marker}: Launch ${profile.name}.`, marker, marker);
  190. await finishSubagentTurn(`${marker}_DONE`, 60000);
  191. expect((await getV4PaneSnapshot()).sessionId).toBe(session.sessionId);
  192. const id = `shp-${session.side.toLowerCase()}-${stage.toLowerCase()}-child`;
  193. children.push({ capture: await waitForSubagentRequest(id), profile: expected });
  194. const childIds = readChildSessionIds(session.sessionId);
  195. expect(childIds).toHaveLength(stageIndex + 1);
  196. await assertChildTrajectory(childIds.at(-1)!, [id]);
  197. const bodies = (await readSubagentCapture())
  198. .filter((r) =>
  199. new RegExp(
  200. `^shp-${session.side.toLowerCase()}-(seed|(?:next|created|rebuilt)-(?:tool|final))$`,
  201. "u",
  202. ).test(r.replay?.fixtureId ?? ""),
  203. )
  204. .map((r) => r.requestJson as CapturedPrompt);
  205. const requestCount = 3 + stageIndex * 2;
  206. expect(bodies).toHaveLength(requestCount);
  207. for (const body of bodies) expect(JSON.stringify(body)).not.toContain(nestedName);
  208. for (let i = 1; i < bodies.length; i++) assertProviderPrefix(bodies[i - 1]!, bodies[i]!);
  209. const trajectory = await exportPromptTrajectory(
  210. session.sessionId,
  211. `subagent-path-${session.side}-${stage}`,
  212. );
  213. expect(trajectory.trajectories).toEqual([
  214. expect.objectContaining({ reason: "initial", requestCount }),
  215. ]);
  216. }
  217. }
  218. await writeFile(
  219. join(process.env.ZCODE_E2E_ARTIFACT_DIR!, "subagent-path-evidence.json"),
  220. JSON.stringify(
  221. {
  222. sessions,
  223. disk,
  224. publicationError,
  225. requests: children.map(({ capture, profile }) => ({
  226. id: capture.replay?.fixtureId,
  227. request: capture.requestJson,
  228. expected: profile,
  229. })),
  230. },
  231. null,
  232. 2,
  233. ),
  234. );
  235. // 先采集两个 Host 的完整请求及轨迹,再一起报告配置断言,避免 A 的失败遮住 B。
  236. const failures: string[] = [];
  237. for (const { capture: child, profile: expected } of children) {
  238. try {
  239. assertRequestCacheBreakpoint(child.requestJson as CapturedPrompt);
  240. assertSubagentProfile(child, expected);
  241. } catch (error) {
  242. failures.push(`${child.replay?.fixtureId}: ${String(error)}`);
  243. }
  244. }
  245. expect(failures).toEqual([]);
  246. expect(publicationError).toBeUndefined();
  247. } finally {
  248. for (const window of windows)
  249. await browser.electron.execute(
  250. (electron, id) => electron.BrowserWindow.fromId(id)?.destroy(),
  251. window.windowId,
  252. );
  253. await rm(projectRoot, { recursive: true, force: true });
  254. await browser.switchToWindow(initialHandle);
  255. await rm(nestedRoot, { recursive: true, force: true });
  256. await rename(join(storage, "AGENTS"), root + "-case-tmp");
  257. await rename(root + "-case-tmp", root);
  258. }
  259. });
  260. it("SHR16/SHR18-SHR21: 双 Host 的目录、覆盖、失效故障、并发和销毁边界", async function () {
  261. this.timeout(600000);
  262. await prepareV4ConversationE2E();
  263. await useEnglishSubagentSettings();
  264. await saveRefreshProfile(old);
  265. await turn("A_SEED");
  266. const a = (await getV4PaneSnapshot()).sessionId!;
  267. const aHandle = await browser.getWindowHandle();
  268. const { windowId: bWindowId, handle: bHandle } = await openSubagentHostWindow();
  269. try {
  270. await openWorkspaceDraftFromSidebar(getE2EAppDataPaths().workspace);
  271. await selectUpstreamModel();
  272. await selectUpstreamThoughtLevel();
  273. await turn("B_SEED");
  274. const b = (await getV4PaneSnapshot()).sessionId!;
  275. expect(b).not.toBe(a);
  276. const childId = readChildSessionIds(b)[0]!;
  277. expect(childId).toBeTruthy();
  278. assertSubagentProfile(await waitForSubagentRequest("shi-b-seed-child"), old);
  279. const rpc = await boundaryRpcReads();
  280. const aRead = rpc.find((r) => r.sessionId === a && r.kind === "read")!;
  281. const bRead = rpc.find((r) => r.sessionId === b && r.kind === "read")!;
  282. expect(aRead.hostPid).not.toBe(bRead.hostPid);
  283. expect(aRead.pid).not.toBe(bRead.pid);
  284. await send("B_HOLD");
  285. await browser.waitUntil(
  286. async () =>
  287. (await readSubagentCapture()).some((r) => r.replay?.fixtureId === "shi-b-hold-tool"),
  288. { timeout: 30000 },
  289. );
  290. const published = await subagentUpdateCursor();
  291. await browser.switchToWindow(aHandle);
  292. await saveRefreshProfile(updated, old.name);
  293. await published([aRead.hostPid, bRead.hostPid]);
  294. await browser.switchToWindow(bHandle);
  295. assertSubagentProfile(await waitForSubagentRequest("shi-b-hold-child"), old);
  296. await finish("B_HOLD");
  297. await browser.switchToWindow(aHandle);
  298. await turn("A_NEXT");
  299. assertSubagentProfile(await waitForSubagentRequest("shi-a-next-child"), updated);
  300. expect((await getV4PaneSnapshot()).sessionId).toBe(a);
  301. await browser.switchToWindow(bHandle);
  302. await turn("B_RESUME");
  303. assertSubagentProfile(await waitForSubagentRequest("shi-b-resume-child"), updated);
  304. expect(readChildSessionIds(b)).toEqual([childId]);
  305. await turn("B_SPAWN");
  306. assertSubagentProfile(await waitForSubagentRequest("shi-b-spawn-child"), updated);
  307. expect(readChildSessionIds(b)).toHaveLength(2);
  308. const bodies = (await readSubagentCapture())
  309. .filter((r) =>
  310. /^shi-b-(seed|hold|resume|spawn)-(tool|final|notification)$/u.test(
  311. r.replay?.fixtureId ?? "",
  312. ),
  313. )
  314. .map((r) => r.requestJson as CapturedPrompt);
  315. expect(bodies).toHaveLength(10);
  316. for (let i = 1; i < bodies.length; i++) assertProviderPrefix(bodies[i - 1]!, bodies[i]!);
  317. const trajectory = await exportPromptTrajectory(b, "subagent-cross-host-parent");
  318. expect(trajectory.trajectories).toEqual([
  319. expect.objectContaining({ reason: "initial", requestCount: 10 }),
  320. ]);
  321. for (const id of [
  322. "shi-b-seed-child",
  323. "shi-b-hold-child",
  324. "shi-b-resume-child",
  325. "shi-b-spawn-child",
  326. ])
  327. assertRequestCacheBreakpoint(
  328. (await waitForSubagentRequest(id)).requestJson as CapturedPrompt,
  329. );
  330. await assertChildTrajectory(childId, [
  331. "shi-b-seed-child",
  332. "shi-b-hold-child",
  333. "shi-b-resume-child",
  334. ]);
  335. const allReads = (await boundaryRpcReads()).filter(
  336. (r) => r.sessionId === b && r.kind === "read",
  337. );
  338. // 初始化一次,四个用户 turn 加两次后台完成通知;工具后的请求不重复读取。
  339. expect(allReads).toHaveLength(1 + 6);
  340. expect(new Set(allReads.map((r) => r.pid))).toEqual(new Set([bRead.pid]));
  341. const aReads = (await boundaryRpcReads()).filter(
  342. // 新窗口可能先恢复 A;该 Host 的初始化读取不属于原 Host 的父轮计数。
  343. (r) => r.sessionId === a && r.hostPid === aRead.hostPid && r.kind === "read",
  344. );
  345. expect(aReads).toHaveLength(1 + 2);
  346. expect(new Set(aReads.map((r) => r.pid))).toEqual(new Set([aRead.pid]));
  347. const aBodies = (await readSubagentCapture())
  348. .filter((r) => /^shi-a-(seed|next-tool|next-final)$/u.test(r.replay?.fixtureId ?? ""))
  349. .map((r) => r.requestJson as CapturedPrompt);
  350. expect(aBodies).toHaveLength(3);
  351. for (let i = 1; i < aBodies.length; i++) assertProviderPrefix(aBodies[i - 1]!, aBodies[i]!);
  352. const aTrajectory = await exportPromptTrajectory(a, "subagent-cross-host-a-parent");
  353. expect(aTrajectory.trajectories).toEqual([
  354. expect.objectContaining({ reason: "initial", requestCount: 3 }),
  355. ]);
  356. const latest = await exerciseSubagentHostBranches(
  357. {
  358. a: { handle: aHandle, sessionId: a, hostPid: aRead.hostPid, cliPid: aRead.pid },
  359. b: { handle: bHandle, sessionId: b, hostPid: bRead.hostPid, cliPid: bRead.pid },
  360. },
  361. old,
  362. updated,
  363. );
  364. // 后台文件重载不再挂住 RPC;通过测试侧 stdio 代理挂起请求,保留断连取消的原始断言。
  365. // 退出是 E2E 的生命周期屏障;迟到 Promise 不能回填的细粒度断言由缓存单测负责。
  366. const disposalProfile = { ...latest, prompt: "E2E_SHB_COLD_PROFILE" };
  367. const file = join(getE2EAppDataPaths().storageRoot, "agents", `${old.name}.md`);
  368. await setHostFaults({
  369. files: [{ id: "dispose", operation: "readFile", path: file, action: "hold", once: true }],
  370. });
  371. await browser.switchToWindow(aHandle);
  372. await saveRefreshProfile(disposalProfile, old.name);
  373. await waitForHostBoundary("file-held", "dispose");
  374. await writeFile(
  375. join(process.env.ZCODE_E2E_ARTIFACT_DIR!, "subagent-config-control.json"),
  376. JSON.stringify({ heldSessionIds: [b] }),
  377. );
  378. const beforeClosing = (await boundaryRpcReads()).filter(
  379. (r) => r.sessionId === b && r.kind === "read",
  380. ).length;
  381. await browser.switchToWindow(bHandle);
  382. await sendV4Prompt("E2E_SHB_CLOSE_WAIT: Await configuration before executing.");
  383. await browser.waitUntil(
  384. async () =>
  385. (await boundaryRpcReads()).filter((r) => r.sessionId === b && r.kind === "read")
  386. .length ===
  387. beforeClosing + 1,
  388. { timeout: 15000 },
  389. );
  390. await browser.waitUntil(
  391. async () => (await boundaryRpcReads()).some((r) => r.sessionId === b && r.kind === "held"),
  392. { timeout: 15000 },
  393. );
  394. await browser.electron.execute(
  395. (electron, id) => electron.BrowserWindow.fromId(id)?.destroy(),
  396. bWindowId,
  397. );
  398. await browser.waitUntil(
  399. () => {
  400. try {
  401. process.kill(bRead.hostPid, 0);
  402. return false;
  403. } catch (error) {
  404. return (error as NodeJS.ErrnoException).code === "ESRCH";
  405. }
  406. },
  407. { timeout: 15000, timeoutMsg: "待配置读取的 Host 未退出" },
  408. );
  409. await setHostFaults({ released: ["dispose"] });
  410. const requestsAfterClose = (await readSubagentCapture()).filter((r) =>
  411. JSON.stringify(r.requestJson).includes("E2E_SHB_CLOSE_WAIT:"),
  412. );
  413. // 新窗口首次准备不依赖早先是否收到通知,直接加载磁盘最新配置。
  414. const cold = await openSubagentHostWindow();
  415. try {
  416. await openWorkspaceDraftFromSidebar(getE2EAppDataPaths().workspace);
  417. await selectUpstreamModel();
  418. await selectUpstreamThoughtLevel();
  419. await sendV4PromptAndWaitAccepted(
  420. "E2E_SHB_COLD_START: Launch the current reviewer.",
  421. "E2E_SHB_COLD_START",
  422. "未接收 cold start",
  423. );
  424. await finishSubagentTurn("E2E_SHB_COLD_START_DONE", 60000);
  425. const coldSession = (await getV4PaneSnapshot()).sessionId!;
  426. assertSubagentProfile(
  427. await waitForSubagentRequest("shb-cold_start-child"),
  428. disposalProfile,
  429. );
  430. const coldReads = (await boundaryRpcReads()).filter(
  431. (r) => r.sessionId === coldSession && r.kind === "read",
  432. );
  433. // 新 Host 上的 session 同样先初始化,再为首个父轮读取快照。
  434. expect(coldReads).toHaveLength(1 + 1);
  435. expect([aRead.hostPid, bRead.hostPid]).not.toContain(coldReads[0]!.hostPid);
  436. expect([aRead.pid, bRead.pid]).not.toContain(coldReads[0]!.pid);
  437. const exported = await exportPromptTrajectory(coldSession, "subagent-host-cold-start");
  438. expect(exported.trajectories).toEqual([
  439. expect.objectContaining({ reason: "initial", requestCount: 2 }),
  440. ]);
  441. await assertChildTrajectory(readChildSessionIds(coldSession)[0]!, ["shb-cold_start-child"]);
  442. } finally {
  443. await browser.electron.execute(
  444. (electron, id) => electron.BrowserWindow.fromId(id)?.destroy(),
  445. cold.windowId,
  446. );
  447. }
  448. // 先完成独立的冷启动验证,再报告关闭分支;保留失败断言,不让一个失败掩盖后续未执行场景。
  449. expect(requestsAfterClose).toHaveLength(0);
  450. } finally {
  451. await browser.electron.execute(
  452. (electron, id) => electron.BrowserWindow.fromId(id)?.destroy(),
  453. bWindowId,
  454. );
  455. await browser.switchToWindow(aHandle);
  456. }
  457. });
  458. });
  459. async function send(stage: string) {
  460. const marker = `E2E_SHI_${stage}`;
  461. await sendV4PromptAndWaitAccepted(
  462. `${marker}: ${stage === "A_SEED" ? "Remember this session." : stage === "B_HOLD" || stage === "B_RESUME" ? "Resume the existing subagent using SendMessage." : `Launch ${old.name}.`}`,
  463. marker,
  464. `未接收 ${marker}`,
  465. );
  466. }
  467. const finish = (stage: string) =>
  468. finishSubagentTurn(
  469. `E2E_SHI_${stage}_${stage === "B_HOLD" || stage === "B_RESUME" ? "SETTLED" : "DONE"}`,
  470. 90000,
  471. );
  472. async function turn(stage: string) {
  473. await send(stage);
  474. await finish(stage);
  475. }