Skip to content

agent: add adapter for Ctrip - #2643

Merged
esokullu merged 2 commits into
webbrain-one:mainfrom
alectimison-maker:agent/ctrip-adapter
Aug 2, 2026
Merged

agent: add adapter for Ctrip#2643
esokullu merged 2 commits into
webbrain-one:mainfrom
alectimison-maker:agent/ctrip-adapter

Conversation

@alectimison-maker

Copy link
Copy Markdown
Contributor

Summary

Adds a mirrored Ctrip adapter for Chrome and Firefox.

Without this adapter, the agent can compare sponsored or incomplete travel prices, confuse a Ctrip train request with an issued 12306 ticket, or report a submitted/held itinerary as a completed booking.

  • Cover Ctrip hotel, flight, train, vacation, attraction, account, order, and secure-booking hosts.
  • Preserve exact dates, airports/stations, room/fare conditions, passengers, add-ons, cancellation rules, and final totals.
  • Require explicit confirmation before 提交订单 and verify product-specific success states.
  • Handle the observed blank HTTP 432 response on flights.ctrip.com without rapid retry loops.
  • Add host-scope, phishing-lookalike, visible-label, transaction-safety, anti-automation, and Chrome/Firefox parity tests.

Validation

  • Targeted Ctrip production and guidance assertions: passed.
  • Anonymous Chrome/Playwright read-only check: home, hotel detail, and train pages returned HTTP 200 and selected ctrip; the flight host returned HTTP 432 but still selected ctrip, which is now documented as an anti-automation response.
  • node test/run.js: 1398/1399 passed; the single failure predates this branch and is the repository's changelog/package version mismatch.
  • git diff --check: passed.

Compatibility and risks

The change is prompt-only and mirrored across both browser builds. No authenticated booking, passenger-data, order, or payment mutation was performed.

@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

@alectimison-maker is attempting to deploy a commit to the esokullu's projects Team on Vercel.

A member of the Team first needs to authorize it.

@esokullu esokullu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Four actionable Ctrip adapter findings:

Comment thread src/chrome/src/agent/adapters.js Outdated
- For flights, verify airports, local departure and arrival dates, operating carrier, stops, transfer airports, cabin, baggage "行李" allowance, change/refund rules, and whether separate tickets are involved. Do not compare only the headline fare or assume an overnight arrival is the departure date.
- For trains, distinguish Ctrip's booking layer from the official 12306 order. Verify train, stations, date, seat class, passenger, service/insurance add-ons, and final total; if the flow hands off to 12306, re-read that page under the 12306 adapter instead of assuming Ctrip completed the ticket.
- Stop for the user when QR "扫码", password, SMS "短信", payment verification, or real-name passenger verification appears. Do not retry around authentication, enter identity details not explicitly provided for this booking, or expose document numbers in summaries.
- Remove optional insurance, packages, coupons, memberships, or paid add-ons unless the user requested them, and re-read the cancellation/change terms and total after any selection. A lower price can carry materially stricter restrictions.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Do not strip automatically applied coupons

When Ctrip pre-applies a discount coupon at checkout, this instruction tells the model to remove it solely because the user did not request it, increasing the payable total; unlike insurance or memberships, an applicable coupon is not a paid add-on. Preserve beneficial coupons while checking restrictions and limit automatic removal to chargeable extras, consistent with the spend-money safety rule in AGENT.md.

Comment thread src/chrome/src/agent/adapters.js Outdated
{
name: 'ctrip',
category: 'general',
matches: (url) => /^https?:\/\/(?:(?:www|hotels|flights|trains|vacations|tickets|passport|my|secure)\.)?ctrip\.com\//.test(url),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Match the live Ctrip attraction-ticket hosts

When the user chooses the homepage's 景点门票 product, Ctrip navigates to huodong.ctrip.com/things-to-do/list (and piao.ctrip.com redirects there), but this matcher returns null for both while accepting the non-resolving tickets.ctrip.com. Match the live hosts and test one of those URLs.

Comment thread src/chrome/src/agent/adapters.js Outdated
- Treat cards marked "广告" as sponsored placements. Compare the exact product, supplier, dates, included services, and final payable total instead of ranking by homepage position, crossed-out price, member price, or a displayed "起" price.
- For hotels, set the city/property, "入住" and "离店" dates, rooms, and guests before reading availability. Select the exact "房型", bed, breakfast, occupancy, payment timing, and "退订" / cancellation rule; different rows for the same hotel are not interchangeable.
- For flights, verify airports, local departure and arrival dates, operating carrier, stops, transfer airports, cabin, baggage "行李" allowance, change/refund rules, and whether separate tickets are involved. Do not compare only the headline fare or assume an overnight arrival is the departure date.
- For trains, distinguish Ctrip's booking layer from the official 12306 order. Verify train, stations, date, seat class, passenger, service/insurance add-ons, and final total; if the flow hands off to 12306, re-read that page under the 12306 adapter instead of assuming Ctrip completed the ticket.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Remove the reference to a nonexistent 12306 adapter

When the train flow hands off to www.12306.cn, ADAPTERS contains no 12306 matcher and getActiveAdapter() returns null, so the promised 12306 adapter can never supply this guidance. Add that adapter or require a fresh page read without claiming an adapter exists.

Comment thread src/chrome/src/agent/adapters.js Outdated
Comment on lines +16214 to +16216
- Treat the review page and "提交订单" as a consequential booking action. Re-read travelers/guests, contact details, itinerary, room/fare, cancellation terms, add-ons, currency, and total, and do not submit without the user's explicit confirmation.
- Report success only when the product-specific result shows "订单号" plus "预订成功" or, for flights/trains, the applicable "出票成功" status. A form submission, pending confirmation, payment redirect, or itinerary held for payment is not a completed booking.
- If flights.ctrip.com becomes blank or returns HTTP 432, treat it as an anti-automation response rather than "no flights". Do not retry rapidly; return through www.ctrip.com's "机票" entry after a pause, and ask the user to handle any verification that appears.`,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Reduce the notes to the documented eight-bullet limit

This block adds 10 bullets and 384 words, so every first Ctrip turn pays a sizable prompt cost and violates the repository guidance to keep adapter notes short and the documented eight-bullet maximum. Consolidate at least two bullets so compact and local-model conversations do not lose avoidable context budget.

@esokullu
esokullu merged commit ce6ee38 into webbrain-one:main Aug 2, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants