🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✅ test(builtin-tool-memory): added promptfoo test for memory (#11786)
Neko568136ff6748
diff --git a/packages/builtin-tool-memory/package.json b/packages/builtin-tool-memory/package.jsonindex dbb0149a312..949f6642de6 100644--- a/packages/builtin-tool-memory/package.json+++ b/packages/builtin-tool-memory/package.json@@ -2,18 +2,23 @@"name": "@lobechat/builtin-tool-memory","version": "1.0.0","private": true,+ "type": "module","exports": {".": "./src/index.ts","./client": "./src/client/index.ts","./executor": "./src/executor/index.ts"},"main": "./src/index.ts",+ "scripts": {+ "build:gen-tool-call": "tsx scripts/generate-tool-call.ts"+ },"dependencies": {"@lobechat/memory-user-memory": "workspace:*","@lobechat/prompts": "workspace:*"},"devDependencies": {- "@lobechat/types": "workspace:*"+ "@lobechat/types": "workspace:*",+ "promptfoo": "^0.120.17"},"peerDependencies": {"@lobehub/ui": "^4",diff --git a/packages/builtin-tool-memory/promptfoo/evals/preferences/tool-call/basic/buildMessages.ts b/packages/builtin-tool-memory/promptfoo/evals/preferences/tool-call/basic/buildMessages.tsnew file mode 100644index 00000000000..6dc01c9490f--- /dev/null+++ b/packages/builtin-tool-memory/promptfoo/evals/preferences/tool-call/basic/buildMessages.ts@@ -0,0 +1,19 @@+export interface PromptVars {+ conversation: string;+}++export const buildActivityMessages = (vars: PromptVars) => {+ const messages = [+ { content: 'You are a memory assistant, help the user to organize their preferences with memory related tools', role: 'system' as const },+ { content: 'I love to drink Hong Kong Milk Tea', role: 'user' as const },+ ];++ if (vars.conversation) {+ messages.push({+ content: `Conversation:\n${vars.conversation}`,+ role: 'user' as const,+ });+ }++ return messages;+};diff --git a/packages/builtin-tool-memory/promptfoo/evals/preferences/tool-call/basic/eval.yaml b/packages/builtin-tool-memory/promptfoo/evals/preferences/tool-call/basic/eval.yamlnew file mode 100644index 00000000000..c4a70f45f66--- /dev/null+++ b/packages/builtin-tool-memory/promptfoo/evals/preferences/tool-call/basic/eval.yaml@@ -0,0 +1,14 @@+description: Regression benchmark for activity layer structured extraction++providers:+ - id: openai:chat:google/gemini-2.5-pro+ config:+ tools: file://../../../../tool-calls/memory-addPreferenceMemory.json+ tool_choice:+ type: any++prompts:+ - file://./prompt.ts++tests:+ - file://./tests/cases.tsdiff --git a/packages/builtin-tool-memory/promptfoo/evals/preferences/tool-call/basic/prompt.ts b/packages/builtin-tool-memory/promptfoo/evals/preferences/tool-call/basic/prompt.tsnew file mode 100644index 00000000000..c686ed81185--- /dev/null+++ b/packages/builtin-tool-memory/promptfoo/evals/preferences/tool-call/basic/prompt.ts@@ -0,0 +1,7 @@+// @ts-expect-error - ignore ts error for .ts file import+import { buildActivityMessages } from './buildMessages.ts';+import type { PromptVars } from './buildMessages';++export default function generatePrompt({ vars }: { vars: PromptVars }) {+ return buildActivityMessages(vars);+}diff --git a/packages/builtin-tool-memory/promptfoo/evals/preferences/tool-call/basic/tests/cases.ts b/packages/builtin-tool-memory/promptfoo/evals/preferences/tool-call/basic/tests/cases.tsnew file mode 100644index 00000000000..f859f1883e9--- /dev/null+++ b/packages/builtin-tool-memory/promptfoo/evals/preferences/tool-call/basic/tests/cases.ts@@ -0,0 +1,106 @@+type PromptfooAssert =+ | { type: 'javascript'; value: string }+ | { provider?: string; type: 'llm-rubric'; value: string };++interface PromptfooTestCase {+ assert: PromptfooAssert[];+ description?: string;+ vars: Record<string, unknown>;+}++const baseSchemaAssert: PromptfooAssert = {+ type: 'javascript',+ value: `+ let parsed;+ try {+ parsed = JSON.parse(output);+ } catch (error) {+ console.error('Failed to parse JSON output', error);+ return false;+ }++ if (!parsed || !Array.isArray(parsed.memories)) return false;++ return parsed.memories.every((memory) => {+ return (+ memory.memoryType === 'activity' &&+ memory.title &&+ memory.summary &&+ memory.withActivity?.type &&+ memory.withActivity?.narrative+ );+ });+ `,+};++const baseVars = {+ availableCategories: ['work', 'health', 'personal'],+ language: 'English',+ topK: 5,+ username: 'User',+};++const testCases: PromptfooTestCase[] = [+ {+ assert: [+ baseSchemaAssert,+ {+ type: 'javascript',+ value: `+ const data = JSON.parse(output);+ const first = data.memories?.[0];+ if (!first) return false;++ const activity = first.withActivity || {};+ return Boolean(activity.startsAt && activity.endsAt && activity.timezone && activity.associatedLocations?.[0]?.name);+ `,+ },+ {+ provider: 'openai:gpt-5-mini',+ type: 'llm-rubric',+ value:+ 'Should extract a meeting activity including timing (start/end/timezone), location name ACME HQ, status completed when implied, and feedback reflecting the positive tone.',+ },+ ],+ description: 'Meeting with explicit time and location',+ vars: {+ ...baseVars,+ conversation:+ 'User: I met with Alice at ACME HQ on 2024-05-03 from 14:00-15:00 America/New_York. We reviewed Q2 renewal scope and agreed to send revised pricing next week. I felt positive and collaborative about the call.',+ retrievedContexts: ['Previous similar memory: met with Alice about renewal last month.'],+ sessionDate: '2024-05-03',+ },+ },+ {+ assert: [+ baseSchemaAssert,+ {+ type: 'javascript',+ value: `+ const data = JSON.parse(output);+ const first = data.memories?.[0];+ if (!first) return false;++ const activity = first.withActivity || {};+ return Boolean(activity.narrative && activity.feedback);+ `,+ },+ {+ provider: 'openai:gpt-5-mini',+ type: 'llm-rubric',+ value:+ 'Should capture an exercise activity without inventing exact timestamps or timezones; keep the narrative and feedback about the yoga session at home and omit temporal fields that were not provided.',+ },+ ],+ description: 'Exercise without explicit time or timezone',+ vars: {+ ...baseVars,+ conversation:+ 'User: Over the weekend I did a 30-minute yoga session at home with my roommate. No specific time was set, it was just a casual stretch and it left me feeling calm.',+ retrievedContexts: [],+ sessionDate: '2025-05-05 10:02:00',+ },+ },+];++export default testCases;diff --git a/packages/builtin-tool-memory/promptfoo/tool-calls/memory-addContextMemory.json b/packages/builtin-tool-memory/promptfoo/tool-calls/memory-addContextMemory.jsonnew file mode 100644index 00000000000..6375077164e--- /dev/null+++ b/packages/builtin-tool-memory/promptfoo/tool-calls/memory-addContextMemory.json@@ -0,0 +1,192 @@+{+ "description": "Create a context memory that captures ongoing situations, projects, or environments. Include actors, resources, statuses, urgency/impact, and a clear description.",+ "name": "addContextMemory",+ "parameters": {+ "additionalProperties": false,+ "properties": {+ "details": {+ "description": "Optional detailed information",+ "type": "string"+ },+ "memoryCategory": {+ "description": "Memory category",+ "type": "string"+ },+ "memoryType": {+ "description": "Memory type",+ "enum": [+ "activity",+ "context",+ "event",+ "fact",+ "location",+ "other",+ "people",+ "preference",+ "technology",+ "topic"+ ],+ "type": "string"+ },+ "summary": {+ "description": "Concise overview of this specific memory",+ "type": "string"+ },+ "tags": {+ "description": "User defined tags that summarize the context facets",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "title": {+ "description": "Brief descriptive title",+ "type": "string"+ },+ "withContext": {+ "additionalProperties": false,+ "properties": {+ "associatedObjects": {+ "description": "Array of objects describing involved roles, entities, or resources, [] empty if none",+ "items": {+ "additionalProperties": false,+ "properties": {+ "extra": {+ "description": "Additional metadata about the object, should always be a valid JSON string if present",+ "type": [+ "string",+ "null"+ ]+ },+ "name": {+ "description": "Name of the associated object",+ "type": "string"+ },+ "type": {+ "description": "Type/category of the associated object",+ "enum": [+ "application",+ "item",+ "knowledge",+ "other",+ "person",+ "place"+ ],+ "type": "string"+ }+ },+ "required": [+ "extra",+ "name",+ "type"+ ],+ "type": "object"+ },+ "type": "array"+ },+ "associatedSubjects": {+ "description": "Array of JSON objects describing involved subjects or participants, [] empty if none",+ "items": {+ "additionalProperties": false,+ "properties": {+ "extra": {+ "description": "Additional metadata about the subject, should always be a valid JSON string if present",+ "type": [+ "string",+ "null"+ ]+ },+ "name": {+ "description": "Name of the associated subject",+ "type": "string"+ },+ "type": {+ "description": "Type/category of the associated subject",+ "enum": [+ "item",+ "other",+ "person",+ "pet"+ ],+ "type": "string"+ }+ },+ "required": [+ "extra",+ "name",+ "type"+ ],+ "type": "object"+ },+ "type": "array"+ },+ "currentStatus": {+ "description": "High level status markers (must be one of 'planned', 'ongoing', 'completed', 'aborted', 'on_hold', 'cancelled')",+ "enum": [+ "aborted",+ "cancelled",+ "completed",+ "on_hold",+ "ongoing",+ "planned"+ ],+ "type": "string"+ },+ "description": {+ "description": "Rich narrative describing the situation, timeline, or environment",+ "type": "string"+ },+ "labels": {+ "description": "Model generated tags that summarize the context themes",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "scoreImpact": {+ "description": "Numeric score (0-1 (0% to 100%)) describing importance",+ "maximum": 1,+ "minimum": 0,+ "type": "number"+ },+ "scoreUrgency": {+ "description": "Numeric score (0-1 (0% to 100%)) describing urgency",+ "maximum": 1,+ "minimum": 0,+ "type": "number"+ },+ "title": {+ "description": "Optional synthesized context headline",+ "type": "string"+ },+ "type": {+ "description": "High level context archetype (e.g., 'project', 'relationship', 'goal')",+ "type": "string"+ }+ },+ "required": [+ "associatedObjects",+ "associatedSubjects",+ "currentStatus",+ "description",+ "labels",+ "scoreImpact",+ "scoreUrgency",+ "title",+ "type"+ ],+ "type": "object"+ }+ },+ "required": [+ "details",+ "memoryCategory",+ "memoryType",+ "summary",+ "tags",+ "title",+ "withContext"+ ],+ "type": "object"+ }+}\ No newline at end of filediff --git a/packages/builtin-tool-memory/promptfoo/tool-calls/memory-addExperienceMemory.json b/packages/builtin-tool-memory/promptfoo/tool-calls/memory-addExperienceMemory.jsonnew file mode 100644index 00000000000..463ddf8e5d2--- /dev/null+++ b/packages/builtin-tool-memory/promptfoo/tool-calls/memory-addExperienceMemory.json@@ -0,0 +1,125 @@+{+ "description": "Record an experience memory capturing situation, actions, reasoning, outcomes, and confidence. Use for lessons, playbooks, or transferable know-how.",+ "name": "addExperienceMemory",+ "parameters": {+ "additionalProperties": false,+ "properties": {+ "details": {+ "description": "Optional detailed information",+ "type": "string"+ },+ "memoryCategory": {+ "description": "Memory category",+ "type": "string"+ },+ "memoryType": {+ "description": "Memory type",+ "enum": [+ "activity",+ "context",+ "event",+ "fact",+ "location",+ "other",+ "people",+ "preference",+ "technology",+ "topic"+ ],+ "type": "string"+ },+ "summary": {+ "description": "Concise overview of this specific memory",+ "type": "string"+ },+ "tags": {+ "description": "Model generated tags that summarize the experience facets",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "title": {+ "description": "Brief descriptive title",+ "type": "string"+ },+ "withExperience": {+ "additionalProperties": false,+ "properties": {+ "action": {+ "description": "Narrative describing actions taken or behaviors exhibited",+ "type": "string"+ },+ "keyLearning": {+ "description": "Narrative describing key insights or lessons learned",+ "type": "string"+ },+ "knowledgeValueScore": {+ "description": "Numeric score (0-1) describing how reusable and shareable this experience is",+ "maximum": 1,+ "minimum": 0,+ "type": "number"+ },+ "labels": {+ "description": "Model generated tags that summarize the experience facets",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "possibleOutcome": {+ "description": "Narrative describing potential outcomes or learnings",+ "type": "string"+ },+ "problemSolvingScore": {+ "description": "Numeric score (0-1) describing how effectively the problem was solved",+ "maximum": 1,+ "minimum": 0,+ "type": "number"+ },+ "reasoning": {+ "description": "Narrative describing the thought process or motivations",+ "type": "string"+ },+ "scoreConfidence": {+ "description": "Numeric score (0-1 (0% to 100%)) describing confidence in the experience details",+ "maximum": 1,+ "minimum": 0,+ "type": "number"+ },+ "situation": {+ "description": "Narrative describing the situation or event",+ "type": "string"+ },+ "type": {+ "description": "Type of experience being recorded",+ "type": "string"+ }+ },+ "required": [+ "situation",+ "reasoning",+ "action",+ "possibleOutcome",+ "keyLearning",+ "type",+ "labels",+ "problemSolvingScore",+ "scoreConfidence",+ "knowledgeValueScore"+ ],+ "type": "object"+ }+ },+ "required": [+ "details",+ "memoryCategory",+ "memoryType",+ "summary",+ "tags",+ "title",+ "withExperience"+ ],+ "type": "object"+ }+}\ No newline at end of filediff --git a/packages/builtin-tool-memory/promptfoo/tool-calls/memory-addIdentityMemory.json b/packages/builtin-tool-memory/promptfoo/tool-calls/memory-addIdentityMemory.jsonnew file mode 100644index 00000000000..851f77b9d3d--- /dev/null+++ b/packages/builtin-tool-memory/promptfoo/tool-calls/memory-addIdentityMemory.json@@ -0,0 +1,148 @@+{+ "description": "Add an identity memory describing enduring facts about a person, their role, relationship, and supporting evidence. Use to track self/others identities.",+ "name": "addIdentityMemory",+ "parameters": {+ "additionalProperties": false,+ "properties": {+ "details": {+ "description": "Optional detailed information",+ "type": [+ "string",+ "null"+ ]+ },+ "memoryCategory": {+ "description": "Memory category",+ "type": "string"+ },+ "memoryType": {+ "description": "Memory type",+ "enum": [+ "activity",+ "context",+ "event",+ "fact",+ "location",+ "other",+ "people",+ "preference",+ "technology",+ "topic"+ ],+ "type": "string"+ },+ "summary": {+ "description": "Concise overview of this specific memory",+ "type": "string"+ },+ "tags": {+ "description": "Model generated tags that summarize the identity facets",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "title": {+ "description": "Honorific-style, concise descriptor (strength + domain/milestone), avoid bare job titles; e.g., \"Trusted open-source maintainer\", \"Specializes in low-latency infra\", \"Former Aliyun engineer\", \"Cares for rescue cats\"",+ "type": "string"+ },+ "withIdentity": {+ "additionalProperties": false,+ "properties": {+ "description": {+ "type": "string"+ },+ "episodicDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "extractedLabels": {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "relationship": {+ "enum": [+ "aunt",+ "brother",+ "classmate",+ "colleague",+ "couple",+ "coworker",+ "daughter",+ "father",+ "friend",+ "granddaughter",+ "grandfather",+ "grandmother",+ "grandson",+ "husband",+ "manager",+ "mentee",+ "mentor",+ "mother",+ "nephew",+ "niece",+ "other",+ "partner",+ "self",+ "sibling",+ "sister",+ "son",+ "spouse",+ "teammate",+ "uncle",+ "wife"+ ],+ "type": "string"+ },+ "role": {+ "description": "Role explicitly mentioned for this identity entry (e.g., \"platform engineer\", \"caregiver\"); keep neutral and only use when evidence exists",+ "type": "string"+ },+ "scoreConfidence": {+ "type": "number"+ },+ "sourceEvidence": {+ "type": [+ "string",+ "null"+ ]+ },+ "type": {+ "enum": [+ "demographic",+ "personal",+ "professional"+ ],+ "type": "string"+ }+ },+ "required": [+ "description",+ "episodicDate",+ "extractedLabels",+ "relationship",+ "role",+ "scoreConfidence",+ "sourceEvidence",+ "type"+ ],+ "type": "object"+ }+ },+ "required": [+ "details",+ "memoryCategory",+ "memoryType",+ "summary",+ "tags",+ "title",+ "withIdentity"+ ],+ "type": "object"+ }+}\ No newline at end of filediff --git a/packages/builtin-tool-memory/promptfoo/tool-calls/memory-addPreferenceMemory.json b/packages/builtin-tool-memory/promptfoo/tool-calls/memory-addPreferenceMemory.jsonnew file mode 100644index 00000000000..ac1073c119a--- /dev/null+++ b/packages/builtin-tool-memory/promptfoo/tool-calls/memory-addPreferenceMemory.json@@ -0,0 +1,200 @@+{+ "description": "Create a preference memory that encodes durable directives or choices the assistant should follow. Include conclusionDirectives, scopes, and context.",+ "name": "addPreferenceMemory",+ "parameters": {+ "additionalProperties": false,+ "properties": {+ "details": {+ "description": "Optional detailed information",+ "type": "string"+ },+ "memoryCategory": {+ "description": "Memory category",+ "type": "string"+ },+ "memoryType": {+ "description": "Memory type",+ "enum": [+ "activity",+ "context",+ "event",+ "fact",+ "location",+ "other",+ "people",+ "preference",+ "technology",+ "topic"+ ],+ "type": "string"+ },+ "summary": {+ "description": "Concise overview of this specific memory",+ "type": "string"+ },+ "tags": {+ "description": "Model generated tags that summarize the preference facets",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "title": {+ "description": "Brief descriptive title",+ "type": "string"+ },+ "withPreference": {+ "additionalProperties": false,+ "properties": {+ "appContext": {+ "additionalProperties": false,+ "description": "Application/surface specific preference, if any",+ "properties": {+ "app": {+ "description": "App or product name this applies to",+ "type": [+ "string",+ "null"+ ]+ },+ "feature": {+ "type": [+ "string",+ "null"+ ]+ },+ "route": {+ "type": [+ "string",+ "null"+ ]+ },+ "surface": {+ "description": "e.g., chat, emails, code review, notes",+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "app",+ "feature",+ "route",+ "surface"+ ],+ "type": [+ "object",+ "null"+ ]+ },+ "conclusionDirectives": {+ "description": "Direct, self-contained instruction to the assistant from the user's perspective (what to do, not how to implement)",+ "type": "string"+ },+ "extractedLabels": {+ "description": "Model generated tags that summarize the preference facets",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "extractedScopes": {+ "description": "Array of JSON strings describing preference facets and applicable scopes",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "originContext": {+ "additionalProperties": false,+ "description": "Context of how/why this preference was expressed",+ "properties": {+ "actor": {+ "description": "Who stated the preference; use 'User' for the user",+ "type": "string"+ },+ "applicableWhen": {+ "description": "Conditions where this preference applies",+ "type": [+ "string",+ "null"+ ]+ },+ "notApplicableWhen": {+ "description": "Conditions where it does not apply",+ "type": [+ "string",+ "null"+ ]+ },+ "scenario": {+ "description": "Applicable scenario or use case",+ "type": [+ "string",+ "null"+ ]+ },+ "trigger": {+ "description": "What prompted this preference",+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "actor",+ "applicableWhen",+ "notApplicableWhen",+ "scenario",+ "trigger"+ ],+ "type": [+ "object",+ "null"+ ]+ },+ "scorePriority": {+ "description": "Numeric prioritization weight (0-1 (0% to 100%)) where higher means more critical to respect",+ "maximum": 1,+ "minimum": 0,+ "type": "number"+ },+ "suggestions": {+ "description": "Follow-up actions or assistant guidance derived from the preference",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "type": {+ "description": "High level preference classification (e.g., 'lifestyle', 'communication')",+ "type": "string"+ }+ },+ "required": [+ "appContext",+ "conclusionDirectives",+ "extractedLabels",+ "extractedScopes",+ "originContext",+ "scorePriority",+ "suggestions",+ "type"+ ],+ "type": "object"+ }+ },+ "required": [+ "title",+ "summary",+ "tags",+ "details",+ "memoryCategory",+ "memoryType",+ "withPreference"+ ],+ "type": "object"+ }+}\ No newline at end of filediff --git a/packages/builtin-tool-memory/promptfoo/tool-calls/memory-removeIdentityMemory.json b/packages/builtin-tool-memory/promptfoo/tool-calls/memory-removeIdentityMemory.jsonnew file mode 100644index 00000000000..b2b250af943--- /dev/null+++ b/packages/builtin-tool-memory/promptfoo/tool-calls/memory-removeIdentityMemory.json@@ -0,0 +1,20 @@+{+ "description": "Remove an identity memory when it is incorrect, obsolete, or duplicated. Always provide a concise reason.",+ "name": "removeIdentityMemory",+ "parameters": {+ "additionalProperties": false,+ "properties": {+ "id": {+ "type": "string"+ },+ "reason": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "reason"+ ],+ "type": "object"+ }+}\ No newline at end of filediff --git a/packages/builtin-tool-memory/promptfoo/tool-calls/memory-searchUserMemory.json b/packages/builtin-tool-memory/promptfoo/tool-calls/memory-searchUserMemory.jsonnew file mode 100644index 00000000000..c881112afbc--- /dev/null+++ b/packages/builtin-tool-memory/promptfoo/tool-calls/memory-searchUserMemory.json@@ -0,0 +1,40 @@+{+ "description": "Retrieve memories based on a search query. Use this to recall previously saved information.",+ "name": "searchUserMemory",+ "parameters": {+ "additionalProperties": false,+ "properties": {+ "query": {+ "type": "string"+ },+ "topK": {+ "additionalProperties": false,+ "properties": {+ "contexts": {+ "minimum": 0,+ "type": "integer"+ },+ "experiences": {+ "minimum": 0,+ "type": "integer"+ },+ "preferences": {+ "minimum": 0,+ "type": "integer"+ }+ },+ "required": [+ "contexts",+ "experiences",+ "preferences"+ ],+ "type": "object"+ }+ },+ "required": [+ "query",+ "topK"+ ],+ "type": "object"+ }+}\ No newline at end of filediff --git a/packages/builtin-tool-memory/promptfoo/tool-calls/memory-updateIdentityMemory.json b/packages/builtin-tool-memory/promptfoo/tool-calls/memory-updateIdentityMemory.jsonnew file mode 100644index 00000000000..580323ccfe4--- /dev/null+++ b/packages/builtin-tool-memory/promptfoo/tool-calls/memory-updateIdentityMemory.json@@ -0,0 +1,153 @@+{+ "description": "Update an existing identity memory with refined details, relationships, roles, or tags. Use mergeStrategy to control replacement vs merge.",+ "name": "updateIdentityMemory",+ "parameters": {+ "additionalProperties": false,+ "properties": {+ "id": {+ "type": "string"+ },+ "mergeStrategy": {+ "enum": [+ "merge",+ "replace"+ ],+ "type": "string"+ },+ "set": {+ "additionalProperties": false,+ "properties": {+ "details": {+ "description": "Optional detailed information, use null for omitting the field",+ "type": [+ "string",+ "null"+ ]+ },+ "memoryCategory": {+ "description": "Memory category, use null for omitting the field",+ "type": [+ "string",+ "null"+ ]+ },+ "memoryType": {+ "description": "Memory type, use null for omitting the field",+ "enum": [+ "activity",+ "context",+ "event",+ "fact",+ "location",+ "other",+ "people",+ "preference",+ "technology",+ "topic",+ null+ ]+ },+ "summary": {+ "description": "Concise overview of this specific memory, use null for omitting the field",+ "type": [+ "string",+ "null"+ ]+ },+ "tags": {+ "description": "Model generated tags that summarize the identity facets, use null for omitting the field",+ "items": {+ "type": "string"+ },+ "type": [+ "array",+ "null"+ ]+ },+ "title": {+ "description": "Honorific-style, concise descriptor (strength + domain/milestone), avoid bare job titles; e.g., \"Trusted open-source maintainer\", \"Specializes in low-latency infra\", \"Former Aliyun engineer\", \"Cares for rescue cats\"; use null for omitting the field",+ "type": [+ "string",+ "null"+ ]+ },+ "withIdentity": {+ "additionalProperties": false,+ "properties": {+ "description": {+ "type": [+ "string",+ "null"+ ]+ },+ "episodicDate": {+ "type": [+ "string",+ "null"+ ]+ },+ "extractedLabels": {+ "items": {+ "type": "string"+ },+ "type": [+ "array",+ "null"+ ]+ },+ "relationship": {+ "description": "Possible values: aunt | brother | classmate | colleague | couple | coworker | daughter | father | friend | granddaughter | grandfather | grandmother | grandson | husband | manager | mentee | mentor | mother | nephew | niece | other | partner | self | sibling | sister | son | spouse | teammate | uncle | wife",+ "type": [+ "string",+ "null"+ ]+ },+ "role": {+ "description": "Role explicitly mentioned for this identity entry (e.g., \"platform engineer\", \"caregiver\"); keep existing when not updated; use null for omitting the field",+ "type": [+ "string",+ "null"+ ]+ },+ "scoreConfidence": {+ "type": [+ "number",+ "null"+ ]+ },+ "sourceEvidence": {+ "type": [+ "string",+ "null"+ ]+ },+ "type": {+ "description": "Possible values: demographic | personal | professional",+ "type": [+ "string",+ "null"+ ]+ }+ },+ "required": [+ "description",+ "extractedLabels",+ "role"+ ],+ "type": "object"+ }+ },+ "required": [+ "withIdentity"+ ],+ "type": "object"+ }+ },+ "required": [+ "id",+ "mergeStrategy",+ "set"+ ],+ "type": "object"+ }+}\ No newline at end of filediff --git a/packages/builtin-tool-memory/promptfooconfig.yaml b/packages/builtin-tool-memory/promptfooconfig.yamlnew file mode 100644index 00000000000..ed731b30549--- /dev/null+++ b/packages/builtin-tool-memory/promptfooconfig.yaml@@ -0,0 +1,33 @@+description: LobeHub Prompts (memory-user-memory) Testing Suite++# Test configurations - run all prompt tests+testPaths:+ - promptfoo/evals/preferences/tool-call/basic/eval.yaml++# Default provider setup (must specify either providers or targets)+providers:+ - id: google:gemini-2.5-pro++# Output configuration+outputPath: promptfoo-results.json++# Default test settings+defaultTest:+ assert:+ - type: llm-rubric+ provider: openai:gpt-5-mini+ value: "The response should be relevant and well-formatted"+ - type: llm-rubric+ provider: google:gemini-2.5-flash+ value: "The response should be relevant and well-formatted"+ - type: cost+ threshold: 0.01 # Maximum cost per test in USD++# Evaluation settings+evaluateOptions:+ maxConcurrency: 5+ delay: 100++# TypeScript support+transforms:+ - "typescript"diff --git a/packages/builtin-tool-memory/scripts/generate-tool-call.ts b/packages/builtin-tool-memory/scripts/generate-tool-call.tsnew file mode 100644index 00000000000..c157a8149ae--- /dev/null+++ b/packages/builtin-tool-memory/scripts/generate-tool-call.ts@@ -0,0 +1,30 @@+/* eslint-disable unicorn/prefer-top-level-await */+import { mkdir, writeFile } from 'node:fs/promises';+import { join } from 'node:path';+import { exit } from 'node:process';++import type { BuiltinToolManifest } from '@lobechat/types';+import { MemoryManifest } from '../../builtin-tool-memory';++const OUTPUT_DIR = join(process.cwd(), 'promptfoo/tool-calls');++const writeToolCallSchemaFromManifest = async (prefix: string, manifest: BuiltinToolManifest) => {+ for (const tool of manifest.api) {+ const transformedTool = {+ ...tool,+ type: 'function'+ }+ await writeFile(join(OUTPUT_DIR, `${prefix}-${transformedTool.name}.json`), JSON.stringify(transformedTool, null, 2));+ }+}++async function main() {+ await mkdir(OUTPUT_DIR, { recursive: true });+ await writeToolCallSchemaFromManifest('memory', MemoryManifest);+}++main().catch((err) => {+ // eslint-disable-next-line no-console+ console.error(err);+ exit(1);+});diff --git a/packages/memory-user-memory/package.json b/packages/memory-user-memory/package.jsonindex 210ebc8f7df..65b9cf609ca 100644--- a/packages/memory-user-memory/package.json+++ b/packages/memory-user-memory/package.json@@ -32,7 +32,7 @@"@lobechat/types": "workspace:*","@types/json-schema": "^7.0.15","@types/xast": "^2.0.4",- "promptfoo": "^0.118.17",+ "promptfoo": "^0.120.17","tsx": "^4.20.6"},"peerDependencies": {diff --git a/packages/prompts/package.json b/packages/prompts/package.jsonindex c978fc8c5b0..0f9ab30ff51 100644--- a/packages/prompts/package.json+++ b/packages/prompts/package.json@@ -20,7 +20,7 @@},"devDependencies": {"@lobechat/types": "workspace:*",- "promptfoo": "^0.118.17",+ "promptfoo": "^0.120.17","tsx": "^4.20.6"}}