refactor: add remote runtime adapter
This commit is contained in:
11
src/lib/execution/backends/boss-native-orchestrator.ts
Normal file
11
src/lib/execution/backends/boss-native-orchestrator.ts
Normal 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",
|
||||
};
|
||||
},
|
||||
};
|
||||
43
src/lib/execution/remote-runtime-adapter.ts
Normal file
43
src/lib/execution/remote-runtime-adapter.ts
Normal 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;
|
||||
Reference in New Issue
Block a user