refactor: adapt resource loader and tool wiring to pi-coding-agent 0.70

Three API shifts converge here:

- DefaultResourceLoaderOptions.agentDir is required as of 0.68 (the
  old process.cwd() fallback was removed). Pass getFusionAgentDir()
  explicitly in createFnAgent.

- createAgentSession({ tools }) is now a string[] allowlist of tool
  names, not a Tool[] array (0.68). Our boundary-wrapping via
  wrapToolsWithBoundary produces Tool instances, so we can no longer
  pass them through \`tools\`. Move them into \`customTools\` and
  suppress the built-in defaults with \`noTools: "builtin"\`. The
  wrapped tools keep the same names (read, bash, ...) as the built-ins
  they replace, so no call-site or prompt changes are needed.

- SettingsManager.create's first arg (cwd) became required (was
  optional before). Dashboard routes that previously passed
  \`undefined\` for a process-global settings view now pass
  process.cwd() to match the existing DefaultPackageManager call below.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-23 17:13:58 -07:00
parent 4ce0bf57ac
commit 6296c3cb53
2 changed files with 15 additions and 5 deletions

View File

@@ -3455,7 +3455,7 @@ export function createApiRoutes(store: TaskStore, options?: ServerOptions): Rout
try {
const { SettingsManager, getAgentDir } = await import("@mariozechner/pi-coding-agent");
const agentDir = getAgentDir();
const settingsManager = SettingsManager.create(undefined, agentDir);
const settingsManager = SettingsManager.create(process.cwd(), agentDir);
const packages = settingsManager.getPackages();
const extensions = settingsManager.getExtensionPaths();
const skills = settingsManager.getSkillPaths();
@@ -3493,7 +3493,7 @@ export function createApiRoutes(store: TaskStore, options?: ServerOptions): Rout
const { SettingsManager, getAgentDir } = await import("@mariozechner/pi-coding-agent");
const agentDir = getAgentDir();
const settingsManager = SettingsManager.create(undefined, agentDir);
const settingsManager = SettingsManager.create(process.cwd(), agentDir);
if (packages !== undefined) {
if (!Array.isArray(packages)) {
@@ -3551,7 +3551,7 @@ export function createApiRoutes(store: TaskStore, options?: ServerOptions): Rout
const { SettingsManager, DefaultPackageManager, getAgentDir } = await import("@mariozechner/pi-coding-agent");
const agentDir = getAgentDir();
const cwd = process.cwd();
const settingsManager = SettingsManager.create(undefined, agentDir);
const settingsManager = SettingsManager.create(process.cwd(), agentDir);
const packageManager = new DefaultPackageManager({ cwd, agentDir, settingsManager });
await packageManager.install(source.trim());