Skip to main content

agentmux_srv/server/remote_ops/
tasks.rs

1// Copyright 2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4//! `tasks.enqueue` and `tasks.list` (spec ยง4.3, phase P3): file a task on this machine's board for
5//! one of its agents, and read the board. The logic is `work_remote`; these only give it the
6//! transport's verified caller.
7
8use serde_json::Value;
9
10use super::{AppState, RemoteCaller, RemoteRefusal, RemoteResult};
11use crate::server::work_remote::{self, Failure};
12
13fn refusal(f: Failure) -> RemoteRefusal {
14    RemoteRefusal::new(f.code, f.message)
15}
16
17pub(super) async fn enqueue(state: &AppState, caller: &RemoteCaller, params: Value) -> RemoteResult {
18    work_remote::tasks_enqueue(state, &caller.actor(), params).await.map_err(refusal)
19}
20
21pub(super) async fn list(state: &AppState, caller: &RemoteCaller, params: Value) -> RemoteResult {
22    work_remote::tasks_list_for(state, Some(&caller.actor()), params).map_err(refusal)
23}