@danceiny/gotry 0.0.1-rc.18 → 0.0.1-rc.20
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 +42 -16
- package/README.zh-CN.md +37 -15
- package/bin/gotry-bootstrap.js +309 -30
- package/bin/gotry-inner.js +74 -23
- package/bin/gotry-runtime-resolution.d.ts +1 -1
- package/bin/gotry-runtime-resolution.js +7 -8
- package/cordis.gotry-patch.yml +22 -8
- package/data/stations-12306-verify.json +524 -0
- package/dist/capabilities/agent-reach.js +4 -4
- package/dist/capabilities/anything.js +62 -29
- package/dist/capabilities/channel-health.js +103 -0
- package/dist/capabilities/channel-registry.js +213 -0
- package/dist/capabilities/doctor.js +307 -0
- package/dist/capabilities/effect.js +178 -5
- package/dist/capabilities/flyai.js +13 -0
- package/dist/capabilities/hbcli.js +28 -2
- package/dist/capabilities/session/adapters/ctrip-hotel.js +207 -0
- package/dist/capabilities/session/adapters/rail-12306.js +285 -0
- package/dist/capabilities/session/extension-bridge.js +14 -1
- package/dist/capabilities/session/extension-channel.js +4 -2
- package/dist/capabilities/session/extension-distribution.js +1 -1
- package/dist/capabilities/session-search.js +311 -0
- package/dist/capabilities/visa-policy.js +126 -0
- package/dist/scripts/agent-planning-turn-deadline-e2e.js +305 -0
- package/dist/scripts/agent-planning-turn-deadline-tests.js +281 -0
- package/dist/scripts/anything-tests.js +70 -21
- package/dist/scripts/benchmark-environment-bridge-e2e.js +139 -37
- package/dist/scripts/benchmark-environment-bridge-tests.js +1099 -306
- package/dist/scripts/booking-copilot-availability-ledger-binding-tests.js +26 -26
- package/dist/scripts/{booking-copilot-availability-policy-v2-tests.js → booking-copilot-availability-policy-tests.js} +115 -115
- package/dist/scripts/booking-copilot-crossrepo-fixture-server.js +41 -1
- package/dist/scripts/booking-copilot-dsh-core-proof-tests.js +75 -120
- package/dist/scripts/booking-copilot-dsh-planner-proof-tests.js +370 -61
- package/dist/scripts/booking-copilot-dsh-plugin-proof-tests.js +2 -2
- package/dist/scripts/booking-copilot-event-sequence-concurrency-proof-tests.js +7 -3
- package/dist/scripts/booking-copilot-gap-code-contract-proof-tests.js +15 -9
- package/dist/scripts/booking-copilot-operation-ledger-concurrency-proof-tests.js +19 -11
- package/dist/scripts/booking-copilot-receipt-ledger-concurrency-proof-tests.js +16 -52
- package/dist/scripts/booking-copilot-runtime-proof-tests.js +3953 -155
- package/dist/scripts/booking-copilot-server-proof-tests.js +58 -23
- package/dist/scripts/booking-copilot-startup-proof-tests.js +10 -119
- package/dist/scripts/booking-surface-contract-proof-tests.js +1154 -326
- package/dist/scripts/bootstrap-tests.js +113 -2
- package/dist/scripts/build-metrics-report.js +339 -0
- package/dist/scripts/channel-probe-tests.js +148 -0
- package/dist/scripts/channel-probe.js +252 -0
- package/dist/scripts/channel-registry-tests.js +262 -0
- package/dist/scripts/doctor-tests.js +175 -0
- package/dist/scripts/effect-tests.js +274 -1
- package/dist/scripts/extension-tests.js +129 -11
- package/dist/scripts/fact-gate-tests.js +91 -2
- package/dist/scripts/flyai-tests.js +17 -1
- package/dist/scripts/hbcli-e2e-tests.js +1 -3
- package/dist/scripts/hbcli-tests.js +38 -1
- package/dist/scripts/metrics-report-tests.js +288 -0
- package/dist/scripts/persona-surface-guard-tests.js +19 -0
- package/dist/scripts/session-tests.js +401 -1
- package/dist/scripts/smoke.js +100 -83
- package/dist/scripts/turn-handoff-collect-tests.js +216 -0
- package/dist/scripts/turn-handoff-collect.js +189 -0
- package/dist/scripts/turn-policy-tests.js +56 -0
- package/dist/scripts/typed-contract-canary.js +261 -0
- package/dist/scripts/visa-policy-tests.js +75 -0
- package/dist/scripts/wish-channel-gate-tests.js +111 -0
- package/dist/src/artifact-gate.js +91 -3
- package/dist/src/benchmark-agent-conformance.js +39 -16
- package/dist/src/benchmark-environment-bridge.js +316 -52
- package/dist/src/bookable-facts.js +62 -3
- package/dist/src/booking-surface/{availability-policy-v2.js → availability-policy.js} +89 -89
- package/dist/src/booking-surface/canonical-schema.js +8 -22
- package/dist/src/booking-surface/contracts.js +70 -19
- package/dist/src/booking-surface/dsh-planner.js +310 -177
- package/dist/src/booking-surface/dsh-plugin.js +3 -3
- package/dist/src/booking-surface/index.js +1 -5
- package/dist/src/booking-surface/profile.js +1 -1
- package/dist/src/booking-surface/runtime.js +1682 -247
- package/dist/src/booking-surface/server.js +371 -185
- package/dist/src/booking-surface/startup.js +17 -27
- package/dist/src/booking-surface/validation.js +270 -760
- package/dist/src/index.js +739 -150
- package/dist/src/turn-deadline.js +292 -0
- package/dist/src/turn-policy.js +146 -0
- package/dist/src/wish-pool.js +5 -0
- package/extension/background.js +23 -4
- package/extension/content-main.js +47 -9
- package/extension/manifest.json +27 -9
- package/package.json +7 -26
- package/schemas/booking.surface.schema.json +2593 -0
- package/ts/capabilities/agent-reach.ts +4 -4
- package/ts/capabilities/anything.ts +89 -38
- package/ts/capabilities/flyai.ts +21 -3
- package/ts/capabilities/hbcli.ts +53 -4
- package/ts/capabilities/session/action-cache.ts +1 -1
- package/ts/capabilities/session/adapters/ctrip-hotel.ts +238 -0
- package/ts/capabilities/session/adapters/rail-12306.ts +293 -0
- package/ts/capabilities/session/extension-bridge.ts +32 -2
- package/ts/capabilities/session/extension-channel.ts +9 -8
- package/ts/capabilities/session/extension-distribution.ts +3 -1
- package/ts/capabilities/session/health-watch.ts +1 -1
- package/ts/capabilities/session/read-guard.ts +1 -1
- package/ts/capabilities/session/wizard.ts +1 -1
- package/ts/capabilities/session-search.ts +323 -1
- package/ts/dsh-runtime/vendor/README.md +60 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/LICENSE +21 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/README.en.md +200 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/README.md +202 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/client/client.js +216 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/cordis.patch.yml +5 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/clients/amap.js +371 -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 +56 -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 +126 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/config.js +16 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/index.js +109 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/settings-ns.js +27 -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 +170 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/clients/amap.d.ts +53 -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 +20 -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/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/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 +16 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types/types.d.ts +55 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/lib/types.js +16 -0
- package/ts/dsh-runtime/vendor/dsh-map-tools/package.json +91 -0
- package/ts/package.json +9 -0
- package/ts/scripts/turn-handoff-collect.ts +178 -0
- package/ts/src/artifact-gate.ts +82 -2
- package/ts/src/benchmark-agent-conformance.ts +54 -15
- package/ts/src/benchmark-environment-bridge.ts +234 -46
- package/ts/src/bookable-facts.ts +109 -5
- package/ts/src/booking-saga.ts +1 -1
- package/ts/src/booking-surface/{availability-policy-v2.ts → availability-policy.ts} +124 -125
- package/ts/src/booking-surface/canonical-schema.js +8 -22
- package/ts/src/booking-surface/contracts.ts +278 -239
- package/ts/src/booking-surface/dsh-planner.ts +333 -194
- package/ts/src/booking-surface/dsh-plugin.js +3 -3
- package/ts/src/booking-surface/index.ts +1 -5
- package/ts/src/booking-surface/profile.ts +11 -11
- package/ts/src/booking-surface/runtime.ts +1351 -351
- package/ts/src/booking-surface/server.ts +282 -175
- package/ts/src/booking-surface/startup.ts +36 -48
- package/ts/src/booking-surface/validation.ts +194 -442
- package/ts/src/contracts.ts +1 -1
- package/ts/src/index.ts +492 -172
- package/ts/src/loop.ts +1 -1
- package/ts/src/state-ledger.ts +1 -1
- package/ts/src/turn-deadline.ts +365 -0
- package/ts/src/turn-policy.ts +154 -0
- package/ts/src/wish-pool.ts +17 -4
- package/dist/scripts/agent-planning-budget-e2e.js +0 -227
- package/dist/scripts/agent-planning-budget-tests.js +0 -173
- package/dist/scripts/booking-copilot-v2-runtime-proof-tests.js +0 -3935
- package/dist/scripts/booking-surface-v2-contract-proof-tests.js +0 -1174
- package/dist/src/booking-surface/contracts-v2.js +0 -89
- package/dist/src/booking-surface/runtime-v2.js +0 -1771
- package/dist/src/booking-surface/server-v2.js +0 -334
- package/dist/src/booking-surface/validation-v2.js +0 -319
- package/dist/src/tool-budget.js +0 -136
- package/schemas/booking.surface.v1.schema.json +0 -927
- package/schemas/booking.surface.v2.schema.json +0 -61
- package/ts/src/booking-surface/contracts-v2.ts +0 -118
- package/ts/src/booking-surface/runtime-v2.ts +0 -1466
- package/ts/src/booking-surface/server-v2.ts +0 -247
- package/ts/src/booking-surface/validation-v2.ts +0 -205
- package/ts/src/tool-budget.ts +0 -165
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://gotry.dev/schemas/booking.surface.v2.schema.json",
|
|
4
|
-
"oneOf": [
|
|
5
|
-
{"$ref":"#/$defs/Workspace"},{"$ref":"#/$defs/Action"},{"$ref":"#/$defs/Receipt"},
|
|
6
|
-
{"$ref":"#/$defs/Ingress"},{"$ref":"#/$defs/UserTurn"},{"$ref":"#/$defs/Continuation"},{"$ref":"#/$defs/Event"}
|
|
7
|
-
],
|
|
8
|
-
"$defs": {
|
|
9
|
-
"Ref":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/OpaqueRef"},
|
|
10
|
-
"Hex64":{"type":"string","pattern":"^[0-9a-f]{64}$"},
|
|
11
|
-
"Surface":{"enum":["tenant","customer_portal","storefront","payment_link"]},
|
|
12
|
-
"Kind":{"enum":["search.patch","search.run","results.view.patch","hotel.focus","hotel.select","offers.query","offers.view.patch","offers.compare","offer.select","offer.check","checkout.prepare","order.observe"]},
|
|
13
|
-
"Codes":{"type":"array","minItems":0,"maxItems":28,"uniqueItems":true,"items":{"enum":["byos_mapped_risk","check_avail_failed","check_avail_unverified","component_executor_unavailable","hotel_not_visible","hotel_rates_failed","offer_facts_changed","offer_not_loaded","offer_unavailable","order_not_found","order_outcome_not_observed","order_state_unknown","order_status_unavailable","requested_offers_not_loaded","search_failed","search_form_invalid","search_session_expired","search_terminal_timeout","stale_revision","surface_adapter_failed","undo_token_not_found","unhandled","unsupported","verified_offer_required","workspace_changed_during_action","criterion_must_not_met","no_hotels_matched","offer_target_not_reached"]}},
|
|
14
|
-
"LoadedOffer":{"type":"object","additionalProperties":false,"required":["offerRef","offerVersionRef","hotelRef","evidenceLevel","factRefs"],"properties":{"offerRef":{"$ref":"#/$defs/Ref"},"offerVersionRef":{"$ref":"#/$defs/Ref"},"hotelRef":{"$ref":"#/$defs/Ref"},"evidenceLevel":{"enum":["listed","rate_loaded","checked"]},"factRefs":{"type":"array","maxItems":64,"uniqueItems":true,"items":{"$ref":"#/$defs/Ref"}}}},
|
|
15
|
-
"VerifiedOffer":{"type":"object","additionalProperties":false,"required":["offerRef","offerVersionRef","verifiedOfferRef","expiresAt"],"properties":{"offerRef":{"$ref":"#/$defs/Ref"},"offerVersionRef":{"$ref":"#/$defs/Ref"},"verifiedOfferRef":{"$ref":"#/$defs/Ref"},"expiresAt":{"type":"string","pattern":"^\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\\d|3[01])T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d{1,9})?(?:Z|[+-](?:[01]\\d|2[0-3]):[0-5]\\d)$"}}},
|
|
16
|
-
"OfferVersionInput":{"type":"object","additionalProperties":false,"required":["offerRef","offerVersionRef"],"properties":{"offerRef":{"$ref":"#/$defs/Ref"},"offerVersionRef":{"$ref":"#/$defs/Ref"}}},
|
|
17
|
-
"CheckoutPrepareVersionInput":{"type":"object","additionalProperties":false,"required":["offerRef","offerVersionRef","verifiedOfferRef"],"properties":{"offerRef":{"$ref":"#/$defs/Ref"},"offerVersionRef":{"$ref":"#/$defs/Ref"},"verifiedOfferRef":{"$ref":"#/$defs/Ref"}}},
|
|
18
|
-
"Workspace":{"type":"object","additionalProperties":false,"required":["schemaVersion","contextRef","surface","revision","locale","currency","searchDraft","results","visibleHotels","loadedOffers","shortlistedOfferRefs","capabilities"],"properties":{"schemaVersion":{"const":"booking.surface.v2"},"contextRef":{"$ref":"#/$defs/Ref"},"surface":{"$ref":"#/$defs/Surface"},"revision":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/Revision"},"locale":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/NonEmptyString"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"searchDraft":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/SearchDraftSnapshotV1"},"results":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/ResultViewSnapshotV1"},"visibleHotels":{"type":"array","maxItems":100,"items":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/VisibleHotelFactV1"}},"loadedOffers":{"type":"array","maxItems":200,"items":{"$ref":"#/$defs/LoadedOffer"}},"focusedHotelRef":{"$ref":"#/$defs/Ref"},"shortlistedOfferRefs":{"type":"array","maxItems":100,"uniqueItems":true,"items":{"$ref":"#/$defs/Ref"}},"selectedOfferRef":{"$ref":"#/$defs/Ref"},"verifiedOffer":{"$ref":"#/$defs/VerifiedOffer"},"capabilities":{"type":"object","additionalProperties":false,"required":["surface","allowedActions"],"properties":{"surface":{"$ref":"#/$defs/Surface"},"allowedActions":{"type":"array","minItems":1,"maxItems":12,"uniqueItems":true,"items":{"$ref":"#/$defs/Kind"}}}}}},
|
|
19
|
-
"IngressWorkspace":{"type":"object","additionalProperties":false,"required":["schemaVersion","revision","locale","currency","searchDraft","results","visibleHotels","loadedOffers","shortlistedOfferRefs"],"properties":{"schemaVersion":{"const":"booking.surface.v2"},"revision":{"type":"integer","minimum":0},"locale":{"type":"string","minLength":1,"maxLength":64},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"searchDraft":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/SearchDraftSnapshotV1"},"results":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/ResultViewSnapshotV1"},"visibleHotels":{"type":"array","maxItems":100,"items":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/VisibleHotelFactV1"}},"loadedOffers":{"type":"array","maxItems":200,"items":{"$ref":"#/$defs/LoadedOffer"}},"focusedHotelRef":{"$ref":"#/$defs/Ref"},"shortlistedOfferRefs":{"type":"array","maxItems":100,"uniqueItems":true,"items":{"$ref":"#/$defs/Ref"}},"selectedOfferRef":{"$ref":"#/$defs/Ref"}}},
|
|
20
|
-
"PresentationKey":{"type":"string","minLength":1,"maxLength":512},
|
|
21
|
-
"RequestKey":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[A-Za-z0-9][A-Za-z0-9:._-]{7,127}$"},
|
|
22
|
-
"ApprovalRef":{"type":"object","additionalProperties":false,"required":["approvalId","blockerId","contextRef","sourceTurnId","presentationRequestKey","sourceActionId","targetActionId","sourceRevision","targetActionKind","to","expiresAt","nonce","sourceReceiptDigest","scope","code","criterionPath","valueDigest"],"properties":{"approvalId":{"$ref":"#/$defs/Ref"},"blockerId":{"$ref":"#/$defs/Ref"},"contextRef":{"$ref":"#/$defs/Ref"},"sourceTurnId":{"$ref":"#/$defs/Ref"},"presentationRequestKey":{"$ref":"#/$defs/PresentationKey"},"sourceActionId":{"$ref":"#/$defs/Ref"},"targetActionId":{"$ref":"#/$defs/Ref"},"sourceRevision":{"type":"integer","minimum":0},"targetActionKind":{"$ref":"#/$defs/Kind"},"to":{"enum":["prefer","drop"]},"expiresAt":{"type":"string","minLength":1},"nonce":{"$ref":"#/$defs/Ref"},"sourceReceiptDigest":{"$ref":"#/$defs/Hex64"},"scope":{"enum":["search","offer","availability","checkout"]},"code":{"enum":["no_hotels_matched","hotel_not_visible","hotel_rates_failed","criterion_must_not_met","offer_target_not_reached","offer_unavailable"]},"criterionPath":{"type":"string","pattern":"^(searchDraft|results|offers|checkout)(\\.[A-Za-z][A-Za-z0-9_]*){0,3}$","maxLength":160},"valueDigest":{"$ref":"#/$defs/Hex64"}}},
|
|
23
|
-
"ActionBase":{"type":"object","additionalProperties":false,"required":["schemaVersion","kind","actionId","contextRef","expectedRevision","reason","factRefs","input"],"properties":{"schemaVersion":{"const":"booking.surface.v2"},"kind":{"$ref":"#/$defs/Kind"},"actionId":{"$ref":"#/$defs/Ref"},"contextRef":{"$ref":"#/$defs/Ref"},"expectedRevision":{"type":"integer","minimum":0},"reason":{"type":"string","minLength":1,"maxLength":1000},"factRefs":{"type":"array","maxItems":64,"uniqueItems":true,"items":{"$ref":"#/$defs/Ref"}},"input":{"type":"object"},"relaxationApprovalRef":{"$ref":"#/$defs/ApprovalRef"}}},
|
|
24
|
-
"Action":{"oneOf":[
|
|
25
|
-
{"allOf":[{"$ref":"#/$defs/ActionBase"},{"type":"object","properties":{"kind":{"const":"search.patch"},"input":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/SearchPatchInputV1"}}}]},
|
|
26
|
-
{"allOf":[{"$ref":"#/$defs/ActionBase"},{"type":"object","properties":{"kind":{"const":"search.run"},"input":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/SearchRunInputV1"}}}]},
|
|
27
|
-
{"allOf":[{"$ref":"#/$defs/ActionBase"},{"type":"object","properties":{"kind":{"const":"results.view.patch"},"input":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/ResultsViewPatchInputV1"}}}]},
|
|
28
|
-
{"allOf":[{"$ref":"#/$defs/ActionBase"},{"type":"object","properties":{"kind":{"const":"hotel.focus"},"input":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/HotelFocusInputV1"}}}]},
|
|
29
|
-
{"allOf":[{"$ref":"#/$defs/ActionBase"},{"type":"object","properties":{"kind":{"const":"hotel.select"},"input":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/HotelSelectInputV1"}}}]},
|
|
30
|
-
{"allOf":[{"$ref":"#/$defs/ActionBase"},{"type":"object","properties":{"kind":{"const":"offers.query"},"input":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/OffersQueryInputV1"}}}]},
|
|
31
|
-
{"allOf":[{"$ref":"#/$defs/ActionBase"},{"type":"object","properties":{"kind":{"const":"offers.view.patch"},"input":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/OffersViewPatchInputV1"}}}]},
|
|
32
|
-
{"allOf":[{"$ref":"#/$defs/ActionBase"},{"type":"object","properties":{"kind":{"const":"offers.compare"},"input":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/OffersCompareInputV1"}}}]},
|
|
33
|
-
{"allOf":[{"$ref":"#/$defs/ActionBase"},{"type":"object","properties":{"kind":{"const":"offer.select"},"input":{"$ref":"#/$defs/OfferVersionInput"}}}]},
|
|
34
|
-
{"allOf":[{"$ref":"#/$defs/ActionBase"},{"type":"object","properties":{"kind":{"const":"offer.check"},"input":{"$ref":"#/$defs/OfferVersionInput"}}}]},
|
|
35
|
-
{"allOf":[{"$ref":"#/$defs/ActionBase"},{"type":"object","properties":{"kind":{"const":"checkout.prepare"},"input":{"$ref":"#/$defs/CheckoutPrepareVersionInput"}}}]},
|
|
36
|
-
{"allOf":[{"$ref":"#/$defs/ActionBase"},{"type":"object","properties":{"kind":{"const":"order.observe"},"input":{"$ref":"https://gotry.dev/schemas/booking.surface.v1.schema.json#/$defs/OrderObserveInputV1"}}}]}
|
|
37
|
-
]},
|
|
38
|
-
"Approval":{"type":"object","additionalProperties":false,"required":["taskId","contextRef","sourceTurnId","presentationRequestKey","optionDigest","approvalId","deliveryNonce","blockerId","sourceActionId","sourceReceiptDigest","scope","code","criterionPath","valueDigest","from","to","approved"],"properties":{"taskId":{"$ref":"#/$defs/Ref"},"contextRef":{"$ref":"#/$defs/Ref"},"sourceTurnId":{"$ref":"#/$defs/Ref"},"presentationRequestKey":{"$ref":"#/$defs/PresentationKey"},"optionDigest":{"$ref":"#/$defs/Hex64"},"approvalId":{"$ref":"#/$defs/Ref"},"deliveryNonce":{"$ref":"#/$defs/Ref"},"blockerId":{"$ref":"#/$defs/Ref"},"sourceActionId":{"$ref":"#/$defs/Ref"},"sourceReceiptDigest":{"$ref":"#/$defs/Hex64"},"scope":{"enum":["search","offer","availability","checkout"]},"code":{"enum":["no_hotels_matched","hotel_not_visible","hotel_rates_failed","criterion_must_not_met","offer_target_not_reached","offer_unavailable"]},"criterionPath":{"type":"string","pattern":"^(searchDraft|results|offers|checkout)(\\.[A-Za-z][A-Za-z0-9_]*){0,3}$","maxLength":160},"valueDigest":{"$ref":"#/$defs/Hex64"},"from":{"const":"must"},"to":{"enum":["prefer","drop"]},"approved":{"const":true}}},
|
|
39
|
-
"Blocker":{"type":"object","additionalProperties":false,"required":["blockerId","sourceActionId","sourceReceiptDigest","scope","code","criterionPath","strength","valueDigest","evidence"],"properties":{"blockerId":{"$ref":"#/$defs/Ref"},"sourceActionId":{"$ref":"#/$defs/Ref"},"sourceReceiptDigest":{"$ref":"#/$defs/Hex64"},"scope":{"enum":["search","offer","availability","checkout"]},"code":{"enum":["no_hotels_matched","hotel_not_visible","hotel_rates_failed","criterion_must_not_met","offer_target_not_reached","offer_unavailable"]},"criterionPath":{"type":"string","pattern":"^(searchDraft|results|offers|checkout)(\\.[A-Za-z][A-Za-z0-9_]*){0,3}$","maxLength":160},"strength":{"const":"must"},"valueDigest":{"$ref":"#/$defs/Hex64"},"valueLabel":{"type":"string","minLength":1,"maxLength":120},"evidence":{"type":"object","additionalProperties":false,"required":["factRefs","gapCodes"],"properties":{"factRefs":{"type":"array","minItems":1,"maxItems":32,"uniqueItems":true,"items":{"$ref":"#/$defs/Ref"}},"gapCodes":{"$ref":"#/$defs/Codes"},"requested":{"type":"integer","minimum":0},"actual":{"type":"integer","minimum":0}}}}},
|
|
40
|
-
"Result":{"type":"object","additionalProperties":false,"required":["outcome","hardCriteriaMet","factRefs","gapCodes","blockers","relaxationsApplied"],"properties":{"outcome":{"enum":["complete","partial","empty"]},"requestedCount":{"type":"integer","minimum":0},"actualCount":{"type":"integer","minimum":0},"hardCriteriaMet":{"type":"boolean"},"factRefs":{"type":"array","maxItems":64,"uniqueItems":true,"items":{"$ref":"#/$defs/Ref"}},"gapCodes":{"$ref":"#/$defs/Codes"},"blockers":{"type":"array","maxItems":8,"items":{"$ref":"#/$defs/Blocker"}},"relaxationsApplied":{"type":"array","maxItems":1,"items":{"$ref":"#/$defs/Approval"}}}},
|
|
41
|
-
"Observation":{"oneOf":[{"type":"object","additionalProperties":false,"required":["kind"],"properties":{"kind":{"const":"search.state"},"searchSessionRef":{"$ref":"#/$defs/Ref"},"resultCount":{"type":"integer","minimum":0},"gapCodes":{"$ref":"#/$defs/Codes"}}},{"type":"object","additionalProperties":false,"required":["kind","matchedHotelRefs","visibleCount"],"properties":{"kind":{"const":"results.state"},"matchedHotelRefs":{"type":"array","maxItems":100,"items":{"$ref":"#/$defs/Ref"}},"visibleCount":{"type":"integer","minimum":0},"gapCodes":{"$ref":"#/$defs/Codes"}}},{"type":"object","additionalProperties":false,"required":["kind","hotelRef"],"properties":{"kind":{"enum":["hotel.focus","hotel.selection"]},"hotelRef":{"$ref":"#/$defs/Ref"}}},{"type":"object","additionalProperties":false,"required":["kind","hotelRefs","offerRefs","loadedHotelCount"],"properties":{"kind":{"const":"offers.state"},"hotelRefs":{"type":"array","maxItems":100,"items":{"$ref":"#/$defs/Ref"}},"offerRefs":{"type":"array","maxItems":200,"items":{"$ref":"#/$defs/Ref"}},"loadedHotelCount":{"type":"integer","minimum":0},"gapCodes":{"$ref":"#/$defs/Codes"}}},{"type":"object","additionalProperties":false,"required":["kind","offerRef","checkedOfferVersionRef","available","changedFactRefs"],"properties":{"kind":{"const":"offer.availability"},"offerRef":{"$ref":"#/$defs/Ref"},"checkedOfferVersionRef":{"$ref":"#/$defs/Ref"},"currentOfferVersionRef":{"$ref":"#/$defs/Ref"},"verifiedOfferRef":{"$ref":"#/$defs/Ref"},"available":{"type":"boolean"},"changedFactRefs":{"type":"array","maxItems":64,"items":{"$ref":"#/$defs/Ref"}},"gapCodes":{"$ref":"#/$defs/Codes"}}},{"type":"object","additionalProperties":false,"required":["kind","code","factRefs"],"properties":{"kind":{"const":"gap"},"code":{"enum":["byos_mapped_risk","check_avail_failed","check_avail_unverified","component_executor_unavailable","hotel_not_visible","hotel_rates_failed","offer_facts_changed","offer_not_loaded","offer_unavailable","order_not_found","order_outcome_not_observed","order_state_unknown","order_status_unavailable","requested_offers_not_loaded","search_failed","search_form_invalid","search_session_expired","search_terminal_timeout","stale_revision","surface_adapter_failed","undo_token_not_found","unhandled","unsupported","verified_offer_required","workspace_changed_during_action","criterion_must_not_met","no_hotels_matched","offer_target_not_reached"]},"factRefs":{"type":"array","maxItems":64,"items":{"$ref":"#/$defs/Ref"}}}}]},
|
|
42
|
-
"OfferSelectionObservation":{"type":"object","additionalProperties":false,"required":["kind","offerRef","offerVersionRef"],"properties":{"kind":{"const":"offer.selection"},"offerRef":{"$ref":"#/$defs/Ref"},"offerVersionRef":{"$ref":"#/$defs/Ref"}}},
|
|
43
|
-
"HandoffObservation":{"type":"object","additionalProperties":false,"required":["kind","offerRef","offerVersionRef","verifiedOfferRef","handoffRef"],"properties":{"kind":{"const":"checkout.handoff"},"offerRef":{"$ref":"#/$defs/Ref"},"offerVersionRef":{"$ref":"#/$defs/Ref"},"verifiedOfferRef":{"$ref":"#/$defs/Ref"},"handoffRef":{"$ref":"#/$defs/Ref"}}},
|
|
44
|
-
"OrderObservation":{"type":"object","additionalProperties":false,"required":["kind","orderRef","state"],"properties":{"kind":{"const":"order.state"},"orderRef":{"$ref":"#/$defs/Ref"},"state":{"enum":["pending","verified","failed","unknown"]},"gapCodes":{"$ref":"#/$defs/Codes"}}},
|
|
45
|
-
"ObservationExpanded":{"oneOf":[{"$ref":"#/$defs/Observation"},{"$ref":"#/$defs/OfferSelectionObservation"},{"$ref":"#/$defs/HandoffObservation"},{"$ref":"#/$defs/OrderObservation"}]},
|
|
46
|
-
"Receipt":{"type":"object","additionalProperties":false,"required":["schemaVersion","kind","actionId","contextRef","status","revision","observation","resultContract"],"properties":{"schemaVersion":{"const":"booking.surface.v2"},"kind":{"const":"action.receipt"},"actionId":{"$ref":"#/$defs/Ref"},"contextRef":{"$ref":"#/$defs/Ref"},"status":{"enum":["applied","needs_input","partial","no_match","unavailable","changed","stale","unsupported","failed"]},"revision":{"type":"integer","minimum":0},"observation":{"$ref":"#/$defs/ObservationExpanded"},"resultContract":{"$ref":"#/$defs/Result"},"undoToken":{"$ref":"#/$defs/Ref"}}},
|
|
47
|
-
"Ingress":{"type":"object","additionalProperties":false,"required":["schemaVersion","kind","requestKey","surfaceHint","workspace","request"],"properties":{"schemaVersion":{"const":"booking.surface.v2"},"kind":{"const":"user.turn.ingress"},"requestKey":{"$ref":"#/$defs/RequestKey"},"taskHandle":{"$ref":"#/$defs/Ref"},"surfaceHint":{"$ref":"#/$defs/Surface"},"workspace":{"$ref":"#/$defs/IngressWorkspace"},"request":{"type":"object","additionalProperties":false,"required":["text"],"properties":{"text":{"type":"string","minLength":1,"maxLength":4000}}}}},
|
|
48
|
-
"UserTurn":{"type":"object","additionalProperties":false,"required":["schemaVersion","kind","taskId","turnId","workspace","request"],"properties":{"schemaVersion":{"const":"booking.surface.v2"},"kind":{"const":"user.turn"},"taskId":{"$ref":"#/$defs/Ref"},"turnId":{"$ref":"#/$defs/Ref"},"workspace":{"$ref":"#/$defs/Workspace"},"request":{"type":"object","additionalProperties":false,"required":["text"],"properties":{"text":{"type":"string","minLength":1,"maxLength":4000},"approval":{"$ref":"#/$defs/Approval"}}}}},
|
|
49
|
-
"Continuation":{"type":"object","additionalProperties":false,"required":["schemaVersion","kind","taskId","workspace","receipt"],"properties":{"schemaVersion":{"const":"booking.surface.v2"},"kind":{"const":"action.receipt.continuation"},"taskId":{"$ref":"#/$defs/Ref"},"workspace":{"$ref":"#/$defs/Workspace"},"receipt":{"$ref":"#/$defs/Receipt"}}},
|
|
50
|
-
"Event":{"oneOf":[
|
|
51
|
-
{"$ref":"#/$defs/StatusEvent"},{"$ref":"#/$defs/QuestionEvent"},{"$ref":"#/$defs/OperationEvent"},{"$ref":"#/$defs/ExplanationEvent"},{"$ref":"#/$defs/TerminalEvent"},{"$ref":"#/$defs/ErrorEvent"}
|
|
52
|
-
]},
|
|
53
|
-
"EventBase":{"type":"object","required":["schemaVersion","eventId","taskId","contextRef","sequence","emittedAt","kind"],"properties":{"schemaVersion":{"const":"booking.surface.v2"},"eventId":{"$ref":"#/$defs/Ref"},"taskId":{"$ref":"#/$defs/Ref"},"contextRef":{"$ref":"#/$defs/Ref"},"sequence":{"type":"integer","minimum":1},"emittedAt":{"type":"string","minLength":1},"kind":{"enum":["status","question","operation","explanation","terminal","error"]}}},
|
|
54
|
-
"StatusEvent":{"type":"object","allOf":[{"$ref":"#/$defs/EventBase"},{"type":"object","required":["kind","status"],"properties":{"kind":{"const":"status"},"status":{"enum":["submitted","working","waiting_receipt","input_required"]}}}],"unevaluatedProperties":false},
|
|
55
|
-
"QuestionEvent":{"type":"object","additionalProperties":false,"required":["schemaVersion","eventId","taskId","contextRef","sequence","emittedAt","kind","question"],"properties":{"schemaVersion":{"const":"booking.surface.v2"},"eventId":{"$ref":"#/$defs/Ref"},"taskId":{"$ref":"#/$defs/Ref"},"contextRef":{"$ref":"#/$defs/Ref"},"sequence":{"type":"integer","minimum":1},"emittedAt":{"type":"string","minLength":1},"kind":{"const":"question"},"question":{"type":"object","additionalProperties":false,"required":["questionId","prompt","missingFields","type","blocker","approvalOptions"],"properties":{"questionId":{"$ref":"#/$defs/Ref"},"prompt":{"type":"string","minLength":1},"missingFields":{"type":"array","maxItems":32,"items":{"type":"string"}},"type":{"const":"relaxation_approval_required"},"blocker":{"$ref":"#/$defs/Blocker"},"approvalOptions":{"type":"array","minItems":1,"maxItems":2,"items":{"type":"object","additionalProperties":false,"required":["approval"],"properties":{"approval":{"$ref":"#/$defs/Approval"}}}}}}}},
|
|
56
|
-
"OperationEvent":{"type":"object","allOf":[{"$ref":"#/$defs/EventBase"},{"type":"object","required":["kind","action"],"properties":{"kind":{"const":"operation"},"action":{"$ref":"#/$defs/Action"}}}],"unevaluatedProperties":false},
|
|
57
|
-
"ExplanationEvent":{"type":"object","allOf":[{"$ref":"#/$defs/EventBase"},{"type":"object","required":["kind","explanation"],"properties":{"kind":{"const":"explanation"},"explanation":{"type":"object","additionalProperties":false,"required":["text","factRefs"],"properties":{"text":{"type":"string","minLength":1},"factRefs":{"type":"array","maxItems":64,"items":{"$ref":"#/$defs/Ref"}}}}}}],"unevaluatedProperties":false},
|
|
58
|
-
"TerminalEvent":{"type":"object","allOf":[{"$ref":"#/$defs/EventBase"},{"type":"object","required":["kind","terminal"],"properties":{"kind":{"const":"terminal"},"terminal":{"type":"object","additionalProperties":false,"required":["status","summary","factRefs"],"properties":{"status":{"enum":["completed","stopped"]},"summary":{"type":"string","minLength":1},"factRefs":{"type":"array","maxItems":64,"items":{"$ref":"#/$defs/Ref"}}}}}}],"unevaluatedProperties":false},
|
|
59
|
-
"ErrorEvent":{"type":"object","allOf":[{"$ref":"#/$defs/EventBase"},{"type":"object","required":["kind","error"],"properties":{"kind":{"const":"error"},"error":{"type":"object","additionalProperties":false,"required":["code","message","retryable"],"properties":{"code":{"type":"string","pattern":"^[A-Z][A-Z0-9_.-]*$"},"message":{"type":"string","minLength":1},"retryable":{"type":"boolean"}}}}}],"unevaluatedProperties":false}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import type { BookingReadActionKindV1, BookingWorkspaceSnapshotV1, SearchCriteriaPatchV1, ResultsViewPatchV1, OfferCriteriaV1, EvidenceLevelV1 } from './contracts.ts'
|
|
2
|
-
|
|
3
|
-
export const BOOKING_SURFACE_SCHEMA_VERSION_V2 = 'booking.surface.v2' as const
|
|
4
|
-
/**
|
|
5
|
-
* Process composition modes are deliberately separate from the payload
|
|
6
|
-
* schema. The default accepts turns already bound by HotelByte's BFF; the
|
|
7
|
-
* second mode is reserved for an in-process BFF binding seam.
|
|
8
|
-
*/
|
|
9
|
-
export const BOOKING_COPILOT_V2_INGRESS_MODES = ['bff-bound-turn-only', 'bff-ingress-binding'] as const
|
|
10
|
-
export type BookingCopilotV2IngressMode = typeof BOOKING_COPILOT_V2_INGRESS_MODES[number]
|
|
11
|
-
export const BOOKING_COPILOT_V2_ACCEPTED_TURN_KINDS = ['user.turn', 'action.receipt.continuation'] as const
|
|
12
|
-
export const BOOKING_COPILOT_V2_INGRESS_TURN_KIND = 'user.turn.ingress' as const
|
|
13
|
-
/** Hard task-level operation budget. The counter is persisted in the v2 ledger. */
|
|
14
|
-
export const BOOKING_COPILOT_MAX_OPERATIONS_V2 = 20 as const
|
|
15
|
-
export const BOOKING_SURFACE_SCHEMA_V2_SHA256 = '45df62db1b19d30a4fd22ddc94eb550e8ff32d8a225558b5ff13ba303588fc03' as const
|
|
16
|
-
export const BOOKING_READ_ACTION_KINDS_V2 = ['search.patch','search.run','results.view.patch','hotel.focus','hotel.select','offers.query','offers.view.patch','offers.compare','offer.select','offer.check','checkout.prepare','order.observe'] as const satisfies readonly BookingReadActionKindV1[]
|
|
17
|
-
export type BookingReadActionKindV2 = typeof BOOKING_READ_ACTION_KINDS_V2[number]
|
|
18
|
-
export type BookingSurfaceV2 = 'tenant' | 'customer_portal' | 'storefront' | 'payment_link'
|
|
19
|
-
/** Product-owned least-privilege action matrix. BFF bindings may narrow these lists, never expand them. */
|
|
20
|
-
export const BOOKING_SURFACE_ALLOWED_ACTIONS_V2: Record<BookingSurfaceV2, readonly BookingReadActionKindV2[]> = {
|
|
21
|
-
tenant: BOOKING_READ_ACTION_KINDS_V2,
|
|
22
|
-
customer_portal: BOOKING_READ_ACTION_KINDS_V2,
|
|
23
|
-
storefront: ['search.patch', 'search.run', 'results.view.patch', 'hotel.focus'],
|
|
24
|
-
payment_link: ['search.patch', 'search.run', 'results.view.patch', 'hotel.focus', 'hotel.select'],
|
|
25
|
-
}
|
|
26
|
-
/** Stable product-matrix observation for UAT and server readiness proofs. */
|
|
27
|
-
export function bookingSurfaceAllowedActionsV2(surface: BookingSurfaceV2): BookingReadActionKindV2[] {
|
|
28
|
-
return [...BOOKING_SURFACE_ALLOWED_ACTIONS_V2[surface]]
|
|
29
|
-
}
|
|
30
|
-
export type BookingRequestKeyV2 = string
|
|
31
|
-
/** Runtime-owned idempotency key; this is not a browser request key. */
|
|
32
|
-
export type BookingInternalDecisionKeyV2 = string
|
|
33
|
-
export const BOOKING_V2_BLOCKER_CODES = ['no_hotels_matched','hotel_not_visible','hotel_rates_failed','criterion_must_not_met','offer_target_not_reached','offer_unavailable'] as const
|
|
34
|
-
export type BookingV2BlockerCode = typeof BOOKING_V2_BLOCKER_CODES[number]
|
|
35
|
-
export const BOOKING_V2_GAP_CODES = ['byos_mapped_risk','check_avail_failed','check_avail_unverified','component_executor_unavailable','hotel_not_visible','hotel_rates_failed','offer_facts_changed','offer_not_loaded','offer_unavailable','order_not_found','order_outcome_not_observed','order_state_unknown','order_status_unavailable','requested_offers_not_loaded','search_failed','search_form_invalid','search_session_expired','search_terminal_timeout','stale_revision','surface_adapter_failed','undo_token_not_found','unhandled','unsupported','verified_offer_required','workspace_changed_during_action','criterion_must_not_met','no_hotels_matched','offer_target_not_reached'] as const
|
|
36
|
-
export type BookingV2GapCode = typeof BOOKING_V2_GAP_CODES[number]
|
|
37
|
-
export type BookingV2BlockerScope = 'search' | 'offer' | 'availability' | 'checkout'
|
|
38
|
-
export interface CriterionBlockerV2 { blockerId: string; sourceActionId: string; sourceReceiptDigest: string; scope: BookingV2BlockerScope; code: BookingV2BlockerCode; criterionPath: string; strength: 'must'; valueDigest: string; valueLabel?: string; evidence: { factRefs: string[]; gapCodes: BookingV2GapCode[]; requested?: number; actual?: number } }
|
|
39
|
-
export interface RelaxationApprovalV2 {
|
|
40
|
-
taskId: string
|
|
41
|
-
contextRef: string
|
|
42
|
-
sourceTurnId: string
|
|
43
|
-
presentationRequestKey: string
|
|
44
|
-
optionDigest: string
|
|
45
|
-
approvalId: string
|
|
46
|
-
deliveryNonce: string
|
|
47
|
-
blockerId: string
|
|
48
|
-
sourceActionId: string
|
|
49
|
-
sourceReceiptDigest: string
|
|
50
|
-
scope: BookingV2BlockerScope
|
|
51
|
-
code: BookingV2BlockerCode
|
|
52
|
-
criterionPath: string
|
|
53
|
-
valueDigest: string
|
|
54
|
-
from: 'must'
|
|
55
|
-
to: 'prefer' | 'drop'
|
|
56
|
-
approved: true
|
|
57
|
-
}
|
|
58
|
-
export interface RelaxationApprovalRefV2 { approvalId: string; blockerId: string; contextRef: string; sourceTurnId: string; presentationRequestKey: string; sourceActionId: string; targetActionId: string; sourceRevision: number; targetActionKind: BookingReadActionKindV2; to: 'prefer'|'drop'; expiresAt: string; nonce: string; sourceReceiptDigest: string; scope: BookingV2BlockerScope; code: BookingV2BlockerCode; criterionPath: string; valueDigest: string }
|
|
59
|
-
interface Base<K extends BookingReadActionKindV2, I> { schemaVersion: typeof BOOKING_SURFACE_SCHEMA_VERSION_V2; kind: K; actionId: string; contextRef: string; expectedRevision: number; reason: string; factRefs: string[]; input: I; relaxationApprovalRef?: RelaxationApprovalRefV2 }
|
|
60
|
-
export type SearchPatchActionV2 = Base<'search.patch', { patch: SearchCriteriaPatchV1 }>
|
|
61
|
-
export type SearchRunActionV2 = Base<'search.run', Record<string, never>>
|
|
62
|
-
export type ResultsViewPatchActionV2 = Base<'results.view.patch', { patch: ResultsViewPatchV1 }>
|
|
63
|
-
export type HotelFocusActionV2 = Base<'hotel.focus', { hotelRef: string }>
|
|
64
|
-
export type HotelSelectActionV2 = Base<'hotel.select', { hotelRef: string }>
|
|
65
|
-
export type OffersQueryActionV2 = Base<'offers.query', { hotelRefs: string[]; criteria: OfferCriteriaV1 }>
|
|
66
|
-
export type OffersViewPatchActionV2 = Base<'offers.view.patch', { hotelRef: string; criteria: OfferCriteriaV1 }>
|
|
67
|
-
export type OffersCompareActionV2 = Base<'offers.compare', { offerRefs: string[]; requestedCount: number }>
|
|
68
|
-
export interface LoadedOfferFactV2 { offerRef: string; offerVersionRef: string; hotelRef: string; evidenceLevel: EvidenceLevelV1; factRefs: string[] }
|
|
69
|
-
export interface VerifiedOfferCapabilityV2 { offerRef: string; offerVersionRef: string; verifiedOfferRef: string; expiresAt: string }
|
|
70
|
-
export type OfferSelectActionV2 = Base<'offer.select', { offerRef: string; offerVersionRef: string }>
|
|
71
|
-
export type OfferCheckActionV2 = Base<'offer.check', { offerRef: string; offerVersionRef: string }>
|
|
72
|
-
export type CheckoutPrepareActionV2 = Base<'checkout.prepare', { offerRef: string; offerVersionRef: string; verifiedOfferRef: string }>
|
|
73
|
-
export type OrderObserveActionV2 = Base<'order.observe', { orderRef: string }>
|
|
74
|
-
export type BookingReadActionV2=SearchPatchActionV2|SearchRunActionV2|ResultsViewPatchActionV2|HotelFocusActionV2|HotelSelectActionV2|OffersQueryActionV2|OffersViewPatchActionV2|OffersCompareActionV2|OfferSelectActionV2|OfferCheckActionV2|CheckoutPrepareActionV2|OrderObserveActionV2
|
|
75
|
-
export interface BookingWorkspaceSnapshotV2 extends Omit<BookingWorkspaceSnapshotV1,'schemaVersion'|'surface'|'capabilities'|'loadedOffers'|'verifiedOfferRef'>{schemaVersion:typeof BOOKING_SURFACE_SCHEMA_VERSION_V2;surface:BookingSurfaceV2;loadedOffers:LoadedOfferFactV2[];verifiedOffer?:VerifiedOfferCapabilityV2;capabilities:{surface:BookingSurfaceV2;allowedActions:BookingReadActionKindV2[]}}
|
|
76
|
-
export type BookingWorkspaceIngressSnapshotV2 = Pick<BookingWorkspaceSnapshotV2, 'schemaVersion'|'revision'|'locale'|'currency'|'searchDraft'|'results'|'visibleHotels'|'loadedOffers'|'focusedHotelRef'|'shortlistedOfferRefs'|'selectedOfferRef'>
|
|
77
|
-
export type ActionObservationV2 =
|
|
78
|
-
| { kind: 'search.state'; searchSessionRef?: string; resultCount?: number; gapCodes?: BookingV2GapCode[] }
|
|
79
|
-
| { kind: 'results.state'; matchedHotelRefs: string[]; visibleCount: number; gapCodes?: BookingV2GapCode[] }
|
|
80
|
-
| { kind: 'hotel.focus'; hotelRef: string }
|
|
81
|
-
| { kind: 'hotel.selection'; hotelRef: string }
|
|
82
|
-
| { kind: 'offers.state'; hotelRefs: string[]; offerRefs: string[]; loadedHotelCount: number; gapCodes?: BookingV2GapCode[] }
|
|
83
|
-
| { kind: 'offer.selection'; offerRef: string; offerVersionRef: string }
|
|
84
|
-
| { kind: 'offer.availability'; offerRef: string; checkedOfferVersionRef: string; currentOfferVersionRef?: string; verifiedOfferRef?: string; available: boolean; changedFactRefs: string[]; gapCodes?: BookingV2GapCode[] }
|
|
85
|
-
| { kind: 'checkout.handoff'; offerRef: string; offerVersionRef: string; verifiedOfferRef: string; handoffRef: string }
|
|
86
|
-
| { kind: 'order.state'; orderRef: string; state: 'pending'|'verified'|'failed'|'unknown'; gapCodes?: BookingV2GapCode[] }
|
|
87
|
-
| { kind: 'gap'; code: BookingV2GapCode; factRefs: string[] }
|
|
88
|
-
export interface ResultContractV2 {outcome:'complete'|'partial'|'empty';requestedCount?:number;actualCount?:number;hardCriteriaMet:boolean;factRefs:string[];gapCodes:BookingV2GapCode[];blockers:CriterionBlockerV2[];relaxationsApplied:RelaxationApprovalV2[]}
|
|
89
|
-
export interface ActionReceiptV2 {schemaVersion:typeof BOOKING_SURFACE_SCHEMA_VERSION_V2;kind:'action.receipt';actionId:string;contextRef:string;status:'applied'|'needs_input'|'partial'|'no_match'|'unavailable'|'changed'|'stale'|'unsupported'|'failed';revision:number;observation:ActionObservationV2;resultContract:ResultContractV2;undoToken?:string}
|
|
90
|
-
export interface UserTurnV2 {schemaVersion:typeof BOOKING_SURFACE_SCHEMA_VERSION_V2;kind:'user.turn';taskId:string;turnId:string;workspace:BookingWorkspaceSnapshotV2;request:{text:string;approval?:RelaxationApprovalV2}}
|
|
91
|
-
/** Browser-to-BFF ingress. Identity is deliberately absent from this shape. */
|
|
92
|
-
export interface IngressTurnV2 {schemaVersion:typeof BOOKING_SURFACE_SCHEMA_VERSION_V2;kind:'user.turn.ingress';requestKey:BookingRequestKeyV2;taskHandle?:string;surfaceHint:BookingSurfaceV2;workspace:BookingWorkspaceIngressSnapshotV2;request:{text:string}}
|
|
93
|
-
export interface ReceiptContinuationV2 {schemaVersion:typeof BOOKING_SURFACE_SCHEMA_VERSION_V2;kind:'action.receipt.continuation';taskId:string;workspace:BookingWorkspaceSnapshotV2;receipt:ActionReceiptV2}
|
|
94
|
-
export type BookingCopilotTurnV2=UserTurnV2|IngressTurnV2|ReceiptContinuationV2
|
|
95
|
-
/** Typed BFF seam: implementations authenticate ingress and return only
|
|
96
|
-
* server-issued identity. The HTTP adapter constructs the internal UserTurn. */
|
|
97
|
-
export interface BookingIngressIdentityBindingV2 {
|
|
98
|
-
taskId: string
|
|
99
|
-
turnId: string
|
|
100
|
-
contextRef: string
|
|
101
|
-
/** Authoritative BFF surface; never copied from the browser hint. */
|
|
102
|
-
surface: BookingSurfaceV2
|
|
103
|
-
/** BFF-authorized closed action subset for this surface. */
|
|
104
|
-
allowedActions: BookingReadActionKindV2[]
|
|
105
|
-
}
|
|
106
|
-
export interface BookingIngressPrincipalV2 { subject: string; scope: string }
|
|
107
|
-
export interface BookingIngressBindingV2 {
|
|
108
|
-
bind(input: IngressTurnV2, principal: BookingIngressPrincipalV2): BookingIngressIdentityBindingV2 | Promise<BookingIngressIdentityBindingV2>
|
|
109
|
-
}
|
|
110
|
-
export interface BookingQuestionEventV2 {schemaVersion:typeof BOOKING_SURFACE_SCHEMA_VERSION_V2;eventId:string;taskId:string;contextRef:string;sequence:number;emittedAt:string;kind:'question';question:{questionId:string;prompt:string;missingFields:string[];type:'relaxation_approval_required';blocker:CriterionBlockerV2;approvalOptions:Array<{approval:RelaxationApprovalV2}>}}
|
|
111
|
-
export interface BookingEventBaseV2 { schemaVersion: typeof BOOKING_SURFACE_SCHEMA_VERSION_V2; eventId: string; taskId: string; contextRef: string; sequence: number; emittedAt: string }
|
|
112
|
-
export type BookingSurfaceEventV2 =
|
|
113
|
-
| (BookingEventBaseV2 & { kind: 'status'; status: 'submitted'|'working'|'waiting_receipt'|'input_required' })
|
|
114
|
-
| BookingQuestionEventV2
|
|
115
|
-
| (BookingEventBaseV2 & { kind: 'operation'; action: BookingReadActionV2 })
|
|
116
|
-
| (BookingEventBaseV2 & { kind: 'explanation'; explanation: { text: string; factRefs: string[] } })
|
|
117
|
-
| (BookingEventBaseV2 & { kind: 'terminal'; terminal: { status: 'completed'|'stopped'; summary: string; factRefs: string[] } })
|
|
118
|
-
| (BookingEventBaseV2 & { kind: 'error'; error: { code: string; message: string; retryable: boolean } })
|