Dashboard › opencode › Distillation
1fb9db89-e74b-4386-a1fc-6c078203ea5f["lore_tm_v1_TL8iYsJoubdVkqavhtNXa8nPweOpMKs5X_Om-80dvoQ","lore_tm_v1_TxQAY5w3wtVp-1UCu2foJ9r4SX17p3K7Zvk2aoKvCoU","lore_tm_v1_LUDRQnK5Mx_6SMIiAcRYPsCHCbz6K5H6E85Q3dgJ4r8"]
Date: Sep 9, 2026
/home/byk/Code/opencode-lore/packages/pi/src/index.ts, Pi routine status and errors must go through the core file-based log module, NEVER through console, stdout, or stderr, because Pi runs a full-screen TUI that any raw terminal write would corrupt.lorePiExtension(pi) calls log.silenceStderr() whenever it is not in inert test mode; the silence flag is process-global via globalThis, so the in-process gatewayβs bundled copy of core also suppresses terminal output while logs still reach the log file and Sentry sink and can be read with lore logs.NODE_ENV === "test" unless LORE_PI_FORCE_ACTIVE === "1"; this keeps unrelated test suites from probing or starting a gateway and preserves their console output.LORE_DISABLED disables the Pi extension when set to "1" or "true".lorePiExtension(pi) first calls resolveGatewayUrl() and reuses a detected gateway; otherwise it calls startInProcess(). If neither succeeds, it logs "Lore failed to start β memory features are unavailable. Ensure @loreai/gateway is installed." and returns without registering hooks.X-Lore-Upstream-URL is always set from the original request URL while preserving original authentication headers and URLs./home/byk/Code/opencode-lore/packages/pi/src/index.ts guards fetch interception with process-global module state fetchInterceptorInstalled, preventing interceptor stacking if Pi reinitializes."x-lore-session-id": currentSessionID, "x-lore-project": projectPath, and "x-lore-git-remote": cachedGitRemote when a git remote exists.x-lore-session-id and x-lore-project match current state; credential priority is x-api-key, then x-goog-api-key, then authorization, otherwise {}.projectPath to process.cwd(), currentSessionID with sessionIDFor(undefined), compactAuthHeaders to {}, gatewayAccessHeaders with gatewayAccessHeadersForRemote(gatewayBase), and cachedGitRemote with getGitRemote(projectPath) ?? "".registerProviders() in /home/byk/Code/opencode-lore/packages/pi/src/index.ts calls buildProviderRegistrations({ gatewayBase, sessionID: currentSessionID, projectPath, gitRemote: getGitRemote(projectPath) ?? undefined }); resolving the remote from the current project path ensures worktree changes on session_start use the correct remote./home/byk/Code/opencode-lore/packages/gateway/src/config.ts defines DEFAULT_PORTS = [3207, 5673] as const and DEFAULT_PORT = DEFAULT_PORTS[0]; 3207 represents LORE as an upside-down calculator word and 5673 represents LORE on a T9 keypad.GATEWAY_AUTH_TOKEN_MIN_LENGTH = 32 and GATEWAY_AUTH_TOKEN_MAX_LENGTH = 256.GatewayConfig defaults to hosts: ["127.0.0.1"]; LORE_LISTEN_HOST accepts comma-separated hosts, while CLI --host may be repeated or comma-separated.GatewayConfig.allowRemoteManagement defaults to disabled and is controlled by LORE_ALLOW_REMOTE_MANAGEMENT; it permits non-loopback peers to access dashboard and management APIs."https://api.anthropic.com" via LORE_UPSTREAM_ANTHROPIC and "https://api.openai.com" via LORE_UPSTREAM_OPENAI.GatewayConfig.callerUpstreamAllowlist is empty by default and contains normalized HTTPS origins from comma-separated LORE_CALLER_UPSTREAM_ALLOWLIST; remote/hosted caller-selected X-Lore-Upstream-URL origins are denied unless explicitly allowed, while local gateways do not consult this list.LORE_BEDROCK_REGION, then AWS_REGION or AWS_DEFAULT_REGION, then "us-east-1"; it selects both bedrock-mantle Anthropic and bedrock-runtime Converse/InvokeModel endpoints.GOOGLE_CLOUD_PROJECT, deriving the project from Application Default Credentials at request time when empty; region comes from GOOGLE_CLOUD_REGION or GOOGLE_CLOUD_LOCATION and defaults to "global".LORE_SESSION_EVICTION_TIMEOUT=0 disables eviction.GatewayConfig.gatewayAuthToken, sourced from LORE_GATEWAY_AUTH_TOKEN, is a gateway access credential required by every remote/hosted data-plane request and is separate from provider credentials.GatewayConfig.hostedMode, controlled by LORE_HOSTED_MODE, disables filesystem operations involving client-controlled paths, including git subprocesses, .lore.json/.lore.md reads and writes, lat.md/ scans, and file watchers.GatewayConfig.remoteUrl, sourced from LORE_REMOTE_URL, causes lore run to delegate to a remote gateway instead of starting a local one./home/byk/Code/opencode-lore/packages/gateway/test/lifecycle-wiring.test.ts verifies that an active acquireLifecycleLock("uninstall") blocks startGateway({ port: 0, local: true, quiet: true }) before listener creation, rejecting with LifecycleLockBusyError after advancing fake timers by 5000 ms./home/byk/Code/opencode-lore/packages/gateway/test/lifecycle-wiring.test.ts verifies that createUninstallTombstone(lock) creates persisted uninstalled.json state that blocks a fresh startGateway({ port: 0, local: true, quiet: true }) with an error matching /Lore is uninstalled/; the test removes the marker afterward with rmSync(marker, { force: true }).