@@ -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,86 @@ 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 appendWorkflowEvent ( workflowId , event ) {
504+ try {
505+ const res = await apiClient . post ( `/api/workflows/${ workflowId } /events` , event ) ;
506+ return res . data ;
507+ } catch ( error ) {
508+ handleError ( error ) ;
509+ }
510+ }
511+
512+ export async function createAgentAction ( workflowId , action ) {
513+ try {
514+ const res = await apiClient . post (
515+ `/api/workflows/${ workflowId } /agent-actions` ,
516+ action ,
517+ ) ;
518+ return res . data ;
519+ } catch ( error ) {
520+ handleError ( error ) ;
521+ }
522+ }
523+
524+ export async function approveAgentAction ( workflowId , eventId ) {
525+ try {
526+ const res = await apiClient . post (
527+ `/api/workflows/${ workflowId } /agent-actions/${ eventId } /approve` ,
528+ ) ;
529+ return res . data ;
530+ } catch ( error ) {
531+ handleError ( error ) ;
532+ }
533+ }
534+
535+ export async function rejectAgentAction ( workflowId , eventId ) {
536+ try {
537+ const res = await apiClient . post (
538+ `/api/workflows/${ workflowId } /agent-actions/${ eventId } /reject` ,
539+ ) ;
540+ return res . data ;
541+ } catch ( error ) {
542+ handleError ( error ) ;
543+ }
544+ }
545+
546+ export async function queryWorkflowAgent ( workflowId , query ) {
547+ try {
548+ const res = await apiClient . post ( `/api/workflows/${ workflowId } /agent/query` , {
549+ query,
550+ } ) ;
551+ return res . data ;
552+ } catch ( error ) {
553+ handleError ( error ) ;
554+ }
555+ }
0 commit comments