mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 22:40:43 +00:00
* [EV-001] memory-core: filter memory_search session hits by visibility - Move session visibility + listSpawnedSessionKeys to plugin-sdk; sync test hook with sessions-resolution __testing.setDepsForTest - Extract loadCombinedSessionStoreForGateway to config/sessions; re-export from gateway session-utils - Add session-transcript-hit stem resolver for builtin + QMD paths - Post-filter memory_search results before citations/recall; fail closed when requester session key missing; optional corpus=sessions - Tests: stem extraction, visibility filter smoke, existing suites green * chore: sync plugin-sdk exports for session-transcript-hit and session-visibility Run pnpm plugin-sdk:sync-exports so package.json exports match scripts/lib/plugin-sdk-entrypoints.json. Fixes contract tests and lint:plugins:plugin-sdk-subpaths-exported for memory-core imports. * fix(EV-001): cross-agent session memory hits + hoist combined store load - resolveTranscriptStemToSessionKeys: stop filtering by requester agentId so keys from other agents reach createSessionVisibilityGuard (a2a + visibility=all). - Re-export loadCombinedSessionStoreForGateway from session-transcript-hit; filterMemorySearchHitsBySessionVisibility loads the combined store once per pass. - Drop unused agentId from filter params; extend tests (Greptile/Codex review). * fix(memory_search): honor corpus=sessions before maxResults cap Pass sources into MemoryIndexManager.search so FTS/vector queries add source IN (...) before ranking and top-N slice (Codex: non-session hits could fill the window). QMD path: oversample fetch limit for single-source recall, filter by source, then diversify/clamp to the requested maxResults. Wire corpus=sessions from tools; extend MemorySearchManager opts and wrappers. * fix(memory_search): apply corpus=memory source filter like sessions Pass sources: ["memory"] into manager.search so maxResults applies only within the memory index; post-filter for defense in depth. Document corpus=memory in the tool description. * fix: scope qmd session memory search * fix: enforce memory search session visibility (#70761) (thanks @nefainl) --------- Co-authored-by: NefAI <info@nefai.nl> Co-authored-by: Ayaan Zaidi <hi@obviy.us>
77 lines
2.3 KiB
TypeScript
77 lines
2.3 KiB
TypeScript
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
import { registerMemoryCli } from "./src/cli.js";
|
|
import { registerDreamingCommand } from "./src/dreaming-command.js";
|
|
import { registerShortTermPromotionDreaming } from "./src/dreaming.js";
|
|
import {
|
|
buildMemoryFlushPlan,
|
|
DEFAULT_MEMORY_FLUSH_FORCE_TRANSCRIPT_BYTES,
|
|
DEFAULT_MEMORY_FLUSH_PROMPT,
|
|
DEFAULT_MEMORY_FLUSH_SOFT_TOKENS,
|
|
} from "./src/flush-plan.js";
|
|
import { registerBuiltInMemoryEmbeddingProviders } from "./src/memory/provider-adapters.js";
|
|
import { buildPromptSection } from "./src/prompt-section.js";
|
|
import { listMemoryCorePublicArtifacts } from "./src/public-artifacts.js";
|
|
import { memoryRuntime } from "./src/runtime-provider.js";
|
|
import { createMemoryGetTool, createMemorySearchTool } from "./src/tools.js";
|
|
export {
|
|
buildMemoryFlushPlan,
|
|
DEFAULT_MEMORY_FLUSH_FORCE_TRANSCRIPT_BYTES,
|
|
DEFAULT_MEMORY_FLUSH_PROMPT,
|
|
DEFAULT_MEMORY_FLUSH_SOFT_TOKENS,
|
|
} from "./src/flush-plan.js";
|
|
export { buildPromptSection } from "./src/prompt-section.js";
|
|
|
|
export default definePluginEntry({
|
|
id: "memory-core",
|
|
name: "Memory (Core)",
|
|
description: "File-backed memory search tools and CLI",
|
|
kind: "memory",
|
|
register(api) {
|
|
registerBuiltInMemoryEmbeddingProviders(api);
|
|
registerShortTermPromotionDreaming(api);
|
|
registerDreamingCommand(api);
|
|
api.registerMemoryCapability({
|
|
promptBuilder: buildPromptSection,
|
|
flushPlanResolver: buildMemoryFlushPlan,
|
|
runtime: memoryRuntime,
|
|
publicArtifacts: {
|
|
listArtifacts: listMemoryCorePublicArtifacts,
|
|
},
|
|
});
|
|
|
|
api.registerTool(
|
|
(ctx) =>
|
|
createMemorySearchTool({
|
|
config: ctx.config,
|
|
agentSessionKey: ctx.sessionKey,
|
|
sandboxed: ctx.sandboxed,
|
|
}),
|
|
{ names: ["memory_search"] },
|
|
);
|
|
|
|
api.registerTool(
|
|
(ctx) =>
|
|
createMemoryGetTool({
|
|
config: ctx.config,
|
|
agentSessionKey: ctx.sessionKey,
|
|
}),
|
|
{ names: ["memory_get"] },
|
|
);
|
|
|
|
api.registerCli(
|
|
({ program }) => {
|
|
registerMemoryCli(program);
|
|
},
|
|
{
|
|
descriptors: [
|
|
{
|
|
name: "memory",
|
|
description: "Search, inspect, and reindex memory files",
|
|
hasSubcommands: true,
|
|
},
|
|
],
|
|
},
|
|
);
|
|
},
|
|
});
|