ei-tui 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/package.json +3 -1
- package/src/cli/README.md +42 -14
- package/src/cli/mcp.ts +237 -0
- package/src/cli.ts +17 -51
- package/src/core/handlers/human-extraction.ts +22 -16
- package/src/core/handlers/human-matching.ts +45 -10
- package/src/core/llm-client.ts +101 -15
- package/src/core/orchestrators/human-extraction.ts +28 -0
- package/src/core/orchestrators/index.ts +1 -0
- package/src/core/processor.ts +37 -41
- package/src/core/prompt-context-builder.ts +1 -0
- package/src/core/queue-processor.ts +26 -17
- package/src/core/state-manager.ts +6 -6
- package/src/core/tools/builtin/fetch-memory.ts +92 -0
- package/src/core/tools/builtin/fetch-message.ts +123 -0
- package/src/core/tools/builtin/find-memory.ts +99 -0
- package/src/core/tools/index.ts +88 -5
- package/src/integrations/persona-history/importer.ts +3 -1
- package/src/prompts/ceremony/dedup.ts +3 -3
- package/src/prompts/ceremony/types.ts +1 -1
- package/src/prompts/human/person-scan.ts +17 -0
- package/src/prompts/human/types.ts +4 -0
- package/src/prompts/response/sections.ts +14 -7
- package/src/prompts/response/types.ts +1 -0
- package/tui/README.md +3 -2
- package/tui/src/util/logger.ts +1 -1
- package/src/core/tools/builtin/read-memory.ts +0 -70
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { ToolExecutor } from "../types.js";
|
|
2
|
-
import type { Fact, Topic, Person, Quote } from "../../types.js";
|
|
3
|
-
|
|
4
|
-
interface PersonaSummary {
|
|
5
|
-
id: string;
|
|
6
|
-
display_name: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
type SearchHumanData = (
|
|
10
|
-
query: string,
|
|
11
|
-
options?: { types?: Array<"fact" | "topic" | "person" | "quote">; limit?: number; recent?: boolean; persona_filter?: string }
|
|
12
|
-
) => Promise<{ facts: Fact[]; topics: Topic[]; people: Person[]; quotes: Quote[] }>;
|
|
13
|
-
|
|
14
|
-
type GetPersonaList = () => Promise<PersonaSummary[]>;
|
|
15
|
-
|
|
16
|
-
export function createReadMemoryExecutor(searchHumanData: SearchHumanData, getPersonaList?: GetPersonaList): ToolExecutor {
|
|
17
|
-
return {
|
|
18
|
-
name: "read_memory",
|
|
19
|
-
|
|
20
|
-
async execute(args: Record<string, unknown>): Promise<string> {
|
|
21
|
-
const query = typeof args.query === "string" ? args.query.trim() : "";
|
|
22
|
-
const recent = args.recent === true;
|
|
23
|
-
const personaArg = typeof args.persona === "string" ? args.persona.trim() : "";
|
|
24
|
-
console.log(`[read_memory] called with query="${query}", types=${JSON.stringify(args.types ?? null)}, limit=${args.limit ?? 10}, recent=${recent}, persona="${personaArg}"`);
|
|
25
|
-
|
|
26
|
-
if (!query && !recent) {
|
|
27
|
-
console.warn("[read_memory] missing query argument");
|
|
28
|
-
return JSON.stringify({ error: "Missing required argument: query (or use recent: true)" });
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const types = Array.isArray(args.types)
|
|
32
|
-
? (args.types.filter(
|
|
33
|
-
t => typeof t === "string" && ["fact", "topic", "person", "quote"].includes(t)
|
|
34
|
-
) as Array<"fact" | "topic" | "person" | "quote">)
|
|
35
|
-
: undefined;
|
|
36
|
-
|
|
37
|
-
const limit = typeof args.limit === "number" && args.limit > 0 ? Math.min(args.limit, 20) : 10;
|
|
38
|
-
|
|
39
|
-
// Resolve persona display_name to ID
|
|
40
|
-
let persona_filter: string | undefined;
|
|
41
|
-
if (personaArg && getPersonaList) {
|
|
42
|
-
const personas = await getPersonaList();
|
|
43
|
-
const match = personas.find(p => p.display_name.toLowerCase() === personaArg.toLowerCase());
|
|
44
|
-
if (match) {
|
|
45
|
-
persona_filter = match.id;
|
|
46
|
-
console.log(`[read_memory] resolved persona "${personaArg}" to ID "${persona_filter}"`);
|
|
47
|
-
} else {
|
|
48
|
-
console.warn(`[read_memory] persona "${personaArg}" not found, proceeding without filter`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const results = await searchHumanData(query, { types, limit, recent, persona_filter });
|
|
53
|
-
|
|
54
|
-
const total = results.facts.length + results.topics.length + results.people.length + results.quotes.length;
|
|
55
|
-
console.log(`[read_memory] query="${query}" => ${total} results (facts=${results.facts.length}, topics=${results.topics.length}, people=${results.people.length}, quotes=${results.quotes.length})`);
|
|
56
|
-
|
|
57
|
-
const output: Record<string, unknown[]> = {};
|
|
58
|
-
if (results.facts.length > 0) output.facts = results.facts.map(f => ({ name: f.name, description: f.description }));
|
|
59
|
-
if (results.topics.length > 0) output.topics = results.topics.map(t => ({ name: t.name, description: t.description }));
|
|
60
|
-
if (results.people.length > 0) output.people = results.people.map(p => ({ name: p.name, relationship: p.relationship, description: p.description, identifiers: p.identifiers ?? [] }));
|
|
61
|
-
if (results.quotes.length > 0) output.quotes = results.quotes.map(q => ({ text: q.text, speaker: q.speaker }));
|
|
62
|
-
|
|
63
|
-
if (Object.keys(output).length === 0) {
|
|
64
|
-
return JSON.stringify({ result: "No relevant memories found for this query." });
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return JSON.stringify(output);
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
}
|