@danceiny/gotry 0.0.1-rc.15 → 0.0.1-rc.17
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 +51 -13
- package/README.zh-CN.md +26 -12
- package/bin/gotry-booking-copilot.js +53 -0
- package/bin/gotry-bootstrap.js +357 -8
- package/bin/gotry-inner.js +442 -60
- package/bin/gotry-runtime-resolution.d.ts +27 -0
- package/bin/gotry-runtime-resolution.js +50 -0
- package/bin/gotry.js +1 -1
- package/cordis.gotry-patch.yml +15 -1
- package/data/airline-airports.json +39 -0
- package/dist/capabilities/agent-reach-deep.js +1 -1
- package/dist/capabilities/agent-reach.js +1 -1
- package/dist/capabilities/anything.js +1 -1
- package/dist/capabilities/artifacts.js +1 -1
- package/dist/capabilities/effect.js +293 -0
- package/dist/capabilities/fact-log.js +41 -0
- package/dist/capabilities/flyai.js +20 -6
- package/dist/capabilities/hbcli.js +43 -1
- package/dist/capabilities/incident-log.js +1 -1
- package/dist/capabilities/model-override.js +18 -0
- package/dist/capabilities/opensky.js +1 -1
- package/dist/capabilities/resilience.js +90 -0
- package/dist/capabilities/session/action-cache.js +1 -1
- package/dist/capabilities/session/adapters/ctrip-flight.js +1 -1
- package/dist/capabilities/session/adapters/meituan-local.js +1 -1
- package/dist/capabilities/session/benchmark.js +2 -1
- package/dist/capabilities/session/extension-bridge.js +358 -0
- package/dist/capabilities/session/extension-channel.js +93 -0
- package/dist/capabilities/session/extension-distribution.js +234 -0
- package/dist/capabilities/session/extract.js +1 -1
- package/dist/capabilities/session/golden-score.js +92 -0
- package/dist/capabilities/session/health-watch.js +216 -0
- package/dist/capabilities/session/read-guard.js +1 -1
- package/dist/capabilities/session/static-flight-golden.js +137 -0
- package/dist/capabilities/session/transport.js +1 -1
- package/dist/capabilities/session/wizard.js +147 -0
- package/dist/capabilities/session-consent.js +1 -1
- package/dist/capabilities/session-login.js +83 -1
- package/dist/capabilities/session-search.js +111 -2
- package/dist/capabilities/weather.js +168 -46
- package/dist/data/session-golden-20.json +25 -0
- package/dist/data/sf-golden-manifest.json +102 -0
- package/dist/data/sf-static-routes.json +91 -0
- package/dist/scripts/action-cache-tests.js +1 -1
- package/dist/scripts/agent-planning-budget-e2e.js +227 -0
- package/dist/scripts/agent-planning-budget-tests.js +173 -0
- package/dist/scripts/agent-reach-deep-tests.js +1 -1
- package/dist/scripts/agent-reach-tests.js +1 -1
- package/dist/scripts/agent-reach-wrapper-tests.js +1 -1
- package/dist/scripts/anything-tests.js +1 -1
- package/dist/scripts/async-collect.js +1 -1
- package/dist/scripts/benchmark-environment-bridge-e2e.js +981 -0
- package/dist/scripts/benchmark-environment-bridge-tests.js +2544 -0
- package/dist/scripts/booking-copilot-availability-ledger-binding-tests.js +335 -0
- package/dist/scripts/booking-copilot-availability-policy-v2-tests.js +1355 -0
- package/dist/scripts/booking-copilot-bin-proof-tests.js +89 -0
- package/dist/scripts/booking-copilot-crossrepo-fixture-server.js +113 -0
- package/dist/scripts/booking-copilot-dsh-core-proof-tests.js +356 -0
- package/dist/scripts/booking-copilot-dsh-planner-proof-tests.js +557 -0
- package/dist/scripts/booking-copilot-dsh-plugin-proof-tests.js +140 -0
- package/dist/scripts/booking-copilot-event-sequence-concurrency-proof-tests.js +202 -0
- package/dist/scripts/booking-copilot-gap-code-contract-proof-tests.js +102 -0
- package/dist/scripts/booking-copilot-operation-ledger-concurrency-proof-tests.js +374 -0
- package/dist/scripts/booking-copilot-receipt-ledger-concurrency-proof-tests.js +447 -0
- package/dist/scripts/booking-copilot-runtime-proof-tests.js +205 -0
- package/dist/scripts/booking-copilot-server-proof-tests.js +317 -0
- package/dist/scripts/booking-copilot-startup-proof-tests.js +283 -0
- package/dist/scripts/booking-copilot-v2-runtime-proof-tests.js +3935 -0
- package/dist/scripts/booking-saga-tests.js +1 -1
- package/dist/scripts/booking-surface-contract-proof-tests.js +393 -0
- package/dist/scripts/booking-surface-v2-contract-proof-tests.js +1174 -0
- package/dist/scripts/bootstrap-tests.js +59 -3
- package/dist/scripts/build-changelog.js +279 -0
- package/dist/scripts/changelog-tests.js +165 -0
- package/dist/scripts/companion-tests.js +1 -1
- package/dist/scripts/diff-test.js +1 -1
- package/dist/scripts/dsh-runtime-closure-tests.js +225 -0
- package/dist/scripts/dsh-runtime-closure.js +150 -0
- package/dist/scripts/effect-tests.js +474 -0
- package/dist/scripts/engine-run.js +1 -1
- package/dist/scripts/engine-tests.js +1 -1
- package/dist/scripts/evaluation-cadence-tests.js +347 -0
- package/dist/scripts/evaluation-contract-tests.js +574 -0
- package/dist/scripts/extension-distribution-cli.js +35 -0
- package/dist/scripts/extension-distribution-tests.js +341 -0
- package/dist/scripts/extension-tests.js +573 -0
- package/dist/scripts/fact-gate-tests.js +318 -0
- package/dist/scripts/flyai-tests.js +1 -1
- package/dist/scripts/hbcli-e2e-tests.js +180 -0
- package/dist/scripts/hbcli-tests.js +1 -1
- package/dist/scripts/health-watch-cli.js +51 -0
- package/dist/scripts/i18n-tests.js +1 -1
- package/dist/scripts/incident-tests.js +1 -1
- package/dist/scripts/journey-tests.js +1 -1
- package/dist/scripts/ledger-tests.js +1 -1
- package/dist/scripts/ledger-workflow-crash.js +1 -1
- package/dist/scripts/memory-capture-tests.js +1 -1
- package/dist/scripts/memory-decay-tests.js +1 -1
- package/dist/scripts/memory-metrics.js +1 -1
- package/dist/scripts/memory-value-report.js +1 -1
- package/dist/scripts/model-override-e2e.js +176 -0
- package/dist/scripts/nightly-evidence-tests.js +67 -4
- package/dist/scripts/nightly-evidence.js +59 -3
- package/dist/scripts/nudge-digest.js +1 -1
- package/dist/scripts/onboarding-tests.js +186 -0
- package/dist/scripts/opensky-check.js +1 -1
- package/dist/scripts/opensky-tests.js +1 -1
- package/dist/scripts/pnpm-dsh-closure-proof.js +20 -0
- package/dist/scripts/price-drift-tests.js +441 -0
- package/dist/scripts/price-drift-watch.js +491 -0
- package/dist/scripts/probe-poi-tests.js +1 -1
- package/dist/scripts/product-metrics.js +1 -1
- package/dist/scripts/publish-preverify.js +40 -4
- package/dist/scripts/realtime-pricing-tests.js +1 -1
- package/dist/scripts/replay-async.js +1 -1
- package/dist/scripts/replay-real.js +1 -1
- package/dist/scripts/replay.js +1 -1
- package/dist/scripts/session-attach-diagnose.js +1 -1
- package/dist/scripts/session-attach-poc.js +1 -1
- package/dist/scripts/session-benchmark.js +1 -1
- package/dist/scripts/session-extract-tests.js +1 -1
- package/dist/scripts/session-login.js +1 -1
- package/dist/scripts/session-tests.js +70 -20
- package/dist/scripts/sf-live-benchmark.js +338 -0
- package/dist/scripts/sf-live-cli-tests.js +21 -0
- package/dist/scripts/sf-soft-score-tests.js +108 -0
- package/dist/scripts/sf-summary.js +93 -0
- package/dist/scripts/skeleton-check.js +1 -1
- package/dist/scripts/skeleton-integration-test.js +1 -1
- package/dist/scripts/skills-contract-tests.js +1 -1
- package/dist/scripts/smoke-session-gate-tests.js +29 -0
- package/dist/scripts/smoke.js +154 -33
- package/dist/scripts/state-cli-tests.js +1 -1
- package/dist/scripts/state-cli.js +1 -1
- package/dist/scripts/static-golden-tests.js +299 -0
- package/dist/scripts/time-eval-tests.js +1 -1
- package/dist/scripts/travel-timeline-tests.js +1 -1
- package/dist/scripts/unified-tests.js +1 -1
- package/dist/scripts/weather-tests.js +694 -44
- package/dist/scripts/z3-race-tests.js +1 -1
- package/dist/src/artifact-gate.js +310 -0
- package/dist/src/benchmark-agent-conformance.js +370 -0
- package/dist/src/benchmark-environment-bridge.js +384 -0
- package/dist/src/benchmark-headless-child-diagnostics.js +173 -0
- package/dist/src/benchmark-tool-isolation.js +124 -0
- package/dist/src/bookable-facts.js +349 -0
- package/dist/src/booking-saga.js +1 -1
- package/dist/src/booking-surface/availability-policy-v2.js +830 -0
- package/dist/src/booking-surface/canonical-schema.js +113 -0
- package/dist/src/booking-surface/contracts-v2.js +89 -0
- package/dist/src/booking-surface/contracts.js +46 -0
- package/dist/src/booking-surface/dsh-planner.js +453 -0
- package/dist/src/booking-surface/dsh-plugin.js +93 -0
- package/dist/src/booking-surface/error-codes.js +94 -0
- package/dist/src/booking-surface/index.js +15 -0
- package/dist/src/booking-surface/profile.js +68 -0
- package/dist/src/booking-surface/runtime-v2.js +1771 -0
- package/dist/src/booking-surface/runtime.js +351 -0
- package/dist/src/booking-surface/server-v2.js +334 -0
- package/dist/src/booking-surface/server.js +302 -0
- package/dist/src/booking-surface/startup.js +159 -0
- package/dist/src/booking-surface/validation-v2.js +319 -0
- package/dist/src/booking-surface/validation.js +809 -0
- package/dist/src/bridge.js +1 -1
- package/dist/src/companions.js +1 -1
- package/dist/src/contracts.js +1 -1
- package/dist/src/dsh-llm.js +1 -1
- package/dist/src/engine.js +1 -1
- package/dist/src/evaluation-cadence.js +234 -0
- package/dist/src/evaluation-contracts.js +906 -0
- package/dist/src/i18n.js +1 -1
- package/dist/src/index.js +234 -60
- package/dist/src/journey.js +1 -1
- package/dist/src/loop.js +1 -1
- package/dist/src/memory-capture.js +1 -1
- package/dist/src/memory-decay.js +1 -1
- package/dist/src/memory-utility.js +1 -1
- package/dist/src/mock-llm.js +1 -1
- package/dist/src/model.js +1 -1
- package/dist/src/realtime-pricing.js +14 -7
- package/dist/src/slot-spec.js +1 -1
- package/dist/src/state-ledger.js +2 -1
- package/dist/src/time-anchor.js +1 -1
- package/dist/src/tool-budget.js +136 -0
- package/dist/src/tool-packet.js +1 -1
- package/dist/src/travel-slots.js +1 -1
- package/dist/src/travel-timeline.js +1 -1
- package/dist/src/unified.js +1 -1
- package/dist/src/wish-pool.js +1 -1
- package/dist/src/z3-shared.js +1 -1
- package/extension/README.md +50 -0
- package/extension/background.js +160 -0
- package/extension/content-bridge.js +41 -0
- package/extension/content-main.js +62 -0
- package/extension/manifest.json +32 -0
- package/package.json +291 -12
- package/schemas/booking.surface.v1.schema.json +927 -0
- package/schemas/booking.surface.v2.schema.json +61 -0
- package/ts/capabilities/fact-log.ts +54 -0
- package/ts/capabilities/flyai.ts +16 -3
- package/ts/capabilities/hbcli.ts +46 -0
- package/ts/capabilities/session/benchmark.ts +4 -1
- package/ts/capabilities/session/extension-bridge.ts +377 -0
- package/ts/capabilities/session/extension-channel.ts +95 -0
- package/ts/capabilities/session/extension-distribution.ts +264 -0
- package/ts/capabilities/session/golden-score.ts +139 -0
- package/ts/capabilities/session/health-watch.ts +257 -0
- package/ts/capabilities/session/static-flight-golden.ts +209 -0
- package/ts/capabilities/session/wizard.ts +140 -0
- package/ts/capabilities/session-login.ts +63 -2
- package/ts/capabilities/session-search.ts +105 -3
- package/ts/capabilities/weather.ts +141 -52
- package/ts/package.json +3 -3
- package/ts/src/artifact-gate.ts +365 -0
- package/ts/src/benchmark-agent-conformance.ts +448 -0
- package/ts/src/benchmark-environment-bridge.ts +348 -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 +557 -0
- package/ts/src/booking-surface/availability-policy-v2.ts +523 -0
- package/ts/src/booking-surface/canonical-schema.js +113 -0
- package/ts/src/booking-surface/contracts-v2.ts +118 -0
- package/ts/src/booking-surface/contracts.ts +380 -0
- package/ts/src/booking-surface/dsh-planner.ts +452 -0
- package/ts/src/booking-surface/dsh-plugin.js +93 -0
- package/ts/src/booking-surface/error-codes.ts +101 -0
- package/ts/src/booking-surface/index.ts +12 -0
- package/ts/src/booking-surface/profile.ts +42 -0
- package/ts/src/booking-surface/runtime-v2.ts +1466 -0
- package/ts/src/booking-surface/runtime.ts +483 -0
- package/ts/src/booking-surface/server-v2.ts +247 -0
- package/ts/src/booking-surface/server.ts +324 -0
- package/ts/src/booking-surface/startup.ts +196 -0
- package/ts/src/booking-surface/validation-v2.ts +205 -0
- package/ts/src/booking-surface/validation.ts +453 -0
- package/ts/src/index.ts +161 -14
- package/ts/src/state-ledger.ts +1 -0
- package/ts/src/tool-budget.ts +165 -0
package/dist/src/i18n.js
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import { ensureStateDir, recordLatency } from './bridge.js';
|
|
|
5
5
|
import { segmentsFromCandidate, solveChoiceSegment } from './unified.js';
|
|
6
6
|
import { checkConnectivity } from '../scripts/skeleton-check.js';
|
|
7
7
|
import { parseCandidate, parseRequest } from './model.js';
|
|
8
|
-
import { searchHotels as hbcliSearchHotels } from '../capabilities/hbcli.js';
|
|
9
8
|
import { installProcessGuards, guardToolExecute } from '../capabilities/incident-log.js';
|
|
10
9
|
import { interpretArgs } from './tool-packet.js';
|
|
11
10
|
import { projectUtility } from './memory-utility.js';
|
|
@@ -14,16 +13,34 @@ import { resolveTimelineDate } from './travel-timeline.js';
|
|
|
14
13
|
import { ensureLedger, readCompanionsWithFallback, readMotivationWithFallback, readTripsWithFallback, readWishPoolWithFallback } from './state-ledger.js';
|
|
15
14
|
import { buildTimeAnchor } from './time-anchor.js';
|
|
16
15
|
import { resolveSlotDate } from './slot-spec.js';
|
|
17
|
-
import {
|
|
18
|
-
import { verifyFlight } from '../capabilities/opensky.js';
|
|
16
|
+
import { wmoLabel } from '../capabilities/weather.js';
|
|
19
17
|
import { anythingSearch } from '../capabilities/anything.js';
|
|
20
18
|
import { readUrl, reach, reachStatus } from '../capabilities/agent-reach.js';
|
|
21
19
|
import { videoSubtitle, githubSearch } from '../capabilities/agent-reach-deep.js';
|
|
22
|
-
import { flyaiSearch } from '../capabilities/flyai.js';
|
|
23
|
-
import { sessionFlightSearch } from '../capabilities/session-search.js';
|
|
24
20
|
import { sessionLogin } from '../capabilities/session-login.js';
|
|
21
|
+
import { EXTENSION_STORE_URL } from '../capabilities/session/extension-bridge.js';
|
|
25
22
|
import { createConsentGate, approvalFromContext } from '../capabilities/session-consent.js';
|
|
23
|
+
import { installModelOverride } from '../capabilities/model-override.js';
|
|
26
24
|
import { listArtifacts, readArtifact } from '../capabilities/artifacts.js';
|
|
25
|
+
import { interpretEffect, declinedObservation } from '../capabilities/effect.js';
|
|
26
|
+
import { appendFacts, loadFactRegistry } from '../capabilities/fact-log.js';
|
|
27
|
+
import { factsFromFlyai, factsFromSession } from './bookable-facts.js';
|
|
28
|
+
import { gateArtifact } from './artifact-gate.js';
|
|
29
|
+
import { installToolBudget } from './tool-budget.js';
|
|
30
|
+
import { registerBenchmarkEnvironmentBridge } from './benchmark-environment-bridge.js';
|
|
31
|
+
import { installBenchmarkToolIsolation } from './benchmark-tool-isolation.js';
|
|
32
|
+
import { installBenchmarkAgentConformance } from './benchmark-agent-conformance.js';
|
|
33
|
+
let airlineAirportMapCache = null;
|
|
34
|
+
async function loadAirlineAirportMap() {
|
|
35
|
+
if (airlineAirportMapCache) return airlineAirportMapCache;
|
|
36
|
+
try {
|
|
37
|
+
const { readFile } = await import('node:fs/promises');
|
|
38
|
+
airlineAirportMapCache = JSON.parse(await readFile(join(import.meta.dirname, '..', '..', 'data', 'airline-airports.json'), 'utf-8'));
|
|
39
|
+
return airlineAirportMapCache;
|
|
40
|
+
} catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
27
44
|
export const name = 'gotry-tools';
|
|
28
45
|
export const inject = [
|
|
29
46
|
'tools',
|
|
@@ -33,7 +50,8 @@ export const Config = z.object({
|
|
|
33
50
|
stateRoot: z.string().default('.'),
|
|
34
51
|
timeoutMs: z.number().default(30_000),
|
|
35
52
|
hbcliBin: z.string().default('hbcli'),
|
|
36
|
-
sessionAccess: z.string().default('ask')
|
|
53
|
+
sessionAccess: z.string().default('ask'),
|
|
54
|
+
benchmarkEnvironmentConfigPath: z.string().default('')
|
|
37
55
|
});
|
|
38
56
|
const unwrapQuery = interpretArgs;
|
|
39
57
|
function renderMotivationBrief(stateRoot) {
|
|
@@ -78,6 +96,17 @@ function readTimelineTrips(stateRoot) {
|
|
|
78
96
|
})).sort((a, b)=>a.start < b.start ? 1 : -1).slice(0, 3);
|
|
79
97
|
}
|
|
80
98
|
export function apply(ctx, config) {
|
|
99
|
+
installToolBudget(ctx);
|
|
100
|
+
const rawBenchmarkEnvironmentConfigPath = config.benchmarkEnvironmentConfigPath ?? '';
|
|
101
|
+
if (rawBenchmarkEnvironmentConfigPath.trim()) {
|
|
102
|
+
installModelOverride(ctx);
|
|
103
|
+
const getService = ctx.get;
|
|
104
|
+
const directSubprocess = typeof getService === 'function' ? getService.call(ctx, 'subprocess') : undefined;
|
|
105
|
+
const projection = registerBenchmarkEnvironmentBridge(rawBenchmarkEnvironmentConfigPath, (tool)=>ctx.tools.register(tool), directSubprocess);
|
|
106
|
+
installBenchmarkToolIsolation(ctx);
|
|
107
|
+
installBenchmarkAgentConformance(ctx, projection);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
81
110
|
const sp = ctx['systemPrompt'];
|
|
82
111
|
sp?.variable?.('current_date', ()=>{
|
|
83
112
|
const d = new Date();
|
|
@@ -106,6 +135,7 @@ export function apply(ctx, config) {
|
|
|
106
135
|
approval: approvalFromContext(ctx)
|
|
107
136
|
}));
|
|
108
137
|
}
|
|
138
|
+
installModelOverride(ctx);
|
|
109
139
|
const registerGuarded = (tool)=>{
|
|
110
140
|
const t = {
|
|
111
141
|
...tool
|
|
@@ -549,16 +579,20 @@ export function apply(ctx, config) {
|
|
|
549
579
|
if (r.raw !== r.date) dateNotes.push(`slot-resolved: ${r.raw} → ${r.date}`);
|
|
550
580
|
return r.date;
|
|
551
581
|
};
|
|
552
|
-
const
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
582
|
+
const itp = await interpretEffect({
|
|
583
|
+
effect: 'HBCLI_HOTEL_SEARCH',
|
|
584
|
+
params: {
|
|
585
|
+
destination: q.destination,
|
|
586
|
+
checkIn: resolveDate(q.checkIn),
|
|
587
|
+
checkOut: resolveDate(q.checkOut),
|
|
588
|
+
adults: q.adults,
|
|
589
|
+
hbcliBin: config.hbcliBin,
|
|
590
|
+
timeoutMs: config.timeoutMs,
|
|
591
|
+
fallbackPath
|
|
592
|
+
}
|
|
561
593
|
});
|
|
594
|
+
if (!itp.result) return declinedObservation('HBCLI_HOTEL_SEARCH', itp.trace);
|
|
595
|
+
const resp = itp.result;
|
|
562
596
|
const dir = await ensureStateDir(config.stateRoot);
|
|
563
597
|
const isLive = resp.via === 'hbcli-realtime';
|
|
564
598
|
const evidence = isLive ? resp.evidence : '[静态包:估算]';
|
|
@@ -672,7 +706,14 @@ export function apply(ctx, config) {
|
|
|
672
706
|
let placeLabel = q.place ?? `${q.lat},${q.lng}`;
|
|
673
707
|
if (lat === undefined || lng === undefined) {
|
|
674
708
|
if (!q.place) throw new Error('gotry_weather_check requires place name or lat/lng');
|
|
675
|
-
const
|
|
709
|
+
const geoItp = await interpretEffect({
|
|
710
|
+
effect: 'WEATHER_GEOCODE',
|
|
711
|
+
params: {
|
|
712
|
+
name: q.place
|
|
713
|
+
}
|
|
714
|
+
});
|
|
715
|
+
if (!geoItp.result) return declinedObservation('WEATHER_GEOCODE', geoItp.trace);
|
|
716
|
+
const geo = geoItp.result;
|
|
676
717
|
if (!geo.ok || geo.results.length === 0) {
|
|
677
718
|
return JSON.parse(JSON.stringify({
|
|
678
719
|
ok: false,
|
|
@@ -686,15 +727,23 @@ export function apply(ctx, config) {
|
|
|
686
727
|
placeLabel = `${hit.name}(${hit.admin1 ?? hit.country ?? ''})`;
|
|
687
728
|
}
|
|
688
729
|
const isClimate = q.mode === 'climate' || q.month !== undefined && q.mode !== 'forecast';
|
|
689
|
-
const
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
730
|
+
const wxItp = isClimate ? await interpretEffect({
|
|
731
|
+
effect: 'WEATHER_CLIMATE',
|
|
732
|
+
params: {
|
|
733
|
+
latitude: lat,
|
|
734
|
+
longitude: lng,
|
|
735
|
+
month: q.month ?? new Date().getMonth() + 1
|
|
736
|
+
}
|
|
737
|
+
}) : await interpretEffect({
|
|
738
|
+
effect: 'WEATHER_FORECAST',
|
|
739
|
+
params: {
|
|
740
|
+
latitude: lat,
|
|
741
|
+
longitude: lng,
|
|
742
|
+
days: q.days
|
|
743
|
+
}
|
|
697
744
|
});
|
|
745
|
+
if (!wxItp.result) return declinedObservation(isClimate ? 'WEATHER_CLIMATE' : 'WEATHER_FORECAST', wxItp.trace);
|
|
746
|
+
const r = wxItp.result;
|
|
698
747
|
const dir = await ensureStateDir(config.stateRoot);
|
|
699
748
|
await recordLatency(join(dir, 'bridge-latency.jsonl'), Date.now() - started, `weather:${r.via}`).catch(()=>{});
|
|
700
749
|
const dailyLines = (r.daily ?? []).slice(0, 7).map((d)=>`${d.date} ${d.tempMinC.toFixed(0)}–${d.tempMaxC.toFixed(0)}°C ${wmoLabel(d.weatherCode)}${d.precipProbMaxPct !== null ? ` 降水概率${d.precipProbMaxPct}%` : ''}`);
|
|
@@ -762,11 +811,16 @@ export function apply(ctx, config) {
|
|
|
762
811
|
summary: 'callsign 必填'
|
|
763
812
|
}));
|
|
764
813
|
}
|
|
765
|
-
const
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
814
|
+
const itp = await interpretEffect({
|
|
815
|
+
effect: 'OPENSKY_FLIGHT_VERIFY',
|
|
816
|
+
params: {
|
|
817
|
+
callsign: q.callsign,
|
|
818
|
+
airport: q.airport,
|
|
819
|
+
timeoutMs: q.timeoutMs
|
|
820
|
+
}
|
|
769
821
|
});
|
|
822
|
+
if (!itp.result) return declinedObservation('OPENSKY_FLIGHT_VERIFY', itp.trace);
|
|
823
|
+
const r = itp.result;
|
|
770
824
|
const dir = await ensureStateDir(config.stateRoot);
|
|
771
825
|
await recordLatency(join(dir, 'bridge-latency.jsonl'), Date.now() - started, `flight_verify:${r.via}`).catch(()=>{});
|
|
772
826
|
const summary = r.verdict === 'observed' ? `${r.callsign} 当前 ADS-B 观测命中 (${r.hits?.length ?? 0} 架)${r.airport ? ` 在 ${r.airport}` : ''}\n${r.evidence}` : r.verdict === 'not_observed' ? `${r.callsign} 当前观测列表未见(ADS-B 覆盖有限,不否定该航班存在)\n${r.evidence}` : `${r.callsign} OpenSky 不可用:${r.error}\n${r.evidence}`;
|
|
@@ -842,13 +896,18 @@ export function apply(ctx, config) {
|
|
|
842
896
|
};
|
|
843
897
|
}
|
|
844
898
|
}
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
899
|
+
const itp = await interpretEffect({
|
|
900
|
+
effect: 'FLYAI_SEARCH',
|
|
901
|
+
params: {
|
|
902
|
+
kind: 'hotel',
|
|
903
|
+
destName: dest,
|
|
904
|
+
checkInDate: q.checkIn,
|
|
905
|
+
checkOutDate: q.checkOut,
|
|
906
|
+
keyWords: q.keyWords
|
|
907
|
+
}
|
|
851
908
|
});
|
|
909
|
+
if (!itp.result) return declinedObservation('FLYAI_SEARCH', itp.trace);
|
|
910
|
+
const r = itp.result;
|
|
852
911
|
const top = (r.hotels ?? []).slice(0, 8).map((o)=>`${o.name}${o.star ? `(${o.star})` : ''} ${o.priceRaw ?? '价待询'}${o.poi ? ` · ${o.poi}` : ''}`);
|
|
853
912
|
const summary = r.verdict === 'hit' ? `${dest} 酒店(飞猪官方只读)前 ${top.length} 家(价格多为打码,真实价以 jumpUrl 为准):\n${top.join('\n')}\n${r.evidence}` : `${dest} 酒店无结果或失败:${r.error ?? 'miss'} ${r.evidence}`;
|
|
854
913
|
return JSON.parse(JSON.stringify({
|
|
@@ -873,12 +932,24 @@ export function apply(ctx, config) {
|
|
|
873
932
|
summary: `未发起查询:日期 ${q.date} 已是过去(今天 ${todayYmd}),过去不存在在售机/火车票。` + `多为用户时间表达未带年份所致——向用户确认年份(或按未来最近的同月日修正)后再查。`
|
|
874
933
|
}));
|
|
875
934
|
}
|
|
876
|
-
const
|
|
935
|
+
const itp = await interpretEffect({
|
|
936
|
+
effect: 'FLYAI_SEARCH',
|
|
937
|
+
params: {
|
|
938
|
+
kind,
|
|
939
|
+
origin: q.from,
|
|
940
|
+
destination: q.to,
|
|
941
|
+
depDate: q.date
|
|
942
|
+
}
|
|
943
|
+
});
|
|
944
|
+
if (!itp.result) return declinedObservation('FLYAI_SEARCH', itp.trace);
|
|
945
|
+
const r = itp.result;
|
|
946
|
+
const avMap = await loadAirlineAirportMap();
|
|
947
|
+
await appendFacts(config.stateRoot ?? '.', factsFromFlyai({
|
|
877
948
|
kind,
|
|
878
949
|
origin: q.from,
|
|
879
950
|
destination: q.to,
|
|
880
|
-
|
|
881
|
-
});
|
|
951
|
+
date: q.date
|
|
952
|
+
}, r, new Date().toISOString(), avMap?.city_alias));
|
|
882
953
|
const top = (r.options ?? []).slice(0, 8).map((o)=>`${o.no} ${o.name} ${o.depDateTime.slice(11, 16)}→${o.arrDateTime.slice(11, 16)} ¥${o.price}`);
|
|
883
954
|
const label = kind === 'flight' ? '机票' : '火车票';
|
|
884
955
|
const summary = r.verdict === 'hit' ? `${q.from}→${q.to} ${q.date} ${label}(飞猪官方只读)前 ${top.length} 条:\n${top.join('\n')}\n${r.evidence}` : r.verdict === 'miss' ? `${q.from}→${q.to} ${q.date} ${label}官方通道正常返回 0 条(常见原因:航线未开放/当日售罄)。${r.evidence}` : `${q.from}→${q.to} ${q.date} ${label}检索失败(可能限流/网络):${r.error ?? ''} ${r.evidence}`;
|
|
@@ -912,7 +983,7 @@ export function apply(ctx, config) {
|
|
|
912
983
|
}));
|
|
913
984
|
registerGuarded(defineTool({
|
|
914
985
|
name: 'gotry_session_login',
|
|
915
|
-
description: 'Productized login bootstrap for the account session channel (call this when gotry_session_search returns needs-login — the user never needs a terminal). ' + 'AUTO-DETECTION FIRST: it reads ticket-cookie NAMES before anything else — if the user already logged in (on the external site) it confirms instantly WITHOUT opening any page. ' + 'OPENS the site login entry in the USER\'S OWN Chrome and waits for the user to finish logging in on the external site. ' + 'GoTry NEVER collects, stores, or transmits credentials: no passwords, no SMS codes, no cookie values — it only checks the boolean fact "already logged in" (reads cookie NAMES only, zero values). ' + 'verdict logged-in (tickets detected) | pending (login tab opened, user not done yet — offer to re-check later) | needs-
|
|
986
|
+
description: 'Productized login bootstrap for the account session channel (call this when gotry_session_search returns needs-login — the user never needs a terminal). ' + 'AUTO-DETECTION FIRST: it reads ticket-cookie NAMES before anything else — if the user already logged in (on the external site) it confirms instantly WITHOUT opening any page. ' + 'OPENS the site login entry in the USER\'S OWN Chrome (foreground tab, left open for the user) and waits for the user to finish logging in on the external site. ' + 'GoTry NEVER collects, stores, or transmits credentials: no passwords, no SMS codes, no cookie values — it only checks the boolean fact "already logged in" (reads cookie NAMES only, zero values). ' + 'Transport: the GoTry Session Bridge browser extension (one-time install, ZERO Chrome system dialogs). ' + `verdict logged-in (tickets detected) | pending (login tab opened, user not done yet — offer to re-check later) | needs-extension (one-time extension install: the verdict surfaces the Chrome Web Store installUrl as a clickable link for dsh UI to render — installation is a browser concern, not gotry's). ` + 'Evidence [会话:<site>-login@ts].',
|
|
916
987
|
parameters: {
|
|
917
988
|
query: {
|
|
918
989
|
type: 'json',
|
|
@@ -936,7 +1007,7 @@ export function apply(ctx, config) {
|
|
|
936
1007
|
const r = await sessionLogin({
|
|
937
1008
|
waitMs: typeof q?.waitSeconds === 'number' ? q.waitSeconds * 1000 : undefined
|
|
938
1009
|
});
|
|
939
|
-
const summary = r.verdict === 'logged-in' ? `${r.site} 登录完成确认(票据 cookie 名已检出,只读名字)。说明:登录是在携程官网、用你自己的浏览器完成的——gotry 全程未接触任何密码/验证码/cookie 值。现在可以继续会话检索了。${r.evidence}` : r.verdict === 'pending' ? `登录入口已在你的 Chrome 打开;请在弹出的标签页里正常登录携程(登录由你在官网完成,不属于 gotry)。完成后说一声"继续",我再确认。gotry 只检查"是否已登录",永不收集你的账号信息。${r.evidence}` : r.verdict === 'needs-attach' ?
|
|
1010
|
+
const summary = r.verdict === 'logged-in' ? `${r.site} 登录完成确认(票据 cookie 名已检出,只读名字)。说明:登录是在携程官网、用你自己的浏览器完成的——gotry 全程未接触任何密码/验证码/cookie 值。现在可以继续会话检索了。${r.evidence}` : r.verdict === 'pending' ? `登录入口已在你的 Chrome 打开;请在弹出的标签页里正常登录携程(登录由你在官网完成,不属于 gotry)。完成后说一声"继续",我再确认。gotry 只检查"是否已登录",永不收集你的账号信息。${r.evidence}` : r.verdict === 'needs-extension' ? `需要一次性安装 GoTry Session Bridge 浏览器扩展:这是浏览器的事,gotry 不弹面板不开剪贴板——请直接在 Chrome 应用商店一键装(add-to-chrome 自动更新)。storeUrl=${EXTENSION_STORE_URL}. 装好即生效,装完后告诉我「重试」即可。${r.evidence}` : r.verdict === 'needs-attach' ? `cdp 车道需要一次性开启你 Chrome 的远程调试开关:在你的 Chrome 地址栏打开 chrome://inspect/#remote-debugging 并打开开关,然后说一声"重试"(默认走扩展车道,无需此步)。${r.evidence}` : `登录引导未完成:${r.error ?? '未知原因'} ${r.evidence}`;
|
|
940
1011
|
return JSON.parse(JSON.stringify({
|
|
941
1012
|
...r,
|
|
942
1013
|
summary
|
|
@@ -950,22 +1021,28 @@ export function apply(ctx, config) {
|
|
|
950
1021
|
}),
|
|
951
1022
|
presentResult: (_args, value)=>{
|
|
952
1023
|
const r = value;
|
|
953
|
-
const
|
|
1024
|
+
const needsExt = r.verdict === 'needs-extension';
|
|
1025
|
+
const label = r.verdict === 'logged-in' ? `已登录(${(r.tickets ?? []).length} 票据)` : r.verdict === 'pending' ? '等待你在携程页面完成登录' : needsExt ? '🧩 需装 GoTry Session Bridge 扩展(浏览器商店一键装,自动更新)' : r.verdict ?? '降级';
|
|
1026
|
+
const content = [
|
|
1027
|
+
{
|
|
1028
|
+
type: 'text',
|
|
1029
|
+
text: String(value.summary ?? '')
|
|
1030
|
+
}
|
|
1031
|
+
];
|
|
1032
|
+
if (needsExt && r.installUrl) content.push({
|
|
1033
|
+
type: 'text',
|
|
1034
|
+
text: `安装链接:${r.installUrl}`
|
|
1035
|
+
});
|
|
954
1036
|
return {
|
|
955
1037
|
card: 'generic',
|
|
956
1038
|
title: `账号登录:${label}`,
|
|
957
|
-
content
|
|
958
|
-
{
|
|
959
|
-
type: 'text',
|
|
960
|
-
text: String(value.summary ?? '')
|
|
961
|
-
}
|
|
962
|
-
]
|
|
1039
|
+
content
|
|
963
1040
|
};
|
|
964
1041
|
}
|
|
965
1042
|
}));
|
|
966
1043
|
registerGuarded(defineTool({
|
|
967
1044
|
name: 'gotry_session_search',
|
|
968
|
-
description: 'Search on the USER\'S OWN logged-in browser session (Ctrip flights today; the account channel, not an anonymous instance). ' + 'Consent gate: the FIRST call in a session asks the user via the runtime approval card; once granted it holds for the session, a refusal revokes it for the session (no repeat prompting). ' + '
|
|
1045
|
+
description: 'Search on the USER\'S OWN logged-in browser session (Ctrip flights today; the account channel, not an anonymous instance). ' + 'Consent gate: the FIRST call in a session asks the user via the runtime approval card; once granted it holds for the session, a refusal revokes it for the session (no repeat prompting). ' + 'Transport: GoTry Session Bridge browser extension (one-time install) — the agent side never talks to Chrome debugging, ZERO system dialogs; read-only by construction (the extension never issues requests; it only passively forwards the site\'s own search responses; agent NEVER touches credentials/captcha; on captcha it stops and returns challenged). ' + 'Currently ctrip-flight: sniffs the site search API for structured options. Evidence [会话:ctrip-flight@ts]. ' + 'verdict needs-login = call gotry_session_login (opens the Ctrip login entry in the user\'s own foreground tab — no terminal, no credentials through GoTry); ' + `needs-extension = one-time browser-extension install (Chrome Web Store one-click, installUrl is also surfaced as a clickable link in the verdict field for dsh UI to render) — the DEFAULT transport; cdp (chrome://inspect remote debugging) is a diagnostic fallback only via GOTRY_SESSION_TRANSPORT=cdp. ` + 'Rate-limited (≥30s between same-site calls; a challenged/timeout verdict means STOP — never retry, fall back to other tools).',
|
|
969
1046
|
parameters: {
|
|
970
1047
|
query: {
|
|
971
1048
|
type: 'json',
|
|
@@ -992,12 +1069,23 @@ export function apply(ctx, config) {
|
|
|
992
1069
|
summary: '需要 from/to(中文城市名,词表内)与 date(YYYY-MM-DD)'
|
|
993
1070
|
};
|
|
994
1071
|
}
|
|
995
|
-
const
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1072
|
+
const itp = await interpretEffect({
|
|
1073
|
+
effect: 'SESSION_FLIGHT_SEARCH',
|
|
1074
|
+
params: {
|
|
1075
|
+
from: q.from,
|
|
1076
|
+
to: q.to,
|
|
1077
|
+
date: q.date,
|
|
1078
|
+
auditPath: join(config.stateRoot ?? '.', 'gotry-state', 'session-incidents.jsonl')
|
|
1079
|
+
}
|
|
1000
1080
|
});
|
|
1081
|
+
if (!itp.result) return declinedObservation('SESSION_FLIGHT_SEARCH', itp.trace);
|
|
1082
|
+
const r = itp.result;
|
|
1083
|
+
const avMapS = await loadAirlineAirportMap();
|
|
1084
|
+
await appendFacts(config.stateRoot ?? '.', factsFromSession({
|
|
1085
|
+
origin: q.from,
|
|
1086
|
+
destination: q.to,
|
|
1087
|
+
date: q.date
|
|
1088
|
+
}, r, new Date().toISOString(), avMapS?.city_alias));
|
|
1001
1089
|
const top = (r.options ?? []).slice(0, 8).map((o)=>`${o.flightNo} ${o.airline} ${o.depDateTime.slice(11, 16)}→${o.arrDateTime.slice(11, 16)} ¥${o.price}`);
|
|
1002
1090
|
const summary = r.verdict === 'hit' ? `${q.from}→${q.to} ${q.date} 会话检索(携程,用户本人登录态)前 ${top.length} 条:\n${top.join('\n')}\n${r.evidence}` : `会话检索未取回(${r.verdict}):${r.error ?? ''} ${r.evidence}`;
|
|
1003
1091
|
return JSON.parse(JSON.stringify({
|
|
@@ -1013,16 +1101,22 @@ export function apply(ctx, config) {
|
|
|
1013
1101
|
}),
|
|
1014
1102
|
presentResult: (_args, value)=>{
|
|
1015
1103
|
const r = value;
|
|
1016
|
-
const
|
|
1104
|
+
const needsExt = r.verdict === 'needs-extension';
|
|
1105
|
+
const label = r.verdict === 'hit' ? `会话 ${r.options.length} 条` : r.verdict === 'needs-login' ? '需登录' : needsExt ? '🧩 需装 GoTry Session Bridge 扩展(浏览器商店一键装,自动更新)' : r.verdict ?? '降级';
|
|
1106
|
+
const content = [
|
|
1107
|
+
{
|
|
1108
|
+
type: 'text',
|
|
1109
|
+
text: String(value.summary ?? '')
|
|
1110
|
+
}
|
|
1111
|
+
];
|
|
1112
|
+
if (needsExt && r.installUrl) content.push({
|
|
1113
|
+
type: 'text',
|
|
1114
|
+
text: `安装链接:${r.installUrl}`
|
|
1115
|
+
});
|
|
1017
1116
|
return {
|
|
1018
1117
|
card: 'generic',
|
|
1019
1118
|
title: `会话检索:${label}`,
|
|
1020
|
-
content
|
|
1021
|
-
{
|
|
1022
|
-
type: 'text',
|
|
1023
|
-
text: String(value.summary ?? '')
|
|
1024
|
-
}
|
|
1025
|
-
]
|
|
1119
|
+
content
|
|
1026
1120
|
};
|
|
1027
1121
|
}
|
|
1028
1122
|
}));
|
|
@@ -1490,7 +1584,87 @@ export function apply(ctx, config) {
|
|
|
1490
1584
|
};
|
|
1491
1585
|
}
|
|
1492
1586
|
}));
|
|
1587
|
+
registerGuarded(defineTool({
|
|
1588
|
+
name: 'gotry_fact_gate',
|
|
1589
|
+
description: 'Factuality gate for itinerary artifacts (issue #46): call BEFORE delivering any artifact that contains bookable facts ' + '(flight numbers, times, airports, prices, visa/entry policies). Every bookable claim in the markdown is checked against ' + 'the session fact registry (exact-date tool results recorded by gotry_flyai_search / gotry_session_search — hit AND miss). ' + 'Blocked when: a claimed flight is absent from the exact-date source (never backfill from route pages/history/adjacent dates); ' + 'route+date never queried; times contradict the snapshot; carrier→airport mapping conflicts (FD=DMK vs VZ=BKK are NOT interchangeable); ' + '「联程」without protected_connection=true; policy claims without 「截至 YYYY-MM-DD」; unconditional ✓ on unverified claims. ' + 'Optional itinerary object enables machine invariants (hotel_nights + onboard_nights = total nights, O&D segments vs flight legs, ' + 'budget floor ≥ sum of item minimums). verdict=blocked ⇒ fix or downgrade wording — never present as a verified plan.',
|
|
1590
|
+
parameters: {
|
|
1591
|
+
query: {
|
|
1592
|
+
type: 'json',
|
|
1593
|
+
required: true,
|
|
1594
|
+
description: '{ markdown?: "<产物全文>", path?: "<产物路径(artifacts_list 返回的)>— 二选一", tripYear?: 2027, itinerary?: { trip_start, trip_end, stays: [{place,check_in,check_out}], onboard_nights, od_segments: [{from,to,date,mode,legs}], budget_items: [{label,min_cny,max_cny}], claimed_floor_cny? } }'
|
|
1595
|
+
}
|
|
1596
|
+
},
|
|
1597
|
+
output: {
|
|
1598
|
+
schema: {
|
|
1599
|
+
type: 'json'
|
|
1600
|
+
},
|
|
1601
|
+
render: (_args, value)=>[
|
|
1602
|
+
{
|
|
1603
|
+
type: 'text',
|
|
1604
|
+
text: String(value.summary ?? JSON.stringify(value).slice(0, 800))
|
|
1605
|
+
}
|
|
1606
|
+
]
|
|
1607
|
+
},
|
|
1608
|
+
async execute (args, _exec) {
|
|
1609
|
+
const q = unwrapQuery(args, 'markdown');
|
|
1610
|
+
const avMap = await loadAirlineAirportMap();
|
|
1611
|
+
if (!avMap) {
|
|
1612
|
+
return JSON.parse(JSON.stringify({
|
|
1613
|
+
ok: false,
|
|
1614
|
+
summary: '航司机场映射缺失(data/airline-airports.json)——事实闸不可用,fail closed:产物不得宣称已验证'
|
|
1615
|
+
}));
|
|
1616
|
+
}
|
|
1617
|
+
let markdown = q.markdown;
|
|
1618
|
+
if (!markdown && q.path) {
|
|
1619
|
+
const r = await readArtifact({
|
|
1620
|
+
stateRoot: config.stateRoot ?? '.',
|
|
1621
|
+
path: q.path
|
|
1622
|
+
});
|
|
1623
|
+
if (!r.ok) return JSON.parse(JSON.stringify({
|
|
1624
|
+
ok: false,
|
|
1625
|
+
summary: `产物读取失败:${String(r.error ?? '')}`
|
|
1626
|
+
}));
|
|
1627
|
+
markdown = r.content;
|
|
1628
|
+
}
|
|
1629
|
+
if (!markdown) return JSON.parse(JSON.stringify({
|
|
1630
|
+
ok: false,
|
|
1631
|
+
summary: '需要 markdown(产物全文)或 path(产物路径)'
|
|
1632
|
+
}));
|
|
1633
|
+
const itinerary = q.itinerary;
|
|
1634
|
+
const registry = await loadFactRegistry(config.stateRoot ?? '.');
|
|
1635
|
+
const report = gateArtifact(markdown, registry, avMap, {
|
|
1636
|
+
trip_year: q.tripYear,
|
|
1637
|
+
itinerary
|
|
1638
|
+
});
|
|
1639
|
+
const lines = report.violations.slice(0, 20).map((v)=>` L${v.line} [${v.kind}] ${v.detail}`);
|
|
1640
|
+
const summary = report.verdict === 'pass' ? `事实闸 PASS:${report.traceable}/${report.claims_checked} 可下单 claim 全部回溯到 exact-date 工具结果(query_id 可重放)——可宣称「已验证方案」。` : `事实闸 BLOCKED(${report.violations.length} 违例,${report.traceable}/${report.claims_checked} claim 可回溯)——不得宣称「已验证方案」:\n${lines.join('\n')}\n修正路径:逐条改成 exact-date 源返回的事实,或降级为「未确认/当前不可售,到 D-xx 复核」;exact-date miss 的 route+date 不得用历史班期/相邻日期/航线页填充。`;
|
|
1641
|
+
return JSON.parse(JSON.stringify({
|
|
1642
|
+
ok: true,
|
|
1643
|
+
...report,
|
|
1644
|
+
summary
|
|
1645
|
+
}));
|
|
1646
|
+
},
|
|
1647
|
+
presentCall: (args)=>({
|
|
1648
|
+
card: 'generic',
|
|
1649
|
+
title: '产物事实闸',
|
|
1650
|
+
kind: 'execute',
|
|
1651
|
+
rawInput: args.query
|
|
1652
|
+
}),
|
|
1653
|
+
presentResult: (_args, value)=>{
|
|
1654
|
+
const r = value;
|
|
1655
|
+
return {
|
|
1656
|
+
card: 'generic',
|
|
1657
|
+
title: `事实闸:${r.verdict === 'pass' ? '✅ pass' : `⛔ blocked(${r.violations?.length ?? '?'})`}`,
|
|
1658
|
+
content: [
|
|
1659
|
+
{
|
|
1660
|
+
type: 'text',
|
|
1661
|
+
text: String(r.summary ?? '')
|
|
1662
|
+
}
|
|
1663
|
+
]
|
|
1664
|
+
};
|
|
1665
|
+
}
|
|
1666
|
+
}));
|
|
1493
1667
|
}
|
|
1494
1668
|
|
|
1495
1669
|
|
|
1496
|
-
//# sourceURL
|
|
1670
|
+
//# sourceURL=ts/src/index.ts
|
package/dist/src/journey.js
CHANGED
package/dist/src/loop.js
CHANGED
package/dist/src/memory-decay.js
CHANGED
package/dist/src/mock-llm.js
CHANGED
package/dist/src/model.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { interpretEffect } from '../capabilities/effect.js';
|
|
2
2
|
const IATA_TO_CITY = {
|
|
3
3
|
HKG: '香港',
|
|
4
4
|
HKT: '普吉',
|
|
@@ -76,12 +76,19 @@ export async function overlayRealtimeFlightPrices(spec, opts = {}) {
|
|
|
76
76
|
}
|
|
77
77
|
return out;
|
|
78
78
|
}
|
|
79
|
-
const defaultQuery = (q)=>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
const defaultQuery = async (q)=>{
|
|
80
|
+
const itp = await interpretEffect({
|
|
81
|
+
effect: 'FLYAI_SEARCH',
|
|
82
|
+
params: {
|
|
83
|
+
kind: q.kind,
|
|
84
|
+
origin: q.origin,
|
|
85
|
+
destination: q.destination,
|
|
86
|
+
depDate: q.depDate
|
|
87
|
+
}
|
|
84
88
|
});
|
|
89
|
+
if (!itp.result) throw new Error(itp.trace.evidence.join(';'));
|
|
90
|
+
return itp.result;
|
|
91
|
+
};
|
|
85
92
|
export function realtimeSolvePort(base, opts = {}) {
|
|
86
93
|
return async (spec)=>{
|
|
87
94
|
const enabled = opts.enabled ?? process.env['GOTRY_REALTIME_PRICING'] === '1';
|
|
@@ -102,4 +109,4 @@ export function realtimeSolvePort(base, opts = {}) {
|
|
|
102
109
|
}
|
|
103
110
|
|
|
104
111
|
|
|
105
|
-
//# sourceURL
|
|
112
|
+
//# sourceURL=ts/src/realtime-pricing.ts
|
package/dist/src/slot-spec.js
CHANGED
package/dist/src/state-ledger.js
CHANGED
|
@@ -694,6 +694,7 @@ export class StateLedger {
|
|
|
694
694
|
}
|
|
695
695
|
close() {
|
|
696
696
|
this.db.close();
|
|
697
|
+
for (const [key, value] of openLedgers)if (value === this) openLedgers.delete(key);
|
|
697
698
|
}
|
|
698
699
|
}
|
|
699
700
|
const openLedgers = new Map();
|
|
@@ -924,4 +925,4 @@ export function readCompanionsWithFallback(stateRoot) {
|
|
|
924
925
|
}
|
|
925
926
|
|
|
926
927
|
|
|
927
|
-
//# sourceURL
|
|
928
|
+
//# sourceURL=ts/src/state-ledger.ts
|
package/dist/src/time-anchor.js
CHANGED