diff --git a/openclaw/openclaw.plugin.json b/openclaw/openclaw.plugin.json index cb245fc..1f02297 100644 --- a/openclaw/openclaw.plugin.json +++ b/openclaw/openclaw.plugin.json @@ -2,7 +2,7 @@ "id": "evermind-ai-everos", "name": "OpenClaw Memory — EverOS", "description": "EverOS-backed cross-session memory for OpenClaw (memory slot).", - "version": "3.0.3", + "version": "3.0.4", "kind": "memory", "activation": { "onStartup": true diff --git a/openclaw/package-lock.json b/openclaw/package-lock.json index 4c54113..9cb8bde 100644 --- a/openclaw/package-lock.json +++ b/openclaw/package-lock.json @@ -1,12 +1,12 @@ { "name": "@everos-ai/openclaw-plugin", - "version": "3.0.3", + "version": "3.0.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@everos-ai/openclaw-plugin", - "version": "3.0.3", + "version": "3.0.4", "license": "Apache-2.0", "bin": { "everos-setup": "dist/setup-cli.js" diff --git a/openclaw/package.json b/openclaw/package.json index d07e569..6417ae8 100644 --- a/openclaw/package.json +++ b/openclaw/package.json @@ -1,6 +1,6 @@ { "name": "@everos-ai/openclaw-plugin", - "version": "3.0.3", + "version": "3.0.4", "description": "OpenClaw Memory — EverOS: native memory-slot plugin backed by the local EverOS framework.", "keywords": [ "openclaw", diff --git a/openclaw/src/handlers.ts b/openclaw/src/handlers.ts index 8e480b7..6213796 100644 --- a/openclaw/src/handlers.ts +++ b/openclaw/src/handlers.ts @@ -752,12 +752,20 @@ export function createHandlers(deps: HandlerDeps): Handlers { const project_id = projectIdFrom(ctx); noteActiveSession(sessionIdOf(ctx), project_id); - // The current user prompt lives in `event.prompt`; `event.messages` is - // prior history (empty on a fresh session, verified against the OpenClaw - // runtime — it never contains the current turn). The query keeps the prompt - // whole and blends in up to `queryN - 1` prior user lines for follow-up - // context; a blank prompt falls back to recent history. See buildRecallQuery. - const current = typeof event.prompt === "string" ? event.prompt : ""; + // The current request is `event.currentUserMessage` where the host supplies + // it (2026.11+): `event.prompt` may then carry reconstructed history, and an + // explicit "" means no textual request, which must not fall back to history. + // Older hosts put it in `event.prompt`. `event.messages` is prior history + // (empty on a fresh session; it never contains the current turn). The query + // keeps the request whole and blends in up to `queryN - 1` prior user lines; + // a blank `prompt` falls back to recent history. See buildRecallQuery. + if (event.currentUserMessage === "") return; + const current = + typeof event.currentUserMessage === "string" + ? event.currentUserMessage + : typeof event.prompt === "string" + ? event.prompt + : ""; const q = buildRecallQuery(current, event.messages ?? [], deps.queryN, deps.queryMaxChars); if (!q) return; // nothing to recall on const opts = { timeoutMs: recallTimeoutMs }; diff --git a/openclaw/src/openclaw-types.ts b/openclaw/src/openclaw-types.ts index 3d93648..70de0f5 100644 --- a/openclaw/src/openclaw-types.ts +++ b/openclaw/src/openclaw-types.ts @@ -40,6 +40,11 @@ export interface PluginHookSessionContext { export interface BeforePromptBuildEvent { prompt: string; messages: unknown[]; + /** + * The current request before history projection (OpenClaw 2026.11+). `prompt` + * may carry reconstructed history on some runtimes; `""` means no textual request. + */ + currentUserMessage?: string; } /** Honored return fields for `before_prompt_build` (exactly these five). */ diff --git a/openclaw/test/handlers.test.ts b/openclaw/test/handlers.test.ts index 2773b68..bab71b7 100644 --- a/openclaw/test/handlers.test.ts +++ b/openclaw/test/handlers.test.ts @@ -449,6 +449,32 @@ test("recall: uses event.prompt when history is empty (fresh session)", async () assert.equal(spy.searches[0]!.query, "what am I working on?"); }); +test("recall: currentUserMessage is the query when the host supplies it", async () => { + const spy = spyClient(); + const h = createHandlers(baseDeps(spy.client)); + await h.recall( + { + prompt: "old turn\nold reply\nwhere is the deploy key?", + messages: [], + currentUserMessage: "where is the deploy key?", + }, + ctx(), + ); + assert.equal(spy.searches.length, 2); + for (const s of spy.searches) assert.equal(s.query, "where is the deploy key?"); +}); + +test("recall: an explicit empty currentUserMessage recalls nothing, even with history", async () => { + const spy = spyClient(); + const h = createHandlers(baseDeps(spy.client)); + const out = await h.recall( + { prompt: "reconstructed", messages: [{ role: "user", content: "earlier question" }], currentUserMessage: "" }, + ctx(), + ); + assert.equal(out, undefined); + assert.equal(spy.searches.length, 0); +}); + test("recall: empty query → no search, no injection", async () => { const spy = spyClient(); const h = createHandlers(baseDeps(spy.client));