@kalera/munin-openclaw 1.2.5 → 1.2.7
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 +13 -2
- package/dist/index.js +5 -2
- package/package.json +3 -3
- package/src/index.ts +29 -22
package/.turbo/turbo-build.log
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
declare const _default: {
|
|
2
3
|
id: string;
|
|
3
4
|
name: string;
|
|
4
5
|
description: string;
|
|
5
6
|
kind: string;
|
|
6
|
-
configSchema:
|
|
7
|
-
|
|
7
|
+
configSchema: z.ZodObject<{
|
|
8
|
+
baseUrl: z.ZodDefault<z.ZodString>;
|
|
9
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
10
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
register(api: {
|
|
13
|
+
logger: {
|
|
14
|
+
warn: (msg: string) => void;
|
|
15
|
+
};
|
|
16
|
+
registerTool: (tool: Record<string, unknown>) => void;
|
|
17
|
+
pluginConfig?: Record<string, unknown>;
|
|
18
|
+
}): void;
|
|
8
19
|
};
|
|
9
20
|
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MuninClient } from "@kalera/munin-sdk";
|
|
2
|
+
import { resolveProjectId } from "@kalera/munin-runtime";
|
|
2
3
|
import { Type } from "@sinclair/typebox";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
export default {
|
|
@@ -19,14 +20,16 @@ export default {
|
|
|
19
20
|
process.env.MUNIN_BASE_URL ||
|
|
20
21
|
"https://munin.kalera.dev";
|
|
21
22
|
const apiKey = api.pluginConfig?.apiKey || process.env.MUNIN_API_KEY;
|
|
22
|
-
const projectId = api.pluginConfig?.projectId ||
|
|
23
|
+
const projectId = api.pluginConfig?.projectId ||
|
|
24
|
+
process.env.MUNIN_PROJECT ||
|
|
25
|
+
resolveProjectId(); // walk-up fallback for .env files
|
|
23
26
|
const encryptionKey = process.env.MUNIN_ENCRYPTION_KEY;
|
|
24
27
|
if (!apiKey || !projectId) {
|
|
25
28
|
api.logger.warn("Munin apiKey or projectId is missing. Munin tools will not be registered.");
|
|
26
29
|
return;
|
|
27
30
|
}
|
|
28
31
|
const client = new MuninClient({ baseUrl, apiKey });
|
|
29
|
-
// Helper: inject encryptionKey if set
|
|
32
|
+
// Helper: inject encryptionKey if set (only for E2EE-compatible tools)
|
|
30
33
|
const enrichPayload = (payload) => encryptionKey ? { ...payload, encryptionKey } : payload;
|
|
31
34
|
const handleResult = (res) => ({
|
|
32
35
|
content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kalera/munin-openclaw",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"openclaw": {
|
|
6
6
|
"extensions": [
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@sinclair/typebox": "^0.34.49",
|
|
18
18
|
"zod": "^4.3.6",
|
|
19
|
-
"@kalera/munin-sdk": "1.2.
|
|
20
|
-
"@kalera/munin-runtime": "1.2.
|
|
19
|
+
"@kalera/munin-sdk": "1.2.6",
|
|
20
|
+
"@kalera/munin-runtime": "1.2.6"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"openclaw": "^2026.3.28",
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { MuninClient } from "@kalera/munin-sdk";
|
|
2
|
+
import { resolveProjectId } from "@kalera/munin-runtime";
|
|
3
|
+
import type { MuninAction } from "@kalera/munin-sdk";
|
|
2
4
|
import { Type } from "@sinclair/typebox";
|
|
3
5
|
import { z } from "zod";
|
|
4
6
|
|
|
@@ -14,18 +16,23 @@ export default {
|
|
|
14
16
|
.describe("The base URL for your Munin server."),
|
|
15
17
|
apiKey: z.string().optional().describe("Your API key for Munin."),
|
|
16
18
|
projectId: z.string().optional().describe("Your Context Core ID (e.g. proj_xxx)."),
|
|
17
|
-
})
|
|
18
|
-
register(api:
|
|
19
|
+
}),
|
|
20
|
+
register(api: {
|
|
21
|
+
logger: { warn: (msg: string) => void };
|
|
22
|
+
registerTool: (tool: Record<string, unknown>) => void;
|
|
23
|
+
pluginConfig?: Record<string, unknown>;
|
|
24
|
+
}) {
|
|
19
25
|
const baseUrl =
|
|
20
|
-
(api.pluginConfig?.baseUrl as string) ||
|
|
26
|
+
(api.pluginConfig?.baseUrl as string | undefined) ||
|
|
21
27
|
process.env.MUNIN_BASE_URL ||
|
|
22
28
|
"https://munin.kalera.dev";
|
|
23
29
|
const apiKey =
|
|
24
|
-
(api.pluginConfig?.apiKey as string) || process.env.MUNIN_API_KEY;
|
|
30
|
+
(api.pluginConfig?.apiKey as string | undefined) || process.env.MUNIN_API_KEY;
|
|
25
31
|
const projectId =
|
|
26
|
-
(api.pluginConfig?.projectId as string) ||
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
(api.pluginConfig?.projectId as string | undefined) ||
|
|
33
|
+
process.env.MUNIN_PROJECT ||
|
|
34
|
+
resolveProjectId(); // walk-up fallback for .env files
|
|
35
|
+
const encryptionKey = process.env.MUNIN_ENCRYPTION_KEY;
|
|
29
36
|
|
|
30
37
|
if (!apiKey || !projectId) {
|
|
31
38
|
api.logger.warn(
|
|
@@ -36,11 +43,11 @@ export default {
|
|
|
36
43
|
|
|
37
44
|
const client = new MuninClient({ baseUrl, apiKey });
|
|
38
45
|
|
|
39
|
-
// Helper: inject encryptionKey if set
|
|
40
|
-
const enrichPayload = (payload:
|
|
46
|
+
// Helper: inject encryptionKey if set (only for E2EE-compatible tools)
|
|
47
|
+
const enrichPayload = (payload: Record<string, unknown>): Record<string, unknown> =>
|
|
41
48
|
encryptionKey ? { ...payload, encryptionKey } : payload;
|
|
42
49
|
|
|
43
|
-
const handleResult = (res:
|
|
50
|
+
const handleResult = (res: { data?: unknown }) => ({
|
|
44
51
|
content: [{ type: "text" as const, text: JSON.stringify(res.data, null, 2) }],
|
|
45
52
|
details: res.data,
|
|
46
53
|
});
|
|
@@ -55,8 +62,8 @@ export default {
|
|
|
55
62
|
tags: Type.Optional(Type.String({ description: "Comma-separated list of tags." })),
|
|
56
63
|
title: Type.Optional(Type.String({ description: "Human-readable title." })),
|
|
57
64
|
}),
|
|
58
|
-
async execute(_toolCallId: string, payload:
|
|
59
|
-
const res = await client.invoke(projectId, "store", enrichPayload(payload));
|
|
65
|
+
async execute(_toolCallId: string, payload: Record<string, unknown>) {
|
|
66
|
+
const res = await client.invoke(projectId, "store" as MuninAction, enrichPayload(payload));
|
|
60
67
|
return handleResult(res);
|
|
61
68
|
},
|
|
62
69
|
});
|
|
@@ -68,9 +75,9 @@ export default {
|
|
|
68
75
|
parameters: Type.Object({
|
|
69
76
|
key: Type.String({ description: "The unique identifier of the memory." }),
|
|
70
77
|
}),
|
|
71
|
-
async execute(_toolCallId: string, params:
|
|
78
|
+
async execute(_toolCallId: string, params: Record<string, unknown>) {
|
|
72
79
|
const { key } = params;
|
|
73
|
-
const res = await client.invoke(projectId, "retrieve", enrichPayload({ key }));
|
|
80
|
+
const res = await client.invoke(projectId, "retrieve" as MuninAction, enrichPayload({ key }));
|
|
74
81
|
return handleResult(res);
|
|
75
82
|
},
|
|
76
83
|
});
|
|
@@ -82,9 +89,9 @@ export default {
|
|
|
82
89
|
parameters: Type.Object({
|
|
83
90
|
query: Type.String({ description: "The search term." }),
|
|
84
91
|
}),
|
|
85
|
-
async execute(_toolCallId: string, params:
|
|
92
|
+
async execute(_toolCallId: string, params: Record<string, unknown>) {
|
|
86
93
|
const { query } = params;
|
|
87
|
-
const res = await client.invoke(projectId, "search", enrichPayload({ query }));
|
|
94
|
+
const res = await client.invoke(projectId, "search" as MuninAction, enrichPayload({ query }));
|
|
88
95
|
return handleResult(res);
|
|
89
96
|
},
|
|
90
97
|
});
|
|
@@ -97,8 +104,8 @@ export default {
|
|
|
97
104
|
limit: Type.Optional(Type.Number({ description: "Max results (default: 10)." })),
|
|
98
105
|
offset: Type.Optional(Type.Number({ description: "Pagination offset (default: 0)." })),
|
|
99
106
|
}),
|
|
100
|
-
async execute(_toolCallId: string, params:
|
|
101
|
-
const res = await client.invoke(projectId, "list", enrichPayload(params));
|
|
107
|
+
async execute(_toolCallId: string, params: Record<string, unknown>) {
|
|
108
|
+
const res = await client.invoke(projectId, "list" as MuninAction, enrichPayload(params));
|
|
102
109
|
return handleResult(res);
|
|
103
110
|
},
|
|
104
111
|
});
|
|
@@ -110,8 +117,8 @@ export default {
|
|
|
110
117
|
parameters: Type.Object({
|
|
111
118
|
limit: Type.Optional(Type.Number({ description: "Max results (default: 10)." })),
|
|
112
119
|
}),
|
|
113
|
-
async execute(_toolCallId: string, params:
|
|
114
|
-
const res = await client.invoke(projectId, "recent", enrichPayload(params));
|
|
120
|
+
async execute(_toolCallId: string, params: Record<string, unknown>) {
|
|
121
|
+
const res = await client.invoke(projectId, "recent" as MuninAction, enrichPayload(params));
|
|
115
122
|
return handleResult(res);
|
|
116
123
|
},
|
|
117
124
|
});
|
|
@@ -124,9 +131,9 @@ export default {
|
|
|
124
131
|
memoryIds: Type.Array(Type.String(), { description: "Array of memory IDs to share." }),
|
|
125
132
|
targetProjectIds: Type.Array(Type.String(), { description: "Array of target project IDs." }),
|
|
126
133
|
}),
|
|
127
|
-
async execute(_toolCallId: string, params:
|
|
134
|
+
async execute(_toolCallId: string, params: Record<string, unknown>) {
|
|
128
135
|
const { memoryIds, targetProjectIds } = params;
|
|
129
|
-
const res = await client.invoke(projectId, "share", enrichPayload({ memoryIds, targetProjectIds }));
|
|
136
|
+
const res = await client.invoke(projectId, "share" as MuninAction, enrichPayload({ memoryIds, targetProjectIds }));
|
|
130
137
|
return handleResult(res);
|
|
131
138
|
},
|
|
132
139
|
});
|