refactor: isolate V2 from legacy booking execution
verify / booking-verify (push) Has been cancelled

Make new EML tasks strict V2-only, keep historical runs read-only, remove legacy dispatch, Recovery, contracts-v1 execution paths, legacy parser bridges, writer DTOs, and their obsolete tests while preserving shared SuperAgent transport, SSE, journal, lifecycle, and history readers.
This commit is contained in:
鲨鱼辣椒 committed 2026-08-20 17:09:14 +08:00
1 parent 694c4317a3
commit cec6828479
116 files changed
+457 -21079

No files matched your search

@@ -22,10 +22,8 @@ export async function createAgentBusEmlReplayPreview(
): Promise<AgentBusEmlReplayRun> {
const form = new FormData()
form.append('file', input.file, input.file.name)
form.append('delivery_mode', input.deliveryMode)
if (input.executionPolicy) {
form.append('execution_policy', input.executionPolicy)
}
form.append('delivery_mode', 'FRESH_DELIVERY')
form.append('execution_policy', 'REQUIRE_REAL_L3_L5')
const hotelId = input.hotelId?.trim() || getReservationHotelId()
if (hotelId) {
form.append('hotel_id', hotelId)
@@ -41,7 +41,7 @@ describe('agentBusEmlReplayService', () => {
storage_configured: true,
max_eml_bytes: 10485760,
max_frame_bytes: 1048576,
downstream_mode: 'SUPERAGENT_DISPATCH',
downstream_mode: 'BOOKING_DECISION_V2',
downstream_ready: true,
worker_enabled: true,
execution_ready: true,
@@ -49,7 +49,8 @@ describe('agentBusEmlReplayService', () => {
.mockResolvedValueOnce(mockJsonResponse({
replay_id: '91001',
hotel_id: 'HOTEL-BKK',
delivery_mode: 'PRESERVE_IDENTITY',
delivery_mode: 'FRESH_DELIVERY',
execution_policy: 'REQUIRE_REAL_L3_L5',
status: 'PREVIEW_READY',
original_file_name: 'booking.eml',
original_eml_sha256: 'sha256',
@@ -81,7 +82,8 @@ describe('agentBusEmlReplayService', () => {
expect(form.get('file')).toBeInstanceOf(File)
expect((form.get('file') as File).name).toBe('booking.eml')
expect(form.get('hotel_id')).toBe('HOTEL-BKK')
expect(form.get('delivery_mode')).toBe('PRESERVE_IDENTITY')
expect(form.get('delivery_mode')).toBe('FRESH_DELIVERY')
expect(form.get('execution_policy')).toBe('REQUIRE_REAL_L3_L5')
expect(form.get('run_label')).toBe('frontend smoke')
expect(fetchMock.mock.calls[2]?.[0]).toBe(
'/api/system/debug/agentbus-eml-replays?limit=8&hotel_id=HOTEL-BKK',
@@ -28,10 +28,11 @@ function capabilities() {
storage_configured: true,
max_eml_bytes: 10 * 1024 * 1024,
max_frame_bytes: 1024 * 1024,
downstream_mode: 'SUPERAGENT_DISPATCH',
downstream_mode: 'BOOKING_DECISION_V2',
downstream_ready: true,
worker_enabled: true,
worker_enabled: null,
execution_ready: true,
strict_execution_ready: true,
}
}
@@ -40,7 +41,8 @@ function preview(overrides: Partial<AgentBusEmlReplayRun> = {}): AgentBusEmlRepl
replay_id: '91001',
hotel_id: 'HOTEL-TEST',
run_label: 'view smoke',
delivery_mode: 'PRESERVE_IDENTITY',
delivery_mode: 'FRESH_DELIVERY',
execution_policy: 'REQUIRE_REAL_L3_L5',
status: 'PREVIEW_READY',
original_file_name: 'booking.eml',
original_eml_sha256: 'sha256',
@@ -179,7 +181,8 @@ describe('AgentBusEmlReplayView', () => {
expect(service.createAgentBusEmlReplayPreview).toHaveBeenCalledWith(expect.objectContaining({
file,
hotelId: 'HOTEL-TEST',
deliveryMode: 'PRESERVE_IDENTITY',
deliveryMode: 'FRESH_DELIVERY',
executionPolicy: 'REQUIRE_REAL_L3_L5',
}))
expect(service.executeAgentBusEmlReplay).not.toHaveBeenCalled()
expect(wrapper.text()).toContain('Booking test')
@@ -921,9 +921,7 @@ const authStore = useAuthStore()
const fileInput = ref<HTMLInputElement | null>(null)
const confirmationPanel = ref<HTMLElement | null>(null)
const selectedFile = ref<File | null>(null)
const deliveryMode = ref<AgentBusEmlReplayDeliveryMode>(
route.query.entry === 'email-import' ? 'FRESH_DELIVERY' : 'PRESERVE_IDENTITY',
)
const deliveryMode = ref<AgentBusEmlReplayDeliveryMode>('FRESH_DELIVERY')
const runLabel = ref('')
const dragActive = ref(false)
const capabilities = ref<AgentBusEmlReplayCapabilities | null>(null)
@@ -944,9 +942,7 @@ let pollTimer: number | undefined
const isLocalDemo = computed(() => props.localDemo)
const isEmailImportEntry = computed(() => route.query.entry === 'email-import')
const deliveryModes = computed<AgentBusEmlReplayDeliveryMode[]>(() => (
isEmailImportEntry.value ? ['FRESH_DELIVERY'] : ['PRESERVE_IDENTITY', 'FRESH_DELIVERY']
))
const deliveryModes = computed<AgentBusEmlReplayDeliveryMode[]>(() => ['FRESH_DELIVERY'])
const currentHotelLabel = computed(
() => isLocalDemo.value
? 'BR00 本地演示'
@@ -959,9 +955,7 @@ const executionReady = computed(() => {
if (isLocalDemo.value) {
return true
}
return isEmailImportEntry.value
? Boolean(capabilities.value?.strict_execution_ready)
: Boolean(capabilities.value?.execution_ready)
return Boolean(capabilities.value?.strict_execution_ready)
})
const currentStep = computed(() => {
if (executing.value || currentReplay.value?.processor_result
@@ -1123,7 +1117,7 @@ async function createPreview(): Promise<void> {
file: selectedFile.value,
hotelId: authStore.selectedHotelId,
deliveryMode: deliveryMode.value,
executionPolicy: isEmailImportEntry.value ? 'REQUIRE_REAL_L3_L5' : 'LEGACY_COMPATIBLE',
executionPolicy: 'REQUIRE_REAL_L3_L5',
runLabel: runLabel.value,
})
applyReplay(replay)
@@ -1199,7 +1193,7 @@ async function executeReplay(): Promise<void> {
function applyReplay(replay: AgentBusEmlReplayRun): void {
currentReplay.value = replay
recentDrawerOpen.value = false
deliveryMode.value = isEmailImportEntry.value ? 'FRESH_DELIVERY' : replay.delivery_mode
deliveryMode.value = replay.delivery_mode
runLabel.value = replay.run_label ?? ''
confirmationVisible.value = false
copySucceeded.value = false
@@ -1260,7 +1254,7 @@ function resetReplay(clearQuery = true): void {
executing.value = false
copySucceeded.value = false
runLabel.value = ''
deliveryMode.value = isEmailImportEntry.value ? 'FRESH_DELIVERY' : 'PRESERVE_IDENTITY'
deliveryMode.value = 'FRESH_DELIVERY'
clearSelection()
clearError()
if (clearQuery) {