forked from earendil-works/pi
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path05-tools.ts
More file actions
48 lines (43 loc) · 1.57 KB
/
Copy path05-tools.ts
File metadata and controls
48 lines (43 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* Tools Configuration
*
* Use tool names to choose which built-in tools are enabled.
*
* Tool names are matched against all available tools. If you use a custom `cwd`,
* createAgentSession() applies that cwd when it builds the actual built-in tools.
*
* For custom tools, see 06-extensions.ts - custom tools are registered via the
* extensions system using pi.registerTool().
*/
import { createAgentSession, SessionManager } from "@earendil-works/pi-coding-agent";
// Read-only mode (no edit/write)
const { session: readOnlySession } = await createAgentSession({
tools: ["read", "grep", "find", "ls"],
sessionManager: SessionManager.inMemory(),
});
console.log("Read-only session created");
readOnlySession.dispose();
// Custom tool selection
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";
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
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();