summaryrefslogtreecommitdiff
path: root/makima/frontend/src/lib/api.ts
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-02-04 01:07:14 +0000
committersoryu <soryu@soryu.co>2026-02-04 01:07:14 +0000
commita734bf1a472b19d63341769d26a66628575df7f4 (patch)
treeec78f57e5721d157c620df0c99de5b5efe485231 /makima/frontend/src/lib/api.ts
parentc732dd048128808cd9f67f6e1176a5b565df5678 (diff)
downloadsoryu-a734bf1a472b19d63341769d26a66628575df7f4.tar.gz
soryu-a734bf1a472b19d63341769d26a66628575df7f4.zip
Add chain checkpoint contracts
Diffstat (limited to 'makima/frontend/src/lib/api.ts')
-rw-r--r--makima/frontend/src/lib/api.ts44
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 }));