Dashboard › opencode › Distillation
3bd0d516-ac51-4976-bf97-f8bf97db3cc5["lore_tm_v1_cNECsLskzAc8_HDgl1ylNi3D0-NaSFlsjLvacbv3ASc","lore_tm_v1_xuiYq8HfRJmv8AUW9qGo5t7iDXwVRLx1fyIailpAifw","lore_tm_v1_cup9OOT_obfgM-eyGUQJ3-OjzLFTko7qTdD7ieM0fAA","lore_tm_v1_ylCsRu0xo3__9B7Bydj0Qkz-HBXEmeh000ERI4RQiOM","lore_tm_v1_z7-PlGBUmTAZ2UQk7pWgmOtE1p3elsGOP4G_v1fTtb8","lore_tm_v1_v5D1-5BTfDG2QX8BojiR4FCguvAbG7c8FVbGsYzj5pY","lore_tm_v1_j_yNdesB1JSrpYd54yZazav5pCCxd-kQzrrvbOC2SyI","lore_tm_v1__-q2xKmqL7B99dYkk87XkP9HNHpC9sXnbMpXxNvdZ_E","lore_tm_v1__TymxPmFFIEVJWH1cV05l0MNiDJ5_jHdM98eUOorKOc","lore_tm_v1_iifr5pBFXKPcznEC-MmNndWivLMbdtNFKv7SWABnni4","lore_tm_v1_OOGiEG_BN8eJjLJRQ_xmR9KfUzVSlGK7knsoUVBqv10","lore_tm_v1_V60kg5Gx29sD11yUYXFvxPX879SAZ0NKHl1dEvQbMUE","lore_tm_v1_uo16X9Y6uZf8C-b1RK71aVvKGwAuTl0nxD5S7FSp1EM","lore_tm_v1_DCJlCcCxbR5yXRjBiOi8Jk-XO5JlnGNuUsuaE95WWq8","lore_tm_v1_Hvd1ZVR_hZu8jYLGpPL8NgfLLqebsIHijVaywq1KzRA","lore_tm_v1_5dVDqR2DveCVgVWgw36JXskKRBK97DSrIog__1JRZ2A","lore_tm_v1_ERgtu6KDQh-Tm1cKnoWG2G-rh4no0Au4zrINup_n18E","lore_tm_v1_8G9M9HZ_5K_pafMK_9CnnR3zu1BuTXf8aUZwqHUizfE","lore_tm_v1_k1QPH4D9AyavhOs-d6mxw0PtJ1_u5u325hNxqG4l5b0"]
/home/byk/Code/opencode-lore/packages/opencode/test/gateway-smoke.test.ts contains 4 in-process gateway smoke tests: 1. probeGateway("http://127.0.0.1:19876", 500) returns false when nothing listens; 2. startServer() with config.port=0, remoteGateway=false, and hostedMode=false serves /health with HTTP success and { status: "ok" }; 3. an explicit free port obtained via node:net.createServer() is reused after a 50 ms delay and responds to probeGateway(base, 2000); 4. probeGateway() returns true for a node:http server emulating Loreβs /health response. Shutdown handles are collected and awaited in afterAll./home/byk/Code/opencode-lore/packages/gateway/src/cli/run.ts determines local mode with !(opts.remoteUrl || config.remoteUrl); when a remote URL exists it selects opts.remoteUrl || config.remoteUrl, probes it with probeGateway(remoteUrl), reports [lore] Remote gateway at ${remoteUrl} is not reachable. on failure, and otherwise assigns it to gatewayUrl./home/byk/Code/opencode/packages/plugin/src/v2/effect/plugin.ts defines Plugin<R = Scope.Scope> with id and effect(context: PluginContext): Effect.Effect<void, never, R>, a pass-through define() helper, and PluginDomain methods add(plugin) and remove(id)./home/byk/Code/opencode-lore/packages/pi/src/internal.tsβs resolveGatewayUrl() checks LORE_REMOTE_URL first, strips one trailing slash, validates it through gatewayUrlForLog(), and returns it only if probeGateway() succeeds; an unreachable remote logs a fallback message and proceeds to local discovery.resolveGatewayUrl() next probes LORE_GATEWAY_URL, then builds a deduplicated Set<number> from @loreai/gatewayβs readPortFile() followed by KNOWN_GATEWAY_PORTS, probing each as http://127.0.0.1:${port}; it returns null if none respond./home/byk/Code/opencode-lore/packages/pi/src/internal.tsβs startInProcess() dynamically imports @loreai/gateway, calls startGateway({ quiet: true, local: true }), returns http://127.0.0.1:${handle.port}, logs reuse when handle.owned is false, and on any failure logs pi: failed to start gateway in-process and returns null.sessionIDFor(sessionFile) returns pi-ephemeral-${process.pid} without a session file; otherwise it returns pi- plus the first 24 hexadecimal characters of the SHA-256 hash of the session-file path.gatewayAccessHeadersForRemote(gatewayBase, env) injects { [GATEWAY_AUTH_HEADER]: LORE_GATEWAY_AUTH_TOKEN } only when the trailing-slash-normalized LORE_REMOTE_URL exactly matches the normalized selected gatewayBase and a token exists./home/byk/Code/opencode-lore/packages/pi/src/index.ts makes the Pi extension inert when NODE_ENV === "test" unless LORE_PI_FORCE_ACTIVE === "1"; Lore is explicitly disabled by LORE_DISABLED equal to "1" or "true".log.silenceStderr() because a real Pi process owns a full-screen TUI and terminal output would corrupt rendering; file logging and Sentry remain available through lore logs.resolveGatewayUrl(), otherwise calls startInProcess(); if neither succeeds while Lore is enabled, it logs Lore failed to start β memory features are unavailable. Ensure @loreai/gateway is installed. and returns.X-Lore-Upstream-URL is always set from the original URL.fetchInterceptorInstalled to prevent stacking if Pi reinitializes; request headers include remote gateway access headers, x-lore-session-id, x-lore-project, and optional x-lore-git-remote.x-lore-session-id and x-lore-project match current state, with precedence x-api-key, then x-goog-api-key, then authorization, otherwise {}./home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/module.tsβs PluginModule.make creates an unbounded PubSub<void> change stream, deduplicates watched paths with Set<string>, waits for watcher readiness through Deferred, and disposes createPluginSources() through Effect.acquireRelease.watchTarget(file) recursively climbs to the nearest existing ancestor; it returns watcher input type "directory" or "file" based on stat(), and rethrows only upon reaching a filesystem root that still cannot be statted./home/byk/Code/opencode-lore/packages/opencode/src/internal.tsβs probeGateway(baseURL, timeoutMs=1500) requests ${baseURL}/health, uses probeLoopback() for loopback URLs and global fetch() otherwise, returns false on every exception, aborts at the deadline, and always clears its timer.surfaceGatewayUnavailable(client, message) reports the error to the file/Sentry-backed logger and optionally calls client.tui.showToast() with { title: "Lore", message, variant: "error" }; a toast is TUI-safe because it is rendered through OpenCodeβs HTTP/TUI loop and never writes a raw byte to the terminal.surfaceGatewayUnavailable() is deliberately fire-and-forget and swallows both promise rejection and synchronous exceptions from showToast; a missing/headless TUI or older server lacking /tui/show-toast must never crash a degraded-but-running session, and notification failures must never propagate./home/byk/Code/opencode-v2-pilot/packages/plugin/package.json defines @opencode/plugin version 1.18.15, ESM type, scripts test: bun test --only-failures, typecheck: tsgo --noEmit, and build: tsc -p tsconfig.build.json; exports include "." β "./src/promise/index.ts", "./effect" β "./src/effect/index.ts", "./host" β "./src/host.ts", "./tui" β "./src/tui/index.ts", and "./*" β "./src/*.ts".@opencode/plugin maps #plugin-source to ./src/source.bun.ts for Bun and ./src/source.node.ts for Node/default; optional peer dependencies are @opencode/theme@workspace:*, @opentui/core@>=0.5.10, @opentui/solid@>=0.5.10, and solid-js@>=1.9.0./home/byk/Code/opencode-v2-pilot/packages/plugin/src/effect/plugin.ts defines an Effect Context containing app, location, options, agent, aisdk, catalog, command, event, experimental.terminal.read, integration, mcp, generate, permission, plugin.list, reference, rpc, session, shell, skill, storage, tool, vcs, websearch, and worktree; its Plugin<R = Scope.Scope> exposes id and effect(context): Effect.Effect<void, never, R>./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/plugin.ts exposes the corresponding Promise Context, defines Cleanup = () => Promise<void> | void, and defines a Promise Plugin with id plus setup(context): Promise<Cleanup | void> | Cleanup | void./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.tsβs makeStreams gives async iterators separate scopes, tracks each close callback in subscriptions, closes all subscriptions in an Effect finalizer, removes abort listeners during close, handles already-aborted signals immediately, and closes iterators on completion or error.Effect.runPromiseWith(context), passes optional abort signals to calls, exposes event subscribe and on, combines local and caller signals with AbortSignal.any, returns an unsubscribe function that aborts its controller, and logs asynchronous event-loop failures with Effect.logError.Effect.promise(() => Promise.resolve(plugin.setup(context2))) and releases it by invoking a returned cleanup through Effect.promise(() => Promise.resolve(cleanup())); absent cleanup resolves to Effect.void.