MCPcopy Create free account
hub / github.com/ShipSecAI/studio / startRun

Function startRun

scripts/capture-run-stream.ts:33–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31}
32
33async function startRun() {
34 const response = await fetch(
35 `${API_BASE_URL}/api/v1/workflows/${WORKFLOW_ID}/run`,
36 {
37 method: 'POST',
38 headers: {
39 ...COMMON_HEADERS,
40 'Content-Type': 'application/json',
41 },
42 body: JSON.stringify({}),
43 },
44 )
45
46 if (!response.ok) {
47 const text = await response.text()
48 throw new Error(
49 `Failed to start workflow ${WORKFLOW_ID}: ${response.status} ${response.statusText} - ${text}`,
50 )
51 }
52
53 const payload = await response.json()
54 const runId = payload.runId ?? payload.executionId ?? payload.id
55 if (!runId) {
56 throw new Error(
57 `Start response missing runId: ${JSON.stringify(payload, null, 2)}`,
58 )
59 }
60
61 return { runId, payload }
62}
63
64async function captureStream(runId: string, filePath: string) {
65 await ensureOutputDir(filePath)

Callers 1

mainFunction · 0.85

Calls 1

fetchFunction · 0.85

Tested by

no test coverage detected