Dashboard › opencode › Distillation
33968617-fe01-4d19-a2d5-bf57c056d3d6["lore_tm_v1_0HyX_hlGtMndYbZrrmeMaOdcFFo8UbJeVIlkR-V8x1E"]
X-Lore-Upstream-URL must always be set from the original URL./home/byk/Code/opencode-lore/packages/pi/src/index.ts defines the default async entry point lorePiExtension(pi: ExtensionAPI), which detects or starts the Lore gateway, redirects provider URLs, and registers a compaction override when loaded via pi -e or pi install.lorePiExtension(...) treats Lore as disabled when LORE_DISABLED equals "1" or "true". It treats tests as inert when NODE_ENV === "test" unless LORE_PI_FORCE_ACTIVE === "1"; active tests can use a controlled in-process gateway via LORE_GATEWAY_URL.lorePiExtension(...) calls log.silenceStderr() to prevent stdout/stderr output from corrupting Pi’s full-screen TUI. The process-global silence flag is shared through globalThis with the in-process gateway’s bundled core; logging still goes to the log file and Sentry and can be read with lore logs./home/byk/Code/opencode-lore/packages/pi/src/index.ts: first call resolveGatewayUrl() and, when successful, set gatewayBase, set loreActive = true, and log pi: gateway detected at ${existingUrl}; otherwise call startInProcess(), then set the same state and log pi: gateway started in-process at ${startedUrl} on success.lorePiExtension(...) logs Lore failed to start — memory features are unavailable. Ensure @loreai/gateway is installed. and returns. It also returns immediately whenever loreActive remains false.projectPath = process.cwd(), currentSessionID = sessionIDFor(undefined), compactAuthHeaders = {}, gatewayAccessHeaders = gatewayAccessHeadersForRemote(gatewayBase), and cachedGitRemote = getGitRemote(projectPath) ?? ""./home/byk/Code/opencode-lore/packages/pi/src/index.ts installs installFetchInterceptor(...) only when fetchInterceptorInstalled is false, preventing stacked interceptors if Pi reinitializes. The interceptor reroutes LLM API calls through gatewayBase, preserves original authentication headers and URLs, and complements registerProviders() by catching providers Pi discovers independently.getHeaders() adds gatewayAccessHeaders, x-lore-session-id: currentSessionID, and x-lore-project: projectPath; it conditionally adds x-lore-git-remote: cachedGitRemote when a Git remote is available.onRequestHeaders callback ignores requests unless both x-lore-session-id equals currentSessionID and x-lore-project equals projectPath.