Introduce two wrapper classes around the core Agent: - SyncAgent: exposes run() for synchronous request-response usage - AsyncAgent: exposes write()/read()/close() for non-blocking streaming via Channel Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
16 lines
412 B
TypeScript
16 lines
412 B
TypeScript
import { Agent } from "./runner.js";
|
|
import type { AgentOptions, AgentRunResult } from "./types.js";
|
|
|
|
export class SyncAgent {
|
|
private readonly agent: Agent;
|
|
readonly sessionId: string;
|
|
|
|
constructor(options?: AgentOptions) {
|
|
this.agent = new Agent(options);
|
|
this.sessionId = this.agent.sessionId;
|
|
}
|
|
|
|
async run(prompt: string): Promise<AgentRunResult> {
|
|
return this.agent.run(prompt);
|
|
}
|
|
}
|