@@ -52,7 +52,7 @@ const getErrorDetailMessage = (detail) => {
5252 return String ( detail ) ;
5353} ;
5454
55- export async function getNeuroglancerViewer ( image , label , scales ) {
55+ export async function getNeuroglancerViewer ( image , label , scales , workflowId = null ) {
5656 try {
5757 const url = `${ BASE_URL } /neuroglancer` ;
5858 if ( hasBrowserFile ( image ) ) {
@@ -70,6 +70,9 @@ export async function getNeuroglancerViewer(image, label, scales) {
7070 ) ;
7171 }
7272 formData . append ( "scales" , JSON . stringify ( scales ) ) ;
73+ if ( workflowId ) {
74+ formData . append ( "workflow_id" , String ( workflowId ) ) ;
75+ }
7376 const res = await axios . post ( url , formData ) ;
7477 return res . data ;
7578 }
@@ -78,6 +81,7 @@ export async function getNeuroglancerViewer(image, label, scales) {
7881 image : buildFilePath ( image ) ,
7982 label : buildFilePath ( label ) ,
8083 scales,
84+ workflow_id : workflowId ,
8185 } ) ;
8286 const res = await axios . post ( url , data ) ;
8387 return res . data ;
@@ -141,6 +145,7 @@ export async function startModelTraining(
141145 logPath ,
142146 outputPath ,
143147 configOriginPath = "" ,
148+ workflowId = null ,
144149) {
145150 try {
146151 console . log ( "[API] ===== Starting Training Configuration =====" ) ;
@@ -178,6 +183,7 @@ export async function startModelTraining(
178183 outputPath, // TensorBoard will use this instead
179184 trainingConfig : configToSend ,
180185 configOriginPath,
186+ workflow_id : workflowId ,
181187 } ) ;
182188
183189 console . log ( "[API] Request payload size:" , data . length , "bytes" ) ;
@@ -232,6 +238,7 @@ export async function startModelInference(
232238 outputPath ,
233239 checkpointPath ,
234240 configOriginPath = "" ,
241+ workflowId = null ,
235242) {
236243 console . log ( "\n========== API.JS: START_MODEL_INFERENCE CALLED ==========" ) ;
237244 console . log ( "[API] Function arguments:" ) ;
@@ -293,6 +300,7 @@ export async function startModelInference(
293300 outputPath,
294301 inferenceConfig : configToSend ,
295302 configOriginPath,
303+ workflow_id : workflowId ,
296304 } ;
297305
298306 console . log ( "[API] Payload structure:" ) ;
@@ -462,3 +470,122 @@ export async function getConfigPresetContent(path) {
462470export async function getModelArchitectures ( ) {
463471 return makeApiRequest ( "pytc/architectures" , "get" ) ;
464472}
473+
474+ // ── Workflow spine ───────────────────────────────────────────────────────────
475+
476+ export async function getCurrentWorkflow ( ) {
477+ try {
478+ const res = await apiClient . get ( "/api/workflows/current" ) ;
479+ return res . data ;
480+ } catch ( error ) {
481+ handleError ( error ) ;
482+ }
483+ }
484+
485+ export async function updateWorkflow ( workflowId , patch ) {
486+ try {
487+ const res = await apiClient . patch ( `/api/workflows/${ workflowId } ` , patch ) ;
488+ return res . data ;
489+ } catch ( error ) {
490+ handleError ( error ) ;
491+ }
492+ }
493+
494+ export async function listWorkflowEvents ( workflowId ) {
495+ try {
496+ const res = await apiClient . get ( `/api/workflows/${ workflowId } /events` ) ;
497+ return res . data ;
498+ } catch ( error ) {
499+ handleError ( error ) ;
500+ }
501+ }
502+
503+ export async function getWorkflowHotspots ( workflowId ) {
504+ try {
505+ const res = await apiClient . get ( `/api/workflows/${ workflowId } /hotspots` ) ;
506+ return res . data ;
507+ } catch ( error ) {
508+ handleError ( error ) ;
509+ }
510+ }
511+
512+ export async function getWorkflowImpactPreview ( workflowId ) {
513+ try {
514+ const res = await apiClient . get ( `/api/workflows/${ workflowId } /impact-preview` ) ;
515+ return res . data ;
516+ } catch ( error ) {
517+ handleError ( error ) ;
518+ }
519+ }
520+
521+ export async function getWorkflowMetrics ( workflowId ) {
522+ try {
523+ const res = await apiClient . get ( `/api/workflows/${ workflowId } /metrics` ) ;
524+ return res . data ;
525+ } catch ( error ) {
526+ handleError ( error ) ;
527+ }
528+ }
529+
530+ export async function exportWorkflowBundle ( workflowId ) {
531+ try {
532+ const res = await apiClient . post ( `/api/workflows/${ workflowId } /export-bundle` ) ;
533+ return res . data ;
534+ } catch ( error ) {
535+ handleError ( error ) ;
536+ }
537+ }
538+
539+ export async function appendWorkflowEvent ( workflowId , event ) {
540+ try {
541+ const res = await apiClient . post ( `/api/workflows/${ workflowId } /events` , event ) ;
542+ return res . data ;
543+ } catch ( error ) {
544+ handleError ( error ) ;
545+ }
546+ }
547+
548+ export async function createAgentAction ( workflowId , action ) {
549+ try {
550+ const res = await apiClient . post (
551+ `/api/workflows/${ workflowId } /agent-actions` ,
552+ action ,
553+ ) ;
554+ return res . data ;
555+ } catch ( error ) {
556+ handleError ( error ) ;
557+ }
558+ }
559+
560+ export async function approveAgentAction ( workflowId , eventId ) {
561+ try {
562+ const res = await apiClient . post (
563+ `/api/workflows/${ workflowId } /agent-actions/${ eventId } /approve` ,
564+ ) ;
565+ return res . data ;
566+ } catch ( error ) {
567+ handleError ( error ) ;
568+ }
569+ }
570+
571+ export async function rejectAgentAction ( workflowId , eventId ) {
572+ try {
573+ const res = await apiClient . post (
574+ `/api/workflows/${ workflowId } /agent-actions/${ eventId } /reject` ,
575+ ) ;
576+ return res . data ;
577+ } catch ( error ) {
578+ handleError ( error ) ;
579+ }
580+ }
581+
582+ export async function queryWorkflowAgent ( workflowId , query ) {
583+ try {
584+ const res = await apiClient . post ( `/api/workflows/${ workflowId } /agent/query` , {
585+ query,
586+ } ) ;
587+ return res . data ;
588+ } catch ( error ) {
589+ handleError ( error ) ;
590+ }
591+ }
0 commit comments