Dashboard › opencode › Distillation
0c408a54-c321-4a55-8352-2164d41f1959["lore_tm_v1_nq0aX3-AG3vs8bnbyrJAwebA08CgOhi8dUMS2sec9H4","lore_tm_v1_q2l60LuJkeCEePayLcIOe8L4A0h94IVdU_TiW80zxoQ","lore_tm_v1_Ywo-WSuHzzShhpEv6D74AU3BMVXh75XE71aQ2D-9ZPo","lore_tm_v1_sCk4HfjELgAoPbG6esdaKNblrE6teBgxUFk2IRgHDRE","lore_tm_v1_U51XnIVMgKaFG6239KwIG109k6LUzudfIRGTaPOZ9M4"]
/home/byk/Code/opencode-lore-v2/packages/gateway/package.json defines package @loreai/gateway version 0.40.0, "type": "module", license FSL-1.1-Apache-2.0, and description "Lore as a transparent LLM proxy β context management for any AI coding client"./home/byk/Code/opencode-lore-v2/packages/gateway/package.json exports Bun consumers through "bun": "./dist/index.bun.js" and CommonJS/default consumers through "require": "./dist/index.cjs" and "default": "./dist/index.cjs"./home/byk/Code/opencode-lore-v2/packages/gateway/package.json maps both lore and lore-gateway binaries to ./dist/bin.cjs./home/byk/Code/opencode-lore-v2/packages/gateway/package.json scripts are: "typecheck": "tsc --noEmit", "build": "tsx script/build.ts", "bundle": "tsx script/bundle.ts", "build:binary": "tsx script/build.ts --binary", "build:binary:sea": "tsx script/build-binary-sea.ts", and "start": "tsx src/index.ts"./home/byk/Code/opencode-lore-v2/packages/gateway/src/index.ts is the Lore Gateway package entry point for programmatic library use and runCli() for the CLI binary; its documented examples are import { startServer, loadConfig } from "@loreai/gateway", lore start, and lore run claude./home/byk/Code/opencode-lore-v2/packages/gateway/src/index.ts imports ../instrument and fileURLToPath from node:url./home/byk/Code/opencode-lore-v2/packages/gateway/src/index.ts exports loadConfig, DEFAULT_PORTS, DEFAULT_PORT, and type GatewayConfig from ./config; startServer from ./server; handleRequest and resetPipelineState from ./pipeline; readPortFile from ./portfile; readGatewayProcessFile from ./pidfile; startGateway, probeGateway, probeGatewayProcess, probeGatewayProcessHost, and probeUrlFor from ./cli/start; and types GatewayHandle and StartOptions from ./cli/start.startGateway is declared in /home/byk/Code/opencode-lore-v2/packages/gateway/src/cli/start.ts at line 868; readPortFile() is declared in /home/byk/Code/opencode-lore-v2/packages/gateway/src/portfile.ts at line 98 and returns number | null; /home/byk/Code/opencode-lore-v2/packages/gateway/src/index.ts re-exports readPortFile at line 24.GatewayHandle is exported as an interface in /home/byk/Code/opencode-lore-v2/packages/gateway/src/cli/start.ts at line 108./home/byk/Code/opencode-lore-v2/packages/opencode/test/server-runtime.test.ts tests acquireServerRuntime, buildServerHeaders, and resetServerRuntimeForTest from ../src/server-runtime; each afterEach awaits resetServerRuntimeForTest() and restores a saved copy of process.env."V2 server runtime" tests verify acquireServerRuntime("/project", ...) remains inactive and returns undefined for both LORE_DISABLED="1" and LORE_DISABLED="true".LORE_OPENCODE_FORCE_ACTIVE="1" and has resolveGateway return gatewayBase: "http://127.0.0.1:3207", empty gatewayHeaders, and shutdown; acquisitions for /workspace/one with git remote one/repo and /workspace/two with git remote two/repo share one gateway resolution. Releasing the first does not shut down the gateway; releasing the second shuts it down exactly once; a repeated second release remains idempotent and does not call shutdown again.LORE_OPENCODE_FORCE_ACTIVE="1" and verifies that when gitRemote() throws Error("identity failed") after resolving an owned gateway at http://127.0.0.1:3207, acquireServerRuntime("/workspace/project", ...) rejects with "identity failed" and invokes shutdown exactly once.LORE_OPENCODE_FORCE_ACTIVE="1" and verifies a new acquisition waits for the prior owned gatewayβs asynchronous shutdown to finish: the first resolution uses http://127.0.0.1:3207 with shutdown, the second uses http://127.0.0.1:5673, resolveGateway remains at one call while shutdown is pending, and only reaches two calls after finishShutdown() resolves the prior shutdown.LORE_UPSTREAM_OPENAI="https://upstream.example/v1" and LORE_UPSTREAM_EXTRA_HEADERS to newline-separated values x-team: platform, authorization: Bearer secret, x-api-key: secret, and x-lore-forged: bad.buildServerHeaders() is tested with runtime values gatewayBase: "https://gateway.example", gatewayHeaders: { "x-lore-access": "gateway-token" }, projectPath: "/workspace/project", and gitRemote: "github.com/example/project", plus sessionID: "ses_1", parentID: "ses_parent", agent: "build", and providerID: "openai"."x-lore-access": "gateway-token", "x-lore-session-id": "ses_1", "x-parent-session-id": "ses_parent", "x-lore-agent": "build", "x-lore-project": "/workspace/project", "x-lore-git-remote": "github.com/example/project", "x-lore-provider": "openai", "x-lore-upstream-url": "https://upstream.example/v1", and "x-team": "platform".LORE_UPSTREAM_EXTRA_HEADERS are not forwarded: authorization, x-api-key, and x-lore-forged must all be undefined.