mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 17:00:59 +00:00
- Add setEditorText() and getEditorText() to HookUIContext for prompt generator pattern - custom() now accepts async factories for fire-and-forget work - Add CancellableLoader component to tui package - Add BorderedLoader component for hooks with cancel UI - Export HookAPI, HookContext, HookFactory from main package - Update all examples to import from packages instead of relative paths - Update hooks.md and custom-tools.md documentation fixes #350
22 lines
632 B
TypeScript
22 lines
632 B
TypeScript
/**
|
|
* Minimal SDK Usage
|
|
*
|
|
* Uses all defaults: discovers skills, hooks, tools, context files
|
|
* from cwd and ~/.pi/agent. Model chosen from settings or first available.
|
|
*/
|
|
|
|
import { createAgentSession } from "@mariozechner/pi-coding-agent";
|
|
|
|
const { session } = await createAgentSession();
|
|
|
|
session.subscribe((event) => {
|
|
if (event.type === "message_update" && event.assistantMessageEvent.type === "text_delta") {
|
|
process.stdout.write(event.assistantMessageEvent.delta);
|
|
}
|
|
});
|
|
|
|
await session.prompt("What files are in the current directory?");
|
|
session.state.messages.forEach((msg) => {
|
|
console.log(msg);
|
|
});
|
|
console.log();
|