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" });
}
Output
turn.started
textRun the tests
approval.requestedbun test
approval.resolvedallow
toolbun test · 12 pass
turn.finished
Kept in the app as main · See it in the app →