Dashboard › opencode › Distillation
bf3ccb3e-0f95-4965-a0ee-08974bb5b42b["lore_tm_v1_2rTiyA2IvSaSSrnLLb2DXLqKTwbsCdEz9zBjhrla8Jc","lore_tm_v1_741xFsGun4oNAQwb4Kx0peDHtV9Z6xvggiQcjprZlO4","lore_tm_v1_lheLfwGOxujn18eMs0H6iRLmEKgwP2I8_D1tv3XuRgI"]
/home/byk/Code/opencode-lore-v2/packages/gateway/src/cli/start.ts states startGateway() runs startGatewayLocked() under withLifecycleLock("gateway-start", ...).opts.port marks config.portExplicit = true, while opts.hosts, opts.debug, and opts.allowRemoteManagement override their corresponding config values.log.warn() when opts.quiet === true; otherwise notices use console.error("[lore] ...") to remain visible for lore start. OpenCode plugin and Pi extension in-process callers use quiet mode to avoid corrupting full-screen TUI rendering.opts.local, then LORE_HOSTED_MODE, then caller default; lore start defaults hosted mode on, whereas lore run, lore import, OpenCode plugin, and Pi extension pass local: true to disable hosted mode.local: true because hosted mode is process-wide and disables filesystem operations in @loreai/core, otherwise breaking getGitRemote(), .lore.md import, config loading, and file watching.--local flag always disables remote mode, setting config.remoteGateway = false and config.remoteGatewayAutoDetected = false.LORE_REMOTE_GATEWAY or LORE_HOSTED_MODE settings and bind-address auto-detection; absent these and absent --local, lore start defaults config.remoteGateway = true and marks config.remoteGatewayCommandDefault = true.assertGatewayAccessConfigured(config) occurs only after CLI/environment/default hosted- and remote-mode precedence has been fully applied, allowing --local to opt out first.3207, then 5673, then 0 for an OS-assigned random port.controlToken with randomBytes(32).toString("base64url"); when currentProcessIdentity() is unavailable, notably because Node lacks a race-free Windows creation-time query, it publishes unverified:${controlToken} so discovery works while destructive stop fails closed.io.authenticate(record); an authenticated record is reused at its actual bound port and host with owned: false, its owner token as managementToken, and a no-op shutdown()./health merely classifies an unauthenticated occupant as foreign and never establishes identity.0; for other ports, probe hosts are deduplicated from "127.0.0.1", config.hosts, and matching-record hosts.--port or LORE_LISTEN_PORT; for default ports it logs that the occupant is not an authenticated Lore gateway and advances to the next candidate or a random port.io.startServer() bind occurs inside the retry try because EADDRINUSE rejects directly from that await; it is called through withoutLifecycleLock(), with lifecycle ownership asserted immediately beforehand.Remote shutdown was requested before gateway publication; refusing., and sets process.exitCode = 1.server.hosts when nonempty so stale or unbindable interfaces such as a stale Tailscale IP rejected with EADDRNOTAVAIL are not advertised.GatewayProcessRecord version 2 containing process.pid, actual port, bound hosts, control token, and processIdentity, asserting lifecycle-lock ownership before each write.AggregateError with both publication and close errors when the listener cannot be closed; message: Gateway publication failed and the live listener could not be closed; discovery evidence was retained.shutdown() is idempotent through cached shutdownPromise and runs under withLifecycleLock("gateway-shutdown", ...) with timeout Math.max(1, Math.floor(SHUTDOWN_DEADLINE_MS / 2)).boundServer.stop() so new work is rejected; 2. io.resetPipelineState({ fast: true }); 3. await listener closure; 4. temporalEmbeddingQueue.stopTemporalEmbeddingScheduler(); 5. temporalEmbeddingQueue.settleTemporalEmbeddingScheduler(EMBED_DRAIN_DEADLINE_MS); 6. embedding.settleDocumentEmbeds(EMBED_DRAIN_DEADLINE_MS); 7. embedding.resetProvider(); 8. shutdownVectorPoolAsync(VECTOR_POOL_SHUTDOWN_DEADLINE_MS); 9. closeDb(); 10. remove discovery after listener and worker teardown.Database close warning: ... but do not wedge shutdown or retain an otherwise-stale process record because SQLite recovery handles failed best-effort checkpoints.processShutdown is created only when opts.processBoundary is true; remote shutdown uses processShutdown(0) when present, otherwise invokes shutdown(), reports Remote shutdown failed: ... on rejection, and sets process.exitCode = 1./port\b.*\bin use/i or /EADDRINUSE/i are treated as port conflicts, and all other errors are immediately rethrown.0 always succeeds or throws a non-EADDRINUSE error, making the final throw new Error("Failed to bind to any port.") unreachable.commandStart(opts) delegates background mode to startDaemon(opts) and otherwise calls startGateway({...opts, processBoundary: true}).0.0.0-beta-19275, 0.0.0-beta-19278, 0.0.0-beta-19283, 0.0.0-beta-19288, 0.0.0-beta-19289, 0.0.0-beta-19296, 0.0.0-beta-19365, and 0.0.0-beta-19378.0.0.0-dev-19274, 0.0.0-dev-19276, 0.0.0-dev-19277, 0.0.0-dev-19280, 0.0.0-dev-19282, 0.0.0-dev-19284, 0.0.0-dev-19285, 0.0.0-dev-19286, 0.0.0-dev-19287, 0.0.0-dev-19290, 0.0.0-dev-19291, 0.0.0-dev-19292, 0.0.0-dev-19293, 0.0.0-dev-19294, 0.0.0-dev-19295, 0.0.0-dev-19297, 0.0.0-dev-19298, 0.0.0-dev-19299, 0.0.0-dev-19300, 0.0.0-dev-19301, 0.0.0-dev-19305, 0.0.0-dev-19306, 0.0.0-dev-19309, 0.0.0-dev-19311, 0.0.0-dev-19312, 0.0.0-dev-19313, 0.0.0-dev-19314, 0.0.0-dev-19315, 0.0.0-dev-19316, 0.0.0-dev-19317, 0.0.0-dev-19323, 0.0.0-dev-19326, 0.0.0-dev-19329, 0.0.0-dev-19330, 0.0.0-dev-19335, 0.0.0-dev-19336, 0.0.0-dev-19337, 0.0.0-dev-19338, 0.0.0-dev-19340, 0.0.0-dev-19342, 0.0.0-dev-19343, 0.0.0-dev-19345, 0.0.0-dev-19346, 0.0.0-dev-19349, 0.0.0-dev-19351, 0.0.0-dev-19352, 0.0.0-dev-19355, 0.0.0-dev-19358, 0.0.0-dev-19360, 0.0.0-dev-19362, 0.0.0-dev-19363, 0.0.0-dev-19364, 0.0.0-dev-19366, 0.0.0-dev-19367, 0.0.0-dev-19368, 0.0.0-dev-19369, 0.0.0-dev-19370, 0.0.0-dev-19371, 0.0.0-dev-19372, 0.0.0-dev-19376, 0.0.0-dev-19377, 0.0.0-dev-19379, and 0.0.0-dev-19380.0.0.0-reserved.