@danceiny/gotry 0.0.1-rc.9 → 0.2.0-rc.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +172 -219
- package/README.zh-CN.md +222 -0
- package/bin/gotry-backend.js +53 -0
- package/bin/gotry-booking-copilot.js +53 -0
- package/bin/gotry-bootstrap.js +1788 -0
- package/bin/gotry-inner.js +733 -83
- package/bin/gotry-process-liveness.d.ts +27 -0
- package/bin/gotry-process-liveness.js +97 -0
- package/bin/gotry-runtime-resolution.d.ts +27 -0
- package/bin/gotry-runtime-resolution.js +49 -0
- package/bin/gotry.js +1 -1
- package/client/client.js +203 -0
- package/cordis.gotry-patch.yml +80 -56
- package/data/airline-airports.json +39 -0
- package/data/stations-12306-verify.json +524 -0
- package/dist/capabilities/agent-reach-deep.js +45 -122
- package/dist/capabilities/agent-reach.js +101 -146
- package/dist/capabilities/anything.js +161 -94
- package/dist/capabilities/artifacts.js +370 -0
- package/dist/capabilities/channel-health.js +131 -0
- package/dist/capabilities/channel-registry.js +256 -0
- package/dist/capabilities/doctor.js +553 -0
- package/dist/capabilities/effect.js +394 -0
- package/dist/capabilities/external-event.js +149 -0
- package/dist/capabilities/fact-log.js +55 -0
- package/dist/capabilities/flyai-config.js +337 -0
- package/dist/capabilities/flyai.js +947 -110
- package/dist/capabilities/fx-contract.js +293 -0
- package/dist/capabilities/geo-atlas.js +246 -0
- package/dist/capabilities/ground-transfer.js +676 -0
- package/dist/capabilities/hbcli.js +260 -123
- package/dist/capabilities/hotelbyte-transaction.js +194 -0
- package/dist/capabilities/incident-log.js +131 -61
- package/dist/capabilities/itinerary-artifact.js +190 -0
- package/dist/capabilities/itinerary-deck-artifact.js +194 -0
- package/dist/capabilities/itinerary-deck-export.js +339 -0
- package/dist/capabilities/lavish-local.js +924 -0
- package/dist/capabilities/model-override.js +38 -0
- package/dist/capabilities/opensky.js +54 -43
- package/dist/capabilities/provider-detail-sanitize.js +64 -0
- package/dist/capabilities/resilience.js +191 -0
- package/dist/capabilities/route-provider-conformance.js +341 -0
- package/dist/capabilities/session/action-cache.js +50 -44
- package/dist/capabilities/session/adapters/ctrip-flight.js +120 -62
- package/dist/capabilities/session/adapters/ctrip-hotel.js +222 -0
- package/dist/capabilities/session/adapters/dida-portal.js +274 -0
- package/dist/capabilities/session/adapters/meituan-local.js +35 -54
- package/dist/capabilities/session/adapters/rail-12306.js +342 -0
- package/dist/capabilities/session/benchmark.js +189 -0
- package/dist/capabilities/session/bridge-ledger.js +224 -0
- package/dist/capabilities/session/extension-bridge.js +636 -0
- package/dist/capabilities/session/extension-channel.js +109 -0
- package/dist/capabilities/session/extension-distribution.js +230 -0
- package/dist/capabilities/session/extract.js +31 -21
- package/dist/capabilities/session/golden-score.js +114 -0
- package/dist/capabilities/session/health-watch.js +215 -0
- package/dist/capabilities/session/read-guard.js +75 -24
- package/dist/capabilities/session/static-flight-golden.js +150 -0
- package/dist/capabilities/session/transport.js +97 -83
- package/dist/capabilities/session/wizard.js +117 -0
- package/dist/capabilities/session-consent.js +178 -0
- package/dist/capabilities/session-login.js +170 -0
- package/dist/capabilities/session-search.js +635 -44
- package/dist/capabilities/spawn-bounded.js +203 -0
- package/dist/capabilities/sponsor-plugin.js +341 -0
- package/dist/capabilities/visa-policy.js +140 -0
- package/dist/capabilities/weather.js +243 -138
- package/dist/data/session-golden-20.json +25 -0
- package/dist/data/sf-golden-manifest.json +103 -0
- package/dist/data/sf-static-routes.json +91 -0
- package/dist/scripts/action-cache-tests.js +24 -59
- package/dist/scripts/agent-planning-turn-deadline-e2e.js +242 -0
- package/dist/scripts/agent-planning-turn-deadline-tests.js +185 -0
- package/dist/scripts/agent-reach-deep-tests.js +30 -40
- package/dist/scripts/agent-reach-error-tests.js +354 -0
- package/dist/scripts/agent-reach-tests.js +26 -18
- package/dist/scripts/agent-reach-wrapper-tests.js +50 -50
- package/dist/scripts/anything-path-measure-tests.js +133 -0
- package/dist/scripts/anything-path-measure.js +150 -0
- package/dist/scripts/anything-tests.js +250 -60
- package/dist/scripts/artifact-client-contract-tests.js +220 -0
- package/dist/scripts/artifacts-capability-tests.js +727 -0
- package/dist/scripts/async-collect.js +50 -11
- package/dist/scripts/benchmark-environment-bridge-e2e.js +741 -0
- package/dist/scripts/benchmark-environment-bridge-tests.js +1452 -0
- package/dist/scripts/booking-copilot-availability-ledger-binding-tests.js +126 -0
- package/dist/scripts/booking-copilot-availability-policy-tests.js +265 -0
- package/dist/scripts/booking-copilot-bin-proof-tests.js +66 -0
- package/dist/scripts/booking-copilot-cleanup-proof-helper.js +76 -0
- package/dist/scripts/booking-copilot-crossrepo-fixture-server.js +144 -0
- package/dist/scripts/booking-copilot-dsh-core-proof-tests.js +424 -0
- package/dist/scripts/booking-copilot-dsh-planner-proof-tests.js +2839 -0
- package/dist/scripts/booking-copilot-dsh-plugin-proof-tests.js +309 -0
- package/dist/scripts/booking-copilot-dsh-readiness-proof.js +238 -0
- package/dist/scripts/booking-copilot-dsh-warmer-proof.js +126 -0
- package/dist/scripts/booking-copilot-event-sequence-concurrency-proof-tests.js +156 -0
- package/dist/scripts/booking-copilot-gap-code-contract-proof-tests.js +70 -0
- package/dist/scripts/booking-copilot-intent-proof-tests.js +422 -0
- package/dist/scripts/booking-copilot-operation-ledger-concurrency-proof-tests.js +184 -0
- package/dist/scripts/booking-copilot-planner-live-probe.js +95 -0
- package/dist/scripts/booking-copilot-proof-runtime.js +42 -0
- package/dist/scripts/booking-copilot-receipt-ledger-concurrency-proof-tests.js +210 -0
- package/dist/scripts/booking-copilot-runtime-proof-tests.js +2349 -0
- package/dist/scripts/booking-copilot-server-proof-tests.js +784 -0
- package/dist/scripts/booking-copilot-startup-proof-tests.js +94 -0
- package/dist/scripts/booking-executor-tests.js +80 -0
- package/dist/scripts/booking-recovery-chain-tests.js +182 -0
- package/dist/scripts/booking-saga-tests.js +125 -0
- package/dist/scripts/booking-surface-contract-proof-tests.js +212 -0
- package/dist/scripts/bootstrap-tests.js +1549 -0
- package/dist/scripts/bridge-events-tests.js +239 -0
- package/dist/scripts/bridge-ledger-tests.js +428 -0
- package/dist/scripts/build-changelog.js +238 -0
- package/dist/scripts/build-metrics-report.js +331 -0
- package/dist/scripts/changelog-tests.js +118 -0
- package/dist/scripts/channel-probe-tests.js +103 -0
- package/dist/scripts/channel-probe.js +169 -0
- package/dist/scripts/channel-registry-tests.js +208 -0
- package/dist/scripts/city-scenario-tier-tests.js +234 -0
- package/dist/scripts/companion-tests.js +25 -70
- package/dist/scripts/dida-cookie-probe.js +87 -0
- package/dist/scripts/dida-runner-stop-tests.js +311 -0
- package/dist/scripts/dida-sw-probe.js +114 -0
- package/dist/scripts/diff-test.js +17 -12
- package/dist/scripts/doctor-tests.js +600 -0
- package/dist/scripts/drill-multiuser-ledger-tests.js +1076 -0
- package/dist/scripts/drill-sdk-descendant-cleanup-tests.js +606 -0
- package/dist/scripts/drill-w2a-sensor-tests.js +788 -0
- package/dist/scripts/dsh-artifact-e2e.js +279 -0
- package/dist/scripts/dsh-artifact-web-e2e.js +675 -0
- package/dist/scripts/dsh-http-proxy-sse-proof.js +90 -0
- package/dist/scripts/dsh-llm-tests.js +437 -0
- package/dist/scripts/dsh-runtime-closure-tests.js +182 -0
- package/dist/scripts/dsh-runtime-closure.js +162 -0
- package/dist/scripts/dsh-session-v3-migration-proof.js +109 -0
- package/dist/scripts/dsh-subprocess-local-proof.js +150 -0
- package/dist/scripts/dsh-target-closure-proof.js +178 -0
- package/dist/scripts/effect-tests.js +539 -0
- package/dist/scripts/engine-run.js +1 -3
- package/dist/scripts/engine-tests.js +16 -10
- package/dist/scripts/evaluation-cadence-tests.js +174 -0
- package/dist/scripts/evaluation-contract-tests.js +268 -0
- package/dist/scripts/extension-distribution-cli.js +39 -0
- package/dist/scripts/extension-distribution-tests.js +443 -0
- package/dist/scripts/extension-tests.js +988 -0
- package/dist/scripts/external-event-tests.js +350 -0
- package/dist/scripts/fact-gate-tests.js +869 -0
- package/dist/scripts/fixtures/extension-bridge-unref-child.mjs +21 -0
- package/dist/scripts/flight-hotel-anchor-363-registered-e2e.js +169 -0
- package/dist/scripts/flight-malformed-tests.js +159 -0
- package/dist/scripts/flyai-setup-tests.js +228 -0
- package/dist/scripts/flyai-setup-tool-tests.js +54 -0
- package/dist/scripts/flyai-tests.js +692 -0
- package/dist/scripts/flyai-tool-registration-contract-tests.js +91 -0
- package/dist/scripts/fx-contract-tests.js +201 -0
- package/dist/scripts/g5-guard-tests.js +150 -0
- package/dist/scripts/g5-guard.js +193 -0
- package/dist/scripts/gen-lunar-anchors.js +106 -0
- package/dist/scripts/geo-atlas-tests.js +283 -0
- package/dist/scripts/gotry-backend-kernel-tests.js +206 -0
- package/dist/scripts/gotry-try-demo-tests.js +79 -0
- package/dist/scripts/gotry-try-demo.js +49 -0
- package/dist/scripts/ground-transfer-tests.js +956 -0
- package/dist/scripts/hbcli-e2e-tests.js +159 -0
- package/dist/scripts/hbcli-live-optin-tests.js +96 -0
- package/dist/scripts/hbcli-release-contract-tests.js +122 -0
- package/dist/scripts/hbcli-tests.js +121 -69
- package/dist/scripts/health-watch-cli.js +73 -0
- package/dist/scripts/hotel-date-gate-tests.js +496 -0
- package/dist/scripts/hotelbyte-reconcile-tests.js +141 -0
- package/dist/scripts/hotelbyte-spawn-e2e-tests.js +373 -0
- package/dist/scripts/i18n-tests.js +41 -0
- package/dist/scripts/incident-tests.js +281 -87
- package/dist/scripts/issue-194-job-id-guard-tests.js +106 -0
- package/dist/scripts/issue-233-cancel-refund-commission-tests.js +392 -0
- package/dist/scripts/issue-271-liveness-tests.js +569 -0
- package/dist/scripts/issue-289-model-retry-real-tests.js +296 -0
- package/dist/scripts/issue-289-model-retry-tests.js +441 -0
- package/dist/scripts/issue-289-web-retry-e2e.js +630 -0
- package/dist/scripts/issue-338-home-city-e2e.js +577 -0
- package/dist/scripts/issue343-real-entry-e2e.js +160 -0
- package/dist/scripts/issue436-persisted-routing-e2e.js +247 -0
- package/dist/scripts/itinerary-artifact-tests.js +368 -0
- package/dist/scripts/itinerary-deck-artifact-tests.js +416 -0
- package/dist/scripts/itinerary-deck-export-tests.js +552 -0
- package/dist/scripts/itinerary-deck-tests.js +435 -0
- package/dist/scripts/itinerary-html-tests.js +426 -0
- package/dist/scripts/journey-tests.js +22 -27
- package/dist/scripts/kernel-manifest-evidence.js +109 -0
- package/dist/scripts/kernel-manifest-gate.js +126 -0
- package/dist/scripts/kernel-manifest-tests.js +212 -0
- package/dist/scripts/kernel-manifest-trace-entry.js +7 -0
- package/dist/scripts/kernel-manifest-trace-hook.mjs +28 -0
- package/dist/scripts/kernel-manifest.js +369 -0
- package/dist/scripts/lavish-local-tests.js +1226 -0
- package/dist/scripts/lavish-product-tools-tests.js +537 -0
- package/dist/scripts/ledger-repair-apply-tests.js +316 -0
- package/dist/scripts/ledger-repair-plan-tests.js +375 -0
- package/dist/scripts/ledger-tests.js +382 -246
- package/dist/scripts/ledger-workflow-crash.js +10 -20
- package/dist/scripts/m3-cohort-tests.js +714 -0
- package/dist/scripts/m3-cohort.js +310 -0
- package/dist/scripts/managed-dsh-cleanup-diagnostic-proof.js +184 -0
- package/dist/scripts/managed-dsh-close-failure-proof.js +172 -0
- package/dist/scripts/managed-dsh-run-port-proof.js +153 -0
- package/dist/scripts/managed-dsh-terminal-proof.js +252 -0
- package/dist/scripts/map-tools-vendor-package-proof.js +365 -0
- package/dist/scripts/memory-capture-tests.js +242 -61
- package/dist/scripts/memory-decay-tests.js +18 -52
- package/dist/scripts/memory-lifecycle-tests.js +657 -0
- package/dist/scripts/memory-lifecycle.js +196 -0
- package/dist/scripts/memory-metrics.js +24 -12
- package/dist/scripts/memory-value-report.js +631 -0
- package/dist/scripts/memory-value-tests.js +328 -0
- package/dist/scripts/metrics-report-tests.js +151 -0
- package/dist/scripts/model-override-e2e.js +137 -0
- package/dist/scripts/nightly-evidence-tests.js +203 -0
- package/dist/scripts/nightly-evidence.js +303 -0
- package/dist/scripts/nudge-digest.js +39 -28
- package/dist/scripts/observability-tests.js +381 -0
- package/dist/scripts/onboarding-tests.js +161 -0
- package/dist/scripts/opensky-check.js +18 -13
- package/dist/scripts/opensky-tests.js +28 -28
- package/dist/scripts/outcome-projection-tests.js +427 -0
- package/dist/scripts/persona-sim-tests.js +603 -0
- package/dist/scripts/persona-sim.js +1081 -0
- package/dist/scripts/persona-surface-guard-tests.js +49 -0
- package/dist/scripts/pnpm-dsh-closure-proof.js +17 -0
- package/dist/scripts/policy-anchor-359-registered-e2e.js +214 -0
- package/dist/scripts/price-drift-tests.js +340 -0
- package/dist/scripts/price-drift-watch.js +447 -0
- package/dist/scripts/probe-poi-tests.js +53 -45
- package/dist/scripts/product-metrics.js +483 -0
- package/dist/scripts/publish-preverify.js +110 -0
- package/dist/scripts/realtime-pricing-tests.js +76 -0
- package/dist/scripts/recall-tests.js +513 -0
- package/dist/scripts/replay-async.js +22 -18
- package/dist/scripts/replay-real.js +18 -18
- package/dist/scripts/replay.js +54 -82
- package/dist/scripts/route-provider-conformance-tests.js +391 -0
- package/dist/scripts/session-attach-diagnose.js +20 -20
- package/dist/scripts/session-attach-poc.js +34 -37
- package/dist/scripts/session-benchmark.js +180 -0
- package/dist/scripts/session-dida-live-e2e.js +199 -0
- package/dist/scripts/session-extract-tests.js +14 -35
- package/dist/scripts/session-link-tests.js +478 -0
- package/dist/scripts/session-login.js +27 -46
- package/dist/scripts/session-tests.js +796 -96
- package/dist/scripts/session-zone-crash.js +49 -0
- package/dist/scripts/session-zone-ledger-tests.js +432 -0
- package/dist/scripts/session-zone-observation-tests.js +492 -0
- package/dist/scripts/session-zone-observe.js +135 -0
- package/dist/scripts/session-zone-wiring-tests.js +566 -0
- package/dist/scripts/session-zones-tests.js +374 -0
- package/dist/scripts/sf-live-benchmark.js +367 -0
- package/dist/scripts/sf-live-challenge-stop-tests.js +453 -0
- package/dist/scripts/sf-live-cli-tests.js +92 -0
- package/dist/scripts/sf-live-options.js +46 -0
- package/dist/scripts/sf-manifest-tests.js +30 -0
- package/dist/scripts/sf-manifest.js +33 -0
- package/dist/scripts/sf-soft-score-tests.js +67 -0
- package/dist/scripts/sf-summary-tests.js +324 -0
- package/dist/scripts/sf-summary.js +525 -0
- package/dist/scripts/share-tests.js +432 -0
- package/dist/scripts/skeleton-check.js +16 -14
- package/dist/scripts/skeleton-integration-test.js +28 -11
- package/dist/scripts/skills-contract-tests.js +51 -46
- package/dist/scripts/smoke-session-gate-tests.js +21 -0
- package/dist/scripts/smoke.js +690 -246
- package/dist/scripts/spawn-bounded-abort-tests.js +244 -0
- package/dist/scripts/sponsor-reuse-tests.js +262 -0
- package/dist/scripts/state-cli-tests.js +226 -101
- package/dist/scripts/state-cli.js +565 -198
- package/dist/scripts/state-repair-cli.js +66 -0
- package/dist/scripts/state-repair-tests.js +140 -0
- package/dist/scripts/static-golden-tests.js +165 -0
- package/dist/scripts/time-eval-tests.js +212 -192
- package/dist/scripts/travel-timeline-tests.js +29 -93
- package/dist/scripts/turn-handoff-collect-tests.js +169 -0
- package/dist/scripts/turn-handoff-collect.js +161 -0
- package/dist/scripts/turn-policy-tests.js +55 -0
- package/dist/scripts/typed-contract-canary.js +176 -0
- package/dist/scripts/tz-resolver-sanity.js +50 -0
- package/dist/scripts/tz-resolver-tests.js +584 -0
- package/dist/scripts/unified-tests.js +60 -20
- package/dist/scripts/visa-policy-tests.js +62 -0
- package/dist/scripts/weather-tests.js +276 -41
- package/dist/scripts/wish-channel-gate-tests.js +54 -0
- package/dist/scripts/write-gate-tests.js +522 -0
- package/dist/scripts/z3-lifecycle-fault-tests.js +188 -0
- package/dist/scripts/z3-lifecycle-tests.js +170 -0
- package/dist/scripts/z3-race-repeat-tests.js +39 -0
- package/dist/scripts/z3-race-tests.js +46 -0
- package/dist/src/artifact-gate.js +829 -0
- package/dist/src/backend/kernel.js +91 -0
- package/dist/src/backend/modules/booking-copilot.js +92 -0
- package/dist/src/backend/modules/booking-executor.js +124 -0
- package/dist/src/backend/modules/session-search.js +551 -0
- package/dist/src/benchmark-agent-conformance.js +578 -0
- package/dist/src/benchmark-environment-bridge.js +515 -0
- package/dist/src/benchmark-headless-child-diagnostics.js +166 -0
- package/dist/src/benchmark-tool-isolation.js +151 -0
- package/dist/src/bookable-facts.js +533 -0
- package/dist/src/booking-saga.js +97 -0
- package/dist/src/booking-surface/availability-policy.js +697 -0
- package/dist/src/booking-surface/booking-intent.js +43 -0
- package/dist/src/booking-surface/cancel-refund-commission.js +379 -0
- package/dist/src/booking-surface/canonical-schema.js +116 -0
- package/dist/src/booking-surface/contracts.js +75 -0
- package/dist/src/booking-surface/dsh-planner.js +1854 -0
- package/dist/src/booking-surface/dsh-plugin.js +378 -0
- package/dist/src/booking-surface/dsh-worker.js +98 -0
- package/dist/src/booking-surface/error-codes.js +231 -0
- package/dist/src/booking-surface/index.js +9 -0
- package/dist/src/booking-surface/managed-dsh-cleanup-diagnostic.js +97 -0
- package/dist/src/booking-surface/managed-dsh-run-port.js +244 -0
- package/dist/src/booking-surface/profile.js +24 -0
- package/dist/src/booking-surface/recovery-chain.js +367 -0
- package/dist/src/booking-surface/runtime.js +1968 -0
- package/dist/src/booking-surface/server.js +674 -0
- package/dist/src/booking-surface/startup.js +168 -0
- package/dist/src/booking-surface/validation.js +261 -0
- package/dist/src/bridge.js +20 -13
- package/dist/src/city-scenario-tier.js +378 -0
- package/dist/src/companions.js +48 -74
- package/dist/src/contracts.js +21 -43
- package/dist/src/dsh-llm.js +171 -115
- package/dist/src/engine.js +276 -193
- package/dist/src/evaluation-cadence.js +97 -0
- package/dist/src/evaluation-contracts.js +283 -0
- package/dist/src/flight-pack-adapter.js +54 -0
- package/dist/src/flight-pack-contract.js +2 -0
- package/dist/src/flyai-setup-tool.js +70 -0
- package/dist/src/gotry-backend.js +125 -0
- package/dist/src/hotel-date-gate.js +118 -0
- package/dist/src/i18n.js +88 -0
- package/dist/src/index.js +2385 -881
- package/dist/src/itinerary-deck.js +139 -0
- package/dist/src/itinerary-doc-shared.js +661 -0
- package/dist/src/itinerary-html.js +131 -0
- package/dist/src/journey.js +155 -108
- package/dist/src/lavish-tools.js +400 -0
- package/dist/src/ledger-repair-apply.js +538 -0
- package/dist/src/ledger-repair-plan.js +463 -0
- package/dist/src/loop.js +331 -161
- package/dist/src/m3-cohort.js +1577 -0
- package/dist/src/memory-capture.js +180 -32
- package/dist/src/memory-decay.js +30 -14
- package/dist/src/memory-lifecycle.js +1310 -0
- package/dist/src/memory-utility.js +27 -40
- package/dist/src/mock-llm.js +36 -61
- package/dist/src/model.js +81 -36
- package/dist/src/outcome-projection.js +746 -0
- package/dist/src/realtime-pricing.js +103 -0
- package/dist/src/recall/card.js +74 -0
- package/dist/src/recall/evaluator.js +140 -0
- package/dist/src/recall/integration.js +17 -0
- package/dist/src/recall/tick.js +166 -0
- package/dist/src/session-link/plan-it-action.js +48 -0
- package/dist/src/session-link/session-link.js +248 -0
- package/dist/src/session-zone-ledger.js +312 -0
- package/dist/src/session-zone-observation.js +354 -0
- package/dist/src/session-zone-wiring.js +658 -0
- package/dist/src/session-zones.js +510 -0
- package/dist/src/share/adapters.js +51 -0
- package/dist/src/share/share-consent.js +76 -0
- package/dist/src/share/share-deck.js +58 -0
- package/dist/src/share/share-token.js +146 -0
- package/dist/src/slot-spec.js +84 -106
- package/dist/src/state-ledger.js +696 -524
- package/dist/src/state-repair.js +299 -0
- package/dist/src/subagent-job-id-guard.js +58 -0
- package/dist/src/time-anchor.js +231 -33
- package/dist/src/tool-packet.js +20 -8
- package/dist/src/travel-slots.js +58 -35
- package/dist/src/travel-timeline.js +44 -63
- package/dist/src/turn-deadline.js +287 -0
- package/dist/src/turn-policy.js +118 -0
- package/dist/src/tz-resolver.js +143 -0
- package/dist/src/unified.js +600 -360
- package/dist/src/wish-pool.js +42 -12
- package/dist/src/write-gate.js +495 -0
- package/dist/src/z3-shared.js +284 -0
- package/extension/README.md +21 -0
- package/extension/README.zh-CN.md +21 -0
- package/extension/background.js +463 -0
- package/extension/content-bridge.js +270 -0
- package/extension/content-main.js +111 -0
- package/extension/manifest.json +60 -0
- package/package.json +407 -14
- package/schemas/booking.intent.schema.json +193 -0
- package/schemas/booking.surface.schema.json +2622 -0
- package/ts/capabilities/agent-reach-deep.ts +114 -0
- package/ts/capabilities/agent-reach.ts +198 -0
- package/ts/capabilities/anything.ts +282 -0
- package/ts/capabilities/artifacts.ts +428 -0
- package/ts/capabilities/fact-log.ts +54 -0
- package/ts/capabilities/flyai-config.ts +388 -0
- package/ts/capabilities/flyai.ts +1274 -0
- package/ts/capabilities/hbcli.ts +253 -71
- package/ts/capabilities/incident-log.ts +88 -59
- package/ts/capabilities/itinerary-artifact.ts +214 -0
- package/ts/capabilities/itinerary-deck-artifact.ts +218 -0
- package/ts/capabilities/itinerary-deck-export.ts +378 -0
- package/ts/capabilities/opensky.ts +121 -0
- package/ts/capabilities/session/action-cache.ts +148 -0
- package/ts/capabilities/session/adapters/ctrip-flight.ts +181 -0
- package/ts/capabilities/session/adapters/ctrip-hotel.ts +238 -0
- package/ts/capabilities/session/adapters/dida-portal.ts +338 -0
- package/ts/capabilities/session/adapters/meituan-local.ts +70 -0
- package/ts/capabilities/session/adapters/rail-12306.ts +392 -0
- package/ts/capabilities/session/benchmark.ts +276 -0
- package/ts/capabilities/session/bridge-ledger.ts +333 -0
- package/ts/capabilities/session/extension-bridge.ts +794 -0
- package/ts/capabilities/session/extension-channel.ts +144 -0
- package/ts/capabilities/session/extension-distribution.ts +266 -0
- package/ts/capabilities/session/extract.ts +54 -0
- package/ts/capabilities/session/golden-score.ts +139 -0
- package/ts/capabilities/session/health-watch.ts +264 -0
- package/ts/capabilities/session/read-guard.ts +141 -0
- package/ts/capabilities/session/static-flight-golden.ts +209 -0
- package/ts/capabilities/session/transport.ts +146 -0
- package/ts/capabilities/session/wizard.ts +140 -0
- package/ts/capabilities/session-consent.ts +211 -0
- package/ts/capabilities/session-login.ts +208 -0
- package/ts/capabilities/session-search.ts +893 -0
- package/ts/capabilities/weather.ts +330 -0
- package/ts/dsh-runtime/vendor/README.md +68 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/LICENSE +21 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/README.en.md +405 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/README.md +404 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/client/client.js +1584 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/cordis.patch.yml +5 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/icon.svg +5 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/clients/amap.js +595 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/clients/nominatim.js +63 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/clients/osrm.js +58 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/clients/photon.js +55 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/config-file.js +87 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/config-route.js +131 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/config.js +16 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/geo.js +232 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/index.js +120 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/settings-ns.js +40 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/staticmap-route.js +115 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/tools/geocode.js +127 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/tools/poi.js +84 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/tools/routes.js +267 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/clients/amap.d.ts +90 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/clients/nominatim.d.ts +17 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/clients/osrm.d.ts +15 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/clients/photon.d.ts +22 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/config-file.d.ts +33 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/config-route.d.ts +23 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/config.d.ts +23 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/geo.d.ts +61 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/index.d.ts +18 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/settings-ns.d.ts +14 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/staticmap-route.d.ts +31 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/tools/geocode.d.ts +11 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/tools/poi.d.ts +9 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/tools/routes.d.ts +75 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/types.d.ts +68 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types.js +16 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/package.json +97 -0
- package/ts/package.json +293 -3
- package/ts/scripts/async-collect.ts +91 -0
- package/ts/scripts/map-tools-vendor-package-proof.ts +404 -0
- package/ts/scripts/skeleton-check.ts +1 -1
- package/ts/scripts/skeleton-integration-test.ts +23 -1
- package/ts/scripts/state-cli.ts +586 -0
- package/ts/scripts/turn-handoff-collect.ts +178 -0
- package/ts/src/artifact-gate.ts +991 -0
- package/ts/src/benchmark-agent-conformance.ts +619 -0
- package/ts/src/benchmark-environment-bridge.ts +538 -0
- package/ts/src/benchmark-headless-child-diagnostics.ts +184 -0
- package/ts/src/benchmark-tool-isolation.ts +166 -0
- package/ts/src/bookable-facts.ts +837 -0
- package/ts/src/booking-saga.ts +133 -0
- package/ts/src/booking-surface/availability-policy.ts +522 -0
- package/ts/src/booking-surface/booking-intent.ts +86 -0
- package/ts/src/booking-surface/cancel-refund-commission.ts +488 -0
- package/ts/src/booking-surface/canonical-schema.js +116 -0
- package/ts/src/booking-surface/contracts.ts +475 -0
- package/ts/src/booking-surface/dsh-planner.ts +1949 -0
- package/ts/src/booking-surface/dsh-plugin.js +378 -0
- package/ts/src/booking-surface/dsh-worker.ts +110 -0
- package/ts/src/booking-surface/error-codes.ts +241 -0
- package/ts/src/booking-surface/index.ts +9 -0
- package/ts/src/booking-surface/managed-dsh-cleanup-diagnostic.ts +151 -0
- package/ts/src/booking-surface/managed-dsh-run-port.ts +273 -0
- package/ts/src/booking-surface/profile.ts +42 -0
- package/ts/src/booking-surface/recovery-chain.ts +409 -0
- package/ts/src/booking-surface/runtime.ts +1793 -0
- package/ts/src/booking-surface/server.ts +733 -0
- package/ts/src/booking-surface/startup.ts +201 -0
- package/ts/src/booking-surface/validation.ts +217 -0
- package/ts/src/companions.ts +113 -0
- package/ts/src/contracts.ts +17 -3
- package/ts/src/dsh-llm.ts +152 -17
- package/ts/src/flyai-setup-tool.ts +77 -0
- package/ts/src/index.ts +2123 -200
- package/ts/src/itinerary-deck.ts +189 -0
- package/ts/src/itinerary-doc-shared.ts +741 -0
- package/ts/src/itinerary-html.ts +171 -0
- package/ts/src/loop.ts +234 -26
- package/ts/src/memory-capture.ts +283 -0
- package/ts/src/memory-decay.ts +55 -0
- package/ts/src/memory-utility.ts +70 -0
- package/ts/src/mock-llm.ts +4 -8
- package/ts/src/model.ts +88 -2
- package/ts/src/recall/card.ts +106 -0
- package/ts/src/recall/evaluator.ts +170 -0
- package/ts/src/recall/integration.ts +35 -0
- package/ts/src/recall/tick.ts +213 -0
- package/ts/src/session-link/plan-it-action.ts +78 -0
- package/ts/src/session-link/session-link.ts +275 -0
- package/ts/src/share/adapters.ts +93 -0
- package/ts/src/share/share-consent.ts +105 -0
- package/ts/src/share/share-deck.ts +85 -0
- package/ts/src/share/share-token.ts +166 -0
- package/ts/src/slot-spec.ts +172 -0
- package/ts/src/state-ledger.ts +1166 -0
- package/ts/src/subagent-job-id-guard.ts +72 -0
- package/ts/src/time-anchor.ts +338 -0
- package/ts/src/tool-packet.ts +32 -0
- package/ts/src/travel-slots.ts +219 -0
- package/ts/src/travel-timeline.ts +83 -0
- package/ts/src/turn-deadline.ts +366 -0
- package/ts/src/turn-policy.ts +154 -0
- package/ts/src/unified.ts +444 -105
- package/ts/src/wish-pool.ts +79 -0
- package/dist/scripts/session-attach-wait.js +0 -41
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GoTry Session Bridge — ISOLATED-world 桥(manifest 默认 world,document_start)。
|
|
3
|
+
*
|
|
4
|
+
* MAIN world(content-main.js)拿不到 chrome API;本脚本监听页面里的
|
|
5
|
+
* gotry-ctrip-sniff 自定义事件,把响应文本经 chrome.runtime.sendMessage 转发给
|
|
6
|
+
* Service Worker(onMessage 按 sender.tab.id 归属到对应 search job)。
|
|
7
|
+
*
|
|
8
|
+
* 附带页标题快报(gotry-page):SW 在嗅探超时/挑战判定(CHALLENGE_RE)时用它。
|
|
9
|
+
*
|
|
10
|
+
* Join 投递(2026-09-11,hotelbyte 产品定案):hotel-be portal 在员工已登录的
|
|
11
|
+
* 页面里挂一段 `window.__gotryJoinTicket = {...}` 即可,本脚本负责:
|
|
12
|
+
* - 页面派发 ticket → SW 静默接收(员工全程不接触 URL/token);
|
|
13
|
+
* - ticket 未注入 → 静默 no-op(扩展安静等下次 portal 页加载);
|
|
14
|
+
* - portal 自己负责派发的合规性(token 由 portal 后端签发,扩展不验签,
|
|
15
|
+
* Node 侧 gotry-backend 经 Bearer 校验——信任链在 hotel-be ↔ gotry-backend 之间)。
|
|
16
|
+
*
|
|
17
|
+
* 代填登录(2026-09-21,hotel-fe#3713 形态 A「免密进入门户」):
|
|
18
|
+
* - portal 页把**一次性凭据载荷**({site,loginUrl,username,password,字段名})经
|
|
19
|
+
* `window.__gotryPortalLogin` + 同名事件投给 SW;SW 打开登录页后回派本脚本填表。
|
|
20
|
+
* - 载荷只在本脚本/本次调用内存活:不写 DOM 之外的面、不回传账密、不落持久存储
|
|
21
|
+
* (扩展无 storage 权限,见 §38 合同);填完即弃。
|
|
22
|
+
* - 站点配方(dida 等):勾选协议框 + 触发原生提交,避免 React 受控输入吞值。
|
|
23
|
+
*/
|
|
24
|
+
;(function () {
|
|
25
|
+
if (window.__gotrySniffBridge) return
|
|
26
|
+
window.__gotrySniffBridge = true
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* portal 安装检测契约(2026-09-24 hotel-fe#3802):hotel-fe 安装横幅只认
|
|
30
|
+
* <body data-portal-helper-installed="true">——旧 portal-helper 的遗留契约,
|
|
31
|
+
* 横幅侧注明「unchanged until portal-helper retirement」,本扩展必须对齐,
|
|
32
|
+
* 否则装了横幅也不消失。document_start 时 body 常未就绪 → DOMContentLoaded
|
|
33
|
+
* 兜底;ISOLATED world 写 DOM 属性对页面主世界可见。
|
|
34
|
+
*/
|
|
35
|
+
var INSTALLED_ATTR = 'data-portal-helper-installed'
|
|
36
|
+
function markInstalled() {
|
|
37
|
+
if (document.body) document.body.setAttribute(INSTALLED_ATTR, 'true')
|
|
38
|
+
}
|
|
39
|
+
if (document.body) markInstalled()
|
|
40
|
+
else document.addEventListener('DOMContentLoaded', markInstalled, { once: true })
|
|
41
|
+
|
|
42
|
+
function dispatchJoinTicket(ev) {
|
|
43
|
+
try {
|
|
44
|
+
// 本脚本跑在隔离世界:页面主世界设置的 window 属性读不到,票据本体必须
|
|
45
|
+
// 走事件的 detail(2026-09-21 hotel-fe#3713 E2E 实证);window 属性仅作
|
|
46
|
+
// MAIN-world 观察面兜底,取不到就安静等下一次事件。
|
|
47
|
+
var t = (ev && ev.detail && ev.detail.ticket) || window.__gotryJoinTicket
|
|
48
|
+
if (!t || typeof t.bridgeUrl !== 'string' || !t.bridgeUrl) return
|
|
49
|
+
chrome.runtime.sendMessage({ type: 'gotry-join', ticket: t }).catch(function () { /* SW 重启中 */ })
|
|
50
|
+
} catch { /* 不抛 */ }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** portal 页投递的一次性凭据载荷 → SW(载荷随消息过手即弃,不落任何存储) */
|
|
54
|
+
function dispatchPortalLogin(ev) {
|
|
55
|
+
try {
|
|
56
|
+
var p = (ev && ev.detail && ev.detail.payload) || window.__gotryPortalLogin
|
|
57
|
+
if (!p || typeof p.loginUrl !== 'string' || !p.loginUrl) return
|
|
58
|
+
chrome.runtime.sendMessage({ type: 'gotry-portal-login', payload: p }).catch(function () {})
|
|
59
|
+
} catch { /* 不抛 */ }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* workspace 事件(批次 B,2026-10-01):页面派发 gotry-workspace-event-available
|
|
64
|
+
* 即把 detail(事件本体 {kind,site?,subject,payload_json,clientTs?,idem_key?})经
|
|
65
|
+
* chrome.runtime.sendMessage 转发 SW——照抄 gotry-join-ticket-available 的转发模式;
|
|
66
|
+
* 本脚本不读不存任何 cookie、零 storage,事件过手即弃(持久面在 SW 侧内存 buffer)。
|
|
67
|
+
*/
|
|
68
|
+
function dispatchWorkspaceEvent(ev) {
|
|
69
|
+
try {
|
|
70
|
+
var d = (ev && ev.detail) || null
|
|
71
|
+
if (!d || typeof d !== 'object' || typeof d.kind !== 'string' || !d.kind) return
|
|
72
|
+
chrome.runtime.sendMessage({ type: 'gotry-workspace-event', event: d }).catch(function () { /* SW 重启中,事件即弃 */ })
|
|
73
|
+
} catch { /* 不抛 */ }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** 原生设值:React 受控 input 需走原型 setter + input/change 事件,直接赋 value 会被吞 */
|
|
77
|
+
function setNativeValue(el, value) {
|
|
78
|
+
var desc = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(el), 'value')
|
|
79
|
+
if (desc && desc.set) desc.set.call(el, value)
|
|
80
|
+
else el.value = value
|
|
81
|
+
el.dispatchEvent(new Event('input', { bubbles: true }))
|
|
82
|
+
el.dispatchEvent(new Event('change', { bubbles: true }))
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** 按站点配方填表并提交;返回结果不含任何账密(红线:只有布尔/错误文案) */
|
|
86
|
+
function fillLogin(payload) {
|
|
87
|
+
var uf = payload.usernameField || 'username'
|
|
88
|
+
var pf = payload.passwordField || 'password'
|
|
89
|
+
var user = document.querySelector('input[name="' + uf + '"]')
|
|
90
|
+
|| document.querySelector('input[type="text"], input[type="email"]')
|
|
91
|
+
var pass = document.querySelector('input[name="' + pf + '"]')
|
|
92
|
+
|| document.querySelector('input[type="password"]')
|
|
93
|
+
if (!user || !pass) return { ok: false, error: 'login inputs not found' }
|
|
94
|
+
setNativeValue(user, payload.username)
|
|
95
|
+
setNativeValue(pass, payload.password)
|
|
96
|
+
// 协议框:登录页常见「已阅读并同意」前置,未勾选则点选(按文案匹配,不靠下标)
|
|
97
|
+
var boxes = document.querySelectorAll('input[type="checkbox"]')
|
|
98
|
+
for (var i = 0; i < boxes.length; i++) {
|
|
99
|
+
var box = boxes[i]
|
|
100
|
+
if (box.checked) continue
|
|
101
|
+
var label = ''
|
|
102
|
+
try { label = ((box.closest('label,div') || box.parentElement || {}).textContent || '') } catch { label = '' }
|
|
103
|
+
if (/agree|agreement|terms|service|协议|同意/i.test(label)) box.click()
|
|
104
|
+
}
|
|
105
|
+
var btn = null
|
|
106
|
+
var buttons = document.querySelectorAll('button, input[type="submit"]')
|
|
107
|
+
for (var j = 0; j < buttons.length; j++) {
|
|
108
|
+
var b = buttons[j]
|
|
109
|
+
if ((b.type === 'submit' || b.tagName === 'BUTTON') && /log\s*-?\s*in|sign\s*-?\s*in|登录/i.test(b.textContent || b.value || '')) { btn = b; break }
|
|
110
|
+
}
|
|
111
|
+
if (btn) btn.click()
|
|
112
|
+
else {
|
|
113
|
+
var form = user.form || (user.closest && user.closest('form'))
|
|
114
|
+
if (form && typeof form.requestSubmit === 'function') form.requestSubmit()
|
|
115
|
+
else if (form) form.submit()
|
|
116
|
+
else return { ok: false, error: 'no submit target' }
|
|
117
|
+
}
|
|
118
|
+
return { ok: true, filled: true }
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
chrome.runtime.onMessage.addListener(function (msg, _sender, sendResponse) {
|
|
122
|
+
if (msg && msg.type === 'gotry-fill-login') {
|
|
123
|
+
var result
|
|
124
|
+
try { result = fillLogin(msg.payload || {}) } catch (e) { result = { ok: false, error: String((e && e.message) || e).slice(0, 120) } }
|
|
125
|
+
sendResponse && sendResponse(result)
|
|
126
|
+
return false
|
|
127
|
+
}
|
|
128
|
+
if (msg && msg.type === 'gotry-dida-search') {
|
|
129
|
+
// 驱动 dida 门户目的地搜索(2026-09-21 实测定型:目的地组首项 + button[name=search])
|
|
130
|
+
runDidaSearch(msg.params || {})
|
|
131
|
+
.then(function (r) { sendResponse && sendResponse(r) })
|
|
132
|
+
.catch(function (e) { sendResponse && sendResponse({ ok: false, error: String((e && e.message) || e).slice(0, 120) }) })
|
|
133
|
+
return true // 异步响应
|
|
134
|
+
}
|
|
135
|
+
return false
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* dida 门户「目的地搜索」配方(2026-09-21 Chrome 实测跑通)。
|
|
140
|
+
* 步骤:关 cookie 授权弹窗 → 填城市 → 点「目的地」组首项 → 点查询按钮 → 等跳 /hotel/list。
|
|
141
|
+
* 返回落地 URL(含 regionID/日期/入住参数)——日期不驱动(门户用自身默认值),
|
|
142
|
+
* 由调用方按落地 URL 的参数格式重写日期后再导航,避免与门户日期选择器耦合。
|
|
143
|
+
*/
|
|
144
|
+
function runDidaSearch(params) {
|
|
145
|
+
var sleep = function (ms) { return new Promise(function (r) { setTimeout(r, ms) }) }
|
|
146
|
+
var norm = function (t) { return String(t || '').replace(/\s+/g, ' ').trim() }
|
|
147
|
+
var log = []
|
|
148
|
+
|
|
149
|
+
function closeCookieModal() {
|
|
150
|
+
var wrap = document.querySelector('.ant-modal-wrap')
|
|
151
|
+
if (!wrap) return
|
|
152
|
+
var btn = Array.prototype.slice.call(wrap.querySelectorAll('button')).find(function (b) { return /确定|接受所有Cookie|Accept/i.test(norm(b.textContent)) })
|
|
153
|
+
if (btn) { btn.click(); log.push('cookie-modal-closed') }
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function setNativeValueState(el, value) {
|
|
157
|
+
var desc = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(el), 'value')
|
|
158
|
+
if (desc && desc.set) desc.set.call(el, value); else el.value = value
|
|
159
|
+
el.dispatchEvent(new Event('input', { bubbles: true }))
|
|
160
|
+
el.dispatchEvent(new Event('change', { bubbles: true }))
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
closeCookieModal()
|
|
164
|
+
return sleep(500).then(function () {
|
|
165
|
+
var tries = 0
|
|
166
|
+
return new Promise(function (resolve) {
|
|
167
|
+
(function waitInput() {
|
|
168
|
+
var el = document.querySelector('input[placeholder*="城市"]')
|
|
169
|
+
if (el) return resolve(el)
|
|
170
|
+
if (++tries > 40) return resolve(null)
|
|
171
|
+
setTimeout(waitInput, 500)
|
|
172
|
+
})()
|
|
173
|
+
})
|
|
174
|
+
}).then(function (input) {
|
|
175
|
+
if (!input) return { ok: false, step: 'city-input', log: log }
|
|
176
|
+
input.focus(); input.click()
|
|
177
|
+
setNativeValueState(input, String(params.city || ''))
|
|
178
|
+
log.push('city-typed')
|
|
179
|
+
return sleep(3500)
|
|
180
|
+
}).then(function () {
|
|
181
|
+
// 目的地候选:优先「目的地」组首项,退化为第一个候选
|
|
182
|
+
var deadline = Date.now() + 12000
|
|
183
|
+
return new Promise(function (resolve) {
|
|
184
|
+
(function tryPick() {
|
|
185
|
+
var groups = Array.prototype.slice.call(document.querySelectorAll('.nd-suggestion-result__group'))
|
|
186
|
+
var item = null
|
|
187
|
+
for (var i = 0; i < groups.length; i++) {
|
|
188
|
+
var first = groups[i].querySelector('.nd-suggestion-item')
|
|
189
|
+
if (!first) continue
|
|
190
|
+
if (!item) item = first
|
|
191
|
+
var label = norm((groups[i].querySelector('.nd-suggestion-search__label') || {}).textContent)
|
|
192
|
+
if (label === '目的地') { item = first; break }
|
|
193
|
+
}
|
|
194
|
+
if (!item) item = document.querySelector('.nd-suggestion-item')
|
|
195
|
+
if (item) { var label2 = norm(item.textContent).slice(0, 40); item.click(); log.push('picked:' + label2); return resolve({ ok: true, picked: label2 }) }
|
|
196
|
+
if (Date.now() > deadline) return resolve({ ok: false, step: 'suggestion', log: log })
|
|
197
|
+
setTimeout(tryPick, 400)
|
|
198
|
+
})()
|
|
199
|
+
})
|
|
200
|
+
}).then(function (pick) {
|
|
201
|
+
if (!pick.ok) return pick
|
|
202
|
+
return sleep(1500).then(function () {
|
|
203
|
+
var btn = document.querySelector('button[name="search"]') || document.querySelector('.hotel-search__search-button')
|
|
204
|
+
if (!btn) return { ok: false, step: 'search-button', picked: pick.picked, log: log }
|
|
205
|
+
btn.click(); log.push('search-clicked')
|
|
206
|
+
var tries = 0
|
|
207
|
+
return new Promise(function (resolve) {
|
|
208
|
+
(function waitList() {
|
|
209
|
+
if (/\/hotel\/list/.test(location.pathname)) return resolve({ ok: true, picked: pick.picked, url: location.href, log: log })
|
|
210
|
+
if (++tries > 40) return resolve({ ok: false, step: 'navigation', url: location.href, log: log })
|
|
211
|
+
setTimeout(waitList, 500)
|
|
212
|
+
})()
|
|
213
|
+
})
|
|
214
|
+
})
|
|
215
|
+
})
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
window.addEventListener('gotry-ctrip-sniff', function (ev) {
|
|
219
|
+
try {
|
|
220
|
+
var d = (ev && ev.detail) || {}
|
|
221
|
+
if (!d.body) return
|
|
222
|
+
chrome.runtime.sendMessage({
|
|
223
|
+
type: 'gotry-sniff',
|
|
224
|
+
url: d.url,
|
|
225
|
+
body: d.body,
|
|
226
|
+
title: document.title || '',
|
|
227
|
+
}).catch(function () { /* SW 重启中,下一条嗅探再投 */ })
|
|
228
|
+
} catch { /* 不抛 */ }
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
/** 页面级挑战标记(2026-09-21):风控/验证码面在 DOM 上的稳定特征。
|
|
232
|
+
* 为什么必须由页面侧判定:网关侧原先拿**嗅探到的供应商响应体**扫「验证|captcha」,
|
|
233
|
+
* 会把酒店名(如「经过验证的净零酒店」)误判成风控 → dida 通道恒 challenged。 */
|
|
234
|
+
function challengeHint() {
|
|
235
|
+
try {
|
|
236
|
+
var sel = 'iframe[src*="captcha" i], .nc_wrapper, #nc_1_wrapper, .geetest_holder, .geetest_panel, [id*="captcha" i], [class*="captcha" i], [class*="slider-verify" i], [class*="verify-wrap" i]'
|
|
237
|
+
if (document.querySelector(sel)) return true
|
|
238
|
+
var text = ((document.body && document.body.innerText) || '').slice(0, 2000)
|
|
239
|
+
return /请完成验证|拖动滑块|安全验证|请输入验证码|人机验证/.test(text)
|
|
240
|
+
} catch { return false }
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function sendPage() {
|
|
244
|
+
try {
|
|
245
|
+
chrome.runtime.sendMessage({
|
|
246
|
+
type: 'gotry-page',
|
|
247
|
+
title: document.title || '',
|
|
248
|
+
url: location.href,
|
|
249
|
+
challenge: challengeHint(),
|
|
250
|
+
}).catch(function () { /* SW 侧无等待者,常态丢弃 */ })
|
|
251
|
+
} catch { /* 环境异常不抛 */ }
|
|
252
|
+
}
|
|
253
|
+
// 页面派发新票据时重取(2026-09-11,hotel-be 侧 C16 落地配套):
|
|
254
|
+
// portal 的票据是**异步**取回的(fetch bridgeTicket),通常晚于 DOMContentLoaded,
|
|
255
|
+
// 上面那次一次性读取会错过;hotel-be 每次写入/刷新 window.__gotryJoinTicket 都会
|
|
256
|
+
// 在 window 上派发该事件 → 这里重取一次即可(不需要轮询,也不引入任何配置面)。
|
|
257
|
+
window.addEventListener('gotry-join-ticket-available', dispatchJoinTicket)
|
|
258
|
+
window.addEventListener('gotry-portal-login-available', dispatchPortalLogin)
|
|
259
|
+
// workspace 事件是纯 CustomEvent(无 window 属性面,无一次性读取——document_start
|
|
260
|
+
// 注入保证本监听先于页面脚本注册,派发即转发,错过即弃)。
|
|
261
|
+
window.addEventListener('gotry-workspace-event-available', dispatchWorkspaceEvent)
|
|
262
|
+
|
|
263
|
+
if (document.readyState === 'loading') {
|
|
264
|
+
window.addEventListener('DOMContentLoaded', function () { sendPage(); dispatchJoinTicket(); dispatchPortalLogin() }, { once: true })
|
|
265
|
+
} else {
|
|
266
|
+
sendPage()
|
|
267
|
+
dispatchJoinTicket()
|
|
268
|
+
dispatchPortalLogin()
|
|
269
|
+
}
|
|
270
|
+
})()
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GoTry Session Bridge — MAIN-world 网络嗅探(manifest world:"MAIN",document_start)。
|
|
3
|
+
*
|
|
4
|
+
* MAIN world 没有 chrome.runtime,只负责:hook 站点自己的 fetch/XHR,把命中
|
|
5
|
+
* 嗅探面的响应文本以 CustomEvent 派发到页面里;ISOLATED 侧的 content-bridge.js
|
|
6
|
+
* 监听事件并经 chrome.runtime 转发给 Service Worker。
|
|
7
|
+
*
|
|
8
|
+
* 嗅探面(与 Node 侧 adapters/ctrip-flight.ts NETWORK_HINTS、adapters/ctrip-hotel.ts
|
|
9
|
+
* HOTEL_NETWORK_HINTS、adapters/rail-12306.ts TRAIN_NETWORK_HINTS 对账,run-all §38
|
|
10
|
+
* 防漂移断言守住):
|
|
11
|
+
* - 机票:search/api/search/batchSearch(精确接口)
|
|
12
|
+
* - 酒店(2026-09-03 实装):URL hint 多版接口名 + **形状嗅探兜底**——响应体
|
|
13
|
+
* JSON 含酒店清单签名即转发,对接口改名免疫(接口名公开资料多版并存,首个
|
|
14
|
+
* 真会话后校准,D-13 同款边界)
|
|
15
|
+
*
|
|
16
|
+
* 只读被动转发:不修改请求、不重放、不伪造(§2.3 反模式红线)——响应由站点自己的
|
|
17
|
+
* 代码发出,我们只听。
|
|
18
|
+
*/
|
|
19
|
+
;(function () {
|
|
20
|
+
if (window.__gotrySniffInstalled) return
|
|
21
|
+
window.__gotrySniffInstalled = true
|
|
22
|
+
|
|
23
|
+
var FLIGHT_HINT_RE = /search\/api\/search\/batchSearch/
|
|
24
|
+
var HOTEL_HINT_RE = /hotels\.ctrip\.com\/(hotels\/api|domestic\/pc\/api)|GetHotelListBySOA|GetHotelListByCity|HotelSearch|hotelsearch|restapi\/soa2\/\d+\/fetchHotelList/i
|
|
25
|
+
/** 火车(2026-09-03 实装):12306 余票查询 XHR(负载均衡变体 queryG/Z/A/U 全命中) */
|
|
26
|
+
var TRAIN_HINT_RE = /leftTicket\/query/i
|
|
27
|
+
/** Dida 供应商门户(2026-09-09 实装):portal-webapi 实时价/价格监控
|
|
28
|
+
* (与 Node 侧 DIDA_NETWORK_HINTS 对账,run-all §38 防漂移断言守住) */
|
|
29
|
+
var DIDA_HINT_RE = /portal-webapi\.dida\.com\/HotelPriceAPI\/SearchRealTime|portal-webapi\.dida\.com\/HotelPriceAPI\/SearchMonitor|portal-webapi\.dida\.com\/HotelPriceAPI\/SearchCache|portal-webapi\.dida\.com\/HotelRecommendAPI\/SearchHomepageRecommendHotels|portal-webapi\.dida\.com\/HotelRecommendAPI\/SearchHomepageRecommendPrices|portal-webapi\.dida\.com\/PopularDestinationAPI\/SearchHotels|portal-webapi\.dida\.com\/PopularDestinationAPI\/SearchHotelPrices/i
|
|
30
|
+
/** 形状嗅探签名(dida 实时价信封;与 Node 侧 looksLikeDidaRatesBody 签名一致) */
|
|
31
|
+
var DIDA_BODY_SIG_RE = /"HotelPriceList"|"RatePlanList"/
|
|
32
|
+
/** 形状嗅探(酒店页兜底;与 Node 侧 looksLikeHotelListBody 签名一致) */
|
|
33
|
+
var HOTEL_BODY_SIG_RE = /"hotelList"|"hotelMatchInfos"|"hotelName"/
|
|
34
|
+
var HOTEL_BODY_MAX = 2_000_000
|
|
35
|
+
var isHotelPage = /(^|\.)hotels\.ctrip\.com$/.test(location.hostname)
|
|
36
|
+
var isTrainPage = /(^|\.)12306\.cn$/.test(location.hostname)
|
|
37
|
+
var isDidaPage = /(^|\.)portal\.dida\.com$/.test(location.hostname)
|
|
38
|
+
|
|
39
|
+
function dispatch(url, body) {
|
|
40
|
+
try {
|
|
41
|
+
window.dispatchEvent(new CustomEvent('gotry-ctrip-sniff', { detail: { url: String(url), body: String(body) } }))
|
|
42
|
+
} catch { /* 页面环境异常不抛 */ }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function hotelPageWants(url) {
|
|
46
|
+
return isHotelPage && (HOTEL_HINT_RE.test(url) || FLIGHT_HINT_RE.test(url))
|
|
47
|
+
}
|
|
48
|
+
function trainPageWants(url) {
|
|
49
|
+
return isTrainPage && TRAIN_HINT_RE.test(url)
|
|
50
|
+
}
|
|
51
|
+
function didaPageWants(url) {
|
|
52
|
+
return isDidaPage && DIDA_HINT_RE.test(url)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var origFetch = window.fetch
|
|
56
|
+
if (typeof origFetch === 'function') {
|
|
57
|
+
window.fetch = function (input, init) {
|
|
58
|
+
return origFetch.apply(this, arguments).then(function (res) {
|
|
59
|
+
try {
|
|
60
|
+
var url = ''
|
|
61
|
+
if (typeof input === 'string') url = input
|
|
62
|
+
else if (input && typeof input.url === 'string') url = input.url
|
|
63
|
+
var urlHint = FLIGHT_HINT_RE.test(url) || hotelPageWants(url) || trainPageWants(url) || didaPageWants(url)
|
|
64
|
+
var isPost = false
|
|
65
|
+
try { isPost = String((init && init.method) || (input && input.method) || 'GET').toUpperCase() === 'POST' } catch { /* ignore */ }
|
|
66
|
+
var capOk = true
|
|
67
|
+
try {
|
|
68
|
+
var len = Number(res.headers && res.headers.get('content-length'))
|
|
69
|
+
if (isHotelPage && !urlHint && len > HOTEL_BODY_MAX) capOk = false
|
|
70
|
+
} catch { /* 头不可读则放行小体兜底 */ }
|
|
71
|
+
if (urlHint || (isHotelPage && isPost && capOk)) {
|
|
72
|
+
var clone = res.clone()
|
|
73
|
+
clone.text().then(function (t) {
|
|
74
|
+
try {
|
|
75
|
+
var responseUrl = typeof res.url === 'string' ? res.url : ''
|
|
76
|
+
if (urlHint || (t.length <= HOTEL_BODY_MAX && HOTEL_BODY_SIG_RE.test(t)) || (t.length <= HOTEL_BODY_MAX && DIDA_BODY_SIG_RE.test(t))) dispatch(responseUrl, t)
|
|
77
|
+
} catch { /* 嗅探失败不影响站点自身 */ }
|
|
78
|
+
}).catch(function () { /* 流不可读则跳过 */ })
|
|
79
|
+
}
|
|
80
|
+
} catch { /* 嗅探失败不影响站点自身 */ }
|
|
81
|
+
return res
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
var origOpen = XMLHttpRequest.prototype.open
|
|
87
|
+
var origSend = XMLHttpRequest.prototype.send
|
|
88
|
+
XMLHttpRequest.prototype.open = function (method, url) {
|
|
89
|
+
this.__gotryUrl = typeof url === 'string' ? url : String(url ?? '')
|
|
90
|
+
this.__gotryMethod = typeof method === 'string' ? method.toUpperCase() : 'GET'
|
|
91
|
+
return origOpen.apply(this, arguments)
|
|
92
|
+
}
|
|
93
|
+
XMLHttpRequest.prototype.send = function () {
|
|
94
|
+
var xhr = this
|
|
95
|
+
xhr.addEventListener('load', function () {
|
|
96
|
+
try {
|
|
97
|
+
if (!xhr.__gotryUrl) return
|
|
98
|
+
var urlHint = FLIGHT_HINT_RE.test(xhr.__gotryUrl) || hotelPageWants(xhr.__gotryUrl) || trainPageWants(xhr.__gotryUrl) || didaPageWants(xhr.__gotryUrl)
|
|
99
|
+
if (!urlHint && !(isHotelPage && xhr.__gotryMethod === 'POST')) return
|
|
100
|
+
var body = ''
|
|
101
|
+
if (xhr.responseType === '' || xhr.responseType === 'text') body = xhr.responseText
|
|
102
|
+
else if (xhr.responseType === 'json') body = JSON.stringify(xhr.response)
|
|
103
|
+
else return
|
|
104
|
+
if (!body) return
|
|
105
|
+
var responseUrl = typeof xhr.responseURL === 'string' ? xhr.responseURL : ''
|
|
106
|
+
if (urlHint || (body.length <= HOTEL_BODY_MAX && HOTEL_BODY_SIG_RE.test(body)) || (body.length <= HOTEL_BODY_MAX && DIDA_BODY_SIG_RE.test(body))) dispatch(responseUrl, body)
|
|
107
|
+
} catch { /* 嗅探失败不影响站点 */ }
|
|
108
|
+
})
|
|
109
|
+
return origSend.apply(this, arguments)
|
|
110
|
+
}
|
|
111
|
+
})()
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 3,
|
|
3
|
+
"name": "Stai Travel Bridge",
|
|
4
|
+
"version": "0.2.0.28",
|
|
5
|
+
"description": "Stai 连接获准的旅行检索与供应商门户:检索结果经本机或授权后端桥接;门户可触发一次性登录代填,扩展不持久保存凭据。",
|
|
6
|
+
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnuzBX8rT8+RZKEUip5VRA0cY056pExy9PNdN9YCiuY3dgglRbcIBhjuFJoR6EX3/MaUv82vJVyItRVrowXLTwDk4WZof0vwFgKL0zBK304PC46pUaAKTSu1PgXeL1+j5KTAGz/9a9+RnPdbj7jND5rM/MOmBHNPVPpp1NlwxRGIgF9OxHSOfXORcH4Iyte1aJSFUJbFtNS/DaE5D+KjyupPLyIqVN/dCiKnNsTCEHQB9ngeli665PFp76hkccHQQZ4sVuMLS4zBPcazUsp1kcnW+xsQoUATkODTCY+Pzk3zUVF1QOESTjRCVnbNi8tkO43RMRs2q63gX/3inFivcEwIDAQAB",
|
|
7
|
+
"permissions": [
|
|
8
|
+
"alarms",
|
|
9
|
+
"cookies"
|
|
10
|
+
],
|
|
11
|
+
"host_permissions": [
|
|
12
|
+
"http://127.0.0.1:8791/*",
|
|
13
|
+
"http://127.0.0.1:8792/*",
|
|
14
|
+
"http://127.0.0.1:8793/*",
|
|
15
|
+
"http://127.0.0.1:8794/*",
|
|
16
|
+
"http://127.0.0.1:8795/*",
|
|
17
|
+
"https://*.ctrip.com/*",
|
|
18
|
+
"https://*.dida.com/*",
|
|
19
|
+
"https://dida.com/*",
|
|
20
|
+
"http://*.dida.com/*",
|
|
21
|
+
"http://dida.com/*",
|
|
22
|
+
"https://portal-test.hotelbyte.com/*",
|
|
23
|
+
"https://portal.hotelbyte.com/*"
|
|
24
|
+
],
|
|
25
|
+
"background": {
|
|
26
|
+
"service_worker": "background.js"
|
|
27
|
+
},
|
|
28
|
+
"content_scripts": [
|
|
29
|
+
{
|
|
30
|
+
"matches": [
|
|
31
|
+
"https://flights.ctrip.com/*",
|
|
32
|
+
"https://hotels.ctrip.com/*",
|
|
33
|
+
"https://kyfw.12306.cn/*",
|
|
34
|
+
"https://www.12306.cn/*",
|
|
35
|
+
"https://portal.dida.com/*"
|
|
36
|
+
],
|
|
37
|
+
"js": [
|
|
38
|
+
"content-main.js"
|
|
39
|
+
],
|
|
40
|
+
"run_at": "document_start",
|
|
41
|
+
"world": "MAIN"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"matches": [
|
|
45
|
+
"https://flights.ctrip.com/*",
|
|
46
|
+
"https://hotels.ctrip.com/*",
|
|
47
|
+
"https://kyfw.12306.cn/*",
|
|
48
|
+
"https://www.12306.cn/*",
|
|
49
|
+
"https://portal.dida.com/*",
|
|
50
|
+
"https://portal-test.hotelbyte.com/*",
|
|
51
|
+
"https://portal.hotelbyte.com/*"
|
|
52
|
+
],
|
|
53
|
+
"js": [
|
|
54
|
+
"content-bridge.js"
|
|
55
|
+
],
|
|
56
|
+
"run_at": "document_start"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"version_name": "0.2.0-rc.28"
|
|
60
|
+
}
|