pub struct CanvasApi { /* private fields */ }Expand description
Canvas documents attached to a session
Implementations§
Source§impl CanvasApi
impl CanvasApi
Sourcepub async fn get_fleet_layout(&self) -> Result<FleetLayout>
pub async fn get_fleet_layout(&self) -> Result<FleetLayout>
Read the canvas layout
An empty canvas answers 200 with empty collections rather than 404 — there is always a canvas, it is just blank.
GET /api/v1/canvas/fleet
Sourcepub async fn materialize_canvas_squad(
&self,
body: &MaterializeCanvasSquadRequest,
) -> Result<MaterializeCanvasSquadResponse>
pub async fn materialize_canvas_squad( &self, body: &MaterializeCanvasSquadRequest, ) -> Result<MaterializeCanvasSquadResponse>
Turn a drawn squad into a real one
Upserts the supervisor and the agents wired to it into an actual Squad, so the drawing
becomes something that can run and delegate. created says whether a squad was made or an
existing one was updated.
Omit worker_ids and the workers are taken from the PERSISTED layout’s outgoing edges for
that supervisor — which is not necessarily what is on the operator’s screen if the canvas
has unsaved changes. Send the ids to be sure.
POST /api/v1/canvas/fleet/materialize
Sourcepub async fn run_canvas_loop(
&self,
body: &RunCanvasLoopRequest,
) -> Result<RunCanvasLoopResponse>
pub async fn run_canvas_loop( &self, body: &RunCanvasLoopRequest, ) -> Result<RunCanvasLoopResponse>
Run a loop container as a mission
A loop drawn on the canvas becomes a single-objective mission that iterates until its condition verifies or a cap is hit. The caller sends the supervisor and the workers it contains; the loop’s run configuration — passes, budget, minutes — is read from the persisted layout, which is the source of truth for it.
The caps are echoed back so the client shows the limits the run is actually bound by rather than the ones on screen. Requires MEF.
POST /api/v1/canvas/loop/run
Sourcepub async fn run_canvas_workflow(
&self,
body: &RunCanvasWorkflowRequest,
) -> Result<RunCanvasWorkflowResponse>
pub async fn run_canvas_workflow( &self, body: &RunCanvasWorkflowRequest, ) -> Result<RunCanvasWorkflowResponse>
Run the wired graph as a mission
The agent graph maps onto a multi-objective mission: one objective per agent step, edges become dependencies, and work advances along them. Each objective is assigned to a single agent, not a squad.
A graph with no workflow edges is 400, not an empty run: a canvas of unconnected agents has no order to execute in, and starting one would look like success. Requires MEF.
POST /api/v1/canvas/workflow/run
Sourcepub async fn save_fleet_layout(
&self,
body: &FleetLayoutUpdate,
) -> Result<FleetLayout>
pub async fn save_fleet_layout( &self, body: &FleetLayoutUpdate, ) -> Result<FleetLayout>
Save the canvas layout
Whole-record write under a compare-and-set: a concurrent edit answers 409 rather than overwriting the other operator’s canvas.
Read dropped on the way back. Entries beyond the caps (500 nodes, 1000 edges, 100
notes) or failing validation are discarded, and the save still succeeds — without that field
a 200 read as “saved” while the operator’s cards snapped back on the next reload. An
oversize body is a clean 422 instead of a silent truncation at the storage limit.
PUT /api/v1/canvas/fleet
Sourcepub async fn schedule_canvas_workflow(
&self,
body: &ScheduleCanvasWorkflowRequest,
) -> Result<ScheduleCanvasWorkflowResponse>
pub async fn schedule_canvas_workflow( &self, body: &ScheduleCanvasWorkflowRequest, ) -> Result<ScheduleCanvasWorkflowResponse>
Run the graph on a cron
Persists a trigger so the wired graph runs on a cadence. The cron expression is validated up front — an invalid one is 400 rather than a schedule that never fires. Requires MEF: without it the answer is 400, because a trigger with no engine behind it would sit there looking scheduled.
POST /api/v1/canvas/workflow/schedule
Sourcepub async fn unschedule_canvas_workflow(
&self,
trigger_id: &str,
) -> Result<UnscheduleCanvasWorkflowResponse>
pub async fn unschedule_canvas_workflow( &self, trigger_id: &str, ) -> Result<UnscheduleCanvasWorkflowResponse>
Remove a workflow schedule
Idempotent: removing a trigger that is not there still answers 200 with status: removed.
DELETE /api/v1/canvas/workflow/schedule/{triggerId}