1ca019fa48
Phase 1 MVP implementation: - PostgreSQL database schema for tasks, agents, executions, time tracking - Backend API: task CRUD, agent management, automatic time tracking - Frontend: Kanban board with drag-and-drop (Parking Lot → In Progress → Done) - Task modal for creating/editing tasks with tags, priority, assignee - 3 core agents seeded: PM, CTO, COO - Agent approval workflow: CxO level requires approval, others auto-execute - Automatic time tracking: starts on in_progress, stops on done - RBAC integration: OPC page accessible to admin/member roles Features: - Drag-and-drop tasks between columns - Assign tasks to humans or AI agents - Priority badges (low, medium, high, urgent) - Tags and due dates - Task history tracking - Time entry tracking with automatic timer - Agent execution records with approval workflow Next steps: - Initialize OPC database on NAS - Implement agent executor service - Add WebSocket for real-time updates - Add email notifications - Add PDF invoice generation
81 lines
2.4 KiB
JavaScript
81 lines
2.4 KiB
JavaScript
/**
|
|
* OPC API Client
|
|
*/
|
|
import { get, post, put, del } from "./api.js";
|
|
|
|
// Tasks
|
|
export async function getTasks(filters = {}) {
|
|
const params = new URLSearchParams();
|
|
if (filters.status) params.append("status", filters.status);
|
|
if (filters.assigned_to) params.append("assigned_to", filters.assigned_to);
|
|
if (filters.project_id) params.append("project_id", filters.project_id);
|
|
if (filters.priority) params.append("priority", filters.priority);
|
|
if (filters.tags) params.append("tags", filters.tags.join(","));
|
|
if (filters.limit) params.append("limit", filters.limit);
|
|
if (filters.offset) params.append("offset", filters.offset);
|
|
|
|
const query = params.toString();
|
|
return get(`/opc/tasks${query ? "?" + query : ""}`);
|
|
}
|
|
|
|
export async function createTask(task) {
|
|
return post("/opc/tasks", task);
|
|
}
|
|
|
|
export async function updateTask(taskId, updates) {
|
|
return put(`/opc/tasks/${taskId}`, updates);
|
|
}
|
|
|
|
export async function deleteTask(taskId) {
|
|
return del(`/opc/tasks/${taskId}`);
|
|
}
|
|
|
|
export async function moveTask(taskId, status) {
|
|
return put(`/opc/tasks/${taskId}/move`, { status });
|
|
}
|
|
|
|
export async function assignTask(taskId, assigned_to, assigned_type = "human") {
|
|
return post(`/opc/tasks/${taskId}/assign`, { assigned_to, assigned_type });
|
|
}
|
|
|
|
export async function getTaskHistory(taskId) {
|
|
return get(`/opc/tasks/${taskId}/history`);
|
|
}
|
|
|
|
export async function getTaskTime(taskId) {
|
|
return get(`/opc/tasks/${taskId}/time`);
|
|
}
|
|
|
|
// Agents
|
|
export async function getAgents(enabledOnly = true) {
|
|
return get(`/opc/agents?enabled_only=${enabledOnly}`);
|
|
}
|
|
|
|
export async function getAgent(agentId) {
|
|
return get(`/opc/agents/${agentId}`);
|
|
}
|
|
|
|
export async function triggerAgent(agentId, taskId) {
|
|
return post(`/opc/agents/${agentId}/execute?task_id=${taskId}`);
|
|
}
|
|
|
|
// Executions
|
|
export async function getExecutions(filters = {}) {
|
|
const params = new URLSearchParams();
|
|
if (filters.task_id) params.append("task_id", filters.task_id);
|
|
if (filters.agent_id) params.append("agent_id", filters.agent_id);
|
|
if (filters.status) params.append("status", filters.status);
|
|
if (filters.limit) params.append("limit", filters.limit);
|
|
|
|
const query = params.toString();
|
|
return get(`/opc/executions${query ? "?" + query : ""}`);
|
|
}
|
|
|
|
export async function getExecution(executionId) {
|
|
return get(`/opc/executions/${executionId}`);
|
|
}
|
|
|
|
export async function approveExecution(executionId, approved) {
|
|
return post(`/opc/executions/${executionId}/approve`, { approved });
|
|
}
|