Move to threads based system.

This commit is contained in:
Gabriel Brown
2026-06-22 10:37:26 -04:00
parent 8ae6c4b533
commit 206b64176b
82 changed files with 6169 additions and 1930 deletions
@@ -0,0 +1,14 @@
import { proxyWorker, withOwnedJob } from '@/lib/agent-worker-proxy';
export const POST = async (
request: Request,
context: { params: Promise<{ jobId: string }> },
) =>
await withOwnedJob(
context,
async (jobId) =>
await proxyWorker(jobId, 'run-command', {
method: 'POST',
body: await request.text(),
}),
);
@@ -0,0 +1,10 @@
import { proxyWorker, withOwnedJob } from '@/lib/agent-worker-proxy';
export const GET = async (
_request: Request,
context: { params: Promise<{ jobId: string }> },
) =>
await withOwnedJob(
context,
async (jobId) => await proxyWorker(jobId, 'diff', { method: 'GET' }),
);
@@ -0,0 +1,28 @@
import { proxyWorker, withOwnedJob } from '@/lib/agent-worker-proxy';
export const GET = async (
request: Request,
context: { params: Promise<{ jobId: string }> },
) =>
await withOwnedJob(context, async (jobId) => {
const url = new URL(request.url);
return await proxyWorker(
jobId,
'file',
{ method: 'GET' },
new URLSearchParams({ path: url.searchParams.get('path') ?? '' }),
);
});
export const PUT = async (
request: Request,
context: { params: Promise<{ jobId: string }> },
) =>
await withOwnedJob(
context,
async (jobId) =>
await proxyWorker(jobId, 'file', {
method: 'PUT',
body: await request.text(),
}),
);
@@ -0,0 +1,14 @@
import { proxyWorker, withOwnedJob } from '@/lib/agent-worker-proxy';
export const POST = async (
request: Request,
context: { params: Promise<{ jobId: string }> },
) =>
await withOwnedJob(
context,
async (jobId) =>
await proxyWorker(jobId, 'message', {
method: 'POST',
body: await request.text(),
}),
);
@@ -0,0 +1,10 @@
import { proxyWorker, withOwnedJob } from '@/lib/agent-worker-proxy';
export const POST = async (
_request: Request,
context: { params: Promise<{ jobId: string }> },
) =>
await withOwnedJob(
context,
async (jobId) => await proxyWorker(jobId, 'open-pr', { method: 'POST' }),
);
@@ -0,0 +1,10 @@
import { proxyWorker, withOwnedJob } from '@/lib/agent-worker-proxy';
export const POST = async (
_request: Request,
context: { params: Promise<{ jobId: string }> },
) =>
await withOwnedJob(
context,
async (jobId) => await proxyWorker(jobId, 'stop', { method: 'POST' }),
);
@@ -0,0 +1,10 @@
import { proxyWorker, withOwnedJob } from '@/lib/agent-worker-proxy';
export const GET = async (
_request: Request,
context: { params: Promise<{ jobId: string }> },
) =>
await withOwnedJob(
context,
async (jobId) => await proxyWorker(jobId, 'tree', { method: 'GET' }),
);