Add SDK for programmatic AgentSession usage

- Add src/core/sdk.ts with createAgentSession() factory and discovery functions
- Update loaders to accept cwd/agentDir parameters (skills, hooks, custom-tools, slash-commands, system-prompt)
- Export SDK from package index

Addresses #272
This commit is contained in:
Mario Zechner 2025-12-22 00:47:16 +01:00
parent 11e743373d
commit 5482bf3e14
8 changed files with 737 additions and 40 deletions

View file

@ -1,3 +1,5 @@
import type { AgentTool } from "@mariozechner/pi-ai";
export { type BashToolDetails, bashTool } from "./bash.js";
export { editTool } from "./edit.js";
export { type FindToolDetails, findTool } from "./find.js";
@ -15,8 +17,14 @@ import { lsTool } from "./ls.js";
import { readTool } from "./read.js";
import { writeTool } from "./write.js";
/** Tool type (AgentTool from pi-ai) */
export type Tool = AgentTool<any>;
// Default tools for full access mode
export const codingTools = [readTool, bashTool, editTool, writeTool];
export const codingTools: Tool[] = [readTool, bashTool, editTool, writeTool];
// Read-only tools for exploration without modification
export const readOnlyTools: Tool[] = [readTool, grepTool, findTool, lsTool];
// All available tools (including read-only exploration tools)
export const allTools = {