refactor: add execution backend selection
This commit is contained in:
@@ -5560,6 +5560,39 @@ export async function getMasterAgentTask(taskId: string) {
|
||||
return state.masterAgentTasks.find((item) => item.taskId === taskId) ?? null;
|
||||
}
|
||||
|
||||
export async function reassignMasterAgentTaskExecution(payload: {
|
||||
taskId: string;
|
||||
deviceId: string;
|
||||
accountId?: string;
|
||||
accountLabel?: string;
|
||||
executionPrompt?: string;
|
||||
}) {
|
||||
const task = await mutateState((state) => {
|
||||
const next = state.masterAgentTasks.find((item) => item.taskId === payload.taskId);
|
||||
if (!next) {
|
||||
throw new Error("MASTER_AGENT_TASK_NOT_FOUND");
|
||||
}
|
||||
if (next.status !== "queued") {
|
||||
return { ...next };
|
||||
}
|
||||
next.deviceId = payload.deviceId;
|
||||
next.accountId = payload.accountId;
|
||||
next.accountLabel = payload.accountLabel;
|
||||
if (payload.executionPrompt?.trim()) {
|
||||
next.executionPrompt = payload.executionPrompt.trim();
|
||||
}
|
||||
return { ...next };
|
||||
});
|
||||
|
||||
publishBossEvent("master_agent.task.updated", {
|
||||
taskId: task.taskId,
|
||||
deviceId: task.deviceId,
|
||||
status: task.status,
|
||||
});
|
||||
|
||||
return task;
|
||||
}
|
||||
|
||||
export async function claimNextMasterAgentTask(deviceId: string) {
|
||||
let attachmentProjectId: string | undefined;
|
||||
let dispatchExecutionProjectId: string | undefined;
|
||||
|
||||
Reference in New Issue
Block a user