refactor: add remote runtime adapter

This commit is contained in:
kris
2026-04-03 00:24:11 +08:00
parent 8a62e72fd5
commit 70e8a13368
5 changed files with 144 additions and 25 deletions

View File

@@ -0,0 +1,11 @@
import type { OrchestrationBackend } from "@/lib/execution/orchestration-backend";
export const BOSS_NATIVE_ORCHESTRATOR: OrchestrationBackend = {
backendId: "boss-native-orchestrator",
async describe() {
return {
backendId: "boss-native-orchestrator",
label: "Boss Native Orchestrator",
};
},
};

View File

@@ -0,0 +1,43 @@
export interface RemoteExecutionResultInput {
status: "completed" | "failed";
dispatchExecutionId?: string;
targetProjectId?: string;
targetThreadId?: string;
rawThreadReply?: string;
replyBody?: string;
errorMessage?: string;
requestId?: string;
}
export interface NormalizedRemoteExecutionResult {
status: "completed" | "failed";
dispatchExecutionId?: string;
targetProjectId?: string;
targetThreadId?: string;
rawThreadReply?: string;
replyBody?: string;
errorMessage?: string;
requestId?: string;
}
function trimToDefined(value: string | undefined) {
const trimmed = value?.trim();
return trimmed ? trimmed : undefined;
}
export function normalizeRemoteExecutionResult(
input: RemoteExecutionResultInput,
): NormalizedRemoteExecutionResult {
return {
status: input.status === "failed" ? "failed" : "completed",
dispatchExecutionId: trimToDefined(input.dispatchExecutionId),
targetProjectId: trimToDefined(input.targetProjectId),
targetThreadId: trimToDefined(input.targetThreadId),
rawThreadReply: trimToDefined(input.rawThreadReply),
replyBody: trimToDefined(input.replyBody),
errorMessage: trimToDefined(input.errorMessage),
requestId: trimToDefined(input.requestId),
};
}
export const normalizeRemoteExecutionResultForTesting = normalizeRemoteExecutionResult;