Dashboard › opencode › Distillation
1885aebf-90eb-401a-a963-a43128b12eb1["lore_tm_v1_0DRBxt7V5_tOVgbFjoAT_M-uNPRDL_FE1l_p74cAcWk","lore_tm_v1_mZbkLrlpCEComgoJSFxr3Zbw1dL75-kGpFjTqjs3roY"]
packages/opencode/node_modules/@opencode/plugin/dist/promise/adapter.js imports Tool from @opencode/schema/tool; Effect, Schema, SchemaAST, and Stream from effect; HttpApiEndpoint and HttpApiSchema from effect/unstable/httpapi; and define from ../effect/plugin.js.packages/opencode/node_modules/@opencode/plugin/dist/promise/adapter.js defines compiledEndpoints as a WeakMap and JsonInput as Schema.fromJsonString(Schema.Unknown).ReturnedRpcError in packages/opencode/node_modules/@opencode/plugin/dist/promise/adapter.js extends Error, preserving type and data alongside the error message.makeStreams in packages/opencode/node_modules/@opencode/plugin/dist/promise/adapter.js converts Effect streams into async iterators, tracks each iterator’s close callback in a Set, and registers an Effect finalizer that closes all subscriptions when the plugin unloads.makeStreams removes itself from the subscription set and removes its abort listener when closed; an optional AbortSignal triggers close(), including immediately when the signal is already aborted.makeStreams iterator wraps next() so completion or rejection closes the subscription before returning the result or rethrowing the error, and exposes return: close.rpcFromEffect in packages/opencode/node_modules/@opencode/plugin/dist/promise/adapter.js captures the Effect context, creates run with Effect.runPromiseWith(context), and turns each RPC definition method into a Promise-returning wrapper that runs the corresponding local Effect method with options?.signal.events.subscribe adapts local.events.subscribe(name) through streams; events.on combines its own AbortController signal with an optional caller signal via AbortSignal.any, processes subscribed events sequentially with await handler(event), logs loop errors through Effect.logError, and returns an unsubscribe callback that aborts the controller.rpcFromEffect.register adapts Promise handlers to Effect handlers through Effect.tryPromise; the adapter comments state that definition keys are preserved so Core can restore each method’s erased schema and error types.LorePlugin in packages/opencode/src/index.ts treats Lore as disabled when LORE_DISABLED equals either "1" or "true", and initializes local loreActive and gatewayBase from process-level processLoreActive and processLoreBase.LorePlugin calls isInertTestEnv(); outside inert test mode it calls log.silenceStderr() because any stdout/stderr output can corrupt OpenCode’s full-screen TUI.globalThis, allowing the in-process gateway’s bundled copy of core to observe it; terminal output including log.error and gateway warnings is suppressed while logs continue to the log file and Sentry sink accessible through lore logs.LorePlugin deliberately skips log.silenceStderr() in inert test mode so unrelated test suites retain console output.LorePlugin only performs gateway probe/start initialization when Lore is not disabled and the environment is not an inert test environment; loreInitPromise memoizes initialization so concurrent LorePlugin calls do not race during probe-to-spawn startup.