From 00531c83c4925d405b342d1a58099a3ddc97a9ba Mon Sep 17 00:00:00 2001 From: DaKheera47 Date: Sun, 15 Feb 2026 18:28:01 +0000 Subject: [PATCH] initlal commit --- orchestrator/src/client/api/client.ts | 65 --- .../client/components/job-chat/Composer.tsx | 52 ++ .../components/job-chat/JobChatPanel.tsx | 361 ++++++++++++ .../components/job-chat/MessageList.tsx | 59 ++ .../components/job-chat/RunControls.tsx | 45 ++ .../components/job-chat/StreamingMessage.tsx | 16 + .../client/components/job-chat/ThreadList.tsx | 62 +++ orchestrator/src/client/pages/JobPage.tsx | 3 + .../src/client/pages/SettingsPage.tsx | 8 + .../components/ChatSettingsSection.tsx | 62 ++- .../src/client/pages/settings/types.ts | 1 + orchestrator/src/server/api/routes.ts | 4 +- .../src/server/api/routes/job-chat.test.ts | 154 ++++++ .../src/server/api/routes/job-chat.ts | 318 +++++++++++ orchestrator/src/server/db/migrate.ts | 19 - .../src/server/repositories/job-chat.ts | 329 +++++++++++ .../src/server/repositories/settings.ts | 1 + .../src/server/services/job-chat-context.ts | 198 +++++++ orchestrator/src/server/services/job-chat.ts | 521 ++++++++++++++++++ .../server/services/settings-conversion.ts | 9 + .../services/settings-update/registry.ts | 5 + orchestrator/src/server/services/settings.ts | 11 + shared/src/settings-schema.ts | 1 + shared/src/testing/factories.ts | 3 + shared/src/types.ts | 3 + 25 files changed, 2214 insertions(+), 96 deletions(-) create mode 100644 orchestrator/src/client/components/job-chat/Composer.tsx create mode 100644 orchestrator/src/client/components/job-chat/JobChatPanel.tsx create mode 100644 orchestrator/src/client/components/job-chat/MessageList.tsx create mode 100644 orchestrator/src/client/components/job-chat/RunControls.tsx create mode 100644 orchestrator/src/client/components/job-chat/StreamingMessage.tsx create mode 100644 orchestrator/src/client/components/job-chat/ThreadList.tsx create mode 100644 orchestrator/src/server/api/routes/job-chat.test.ts create mode 100644 orchestrator/src/server/api/routes/job-chat.ts create mode 100644 orchestrator/src/server/repositories/job-chat.ts create mode 100644 orchestrator/src/server/services/job-chat-context.ts create mode 100644 orchestrator/src/server/services/job-chat.ts diff --git a/orchestrator/src/client/api/client.ts b/orchestrator/src/client/api/client.ts index 049042e..7597775 100644 --- a/orchestrator/src/client/api/client.ts +++ b/orchestrator/src/client/api/client.ts @@ -472,23 +472,6 @@ export async function listJobChatThreads(jobId: string): Promise<{ return fetchApi<{ threads: JobChatThread[] }>(`/jobs/${jobId}/chat/threads`); } -export async function listJobGhostwriterMessages( - jobId: string, - options?: { limit?: number; offset?: number }, -): Promise<{ messages: JobChatMessage[] }> { - const params = new URLSearchParams(); - if (typeof options?.limit === "number") { - params.set("limit", String(options.limit)); - } - if (typeof options?.offset === "number") { - params.set("offset", String(options.offset)); - } - const query = params.toString(); - return fetchApi<{ messages: JobChatMessage[] }>( - `/jobs/${jobId}/chat/messages${query ? `?${query}` : ""}`, - ); -} - export async function createJobChatThread( jobId: string, input?: { title?: string | null }, @@ -556,23 +539,6 @@ export async function streamJobChatMessage( ); } -export async function streamJobGhostwriterMessage( - jobId: string, - input: { content: string; signal?: AbortSignal }, - handlers: { - onEvent: (event: JobChatStreamEvent) => void; - }, -): Promise { - return streamSseEvents( - `/jobs/${jobId}/chat/messages`, - { content: input.content, stream: true }, - { - onEvent: handlers.onEvent, - signal: input.signal, - }, - ); -} - export async function cancelJobChatRun( jobId: string, threadId: string, @@ -587,19 +553,6 @@ export async function cancelJobChatRun( ); } -export async function cancelJobGhostwriterRun( - jobId: string, - runId: string, -): Promise<{ cancelled: boolean; alreadyFinished: boolean }> { - return fetchApi<{ cancelled: boolean; alreadyFinished: boolean }>( - `/jobs/${jobId}/chat/runs/${runId}/cancel`, - { - method: "POST", - body: JSON.stringify({}), - }, - ); -} - export async function regenerateJobChatMessage( jobId: string, threadId: string, @@ -633,24 +586,6 @@ export async function streamRegenerateJobChatMessage( ); } -export async function streamRegenerateJobGhostwriterMessage( - jobId: string, - assistantMessageId: string, - input: { signal?: AbortSignal }, - handlers: { - onEvent: (event: JobChatStreamEvent) => void; - }, -): Promise { - return streamSseEvents( - `/jobs/${jobId}/chat/messages/${assistantMessageId}/regenerate`, - { stream: true }, - { - onEvent: handlers.onEvent, - signal: input.signal, - }, - ); -} - export async function processJob( id: string, options?: { force?: boolean }, diff --git a/orchestrator/src/client/components/job-chat/Composer.tsx b/orchestrator/src/client/components/job-chat/Composer.tsx new file mode 100644 index 0000000..167744d --- /dev/null +++ b/orchestrator/src/client/components/job-chat/Composer.tsx @@ -0,0 +1,52 @@ +import { Send } from "lucide-react"; +import type React from "react"; +import { useState } from "react"; +import { Button } from "@/components/ui/button"; +import { Textarea } from "@/components/ui/textarea"; + +type ComposerProps = { + disabled?: boolean; + onSend: (content: string) => Promise; +}; + +export const Composer: React.FC = ({ disabled, onSend }) => { + const [value, setValue] = useState(""); + + const submit = async () => { + const content = value.trim(); + if (!content || disabled) return; + setValue(""); + await onSend(content); + }; + + return ( +
+