diff options
Diffstat (limited to 'makima/frontend/src/lib')
| -rw-r--r-- | makima/frontend/src/lib/api.ts | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/makima/frontend/src/lib/api.ts b/makima/frontend/src/lib/api.ts index e3dbc30..3fcd728 100644 --- a/makima/frontend/src/lib/api.ts +++ b/makima/frontend/src/lib/api.ts @@ -3194,7 +3194,13 @@ export async function listTaskPatches(taskId: string, contractId: string): Promi // Directive Types & API // ============================================================================= -export type DirectiveStatus = "draft" | "active" | "idle" | "paused" | "archived"; +export type DirectiveStatus = + | "draft" + | "active" + | "idle" + | "paused" + | "inactive" + | "archived"; export type StepStatus = "pending" | "ready" | "running" | "completed" | "failed" | "skipped"; export interface Directive { @@ -3485,6 +3491,24 @@ export async function listDirectiveRevisions( return res.json(); } +/** + * Reset a directive for a new draft cycle: clears its goal and detaches the + * current PR linkage. Past revisions remain attached as history. Used by the + * sidebar's "New draft" right-click on an inactive contract. + */ +export async function newDirectiveDraft( + directiveId: string, +): Promise<Directive> { + const res = await authFetch( + `${API_BASE}/api/v1/directives/${directiveId}/new-draft`, + { method: "POST" }, + ); + if (!res.ok) { + throw new Error(`Failed to reset directive for new draft: ${res.statusText}`); + } + return res.json(); +} + export async function createDirectivePR(id: string): Promise<DirectiveWithSteps> { const res = await authFetch(`${API_BASE}/api/v1/directives/${id}/create-pr`, { method: "POST" }); if (!res.ok) throw new Error(`Failed to create PR: ${res.statusText}`); |
