TripBlocks

ArchitectureRepository / 2026

Architecture / one user-triggered loop

Plan local.
Ground live.
Ask once.

The browser owns the itinerary. A small local Node server owns the credentials and the two external calls: Bailian Managed Agent for the second opinion, FlyAI for real Fliggy inventory. Nothing polls. Nothing is written by the agent without a user action.

Managed Agent live after rechargeFlyAI liveState localStorageFallback optional

The map

Click a node. Read the actual path.

BrowserLocal serverExternal

Browser / React 19

TripBlocks UI

The board is the source of truth. The browser never holds a Bailian or FlyAI key.

Archify-style map drawn from the repository, not a generic diagram.

Request lifecycle

One ask.
Four facts.

The agent is not a background loop. A user message compacts the current trip, goes to the local server once, and returns either a Managed Agent reply or a clearly marked fallback. FlyAI is a separate, cacheable inventory call.

01 / compact

Shape the context

Days, times, places, costs and notes are compacted in src/lib/agent.ts. The full local plan never leaves as an uncontrolled dump.

02 / call

One server hop

POST /api/agent runs bl managed-agent session run --no-stream --output json against the configured agent, environment and vault.

03 / parse

Text + one suggestion

The server extracts assistant text and at most one fenced JSON suggestion, clamps its fields, and returns it with the session id.

04 / decide

The user writes

Suggestions render as cards. The plan changes only when the traveller chooses to add one; the agent never edits the itinerary directly.