fix(coding-agent): dispose SDK example sessions
This commit is contained in:
@@ -13,32 +13,36 @@
|
||||
import { createAgentSession, SessionManager } from "@earendil-works/pi-coding-agent";
|
||||
|
||||
// Read-only mode (no edit/write)
|
||||
await createAgentSession({
|
||||
const { session: readOnlySession } = await createAgentSession({
|
||||
tools: ["read", "grep", "find", "ls"],
|
||||
sessionManager: SessionManager.inMemory(),
|
||||
});
|
||||
console.log("Read-only session created");
|
||||
readOnlySession.dispose();
|
||||
|
||||
// Custom tool selection
|
||||
await createAgentSession({
|
||||
const { session: customToolsSession } = await createAgentSession({
|
||||
tools: ["read", "bash", "grep"],
|
||||
sessionManager: SessionManager.inMemory(),
|
||||
});
|
||||
console.log("Custom tools session created");
|
||||
customToolsSession.dispose();
|
||||
|
||||
// With custom cwd
|
||||
const customCwd = "/path/to/project";
|
||||
await createAgentSession({
|
||||
const { session: customCwdSession } = await createAgentSession({
|
||||
cwd: customCwd,
|
||||
tools: ["read", "bash", "edit", "write"],
|
||||
sessionManager: SessionManager.inMemory(customCwd),
|
||||
});
|
||||
console.log("Custom cwd session created");
|
||||
customCwdSession.dispose();
|
||||
|
||||
// Or pick specific tools for custom cwd
|
||||
await createAgentSession({
|
||||
const { session: specificToolsSession } = await createAgentSession({
|
||||
cwd: customCwd,
|
||||
tools: ["read", "bash", "grep"],
|
||||
sessionManager: SessionManager.inMemory(customCwd),
|
||||
});
|
||||
console.log("Specific tools with custom cwd session created");
|
||||
specificToolsSession.dispose();
|
||||
|
||||
Reference in New Issue
Block a user