@kalera/munin-gemini 1.0.6 → 1.2.5
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/.turbo/turbo-build.log +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +54 -0
- package/gemini-extension.json +1 -1
- package/package.json +3 -3
- package/src/index.ts +63 -0
package/.turbo/turbo-build.log
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,9 @@ export declare function createGeminiCliMuninAdapter(config: {
|
|
|
5
5
|
}): {
|
|
6
6
|
callTool: (projectId: string, name: string, args: Record<string, unknown>) => Promise<import("@kalera/munin-sdk").MuninResponse<unknown>>;
|
|
7
7
|
capabilities: () => Promise<import("@kalera/munin-sdk").MuninCapabilities>;
|
|
8
|
+
beforeAgent: (systemPrompt: string) => Promise<string>;
|
|
8
9
|
};
|
|
10
|
+
export declare const beforeAgent: (systemPrompt: string) => Promise<string>;
|
|
9
11
|
export declare const tools: ({
|
|
10
12
|
name: string;
|
|
11
13
|
description: string;
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,69 @@
|
|
|
1
1
|
import { MuninClient } from "@kalera/munin-sdk";
|
|
2
2
|
export function createGeminiCliMuninAdapter(config) {
|
|
3
3
|
const client = new MuninClient(config);
|
|
4
|
+
const baseUrl = (config.baseUrl || "https://munin.kalera.dev").replace(/\/$/, "");
|
|
5
|
+
const apiKey = config.apiKey;
|
|
4
6
|
return {
|
|
5
7
|
callTool: async (projectId, name, args) => client.invoke(projectId, name, args, { ensureCapability: true }),
|
|
6
8
|
capabilities: () => client.capabilities(),
|
|
9
|
+
beforeAgent: async (systemPrompt) => {
|
|
10
|
+
if (!apiKey)
|
|
11
|
+
return systemPrompt;
|
|
12
|
+
try {
|
|
13
|
+
const response = await fetch(`${baseUrl}/api/memories/pinned`, {
|
|
14
|
+
headers: {
|
|
15
|
+
"Authorization": `Bearer ${apiKey}`,
|
|
16
|
+
"Content-Type": "application/json"
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
if (!response.ok) {
|
|
20
|
+
console.warn(`[Munin] Failed to fetch pinned memories: ${response.statusText}`);
|
|
21
|
+
return systemPrompt;
|
|
22
|
+
}
|
|
23
|
+
const memories = await response.json();
|
|
24
|
+
if (!Array.isArray(memories) || memories.length === 0) {
|
|
25
|
+
return systemPrompt;
|
|
26
|
+
}
|
|
27
|
+
const pinnedContext = memories.slice(0, 5).map((m) => `[${m.key}] ${m.title ? m.title + ': ' : ''}${m.content}`).join('\n\n');
|
|
28
|
+
return `${systemPrompt}\n\n### 📌 PINNED CONTEXT (MANDATORY):\n${pinnedContext}`;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.warn(`[Munin] Error fetching pinned memories:`, error);
|
|
32
|
+
return systemPrompt;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
7
35
|
};
|
|
8
36
|
}
|
|
9
37
|
// Ensure defaults for Gemini CLI if run as an extension
|
|
10
38
|
const baseUrl = process.env.MUNIN_BASE_URL || "https://munin.kalera.dev";
|
|
11
39
|
const apiKey = process.env.MUNIN_API_KEY;
|
|
12
40
|
const extensionClient = new MuninClient({ baseUrl, apiKey });
|
|
41
|
+
export const beforeAgent = async (systemPrompt) => {
|
|
42
|
+
if (!apiKey)
|
|
43
|
+
return systemPrompt;
|
|
44
|
+
try {
|
|
45
|
+
const response = await fetch(`${baseUrl.replace(/\/$/, "")}/api/memories/pinned`, {
|
|
46
|
+
headers: {
|
|
47
|
+
"Authorization": `Bearer ${apiKey}`,
|
|
48
|
+
"Content-Type": "application/json"
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
if (!response.ok) {
|
|
52
|
+
console.warn(`[Munin] Failed to fetch pinned memories: ${response.statusText}`);
|
|
53
|
+
return systemPrompt;
|
|
54
|
+
}
|
|
55
|
+
const memories = await response.json();
|
|
56
|
+
if (!Array.isArray(memories) || memories.length === 0) {
|
|
57
|
+
return systemPrompt;
|
|
58
|
+
}
|
|
59
|
+
const pinnedContext = memories.slice(0, 5).map((m) => `[${m.key}] ${m.title ? m.title + ': ' : ''}${m.content}`).join('\n\n');
|
|
60
|
+
return `${systemPrompt}\n\n### 📌 PINNED CONTEXT (MANDATORY):\n${pinnedContext}`;
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
console.warn(`[Munin] Error fetching pinned memories:`, error);
|
|
64
|
+
return systemPrompt;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
13
67
|
export const tools = [
|
|
14
68
|
{
|
|
15
69
|
name: "munin_store_memory",
|
package/gemini-extension.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kalera-munin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Kalera Munin - Long-Term Memory with GraphRAG Context Cores for Gemini CLI",
|
|
5
5
|
"topics": ["memory", "agent", "kalera", "context", "mcp", "gemini-cli-extension"],
|
|
6
6
|
"permissions": {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kalera/munin-gemini",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"munin-gemini": "dist/cli.js"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@kalera/munin-
|
|
10
|
-
"@kalera/munin-
|
|
9
|
+
"@kalera/munin-sdk": "1.2.5",
|
|
10
|
+
"@kalera/munin-runtime": "1.2.5"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"typescript": "^5.9.2"
|
package/src/index.ts
CHANGED
|
@@ -6,11 +6,43 @@ export function createGeminiCliMuninAdapter(config: {
|
|
|
6
6
|
timeoutMs?: number;
|
|
7
7
|
}) {
|
|
8
8
|
const client = new MuninClient(config);
|
|
9
|
+
const baseUrl = (config.baseUrl || "https://munin.kalera.dev").replace(/\/$/, "");
|
|
10
|
+
const apiKey = config.apiKey;
|
|
9
11
|
|
|
10
12
|
return {
|
|
11
13
|
callTool: async (projectId: string, name: string, args: Record<string, unknown>) =>
|
|
12
14
|
client.invoke(projectId, name as any, args, { ensureCapability: true }),
|
|
13
15
|
capabilities: () => client.capabilities(),
|
|
16
|
+
beforeAgent: async (systemPrompt: string): Promise<string> => {
|
|
17
|
+
if (!apiKey) return systemPrompt;
|
|
18
|
+
try {
|
|
19
|
+
const response = await fetch(`${baseUrl}/api/memories/pinned`, {
|
|
20
|
+
headers: {
|
|
21
|
+
"Authorization": `Bearer ${apiKey}`,
|
|
22
|
+
"Content-Type": "application/json"
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
console.warn(`[Munin] Failed to fetch pinned memories: ${response.statusText}`);
|
|
28
|
+
return systemPrompt;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const memories = await response.json();
|
|
32
|
+
if (!Array.isArray(memories) || memories.length === 0) {
|
|
33
|
+
return systemPrompt;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const pinnedContext = memories.slice(0, 5).map((m: any) =>
|
|
37
|
+
`[${m.key}] ${m.title ? m.title + ': ' : ''}${m.content}`
|
|
38
|
+
).join('\n\n');
|
|
39
|
+
|
|
40
|
+
return `${systemPrompt}\n\n### 📌 PINNED CONTEXT (MANDATORY):\n${pinnedContext}`;
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.warn(`[Munin] Error fetching pinned memories:`, error);
|
|
43
|
+
return systemPrompt;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
14
46
|
};
|
|
15
47
|
}
|
|
16
48
|
|
|
@@ -20,6 +52,37 @@ const apiKey = process.env.MUNIN_API_KEY;
|
|
|
20
52
|
|
|
21
53
|
const extensionClient = new MuninClient({ baseUrl, apiKey });
|
|
22
54
|
|
|
55
|
+
export const beforeAgent = async (systemPrompt: string): Promise<string> => {
|
|
56
|
+
if (!apiKey) return systemPrompt;
|
|
57
|
+
try {
|
|
58
|
+
const response = await fetch(`${baseUrl.replace(/\/$/, "")}/api/memories/pinned`, {
|
|
59
|
+
headers: {
|
|
60
|
+
"Authorization": `Bearer ${apiKey}`,
|
|
61
|
+
"Content-Type": "application/json"
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
if (!response.ok) {
|
|
66
|
+
console.warn(`[Munin] Failed to fetch pinned memories: ${response.statusText}`);
|
|
67
|
+
return systemPrompt;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const memories = await response.json();
|
|
71
|
+
if (!Array.isArray(memories) || memories.length === 0) {
|
|
72
|
+
return systemPrompt;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const pinnedContext = memories.slice(0, 5).map((m: any) =>
|
|
76
|
+
`[${m.key}] ${m.title ? m.title + ': ' : ''}${m.content}`
|
|
77
|
+
).join('\n\n');
|
|
78
|
+
|
|
79
|
+
return `${systemPrompt}\n\n### 📌 PINNED CONTEXT (MANDATORY):\n${pinnedContext}`;
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.warn(`[Munin] Error fetching pinned memories:`, error);
|
|
82
|
+
return systemPrompt;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
23
86
|
export const tools = [
|
|
24
87
|
{
|
|
25
88
|
name: "munin_store_memory",
|