@kalera/munin-gemini 0.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/.turbo/turbo-build.log +4 -0
- package/README.md +20 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +26 -0
- package/dist/index.d.ts +133 -0
- package/dist/index.js +83 -0
- package/gemini-extension.json +9 -0
- package/package.json +20 -0
- package/src/cli.ts +38 -0
- package/src/index.ts +94 -0
- package/tsconfig.json +8 -0
package/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Munin Adapter for Gemini CLI
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
- Phase: scaffold
|
|
6
|
+
- Dispatch style: `callTool(name, args)`
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { createGeminiCliMuninAdapter } from "@kalera/munin-gemini";
|
|
12
|
+
|
|
13
|
+
const adapter = createGeminiCliMuninAdapter({
|
|
14
|
+
baseUrl: process.env.MUNIN_BASE_URL!,
|
|
15
|
+
apiKey: process.env.MUNIN_API_KEY,
|
|
16
|
+
project: process.env.MUNIN_PROJECT ?? "default",
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
await adapter.callTool("list", { limit: 10 });
|
|
20
|
+
```
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { executeWithRetry, loadCliEnv, parseCliArgs, safeError, } from "@kalera/munin-runtime";
|
|
2
|
+
import { createGeminiCliMuninAdapter } from "./index.js";
|
|
3
|
+
async function main() {
|
|
4
|
+
try {
|
|
5
|
+
const { action, payload } = parseCliArgs(process.argv.slice(2), "Usage: munin-gemini <tool-name> [payload-json]");
|
|
6
|
+
const env = loadCliEnv();
|
|
7
|
+
const adapter = createGeminiCliMuninAdapter({
|
|
8
|
+
baseUrl: env.baseUrl,
|
|
9
|
+
apiKey: env.apiKey,
|
|
10
|
+
project: env.project,
|
|
11
|
+
timeoutMs: env.timeoutMs,
|
|
12
|
+
});
|
|
13
|
+
const result = await executeWithRetry(async () => {
|
|
14
|
+
if (action === "capabilities") {
|
|
15
|
+
return { ok: true, data: await adapter.capabilities() };
|
|
16
|
+
}
|
|
17
|
+
return adapter.callTool(action, payload);
|
|
18
|
+
}, env.retries, env.backoffMs);
|
|
19
|
+
console.log(JSON.stringify(result, null, 2));
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.error(JSON.stringify({ ok: false, error: safeError(error) }));
|
|
23
|
+
process.exitCode = 1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
void main();
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
export declare function createGeminiCliMuninAdapter(config: {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
project: string;
|
|
5
|
+
timeoutMs?: number;
|
|
6
|
+
}): {
|
|
7
|
+
callTool: (name: string, args: Record<string, unknown>) => Promise<import("@kalera/munin-sdk").MuninResponse<unknown>>;
|
|
8
|
+
capabilities: () => Promise<import("@kalera/munin-sdk").MuninCapabilities>;
|
|
9
|
+
};
|
|
10
|
+
export declare const tools: ({
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
parameters: {
|
|
14
|
+
type: string;
|
|
15
|
+
properties: {
|
|
16
|
+
key: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
content: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
title: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
tags: {
|
|
29
|
+
type: string;
|
|
30
|
+
items: {
|
|
31
|
+
type: string;
|
|
32
|
+
};
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
query?: undefined;
|
|
36
|
+
limit?: undefined;
|
|
37
|
+
offset?: undefined;
|
|
38
|
+
};
|
|
39
|
+
required: string[];
|
|
40
|
+
};
|
|
41
|
+
execute: (args: any) => Promise<import("@kalera/munin-sdk").MuninResponse<unknown>>;
|
|
42
|
+
} | {
|
|
43
|
+
name: string;
|
|
44
|
+
description: string;
|
|
45
|
+
parameters: {
|
|
46
|
+
type: string;
|
|
47
|
+
properties: {
|
|
48
|
+
key: {
|
|
49
|
+
type: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
content?: undefined;
|
|
53
|
+
title?: undefined;
|
|
54
|
+
tags?: undefined;
|
|
55
|
+
query?: undefined;
|
|
56
|
+
limit?: undefined;
|
|
57
|
+
offset?: undefined;
|
|
58
|
+
};
|
|
59
|
+
required: string[];
|
|
60
|
+
};
|
|
61
|
+
execute: (args: any) => Promise<import("@kalera/munin-sdk").MuninResponse<unknown>>;
|
|
62
|
+
} | {
|
|
63
|
+
name: string;
|
|
64
|
+
description: string;
|
|
65
|
+
parameters: {
|
|
66
|
+
type: string;
|
|
67
|
+
properties: {
|
|
68
|
+
query: {
|
|
69
|
+
type: string;
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
tags: {
|
|
73
|
+
type: string;
|
|
74
|
+
items: {
|
|
75
|
+
type: string;
|
|
76
|
+
};
|
|
77
|
+
description?: undefined;
|
|
78
|
+
};
|
|
79
|
+
limit: {
|
|
80
|
+
type: string;
|
|
81
|
+
description: string;
|
|
82
|
+
};
|
|
83
|
+
key?: undefined;
|
|
84
|
+
content?: undefined;
|
|
85
|
+
title?: undefined;
|
|
86
|
+
offset?: undefined;
|
|
87
|
+
};
|
|
88
|
+
required: string[];
|
|
89
|
+
};
|
|
90
|
+
execute: (args: any) => Promise<import("@kalera/munin-sdk").MuninResponse<unknown>>;
|
|
91
|
+
} | {
|
|
92
|
+
name: string;
|
|
93
|
+
description: string;
|
|
94
|
+
parameters: {
|
|
95
|
+
type: string;
|
|
96
|
+
properties: {
|
|
97
|
+
limit: {
|
|
98
|
+
type: string;
|
|
99
|
+
description?: undefined;
|
|
100
|
+
};
|
|
101
|
+
offset: {
|
|
102
|
+
type: string;
|
|
103
|
+
};
|
|
104
|
+
key?: undefined;
|
|
105
|
+
content?: undefined;
|
|
106
|
+
title?: undefined;
|
|
107
|
+
tags?: undefined;
|
|
108
|
+
query?: undefined;
|
|
109
|
+
};
|
|
110
|
+
required?: undefined;
|
|
111
|
+
};
|
|
112
|
+
execute: (args: any) => Promise<import("@kalera/munin-sdk").MuninResponse<unknown>>;
|
|
113
|
+
} | {
|
|
114
|
+
name: string;
|
|
115
|
+
description: string;
|
|
116
|
+
parameters: {
|
|
117
|
+
type: string;
|
|
118
|
+
properties: {
|
|
119
|
+
limit: {
|
|
120
|
+
type: string;
|
|
121
|
+
description?: undefined;
|
|
122
|
+
};
|
|
123
|
+
key?: undefined;
|
|
124
|
+
content?: undefined;
|
|
125
|
+
title?: undefined;
|
|
126
|
+
tags?: undefined;
|
|
127
|
+
query?: undefined;
|
|
128
|
+
offset?: undefined;
|
|
129
|
+
};
|
|
130
|
+
required?: undefined;
|
|
131
|
+
};
|
|
132
|
+
execute: (args: any) => Promise<import("@kalera/munin-sdk").MuninResponse<unknown>>;
|
|
133
|
+
})[];
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { MuninClient } from "@kalera/munin-sdk";
|
|
2
|
+
export function createGeminiCliMuninAdapter(config) {
|
|
3
|
+
const client = new MuninClient(config);
|
|
4
|
+
return {
|
|
5
|
+
callTool: async (name, args) => client.invoke(name, args, { ensureCapability: true }),
|
|
6
|
+
capabilities: () => client.capabilities(),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
// Ensure defaults for Gemini CLI if run as an extension
|
|
10
|
+
const baseUrl = process.env.MUNIN_BASE_URL || "http://127.0.0.1:3237";
|
|
11
|
+
const project = process.env.MUNIN_PROJECT || "default";
|
|
12
|
+
const apiKey = process.env.MUNIN_API_KEY;
|
|
13
|
+
const extensionClient = new MuninClient({ baseUrl, project, apiKey });
|
|
14
|
+
export const tools = [
|
|
15
|
+
{
|
|
16
|
+
name: "munin_store_memory",
|
|
17
|
+
description: "Store or update a memory in Munin. Requires a unique key and the content.",
|
|
18
|
+
parameters: {
|
|
19
|
+
type: "object",
|
|
20
|
+
properties: {
|
|
21
|
+
key: { type: "string", description: "Unique identifier for this memory" },
|
|
22
|
+
content: { type: "string", description: "The content to remember" },
|
|
23
|
+
title: { type: "string", description: "Optional title" },
|
|
24
|
+
tags: {
|
|
25
|
+
type: "array",
|
|
26
|
+
items: { type: "string" },
|
|
27
|
+
description: "List of tags, e.g. ['planning', 'frontend']"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
required: ["key", "content"],
|
|
31
|
+
},
|
|
32
|
+
execute: async (args) => await extensionClient.store(args),
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "munin_retrieve_memory",
|
|
36
|
+
description: "Retrieve a memory by its unique key.",
|
|
37
|
+
parameters: {
|
|
38
|
+
type: "object",
|
|
39
|
+
properties: {
|
|
40
|
+
key: { type: "string", description: "Unique identifier" },
|
|
41
|
+
},
|
|
42
|
+
required: ["key"],
|
|
43
|
+
},
|
|
44
|
+
execute: async (args) => await extensionClient.retrieve(args),
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "munin_search_memories",
|
|
48
|
+
description: "Search for memories using semantic search or keywords.",
|
|
49
|
+
parameters: {
|
|
50
|
+
type: "object",
|
|
51
|
+
properties: {
|
|
52
|
+
query: { type: "string", description: "Search query" },
|
|
53
|
+
tags: { type: "array", items: { type: "string" } },
|
|
54
|
+
limit: { type: "number", description: "Max results (default: 10)" },
|
|
55
|
+
},
|
|
56
|
+
required: ["query"],
|
|
57
|
+
},
|
|
58
|
+
execute: async (args) => await extensionClient.search(args),
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "munin_list_memories",
|
|
62
|
+
description: "List all memories with pagination.",
|
|
63
|
+
parameters: {
|
|
64
|
+
type: "object",
|
|
65
|
+
properties: {
|
|
66
|
+
limit: { type: "number" },
|
|
67
|
+
offset: { type: "number" },
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
execute: async (args) => await extensionClient.list(args),
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "munin_recent_memories",
|
|
74
|
+
description: "Get the most recently updated memories.",
|
|
75
|
+
parameters: {
|
|
76
|
+
type: "object",
|
|
77
|
+
properties: {
|
|
78
|
+
limit: { type: "number" },
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
execute: async (args) => await extensionClient.recent(args),
|
|
82
|
+
},
|
|
83
|
+
];
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kalera/munin-gemini",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"bin": {
|
|
6
|
+
"munin-gemini": "dist/cli.js"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@kalera/munin-sdk": "0.1.0",
|
|
10
|
+
"@kalera/munin-runtime": "0.1.0"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"typescript": "^5.9.2"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc -p tsconfig.json",
|
|
17
|
+
"lint": "tsc -p tsconfig.json --noEmit",
|
|
18
|
+
"test": "echo 'adapter-gemini-cli tests: pending'"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
executeWithRetry,
|
|
3
|
+
loadCliEnv,
|
|
4
|
+
parseCliArgs,
|
|
5
|
+
safeError,
|
|
6
|
+
} from "@kalera/munin-runtime";
|
|
7
|
+
import { createGeminiCliMuninAdapter } from "./index.js";
|
|
8
|
+
|
|
9
|
+
async function main() {
|
|
10
|
+
try {
|
|
11
|
+
const { action, payload } = parseCliArgs(
|
|
12
|
+
process.argv.slice(2),
|
|
13
|
+
"Usage: munin-gemini <tool-name> [payload-json]",
|
|
14
|
+
);
|
|
15
|
+
const env = loadCliEnv();
|
|
16
|
+
|
|
17
|
+
const adapter = createGeminiCliMuninAdapter({
|
|
18
|
+
baseUrl: env.baseUrl,
|
|
19
|
+
apiKey: env.apiKey,
|
|
20
|
+
project: env.project,
|
|
21
|
+
timeoutMs: env.timeoutMs,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const result = await executeWithRetry(async () => {
|
|
25
|
+
if (action === "capabilities") {
|
|
26
|
+
return { ok: true, data: await adapter.capabilities() };
|
|
27
|
+
}
|
|
28
|
+
return adapter.callTool(action, payload);
|
|
29
|
+
}, env.retries, env.backoffMs);
|
|
30
|
+
|
|
31
|
+
console.log(JSON.stringify(result, null, 2));
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error(JSON.stringify({ ok: false, error: safeError(error) }));
|
|
34
|
+
process.exitCode = 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
void main();
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { MuninClient } from "@kalera/munin-sdk";
|
|
2
|
+
|
|
3
|
+
export function createGeminiCliMuninAdapter(config: {
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
project: string;
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
}) {
|
|
9
|
+
const client = new MuninClient(config);
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
callTool: async (name: string, args: Record<string, unknown>) =>
|
|
13
|
+
client.invoke(name as any, args, { ensureCapability: true }),
|
|
14
|
+
capabilities: () => client.capabilities(),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Ensure defaults for Gemini CLI if run as an extension
|
|
19
|
+
const baseUrl = process.env.MUNIN_BASE_URL || "http://127.0.0.1:3237";
|
|
20
|
+
const project = process.env.MUNIN_PROJECT || "default";
|
|
21
|
+
const apiKey = process.env.MUNIN_API_KEY;
|
|
22
|
+
|
|
23
|
+
const extensionClient = new MuninClient({ baseUrl, project, apiKey });
|
|
24
|
+
|
|
25
|
+
export const tools = [
|
|
26
|
+
{
|
|
27
|
+
name: "munin_store_memory",
|
|
28
|
+
description: "Store or update a memory in Munin. Requires a unique key and the content.",
|
|
29
|
+
parameters: {
|
|
30
|
+
type: "object",
|
|
31
|
+
properties: {
|
|
32
|
+
key: { type: "string", description: "Unique identifier for this memory" },
|
|
33
|
+
content: { type: "string", description: "The content to remember" },
|
|
34
|
+
title: { type: "string", description: "Optional title" },
|
|
35
|
+
tags: {
|
|
36
|
+
type: "array",
|
|
37
|
+
items: { type: "string" },
|
|
38
|
+
description: "List of tags, e.g. ['planning', 'frontend']"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
required: ["key", "content"],
|
|
42
|
+
},
|
|
43
|
+
execute: async (args: any) => await extensionClient.store(args),
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "munin_retrieve_memory",
|
|
47
|
+
description: "Retrieve a memory by its unique key.",
|
|
48
|
+
parameters: {
|
|
49
|
+
type: "object",
|
|
50
|
+
properties: {
|
|
51
|
+
key: { type: "string", description: "Unique identifier" },
|
|
52
|
+
},
|
|
53
|
+
required: ["key"],
|
|
54
|
+
},
|
|
55
|
+
execute: async (args: any) => await extensionClient.retrieve(args),
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "munin_search_memories",
|
|
59
|
+
description: "Search for memories using semantic search or keywords.",
|
|
60
|
+
parameters: {
|
|
61
|
+
type: "object",
|
|
62
|
+
properties: {
|
|
63
|
+
query: { type: "string", description: "Search query" },
|
|
64
|
+
tags: { type: "array", items: { type: "string" } },
|
|
65
|
+
limit: { type: "number", description: "Max results (default: 10)" },
|
|
66
|
+
},
|
|
67
|
+
required: ["query"],
|
|
68
|
+
},
|
|
69
|
+
execute: async (args: any) => await extensionClient.search(args),
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "munin_list_memories",
|
|
73
|
+
description: "List all memories with pagination.",
|
|
74
|
+
parameters: {
|
|
75
|
+
type: "object",
|
|
76
|
+
properties: {
|
|
77
|
+
limit: { type: "number" },
|
|
78
|
+
offset: { type: "number" },
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
execute: async (args: any) => await extensionClient.list(args),
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "munin_recent_memories",
|
|
85
|
+
description: "Get the most recently updated memories.",
|
|
86
|
+
parameters: {
|
|
87
|
+
type: "object",
|
|
88
|
+
properties: {
|
|
89
|
+
limit: { type: "number" },
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
execute: async (args: any) => await extensionClient.recent(args),
|
|
93
|
+
},
|
|
94
|
+
];
|