From 59777e60b846259a76408157a614295b354f1725 Mon Sep 17 00:00:00 2001 From: Miniputer Date: Tue, 21 Jul 2026 15:42:21 +0530 Subject: [PATCH] feat(agents): add local paseo cli access --- packages/agents/package.json | 4 +++- packages/agents/src/agents/zopu.ts | 5 +++++ packages/agents/src/tools/paseo.ts | 31 ++++++++++++++++++++++++++++++ packages/agents/tsconfig.json | 1 + 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 packages/agents/src/tools/paseo.ts diff --git a/packages/agents/package.json b/packages/agents/package.json index 145eb7e..0e99f78 100644 --- a/packages/agents/package.json +++ b/packages/agents/package.json @@ -15,11 +15,13 @@ "@code/env": "workspace:*", "@flue/runtime": "latest", "convex": "catalog:", - "hono": "^4.12.30" + "hono": "^4.12.30", + "valibot": "^1.4.2" }, "devDependencies": { "@code/config": "workspace:*", "@flue/cli": "latest", + "@types/bun": "latest", "typescript": "^6" } } diff --git a/packages/agents/src/agents/zopu.ts b/packages/agents/src/agents/zopu.ts index 1dade89..0593eb6 100644 --- a/packages/agents/src/agents/zopu.ts +++ b/packages/agents/src/agents/zopu.ts @@ -1,6 +1,9 @@ import { parseAgentEnv } from "@code/env/agent"; import { defineAgent } from "@flue/runtime"; import type { AgentRouteHandler } from "@flue/runtime"; +import { local } from "@flue/runtime/node"; + +import { paseoCli } from "../tools/paseo"; export const route: AgentRouteHandler = (_context, next) => next(); @@ -12,5 +15,7 @@ export default defineAgent(({ env }) => { instructions: "You are Zopu, a concise and helpful assistant. Answer the user's request directly. Ask a clarifying question only when the request cannot be completed without one.", model: `${AGENT_MODEL_PROVIDER}/${AGENT_MODEL_NAME}`, + sandbox: local({ cwd: "/workspace/code" }), + tools: [paseoCli], }; }); diff --git a/packages/agents/src/tools/paseo.ts b/packages/agents/src/tools/paseo.ts new file mode 100644 index 0000000..871fdc9 --- /dev/null +++ b/packages/agents/src/tools/paseo.ts @@ -0,0 +1,31 @@ +import { defineTool } from "@flue/runtime"; +import * as v from "valibot"; + +export const paseoCli = defineTool({ + description: + "Run the locally installed Paseo CLI. Pass every argument exactly as it should appear after the paseo executable.", + input: v.object({ + args: v.array(v.string()), + }), + name: "paseo_cli", + output: v.object({ + exitCode: v.number(), + stderr: v.string(), + stdout: v.string(), + }), + async run({ input, signal }) { + const process = Bun.spawn(["paseo", ...input.args], { + cwd: "/workspace/code", + signal, + stderr: "pipe", + stdout: "pipe", + }); + const [exitCode, stderr, stdout] = await Promise.all([ + process.exited, + new Response(process.stderr).text(), + new Response(process.stdout).text(), + ]); + + return { exitCode, stderr, stdout }; + }, +}); diff --git a/packages/agents/tsconfig.json b/packages/agents/tsconfig.json index a571807..09e6502 100644 --- a/packages/agents/tsconfig.json +++ b/packages/agents/tsconfig.json @@ -1,5 +1,6 @@ { "extends": "@code/config/tsconfig.base.json", + "compilerOptions": { "types": ["bun"] }, "include": ["src/**/*.ts"], "exclude": ["dist"] }