diff --git a/frontend/src/routes/reports/llm/[taskId]/report_page.contract.test.js b/frontend/src/routes/reports/llm/[taskId]/report_page.contract.test.ts similarity index 100% rename from frontend/src/routes/reports/llm/[taskId]/report_page.contract.test.js rename to frontend/src/routes/reports/llm/[taskId]/report_page.contract.test.ts diff --git a/frontend/src/services/taskService.js b/frontend/src/services/taskService.js deleted file mode 100644 index f154f562..00000000 --- a/frontend/src/services/taskService.js +++ /dev/null @@ -1,126 +0,0 @@ -// #region TaskService [C:3] [TYPE Service] [SEMANTICS task, service, api, crud, status] -// @BRIEF Service for Task Management API interactions: listing, fetching details, resuming, resolving, and clearing tasks. -// @LAYER Service -// @RELATION DEPENDS_ON -> [ApiModule] - -/** - * Service for interacting with the Task Management API. - */ - -import { requestApi } from '../lib/api'; - -const API_BASE = '/tasks'; - -// #region getTasks:Function [TYPE Function] -/* @PURPOSE: Fetch a list of tasks with pagination and optional status filter. - @PRE: limit and offset are numbers. - @POST: Returns a promise resolving to a list of tasks. -*/ -/** - * Fetch a list of tasks with pagination and optional status filter. - * @param {number} limit - Maximum number of tasks to return. - * @param {number} offset - Number of tasks to skip. - * @param {string|null} status - Filter by task status (optional). - * @returns {Promise} List of tasks. - */ -export async function getTasks(limit = 10, offset = 0, status = null) { - const params = new URLSearchParams({ - limit: limit.toString(), - offset: offset.toString() - }); - if (status) { - params.append('status', status); - } - - return requestApi(`${API_BASE}?${params.toString()}`); -} -// #endregion getTasks:Function - -// #region getTask:Function [TYPE Function] -/* @PURPOSE: Fetch details for a specific task. - @PRE: taskId must be provided. - @POST: Returns a promise resolving to task details. -*/ -/** - * Fetch details for a specific task. - * @param {string} taskId - The ID of the task. - * @returns {Promise} Task details. - */ -export async function getTask(taskId) { - return requestApi(`${API_BASE}/${taskId}`); -} -// #endregion getTask:Function - -// #region getTaskLogs:Function [TYPE Function] -/* @PURPOSE: Fetch logs for a specific task. - @PRE: taskId must be provided. - @POST: Returns a promise resolving to a list of log entries. -*/ -/** - * Fetch logs for a specific task. - * @param {string} taskId - The ID of the task. - * @returns {Promise} List of log entries. - */ -export async function getTaskLogs(taskId) { - // Currently, logs are included in the task object, but we might have a separate endpoint later. - // For now, we fetch the task and return its logs. - // Or if we implement T017 (GET /api/tasks/{task_id}/logs), we would use that. - // The current backend implementation in tasks.py does NOT have a separate /logs endpoint yet. - // T017 is in Phase 3. - // So for now, we'll fetch the task. - const task = await getTask(taskId); - return task.logs || []; -} -// #endregion getTaskLogs:Function - -// #region resumeTask:Function [TYPE Function] -/* @PURPOSE: Resume a task that is awaiting input (e.g., passwords). - @PRE: taskId and passwords must be provided. - @POST: Returns a promise resolving to the updated task object. -*/ -/** - * Resume a task that is awaiting input (e.g., passwords). - * @param {string} taskId - The ID of the task. - * @param {Object} passwords - Map of database names to passwords. - * @returns {Promise} Updated task object. - */ -export async function resumeTask(taskId, passwords) { - return requestApi(`${API_BASE}/${taskId}/resume`, 'POST', { passwords }); -} -// #endregion resumeTask:Function - -// #region resolveTask:Function [TYPE Function] -/* @PURPOSE: Resolve a task that is awaiting mapping. - @PRE: taskId and resolutionParams must be provided. - @POST: Returns a promise resolving to the updated task object. -*/ -/** - * Resolve a task that is awaiting mapping. - * @param {string} taskId - The ID of the task. - * @param {Object} resolutionParams - Resolution parameters. - * @returns {Promise} Updated task object. - */ -export async function resolveTask(taskId, resolutionParams) { - return requestApi(`${API_BASE}/${taskId}/resolve`, 'POST', { resolution_params: resolutionParams }); -} -// #endregion resolveTask:Function - -// #region clearTasks:Function [TYPE Function] -/* @PURPOSE: Clear tasks based on status. - @PRE: status is a string or null. - @POST: Returns a promise that resolves when tasks are cleared. -*/ -/** - * Clear tasks based on status. - * @param {string|null} status - Filter by task status (optional). - */ -export async function clearTasks(status = null) { - const params = new URLSearchParams(); - if (status) { - params.append('status', status); - } - - return requestApi(`${API_BASE}?${params.toString()}`, 'DELETE'); -} -// #endregion clearTasks:Function -// #endregion TaskService \ No newline at end of file diff --git a/frontend/src/services/toolsService.js b/frontend/src/services/toolsService.js deleted file mode 100644 index c16620a7..00000000 --- a/frontend/src/services/toolsService.js +++ /dev/null @@ -1,42 +0,0 @@ -// #region ToolsService [C:2] [TYPE Service] [SEMANTICS tool, service, task, api, runner] -// @BRIEF Service for generic Task API communication used by Tools — run tasks and poll status. - -/** - * Service for generic Task API communication used by Tools. - */ - -import { requestApi } from '../lib/api'; - -const API_BASE = '/tasks'; - -// #region runTask:Function [TYPE Function] -/* @PURPOSE: Start a new task for a given plugin. - @PRE: pluginId and params must be provided. - @POST: Returns a promise resolving to the task instance. -*/ -/** - * Start a new task for a given plugin. - * @param {string} pluginId - The ID of the plugin to run. - * @param {Object} params - Parameters for the plugin. - * @returns {Promise} The created task instance. - */ -export async function runTask(pluginId, params) { - return requestApi(API_BASE, 'POST', { plugin_id: pluginId, params }); -} -// #endregion runTask:Function - -// #region getTaskStatus:Function [TYPE Function] -/* @PURPOSE: Fetch details for a specific task (to poll status or get result). - @PRE: taskId must be provided. - @POST: Returns a promise resolving to task details. -*/ -/** - * Fetch details for a specific task (to poll status or get result). - * @param {string} taskId - The ID of the task. - * @returns {Promise} Task details. - */ -export async function getTaskStatus(taskId) { - return requestApi(`${API_BASE}/${taskId}`); -} -// #endregion getTaskStatus:Function -// #endregion ToolsService \ No newline at end of file