fix(opencode-plugin): recover MEM0_API_KEY from shell profiles (#6404)

This commit is contained in:
Rod Boev
2026-07-20 20:41:41 +05:30
committed by GitHub
parent 8a57967c8a
commit b05cce581b
3 changed files with 185 additions and 1 deletions
@@ -25,6 +25,7 @@ import {
} from "./dream";
import {asScope, scopeSearchFilters, scopeWriteParams, resolveDefaultScope, SCOPE_GUIDANCE, type Scope} from "./scope";
import {parseProjectFromRemote} from "./project";
import {resolveApiKey} from "./api-key";
async function getUserId(): Promise<string> {
if (process.env.MEM0_USER_ID) return process.env.MEM0_USER_ID;
@@ -258,7 +259,7 @@ function extractUserText(input: any, output: any): string {
const Mem0Plugin: Plugin = async (ctx) => {
const {$, client} = ctx;
const apiKey = process.env.MEM0_API_KEY;
const apiKey = resolveApiKey();
if (!apiKey) {
try {