diff options
Diffstat (limited to 'makima/frontend/src/lib/api.ts')
| -rw-r--r-- | makima/frontend/src/lib/api.ts | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/makima/frontend/src/lib/api.ts b/makima/frontend/src/lib/api.ts index e5cf1d8..a08cba7 100644 --- a/makima/frontend/src/lib/api.ts +++ b/makima/frontend/src/lib/api.ts @@ -3255,6 +3255,20 @@ export interface ChainDeliverableDefinition { priority?: string; } +/** Validation configuration for checkpoint contracts */ +export interface CheckpointValidation { + /** Check that all required deliverables from upstream contracts exist */ + checkDeliverables?: boolean; + /** Run tests in the repository */ + runTests?: boolean; + /** Custom validation instructions for Claude */ + checkContent?: string; + /** Action on failure: "block", "retry", "warn" */ + onFailure?: "block" | "retry" | "warn"; + /** Max retry attempts for upstream contracts */ + maxRetries?: number; +} + /** Contract definition stored in chain (before actual contract is created) */ export interface ChainContractDefinition { id: string; @@ -3266,6 +3280,8 @@ export interface ChainContractDefinition { dependsOnNames: string[]; tasks: ChainTaskDefinition[] | null; deliverables: ChainDeliverableDefinition[] | null; + /** Validation config for checkpoint contracts */ + validation: CheckpointValidation | null; editorX: number | null; editorY: number | null; orderIndex: number; @@ -3281,6 +3297,8 @@ export interface AddContractDefinitionRequest { dependsOn?: string[]; tasks?: ChainTaskDefinition[]; deliverables?: ChainDeliverableDefinition[]; + /** Validation config (for checkpoint contracts) */ + validation?: CheckpointValidation; editorX?: number; editorY?: number; orderIndex?: number; @@ -3295,6 +3313,8 @@ export interface UpdateContractDefinitionRequest { dependsOn?: string[]; tasks?: ChainTaskDefinition[]; deliverables?: ChainDeliverableDefinition[]; + /** Validation config (for checkpoint contracts) */ + validation?: CheckpointValidation; editorX?: number; editorY?: number; orderIndex?: number; @@ -3402,10 +3422,30 @@ export async function getChainDefinitionGraph( return res.json(); } -/** Start a chain (creates root contracts and spawns supervisor) */ -export async function startChain(chainId: string): Promise<StartChainResponse> { +/** Options for starting a chain */ +export interface StartChainOptions { + /** Whether to create a supervisor task that monitors chain progress */ + withSupervisor?: boolean; + /** Repository URL for the supervisor task to work with */ + repositoryUrl?: string; +} + +/** Start a chain (creates root contracts and optionally spawns supervisor) */ +export async function startChain( + chainId: string, + options?: StartChainOptions +): Promise<StartChainResponse> { + const body = options + ? JSON.stringify({ + withSupervisor: options.withSupervisor ?? false, + repositoryUrl: options.repositoryUrl, + }) + : undefined; + const res = await authFetch(`${API_BASE}/api/v1/chains/${chainId}/start`, { method: "POST", + headers: body ? { "Content-Type": "application/json" } : undefined, + body, }); if (!res.ok) { const error = await res.json().catch(() => ({ message: res.statusText })); |
