Skip to content

One Real Run Walkthrough (Source Guide) ​

Chinese Source Guide

The line-referenced walkthrough is maintained in Chinese at repo-docs/walkthroughs/one-real-run.md in the repository. Switch the site language switcher to 简体中文 to inspect the rendered page in-site.

Summary of Request Lifecycle ​

  1. Platform Entry (src/platforms/{cloudflare,edgeone,esa}.mjs): Injects platform limits (PLATFORM_LIMITS) and runtime state bindings via runPlatformRequest, then calls createGateway(runtime).fetch(...) in _worker.js.
  2. Auth & Limits: Enforces ingress size limits (API_JSON_LIMIT 16 MiB; EdgeOne 1 MiB), checks client apiKeys against the active state authority (AppConfigStore DO or remote STATE_SERVICE_PATH), and validates payload/replay contracts (validateReplayMetadata, validateToolStrictness).
  3. Model resolution and dispatch. Explicit targets select the provider or account directly. Short names use the saved map and eligible provider declarations. The 48 presets initialize a fresh map. An upgrade preserves the instance's saved aliases.
  4. Bounded Upstream Fetch (fetchUpstream): Applies 120s header/idle timeouts and 32 MiB response caps, failing over across at most 3 shuffled candidate accounts only on explicit 401/403/404/429.