|
|
import { assertRpaWorkerEnv } from "@/lib/rpa/env";
|
|
|
import type { QuoteRequest } from "@/modules/providers/quote-provider";
|
|
|
import { MothershipRPAProvider } from "@/workers/rpa/mothership";
|
|
|
import { closeBrowser } from "@/workers/rpa/session-manager";
|
|
|
|
|
|
export const PROBE_QUOTE_REQUEST: QuoteRequest = {
|
|
|
cargoHash: "probe",
|
|
|
pickup: {
|
|
|
street: "1234 Warehouse Blvd",
|
|
|
city: "Los Angeles",
|
|
|
state: "CA",
|
|
|
zip: "90001",
|
|
|
placeId: "place_la_90001",
|
|
|
formattedAddress: "1234 Warehouse Blvd, Los Angeles, CA 90001",
|
|
|
selectedFromSuggestions: true,
|
|
|
mothershipOptionId: "ms_probe_pickup",
|
|
|
mothershipDisplayLabel: "1234 Warehouse Blvd, Los Angeles, CA 90001",
|
|
|
selectedFromMothership: true,
|
|
|
},
|
|
|
delivery: {
|
|
|
street: "5678 Distribution Dr",
|
|
|
city: "Dallas",
|
|
|
state: "TX",
|
|
|
zip: "75201",
|
|
|
placeId: "place_dallas_75201",
|
|
|
formattedAddress: "5678 Distribution Dr, Dallas, TX 75201",
|
|
|
selectedFromSuggestions: true,
|
|
|
mothershipOptionId: "ms_probe_delivery",
|
|
|
mothershipDisplayLabel: "5678 Distribution Dr, Dallas, TX 75201",
|
|
|
selectedFromMothership: true,
|
|
|
},
|
|
|
weightLb: 500,
|
|
|
dimsIn: { l: 48, w: 40, h: 48 },
|
|
|
palletCount: 2,
|
|
|
cargoType: "general_freight",
|
|
|
};
|
|
|
|
|
|
/** 执行单次 RPA probe(task-130 / TC-601) */
|
|
|
export async function executeProbeQuote() {
|
|
|
if (process.env.RPA_MOCK_MODE !== "true") {
|
|
|
assertRpaWorkerEnv();
|
|
|
}
|
|
|
|
|
|
const provider = new MothershipRPAProvider();
|
|
|
try {
|
|
|
return await provider.getQuote(PROBE_QUOTE_REQUEST);
|
|
|
} finally {
|
|
|
await closeBrowser();
|
|
|
}
|
|
|
}
|