Dashboard › opencode › Distillation
1a0acd8a-9b03-43fa-ad05-f88bdca6d34d["lore_tm_v1_3ZIOiDoeG-jBGMIYWBFk3cT4TTKyQT8yUFcQrTfDcuY"]
loadConfig() always provides the complete GatewayConfig values expected by startServer(); defensive defaults exist because startServer is a public export and callers may pass incomplete config./home/byk/Code/opencode-lore/packages/gateway/src/server.ts defines responseCompletionCallbacks as new WeakMap<Response, () => void>().startServer(config, options) accepts optional controlToken, asynchronous post-response onShutdown, test seams closeServer, shutdownDeadlineMs, and peerAddressForRequest; it returns a promise containing stop, port, hosts, and ready.startServer() selects options.closeServer when supplied; otherwise it calls closeServer(server, options.shutdownDeadlineMs ?? SHUTDOWN_DEADLINE_MS).startServer() defensively converts a nullish config to {} cast as GatewayConfig. If config.hosts is missing or empty, it logs a notice warning that it is defaulting to ["127.0.0.1"], recommends loadConfig() or startGateway() for a fully populated config, and replaces hosts accordingly.startServer() replaces a non-finite or negative config.port with DEFAULT_PORT, then calls assertGatewayAccessConfigured(config).config.allowRemoteManagement is true, startServer() logs: "warning: remote management access is enabled; every client accepted by the listener can access /ui and /api".startServer() bootstraps the daily spend counter from the database by calling bootstrapDailySpend() only when getDailyBudget() > 0, recovering the current day’s spend after restart.