summaryrefslogtreecommitdiff
path: root/makima/frontend/src/lib/api.ts
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-02-14 21:29:26 +0000
committerGitHub <noreply@github.com>2026-02-14 21:29:26 +0000
commit9aadbc7958d39d181c0dd0600e2b7c30bb6c391a (patch)
treeef8bed9718c39041191b58a284ee31f5d8d32521 /makima/frontend/src/lib/api.ts
parentc1e55ce4fec79f9909b957f86bd7fa8b76939746 (diff)
downloadsoryu-9aadbc7958d39d181c0dd0600e2b7c30bb6c391a.tar.gz
soryu-9aadbc7958d39d181c0dd0600e2b7c30bb6c391a.zip
Makima system improvements: Orders, directive questions, PR creation fix, bug fixes (#62)
* feat: soryu-co/soryu - makima: Fix directive goal update bug - stale closure issue * WIP: heartbeat checkpoint * WIP: heartbeat checkpoint * feat: soryu-co/soryu - makima: Create Orders database schema and backend API * feat: soryu-co/soryu - makima: Fix task Claude instance not receiving user inputs from input box * WIP: heartbeat checkpoint * feat: soryu-co/soryu - makima: Build Orders frontend page replacing the Board page * WIP: heartbeat checkpoint * WIP: heartbeat checkpoint * feat: soryu-co/soryu - makima: Fix directive PR creation system
Diffstat (limited to 'makima/frontend/src/lib/api.ts')
-rw-r--r--makima/frontend/src/lib/api.ts145
1 files changed, 145 insertions, 0 deletions
diff --git a/makima/frontend/src/lib/api.ts b/makima/frontend/src/lib/api.ts
index 480041c..f88176b 100644
--- a/makima/frontend/src/lib/api.ts
+++ b/makima/frontend/src/lib/api.ts
@@ -2241,6 +2241,8 @@ export interface PendingQuestion {
questionId: string;
taskId: string;
contractId: string;
+ /** Directive this question relates to (if from a directive task) */
+ directiveId?: string | null;
question: string;
choices: string[];
context: string | null;
@@ -3025,6 +3027,8 @@ export interface Directive {
completionTaskId: string | null;
/** Whether the memory system is enabled for this directive */
memoryEnabled: boolean;
+ /** Whether questions pause execution indefinitely until answered */
+ reconcileMode: boolean;
goalUpdatedAt: string;
startedAt: string | null;
version: number;
@@ -3064,6 +3068,8 @@ export interface DirectiveSummary {
completionTaskId: string | null;
/** Whether the memory system is enabled for this directive */
memoryEnabled: boolean;
+ /** Whether questions pause execution indefinitely until answered */
+ reconcileMode: boolean;
version: number;
createdAt: string;
updatedAt: string;
@@ -3086,6 +3092,8 @@ export interface CreateDirectiveRequest {
baseBranch?: string;
/** Enable the memory system for this directive (default: false) */
memoryEnabled?: boolean;
+ /** Whether questions pause execution indefinitely until answered (default: false) */
+ reconcileMode?: boolean;
}
export interface UpdateDirectiveRequest {
@@ -3098,6 +3106,8 @@ export interface UpdateDirectiveRequest {
orchestratorTaskId?: string;
/** Enable or disable the memory system for this directive */
memoryEnabled?: boolean;
+ /** Whether questions pause execution indefinitely until answered */
+ reconcileMode?: boolean;
version?: number;
}
@@ -3246,3 +3256,138 @@ export async function cleanupDirectiveTasks(id: string): Promise<{ deleted: numb
return res.json();
}
+// =============================================================================
+// Orders API
+// =============================================================================
+
+export type OrderPriority = "critical" | "high" | "medium" | "low" | "none";
+export type OrderStatus = "open" | "in_progress" | "done" | "archived";
+export type OrderType = "feature" | "bug" | "spike" | "chore" | "improvement";
+
+export interface Order {
+ id: string;
+ ownerId: string;
+ title: string;
+ description: string | null;
+ priority: OrderPriority;
+ status: OrderStatus;
+ orderType: OrderType;
+ labels: string[];
+ directiveId: string | null;
+ directiveStepId: string | null;
+ contractId: string | null;
+ repositoryUrl: string | null;
+ createdAt: string;
+ updatedAt: string;
+}
+
+export interface OrderListResponse {
+ orders: Order[];
+ total: number;
+}
+
+export interface CreateOrderRequest {
+ title: string;
+ description?: string | null;
+ priority?: OrderPriority;
+ status?: OrderStatus;
+ orderType?: OrderType;
+ labels?: string[];
+ directiveId?: string | null;
+ contractId?: string | null;
+ repositoryUrl?: string | null;
+}
+
+export interface UpdateOrderRequest {
+ title?: string;
+ description?: string | null;
+ priority?: OrderPriority;
+ status?: OrderStatus;
+ orderType?: OrderType;
+ labels?: string[];
+ directiveId?: string | null;
+ directiveStepId?: string | null;
+ contractId?: string | null;
+ repositoryUrl?: string | null;
+}
+
+export async function listOrders(
+ status?: OrderStatus,
+ type?: OrderType,
+ priority?: OrderPriority,
+ directiveId?: string,
+ contractId?: string,
+): Promise<OrderListResponse> {
+ const params = new URLSearchParams();
+ if (status) params.set("status", status);
+ if (type) params.set("type", type);
+ if (priority) params.set("priority", priority);
+ if (directiveId) params.set("directiveId", directiveId);
+ if (contractId) params.set("contractId", contractId);
+ const qs = params.toString();
+ const res = await authFetch(`${API_BASE}/api/v1/orders${qs ? `?${qs}` : ""}`);
+ if (!res.ok) throw new Error(`Failed to list orders: ${res.statusText}`);
+ return res.json();
+}
+
+export async function createOrder(req: CreateOrderRequest): Promise<Order> {
+ const res = await authFetch(`${API_BASE}/api/v1/orders`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify(req),
+ });
+ if (!res.ok) throw new Error(`Failed to create order: ${res.statusText}`);
+ return res.json();
+}
+
+export async function getOrder(id: string): Promise<Order> {
+ const res = await authFetch(`${API_BASE}/api/v1/orders/${id}`);
+ if (!res.ok) throw new Error(`Failed to get order: ${res.statusText}`);
+ return res.json();
+}
+
+export async function updateOrder(id: string, req: UpdateOrderRequest): Promise<Order> {
+ const res = await authFetch(`${API_BASE}/api/v1/orders/${id}`, {
+ method: "PATCH",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify(req),
+ });
+ if (!res.ok) throw new Error(`Failed to update order: ${res.statusText}`);
+ return res.json();
+}
+
+export async function deleteOrder(id: string): Promise<void> {
+ const res = await authFetch(`${API_BASE}/api/v1/orders/${id}`, { method: "DELETE" });
+ if (!res.ok) throw new Error(`Failed to delete order: ${res.statusText}`);
+}
+
+export async function linkOrderToDirective(orderId: string, directiveId: string): Promise<Order> {
+ const res = await authFetch(`${API_BASE}/api/v1/orders/${orderId}/link-directive`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ directiveId }),
+ });
+ if (!res.ok) throw new Error(`Failed to link order to directive: ${res.statusText}`);
+ return res.json();
+}
+
+export async function linkOrderToContract(orderId: string, contractId: string): Promise<Order> {
+ const res = await authFetch(`${API_BASE}/api/v1/orders/${orderId}/link-contract`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ contractId }),
+ });
+ if (!res.ok) throw new Error(`Failed to link order to contract: ${res.statusText}`);
+ return res.json();
+}
+
+export async function convertOrderToStep(orderId: string, directiveId: string): Promise<DirectiveStep> {
+ const res = await authFetch(`${API_BASE}/api/v1/orders/${orderId}/convert-to-step`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ directiveId }),
+ });
+ if (!res.ok) throw new Error(`Failed to convert order to step: ${res.statusText}`);
+ return res.json();
+}
+