From 05931d19bc0c161d0177c3f983d0cd903d5e8ae3 Mon Sep 17 00:00:00 2001 From: soryu Date: Fri, 16 Jan 2026 01:39:16 +0000 Subject: Fixup: add task contract type to frontend --- makima/frontend/src/lib/api.ts | 50 ++++++++++++++++++++++++++++++-- makima/frontend/src/routes/contracts.tsx | 22 ++++++++++++-- 2 files changed, 68 insertions(+), 4 deletions(-) (limited to 'makima/frontend/src') diff --git a/makima/frontend/src/lib/api.ts b/makima/frontend/src/lib/api.ts index 100a85a..1e62732 100644 --- a/makima/frontend/src/lib/api.ts +++ b/makima/frontend/src/lib/api.ts @@ -1415,7 +1415,7 @@ export async function deleteAccount( // ============================================================================= /** Contract type determines the workflow and required documents */ -export type ContractType = "simple" | "specification"; +export type ContractType = "simple" | "specification" | "task"; export type ContractPhase = "research" | "specify" | "plan" | "execute" | "review"; export type ContractStatus = "active" | "completed" | "archived"; export type RepositorySourceType = "remote" | "local" | "managed"; @@ -1426,12 +1426,17 @@ export function getValidPhases(contractType: ContractType): ContractPhase[] { if (contractType === "simple") { return ["plan", "execute"]; } + if (contractType === "task") { + return ["execute"]; + } return ["research", "specify", "plan", "execute", "review"]; } /** Get default initial phase for a contract type */ export function getDefaultPhase(contractType: ContractType): ContractPhase { - return contractType === "simple" ? "plan" : "research"; + if (contractType === "simple") return "plan"; + if (contractType === "task") return "execute"; + return "research"; } export interface ContractRepository { @@ -2047,3 +2052,44 @@ export async function deleteRepositoryHistory(id: string): Promise { throw new Error(`Failed to delete repository history: ${res.statusText}`); } } + +// ============================================================================= +// Adhoc Task Types (for one-off tasks without supervisor overhead) +// ============================================================================= + +/** Request payload for creating an adhoc (one-off) task */ +export interface AdhocTaskRequest { + /** Name/description of the task */ + name: string; + /** The plan/instructions for the task */ + plan: string; + /** Repository URL (optional) */ + repositoryUrl?: string; + /** Base branch to work from */ + baseBranch?: string; +} + +/** Response for adhoc task creation */ +export interface AdhocTaskResponse { + contract: ContractSummary; + task: Task; +} + +/** + * Create an adhoc (one-off) task without supervisor overhead. + * This creates a minimal "task" type contract with a single task. + * The contract auto-archives when the task completes. + */ +export async function createAdhocTask( + data: AdhocTaskRequest +): Promise { + const res = await authFetch(`${API_BASE}/api/v1/tasks/adhoc`, { + method: "POST", + body: JSON.stringify(data), + }); + if (!res.ok) { + const errorText = await res.text(); + throw new Error(`Failed to create adhoc task: ${errorText || res.statusText}`); + } + return res.json(); +} diff --git a/makima/frontend/src/routes/contracts.tsx b/makima/frontend/src/routes/contracts.tsx index 5e9bf60..8ed4ab5 100644 --- a/makima/frontend/src/routes/contracts.tsx +++ b/makima/frontend/src/routes/contracts.tsx @@ -471,6 +471,20 @@ function ContractsPageContent() { Contract Type
+

- {contractType === "simple" + {contractType === "task" + ? "Execute: One-off adhoc task with no supervisor (auto-archives on completion)" + : contractType === "simple" ? "Plan → Execute: Simple workflow with a plan document" : "Research → Specify → Plan → Execute → Review: Full specification-driven development with TDD"}

@@ -524,7 +540,9 @@ function ContractsPageContent() { ))}

- {contractType === "simple" + {contractType === "task" + ? "Task contracts always start in Execute phase" + : contractType === "simple" ? "Start in Plan to define what to build, or Execute if already planned" : "Skip earlier phases if you already have requirements defined"}

-- cgit v1.2.3