feat(agents): add local paseo cli access

This commit is contained in:
Miniputer
2026-07-21 15:42:21 +05:30
parent 5347db578d
commit 59777e60b8
4 changed files with 40 additions and 1 deletions

View File

@@ -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"
}
}

View File

@@ -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],
};
});

View File

@@ -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 };
},
});

View File

@@ -1,5 +1,6 @@
{
"extends": "@code/config/tsconfig.base.json",
"compilerOptions": { "types": ["bun"] },
"include": ["src/**/*.ts"],
"exclude": ["dist"]
}