This commit is contained in:
-Puter
2026-08-01 22:45:22 +05:30
parent db9afd7a24
commit 6364c33499
10 changed files with 105 additions and 98 deletions

View File

@@ -27,7 +27,7 @@
"devDependencies": {
"@code/config": "workspace:*",
"@flue/cli": "npm:@rivet-dev/labs-flue-cli@1.0.0-beta.9-rivet.2",
"@rivetkit/engine-cli": "2.3.9",
"@rivetkit/engine-cli": "2.3.10",
"@types/bun": "catalog:",
"@types/node": "catalog:",
"typescript": "catalog:"

View File

@@ -5,7 +5,6 @@ import { Hono } from "hono";
import { internalRoute } from "./auth/internal-route";
import { parseAgentEnv } from "./runtime/agent-env";
import { runtimeRegistry } from "./runtime/agent-os-registry";
import {
cancelAgentOsAttempt,
executeAgentOsAttempt,
@@ -82,8 +81,6 @@ app.post(
}
);
app.all("/api/rivet/*", (context) => runtimeRegistry.handler(context.req.raw));
app.route("/", flue());
export default app satisfies Fetchable;

View File

@@ -51,7 +51,11 @@ export const executeAgentOsAttempt = async (
workspaceKey: input.workspaceKey,
}),
];
const repository = new RepositoryWorkspace();
const repository = new RepositoryWorkspace(
env.AGENT_WORKSPACE_ROOT,
true,
env.BUN_EXECUTABLE
);
const prepared = await repository.prepare({
attemptId: input.attemptId,
baseBranch: input.baseBranch,

View File

@@ -1,4 +1,4 @@
import { execFileSync, spawn } from "node:child_process";
import { spawn } from "node:child_process";
import { createHash } from "node:crypto";
import { once } from "node:events";
import {
@@ -131,13 +131,16 @@ const pathExists = async (target: string): Promise<boolean> => {
export class RepositoryWorkspace {
readonly #root: string;
readonly #installDependencies: boolean;
readonly #bunExecutable: string;
constructor(
root = process.env.AGENT_WORKSPACE_ROOT ?? "/var/lib/zopu/workspaces",
installDependencies = true
root = "/srv/zopu/workspaces",
installDependencies = true,
bunExecutable = "bun"
) {
this.#root = root;
this.#installDependencies = installDependencies;
this.#bunExecutable = bunExecutable;
}
async prepare(input: PrepareRepositoryInput): Promise<PreparedRepository> {
@@ -201,9 +204,7 @@ export class RepositoryWorkspace {
"Base branch checkout"
);
}
const bunExecutable =
process.env.BUN_EXECUTABLE ??
execFileSync("which", ["bun"], { encoding: "utf-8" }).trim();
const bunExecutable = this.#bunExecutable;
if (this.#installDependencies) {
requireSuccess(

View File

@@ -8,6 +8,8 @@ const agentEnvSchema = z.object({
AGENT_MODEL_MAX_TOKENS: z.coerce.number().int().positive(),
AGENT_MODEL_NAME: z.string().min(1),
AGENT_MODEL_PROVIDER: z.string().min(1),
AGENT_WORKSPACE_ROOT: z.string().min(1).default("/srv/zopu/workspaces"),
BUN_EXECUTABLE: z.string().min(1).default("bun"),
CONVEX_URL: z.url(),
DAEMON_ID: z.string().min(1),
FLUE_DB_TOKEN: z.string().min(1),