singularity-forge/packages/rpc-client/examples/basic-usage.ts
2026-04-15 13:38:15 +02:00

13 lines
441 B
TypeScript

import { RpcClient } from '@singularity-forge/rpc-client';
const client = new RpcClient({ cwd: process.cwd() });
await client.start();
const { sessionId } = await client.init({ clientId: 'my-app' });
console.log(`Session: ${sessionId}`);
await client.prompt('Create a hello world script');
for await (const event of client.events()) {
if (event.type === 'execution_complete') break;
console.log(event.type);
}
await client.shutdown();