Archetype SDK
npm i @pairful/archetype-sdkimport {
ClientConnectionService,
ConnectorAdapter,
} from "@pairful/archetype-sdk";
const client = await ClientConnectionService.connect(
ConnectorAdapter.webSocketConnector(url),
{ client: "my-app" },
);
const turn = await client.startTurn("main", "run the tests");
for await (const { event } of client.events(turn)) {
if (event.type === "approval.requested")
await client.respond(turn, event.requestId, { action: "allow" });
}
输出
turn.started
text跑一下测试
approval.requestedbun test
approval.resolvedallow
toolbun test · 12 pass
turn.finished
已作为 main 保存在应用的会话里 · 在应用里看看 →