Add features & update project
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import { Brain, Github, Shield, User } from 'lucide-react';
|
||||
import { Brain, Github, ServerCog, Shield, User } from 'lucide-react';
|
||||
|
||||
import { cn } from '@spoon/ui';
|
||||
|
||||
@@ -11,6 +11,7 @@ const settingsItems = [
|
||||
{ href: '/settings/profile', label: 'Profile', icon: User },
|
||||
{ href: '/settings/integrations', label: 'Integrations', icon: Github },
|
||||
{ href: '/settings/ai-providers', label: 'AI providers', icon: Brain },
|
||||
{ href: '/settings/worker', label: 'Worker', icon: ServerCog },
|
||||
{ href: '/settings/security', label: 'Security', icon: Shield },
|
||||
];
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { WorkerHealthPanel } from '@/components/settings/worker-health-panel';
|
||||
|
||||
const WorkerSettingsPage = () => (
|
||||
<section className='max-w-5xl space-y-4'>
|
||||
<div>
|
||||
<h2 className='text-xl font-semibold'>Worker</h2>
|
||||
<p className='text-muted-foreground mt-1 text-sm'>
|
||||
Monitor the agent worker and clean up old workspace state.
|
||||
</p>
|
||||
</div>
|
||||
<WorkerHealthPanel />
|
||||
</section>
|
||||
);
|
||||
|
||||
export default WorkerSettingsPage;
|
||||
@@ -0,0 +1,11 @@
|
||||
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, 'agent/abort', { method: 'POST' }),
|
||||
);
|
||||
@@ -0,0 +1,11 @@
|
||||
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, 'agent/status', { method: 'GET' }),
|
||||
);
|
||||
@@ -0,0 +1,23 @@
|
||||
import {
|
||||
proxyWorker,
|
||||
requireOwnedJob,
|
||||
routeJobId,
|
||||
} from '@/lib/agent-worker-proxy';
|
||||
|
||||
export const POST = async (
|
||||
request: Request,
|
||||
context: { params: Promise<{ jobId: string; interactionId: string }> },
|
||||
) => {
|
||||
const params = await context.params;
|
||||
const jobId = await routeJobId({ params });
|
||||
const owned = await requireOwnedJob(jobId);
|
||||
if (!owned.ok) return owned.response;
|
||||
return await proxyWorker(
|
||||
jobId,
|
||||
`interactions/${encodeURIComponent(params.interactionId)}/reply`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: await request.text(),
|
||||
},
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import {
|
||||
proxyWorkerRoot,
|
||||
requireAuthenticatedUser,
|
||||
} from '@/lib/agent-worker-proxy';
|
||||
|
||||
export const POST = async () => {
|
||||
const authenticated = await requireAuthenticatedUser();
|
||||
if (!authenticated.ok) return authenticated.response;
|
||||
return await proxyWorkerRoot('/cleanup', { method: 'POST' });
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import {
|
||||
proxyWorkerRoot,
|
||||
requireAuthenticatedUser,
|
||||
} from '@/lib/agent-worker-proxy';
|
||||
|
||||
export const GET = async () => {
|
||||
const authenticated = await requireAuthenticatedUser();
|
||||
if (!authenticated.ok) return authenticated.response;
|
||||
return await proxyWorkerRoot('/health', { method: 'GET' });
|
||||
};
|
||||
Reference in New Issue
Block a user