@kalera/munin-openclaw 1.0.1 → 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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @kalera/munin-openclaw@1.0.1 build /home/runner/work/munin-for-agents/munin-for-agents/adapters/openclaw
2
+ > @kalera/munin-openclaw@1.1.0 build /home/runner/work/munin-for-agents/munin-for-agents/adapters/openclaw
3
3
  > tsc -p tsconfig.json
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export declare function createOpenClawMuninAdapter(config: {
2
- baseUrl: string;
3
- apiKey?: string;
4
- timeoutMs?: number;
5
- }): {
6
- execute: (projectId: string, action: string, payload: Record<string, unknown>) => Promise<import("@kalera/munin-sdk").MuninResponse<unknown>>;
7
- capabilities: () => Promise<import("@kalera/munin-sdk").MuninCapabilities>;
8
- };
1
+ declare const _default: {
2
+ id: string;
3
+ name: string;
4
+ description: string;
5
+ configSchema: import("openclaw/plugin-sdk").OpenClawPluginConfigSchema;
6
+ register: NonNullable<import("openclaw/plugin-sdk/plugin-runtime").OpenClawPluginDefinition["register"]>;
7
+ } & Pick<import("openclaw/plugin-sdk/plugin-runtime").OpenClawPluginDefinition, "kind">;
8
+ export default _default;
package/dist/index.js CHANGED
@@ -1,8 +1,101 @@
1
+ import { definePluginEntry } from "openclaw/plugin-sdk/core";
1
2
  import { MuninClient } from "@kalera/munin-sdk";
2
- export function createOpenClawMuninAdapter(config) {
3
- const client = new MuninClient(config);
4
- return {
5
- execute: (projectId, action, payload) => client.invoke(projectId, action, payload, { ensureCapability: true }),
6
- capabilities: () => client.capabilities(),
7
- };
8
- }
3
+ import { Type } from "@sinclair/typebox";
4
+ import { z } from "zod";
5
+ export default definePluginEntry({
6
+ id: "munin-memory",
7
+ name: "Munin ContextKeep",
8
+ description: "Persistent memory tools for OpenClaw agents.",
9
+ kind: "memory",
10
+ configSchema: z.object({
11
+ baseUrl: z
12
+ .string()
13
+ .default("https://munin.kalera.dev")
14
+ .describe("The base URL for your Munin ContextKeep server."),
15
+ apiKey: z.string().describe("Your API key for Munin."),
16
+ }),
17
+ register(api) {
18
+ const baseUrl = api.pluginConfig?.baseUrl ||
19
+ process.env.MUNIN_BASE_URL ||
20
+ "https://munin.kalera.dev";
21
+ const apiKey = api.pluginConfig?.apiKey || process.env.MUNIN_API_KEY;
22
+ if (!apiKey) {
23
+ api.logger.warn("Munin API key is missing. ContextKeep tools will not be registered.");
24
+ return;
25
+ }
26
+ const client = new MuninClient({ baseUrl, apiKey });
27
+ api.registerTool({
28
+ name: "munin_store_memory",
29
+ label: "Store Munin Memory",
30
+ description: "Store a new memory or update an existing one in ContextKeep.",
31
+ parameters: Type.Object({
32
+ projectId: Type.String({
33
+ description: "The Context Core ID for isolation.",
34
+ }),
35
+ key: Type.String({ description: "Unique identifier for the memory." }),
36
+ content: Type.String({ description: "The content of the memory." }),
37
+ tags: Type.Optional(Type.String({ description: "Comma-separated list of tags." })),
38
+ title: Type.Optional(Type.String({ description: "Human-readable title." })),
39
+ }),
40
+ async execute(_toolCallId, params) {
41
+ const { projectId, ...payload } = params;
42
+ const res = await client.invoke(projectId, "store", payload);
43
+ return {
44
+ content: [
45
+ {
46
+ type: "text",
47
+ text: JSON.stringify(res.data, null, 2),
48
+ },
49
+ ],
50
+ details: res.data,
51
+ };
52
+ },
53
+ });
54
+ api.registerTool({
55
+ name: "munin_retrieve_memory",
56
+ label: "Retrieve Munin Memory",
57
+ description: "Retrieve a memory by its key from ContextKeep.",
58
+ parameters: Type.Object({
59
+ projectId: Type.String({ description: "The Context Core ID." }),
60
+ key: Type.String({
61
+ description: "The unique identifier of the memory.",
62
+ }),
63
+ }),
64
+ async execute(_toolCallId, params) {
65
+ const { projectId, key } = params;
66
+ const res = await client.invoke(projectId, "retrieve", { key });
67
+ return {
68
+ content: [
69
+ {
70
+ type: "text",
71
+ text: JSON.stringify(res.data, null, 2),
72
+ },
73
+ ],
74
+ details: res.data,
75
+ };
76
+ },
77
+ });
78
+ api.registerTool({
79
+ name: "munin_search_memories",
80
+ label: "Search Munin Memories",
81
+ description: "Search for memories by key, title, or content in ContextKeep.",
82
+ parameters: Type.Object({
83
+ projectId: Type.String({ description: "The Context Core ID." }),
84
+ query: Type.String({ description: "The search term." }),
85
+ }),
86
+ async execute(_toolCallId, params) {
87
+ const { projectId, query } = params;
88
+ const res = await client.invoke(projectId, "search", { query });
89
+ return {
90
+ content: [
91
+ {
92
+ type: "text",
93
+ text: JSON.stringify(res.data, null, 2),
94
+ },
95
+ ],
96
+ details: res.data,
97
+ };
98
+ },
99
+ });
100
+ },
101
+ });
@@ -0,0 +1,23 @@
1
+ {
2
+ "id": "munin-memory",
3
+ "name": "Munin ContextKeep",
4
+ "description": "Persistent memory and Context Core for OpenClaw agents.",
5
+ "kind": "memory",
6
+ "configSchema": {
7
+ "type": "object",
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "baseUrl": {
11
+ "type": "string",
12
+ "default": "https://munin.kalera.dev",
13
+ "description": "The base URL for your Munin ContextKeep server."
14
+ },
15
+ "apiKey": {
16
+ "type": "string",
17
+ "description": "Your API key for Munin."
18
+ }
19
+ },
20
+ "required": ["apiKey"]
21
+ },
22
+ "skills": ["."]
23
+ }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@kalera/munin-openclaw",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "openclaw": {
6
6
  "extensions": [
7
- "./dist/cli.js"
7
+ "./dist/index.js"
8
8
  ],
9
9
  "requires": {
10
10
  "env": [
@@ -13,15 +13,15 @@
13
13
  ]
14
14
  }
15
15
  },
16
- "bin": {
17
- "munin-openclaw": "dist/cli.js"
18
- },
19
16
  "dependencies": {
20
17
  "@kalera/munin-sdk": "1.0.0",
21
18
  "@kalera/munin-runtime": "1.0.0"
22
19
  },
23
20
  "devDependencies": {
24
- "typescript": "^5.9.2"
21
+ "@sinclair/typebox": "^0.34.49",
22
+ "openclaw": "^2026.3.28",
23
+ "typescript": "^5.9.2",
24
+ "zod": "^4.3.6"
25
25
  },
26
26
  "scripts": {
27
27
  "build": "tsc -p tsconfig.json",
package/src/index.ts CHANGED
@@ -1,16 +1,115 @@
1
+ import { definePluginEntry } from "openclaw/plugin-sdk/core";
1
2
  import { MuninClient } from "@kalera/munin-sdk";
3
+ import { Type } from "@sinclair/typebox";
4
+ import { z } from "zod";
2
5
 
3
- export function createOpenClawMuninAdapter(config: {
4
- baseUrl: string;
5
- apiKey?: string;
6
-
7
- timeoutMs?: number;
8
- }) {
9
- const client = new MuninClient(config);
6
+ export default definePluginEntry({
7
+ id: "munin-memory",
8
+ name: "Munin ContextKeep",
9
+ description: "Persistent memory tools for OpenClaw agents.",
10
+ kind: "memory",
11
+ configSchema: z.object({
12
+ baseUrl: z
13
+ .string()
14
+ .default("https://munin.kalera.dev")
15
+ .describe("The base URL for your Munin ContextKeep server."),
16
+ apiKey: z.string().describe("Your API key for Munin."),
17
+ }) as any,
18
+ register(api) {
19
+ const baseUrl =
20
+ (api.pluginConfig?.baseUrl as string) ||
21
+ process.env.MUNIN_BASE_URL ||
22
+ "https://munin.kalera.dev";
23
+ const apiKey =
24
+ (api.pluginConfig?.apiKey as string) || process.env.MUNIN_API_KEY;
10
25
 
11
- return {
12
- execute: (projectId: string, action: string, payload: Record<string, unknown>) =>
13
- client.invoke(projectId, action as any, payload, { ensureCapability: true }),
14
- capabilities: () => client.capabilities(),
15
- };
16
- }
26
+ if (!apiKey) {
27
+ api.logger.warn(
28
+ "Munin API key is missing. ContextKeep tools will not be registered.",
29
+ );
30
+ return;
31
+ }
32
+
33
+ const client = new MuninClient({ baseUrl, apiKey });
34
+
35
+ api.registerTool({
36
+ name: "munin_store_memory",
37
+ label: "Store Munin Memory",
38
+ description: "Store a new memory or update an existing one in ContextKeep.",
39
+ parameters: Type.Object({
40
+ projectId: Type.String({
41
+ description: "The Context Core ID for isolation.",
42
+ }),
43
+ key: Type.String({ description: "Unique identifier for the memory." }),
44
+ content: Type.String({ description: "The content of the memory." }),
45
+ tags: Type.Optional(
46
+ Type.String({ description: "Comma-separated list of tags." }),
47
+ ),
48
+ title: Type.Optional(
49
+ Type.String({ description: "Human-readable title." }),
50
+ ),
51
+ }),
52
+ async execute(_toolCallId: string, params: any) {
53
+ const { projectId, ...payload } = params;
54
+ const res = await client.invoke(projectId, "store", payload);
55
+ return {
56
+ content: [
57
+ {
58
+ type: "text",
59
+ text: JSON.stringify(res.data, null, 2),
60
+ },
61
+ ],
62
+ details: res.data,
63
+ };
64
+ },
65
+ });
66
+
67
+ api.registerTool({
68
+ name: "munin_retrieve_memory",
69
+ label: "Retrieve Munin Memory",
70
+ description: "Retrieve a memory by its key from ContextKeep.",
71
+ parameters: Type.Object({
72
+ projectId: Type.String({ description: "The Context Core ID." }),
73
+ key: Type.String({
74
+ description: "The unique identifier of the memory.",
75
+ }),
76
+ }),
77
+ async execute(_toolCallId: string, params: any) {
78
+ const { projectId, key } = params;
79
+ const res = await client.invoke(projectId, "retrieve", { key });
80
+ return {
81
+ content: [
82
+ {
83
+ type: "text",
84
+ text: JSON.stringify(res.data, null, 2),
85
+ },
86
+ ],
87
+ details: res.data,
88
+ };
89
+ },
90
+ });
91
+
92
+ api.registerTool({
93
+ name: "munin_search_memories",
94
+ label: "Search Munin Memories",
95
+ description: "Search for memories by key, title, or content in ContextKeep.",
96
+ parameters: Type.Object({
97
+ projectId: Type.String({ description: "The Context Core ID." }),
98
+ query: Type.String({ description: "The search term." }),
99
+ }),
100
+ async execute(_toolCallId: string, params: any) {
101
+ const { projectId, query } = params;
102
+ const res = await client.invoke(projectId, "search", { query });
103
+ return {
104
+ content: [
105
+ {
106
+ type: "text",
107
+ text: JSON.stringify(res.data, null, 2),
108
+ },
109
+ ],
110
+ details: res.data,
111
+ };
112
+ },
113
+ });
114
+ },
115
+ });
package/dist/cli.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/cli.js DELETED
@@ -1,34 +0,0 @@
1
- import { executeWithRetry, loadCliEnv, parseCliArgs, safeError, startMcpServer, } from "@kalera/munin-runtime";
2
- import { createOpenClawMuninAdapter } from "./index.js";
3
- async function main() {
4
- try {
5
- const args = process.argv.slice(2);
6
- // If no arguments, or 'mcp' is passed, start as MCP server
7
- if (args.length === 0 || args[0] === 'mcp') {
8
- await startMcpServer();
9
- return;
10
- }
11
- const { action, payload } = parseCliArgs(args, "Usage: munin-openclaw <action> [payload-json] OR munin-openclaw mcp");
12
- const env = loadCliEnv();
13
- const adapter = createOpenClawMuninAdapter({
14
- baseUrl: env.baseUrl,
15
- apiKey: env.apiKey,
16
- timeoutMs: env.timeoutMs,
17
- });
18
- const result = await executeWithRetry(async () => {
19
- if (action === "capabilities") {
20
- return { ok: true, data: await adapter.capabilities() };
21
- }
22
- const { projectId, ...p } = payload;
23
- if (!projectId)
24
- throw new Error("projectId required in payload");
25
- return adapter.execute(projectId, action, p);
26
- }, env.retries, env.backoffMs);
27
- console.log(JSON.stringify(result, null, 2));
28
- }
29
- catch (error) {
30
- console.error(JSON.stringify({ ok: false, error: safeError(error) }));
31
- process.exitCode = 1;
32
- }
33
- }
34
- void main();
package/src/cli.ts DELETED
@@ -1,47 +0,0 @@
1
- import {
2
- executeWithRetry,
3
- loadCliEnv,
4
- parseCliArgs,
5
- safeError,
6
- startMcpServer,
7
- } from "@kalera/munin-runtime";
8
- import { createOpenClawMuninAdapter } from "./index.js";
9
-
10
- async function main() {
11
- try {
12
- const args = process.argv.slice(2);
13
-
14
- // If no arguments, or 'mcp' is passed, start as MCP server
15
- if (args.length === 0 || args[0] === 'mcp') {
16
- await startMcpServer();
17
- return;
18
- }
19
-
20
- const { action, payload } = parseCliArgs(
21
- args,
22
- "Usage: munin-openclaw <action> [payload-json] OR munin-openclaw mcp",
23
- );
24
- const env = loadCliEnv();
25
-
26
- const adapter = createOpenClawMuninAdapter({
27
- baseUrl: env.baseUrl,
28
- apiKey: env.apiKey,
29
-
30
- timeoutMs: env.timeoutMs,
31
- });
32
-
33
- const result = await executeWithRetry(async () => {
34
- if (action === "capabilities") {
35
- return { ok: true, data: await adapter.capabilities() };
36
- }
37
- const { projectId, ...p } = payload; if (!projectId) throw new Error("projectId required in payload"); return adapter.execute(projectId as string, action, p);
38
- }, env.retries, env.backoffMs);
39
-
40
- console.log(JSON.stringify(result, null, 2));
41
- } catch (error) {
42
- console.error(JSON.stringify({ ok: false, error: safeError(error) }));
43
- process.exitCode = 1;
44
- }
45
- }
46
-
47
- void main();