@kalera/munin-sdk 1.0.6 → 1.2.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-sdk@1.0.6 build /home/runner/work/munin-for-agents/munin-for-agents/packages/ts-sdk
2
+ > @kalera/munin-sdk@1.2.0 build /home/runner/work/munin-for-agents/munin-for-agents/packages/ts-sdk
3
3
  > tsc -p tsconfig.json
4
4
 
package/dist/client.d.ts CHANGED
@@ -11,12 +11,6 @@ export declare class MuninClient {
11
11
  requestId?: string;
12
12
  ensureCapability?: boolean;
13
13
  }): Promise<MuninResponse<TData>>;
14
- /**
15
- * Cleans up raw Munin response for LLM context efficiency.
16
- * Removes dense vector arrays and formats GraphRAG objects into readable structures.
17
- */
18
- private formatLlmResponse;
19
- private formatGraph;
20
14
  store(projectId: string, payload: Record<string, unknown>): Promise<MuninResponse<unknown>>;
21
15
  retrieve(projectId: string, payload: Record<string, unknown>): Promise<MuninResponse<unknown>>;
22
16
  search(projectId: string, payload: Record<string, unknown>): Promise<MuninResponse<unknown>>;
package/dist/client.js CHANGED
@@ -67,68 +67,7 @@ export class MuninClient {
67
67
  message: `Unexpected failure invoking action '${action}'`,
68
68
  });
69
69
  }
70
- return this.formatLlmResponse(body);
71
- }
72
- /**
73
- * Cleans up raw Munin response for LLM context efficiency.
74
- * Removes dense vector arrays and formats GraphRAG objects into readable structures.
75
- */
76
- formatLlmResponse(rawRes) {
77
- if (!rawRes || !rawRes.data)
78
- return rawRes;
79
- const data = rawRes.data;
80
- // Clean single memory retrieve
81
- if (data.key && data.content) {
82
- if (data.embedding)
83
- delete data.embedding;
84
- if (data.knowledge_graph) {
85
- data.knowledge_graph = this.formatGraph(data.knowledge_graph);
86
- }
87
- }
88
- // Clean search/list/recent results
89
- if (Array.isArray(data.results)) {
90
- data.results = data.results.map((mem) => {
91
- if (mem.embedding)
92
- delete mem.embedding;
93
- return mem;
94
- });
95
- }
96
- // Server 'search' action returns 'memories' instead of 'results'
97
- if (Array.isArray(data.memories)) {
98
- data.memories = data.memories.map((mem) => {
99
- if (mem.embedding)
100
- delete mem.embedding;
101
- return mem;
102
- });
103
- }
104
- // Clean graph in search
105
- if (data.knowledge_graph) {
106
- data.knowledge_graph = this.formatGraph(data.knowledge_graph);
107
- }
108
- return rawRes;
109
- }
110
- formatGraph(kg) {
111
- if (!kg)
112
- return kg;
113
- const entities = (kg.entities || []).map((e) => {
114
- if (e.embedding)
115
- delete e.embedding;
116
- return `${e.label || 'Unknown'} (${e.type || 'Unknown'}): ${e.description || ''}`;
117
- });
118
- // To make relationships readable without doing a separate map lookup,
119
- // we use the sourceEntityId and targetEntityId directly or map if populated.
120
- const relationships = (kg.relationships || []).map((r) => {
121
- if (r.embedding)
122
- delete r.embedding;
123
- const source = r.sourceLabel || r.sourceEntityId || 'Unknown';
124
- const target = r.targetLabel || r.targetEntityId || 'Unknown';
125
- return `${source} -[${r.type || 'Unknown'}]-> ${target}`;
126
- });
127
- return {
128
- summary: "GraphRAG knowledge formatted for readability",
129
- entities,
130
- relationships
131
- };
70
+ return body;
132
71
  }
133
72
  async store(projectId, payload) {
134
73
  return this.invoke(projectId, "store", payload, { ensureCapability: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kalera/munin-sdk",
3
- "version": "1.0.6",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/client.ts CHANGED
@@ -104,72 +104,7 @@ export class MuninClient {
104
104
  );
105
105
  }
106
106
 
107
- return this.formatLlmResponse(body);
108
- }
109
-
110
- /**
111
- * Cleans up raw Munin response for LLM context efficiency.
112
- * Removes dense vector arrays and formats GraphRAG objects into readable structures.
113
- */
114
- private formatLlmResponse(rawRes: any): any {
115
- if (!rawRes || !rawRes.data) return rawRes;
116
-
117
- const data = rawRes.data;
118
-
119
- // Clean single memory retrieve
120
- if (data.key && data.content) {
121
- if (data.embedding) delete data.embedding;
122
- if (data.knowledge_graph) {
123
- data.knowledge_graph = this.formatGraph(data.knowledge_graph);
124
- }
125
- }
126
-
127
- // Clean search/list/recent results
128
- if (Array.isArray(data.results)) {
129
- data.results = data.results.map((mem: any) => {
130
- if (mem.embedding) delete mem.embedding;
131
- return mem;
132
- });
133
- }
134
-
135
- // Server 'search' action returns 'memories' instead of 'results'
136
- if (Array.isArray(data.memories)) {
137
- data.memories = data.memories.map((mem: any) => {
138
- if (mem.embedding) delete mem.embedding;
139
- return mem;
140
- });
141
- }
142
-
143
- // Clean graph in search
144
- if (data.knowledge_graph) {
145
- data.knowledge_graph = this.formatGraph(data.knowledge_graph);
146
- }
147
-
148
- return rawRes;
149
- }
150
-
151
- private formatGraph(kg: any): any {
152
- if (!kg) return kg;
153
-
154
- const entities = (kg.entities || []).map((e: any) => {
155
- if (e.embedding) delete e.embedding;
156
- return `${e.label || 'Unknown'} (${e.type || 'Unknown'}): ${e.description || ''}`;
157
- });
158
-
159
- // To make relationships readable without doing a separate map lookup,
160
- // we use the sourceEntityId and targetEntityId directly or map if populated.
161
- const relationships = (kg.relationships || []).map((r: any) => {
162
- if (r.embedding) delete r.embedding;
163
- const source = r.sourceLabel || r.sourceEntityId || 'Unknown';
164
- const target = r.targetLabel || r.targetEntityId || 'Unknown';
165
- return `${source} -[${r.type || 'Unknown'}]-> ${target}`;
166
- });
167
-
168
- return {
169
- summary: "GraphRAG knowledge formatted for readability",
170
- entities,
171
- relationships
172
- };
107
+ return body;
173
108
  }
174
109
 
175
110
  async store(projectId: string, payload: Record<string, unknown>) {