refactor: add remote runtime adapter
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { authorizeDeviceWriteRequest } from "@/lib/boss-device-auth";
|
||||
import { completeMasterAgentTask } from "@/lib/boss-data";
|
||||
import { normalizeRemoteExecutionResult } from "@/lib/execution/remote-runtime-adapter";
|
||||
|
||||
export async function POST(
|
||||
request: NextRequest,
|
||||
@@ -30,17 +31,18 @@ export async function POST(
|
||||
const { taskId } = await context.params;
|
||||
|
||||
try {
|
||||
const normalized = normalizeRemoteExecutionResult(body);
|
||||
const task = await completeMasterAgentTask({
|
||||
taskId,
|
||||
deviceId: body.deviceId.trim(),
|
||||
status: body.status === "failed" ? "failed" : "completed",
|
||||
replyBody: body.replyBody,
|
||||
errorMessage: body.errorMessage,
|
||||
requestId: body.requestId,
|
||||
dispatchExecutionId: body.dispatchExecutionId,
|
||||
targetProjectId: body.targetProjectId,
|
||||
targetThreadId: body.targetThreadId,
|
||||
rawThreadReply: body.rawThreadReply,
|
||||
status: normalized.status,
|
||||
replyBody: normalized.replyBody,
|
||||
errorMessage: normalized.errorMessage,
|
||||
requestId: normalized.requestId,
|
||||
dispatchExecutionId: normalized.dispatchExecutionId,
|
||||
targetProjectId: normalized.targetProjectId,
|
||||
targetThreadId: normalized.targetThreadId,
|
||||
rawThreadReply: normalized.rawThreadReply,
|
||||
});
|
||||
return NextResponse.json({ ok: true, task });
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user