sandbox-agent/foundry/packages/backend/src/actors/repo/index.ts
2026-03-10 22:01:39 -07:00

28 lines
771 B
TypeScript

import { actor, queue } from "rivetkit";
import { workflow } from "rivetkit/workflow";
import { repoDb } from "./db/db.js";
import { REPO_QUEUE_NAMES, repoActions, runRepoWorkflow } from "./actions.js";
export interface RepoInput {
workspaceId: string;
repoId: string;
remoteUrl: string;
}
export const repo = actor({
db: repoDb,
queues: Object.fromEntries(REPO_QUEUE_NAMES.map((name) => [name, queue()])),
options: {
actionTimeout: 5 * 60_000,
},
createState: (_c, input: RepoInput) => ({
workspaceId: input.workspaceId,
repoId: input.repoId,
remoteUrl: input.remoteUrl,
localPath: null as string | null,
syncActorsStarted: false,
taskIndexHydrated: false
}),
actions: repoActions,
run: workflow(runRepoWorkflow),
});