@miniaxolotl/grove-opencode-plugin 0.3.1 → 0.3.2
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/CHANGELOG.md +9 -0
- package/package.json +1 -1
- package/src/capture/hooks.ts +2 -5
- package/src/engine/context.ts +2 -21
- package/src/engine/importance.ts +1 -1
- package/src/engine/staleness.ts +1 -1
- package/src/index.ts +17 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @miniaxolotl/grove-opencode-plugin
|
|
2
2
|
|
|
3
|
+
## [0.3.2](https://github.com/miniaxolotl/grove/compare/grove-opencode-plugin-v0.3.1...grove-opencode-plugin-v0.3.2) (2026-04-26)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* update MCPClient URL to correct default for importance engine ([0e0ab02](https://github.com/miniaxolotl/grove/commit/0e0ab02f91866285f4b3cecf06ad634ed3e51355))
|
|
9
|
+
* update MCPClient URL to correct default for plugin components ([28315b2](https://github.com/miniaxolotl/grove/commit/28315b2a4e54921b347e7350aefc20fe1e28093a))
|
|
10
|
+
* update MCPClient URL to correct default for staleness engine ([5446c17](https://github.com/miniaxolotl/grove/commit/5446c1780228ea82fbd76ba9a7e795ad1be1b862))
|
|
11
|
+
|
|
3
12
|
## [0.3.1](https://github.com/miniaxolotl/grove/compare/grove-opencode-plugin-v0.3.0...grove-opencode-plugin-v0.3.1) (2026-04-26)
|
|
4
13
|
|
|
5
14
|
|
package/package.json
CHANGED
package/src/capture/hooks.ts
CHANGED
|
@@ -23,11 +23,8 @@ function computeImportance(type: CaptureType): number {
|
|
|
23
23
|
return BASE_IMPORTANCE[type];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export function createCaptureHooks(
|
|
27
|
-
|
|
28
|
-
opts: GrovePluginOptions,
|
|
29
|
-
) {
|
|
30
|
-
const mcp = new MCPClient({ url: opts.mcpUrl ?? "http://localhost:3100/mcp" });
|
|
26
|
+
export function createCaptureHooks(opts: GrovePluginOptions) {
|
|
27
|
+
const mcp = new MCPClient({ url: opts.mcpUrl ?? "http://localhost:26080/mcp" });
|
|
31
28
|
|
|
32
29
|
async function captureMemory(input: CaptureInput): Promise<void> {
|
|
33
30
|
const importance = input.importance ?? computeImportance(input.type);
|
package/src/engine/context.ts
CHANGED
|
@@ -1,27 +1,8 @@
|
|
|
1
1
|
import type { GrovePluginOptions } from "../index.js";
|
|
2
2
|
import { MCPClient } from "../client/index.js";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export function createContextEngine(
|
|
7
|
-
_directory: string,
|
|
8
|
-
opts: GrovePluginOptions,
|
|
9
|
-
) {
|
|
10
|
-
const mcp = new MCPClient({ url: opts.mcpUrl ?? "http://localhost:3100/mcp" });
|
|
11
|
-
|
|
12
|
-
async function queryHotMemories(): Promise<MemorySearchResult[]> {
|
|
13
|
-
try {
|
|
14
|
-
const memories = await mcp.searchMemories({
|
|
15
|
-
query: "important decision error resolution",
|
|
16
|
-
limit: 10,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
return memories.filter((m) => m.score >= HOT_THRESHOLD);
|
|
20
|
-
} catch (err) {
|
|
21
|
-
console.error("[grove] Failed to query hot memories:", err);
|
|
22
|
-
return [];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
4
|
+
export function createContextEngine(opts: GrovePluginOptions) {
|
|
5
|
+
const mcp = new MCPClient({ url: opts.mcpUrl ?? "http://localhost:26080/mcp" });
|
|
25
6
|
|
|
26
7
|
async function onSessionCompacting(
|
|
27
8
|
input: { sessionID: string },
|
package/src/engine/importance.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { MCPClient } from "../client/index.js";
|
|
|
4
4
|
const DECAY_RATE = 0.01;
|
|
5
5
|
|
|
6
6
|
export function createImportanceEngine(opts: GrovePluginOptions) {
|
|
7
|
-
const mcp = new MCPClient({ url: opts.mcpUrl ?? "http://localhost:
|
|
7
|
+
const mcp = new MCPClient({ url: opts.mcpUrl ?? "http://localhost:26080/mcp" });
|
|
8
8
|
|
|
9
9
|
function applyDecay(currentImportance: number, daysSinceAccess: number): number {
|
|
10
10
|
const decayed = currentImportance - daysSinceAccess * DECAY_RATE;
|
package/src/engine/staleness.ts
CHANGED
|
@@ -12,7 +12,7 @@ interface StaleMemory {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export function createStalenessEngine(opts: GrovePluginOptions) {
|
|
15
|
-
const mcp = new MCPClient({ url: opts.mcpUrl ?? "http://localhost:
|
|
15
|
+
const mcp = new MCPClient({ url: opts.mcpUrl ?? "http://localhost:26080/mcp" });
|
|
16
16
|
|
|
17
17
|
async function findStaleMemories(daysThreshold: number): Promise<StaleMemory[]> {
|
|
18
18
|
const staleMemories: StaleMemory[] = [];
|
package/src/index.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface GrovePluginOptions {
|
|
|
17
17
|
export const grovePlugin: Plugin = async (ctx) => {
|
|
18
18
|
const directory = ctx.directory || ".";
|
|
19
19
|
|
|
20
|
-
const mcpUrl = process.env.GROVE_MCP_URL || "http://localhost:
|
|
20
|
+
const mcpUrl = process.env.GROVE_MCP_URL || "http://localhost:26080/mcp";
|
|
21
21
|
const project = process.env.GROVE_PROJECT;
|
|
22
22
|
|
|
23
23
|
const opts: GrovePluginOptions = {
|
|
@@ -27,8 +27,8 @@ export const grovePlugin: Plugin = async (ctx) => {
|
|
|
27
27
|
stalenessDays: 7,
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
const capture = createCaptureHooks(
|
|
31
|
-
const contextEngine = createContextEngine(
|
|
30
|
+
const capture = createCaptureHooks(opts);
|
|
31
|
+
const contextEngine = createContextEngine(opts);
|
|
32
32
|
const stalenessEngine = createStalenessEngine(opts);
|
|
33
33
|
const importanceEngine = createImportanceEngine(opts);
|
|
34
34
|
const mcp = new MCPClient({ url: mcpUrl });
|
|
@@ -75,15 +75,23 @@ export const grovePlugin: Plugin = async (ctx) => {
|
|
|
75
75
|
}),
|
|
76
76
|
},
|
|
77
77
|
async "tool.execute.after"(input: { tool: string; sessionID: string; args: unknown }, output: { title: string; output: string }) {
|
|
78
|
-
|
|
78
|
+
try {
|
|
79
|
+
await capture.onToolExecuted(input, output);
|
|
80
|
+
} catch (err) {
|
|
81
|
+
console.error("[grove] tool.execute.after hook failed:", err);
|
|
82
|
+
}
|
|
79
83
|
},
|
|
80
84
|
async "experimental.session.compacting"(input: { sessionID: string }, output: { context: string[]; prompt?: string }) {
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
try {
|
|
86
|
+
await contextEngine.onSessionCompacting(input, output);
|
|
87
|
+
await importanceEngine.decayMemories(input.sessionID);
|
|
83
88
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
const staleResult = await stalenessEngine.onStalenessCheck();
|
|
90
|
+
if (staleResult.staleCount > 0) {
|
|
91
|
+
output.context.push(`[grove] ${staleResult.message}`);
|
|
92
|
+
}
|
|
93
|
+
} catch (err) {
|
|
94
|
+
console.error("[grove] session.compacting hook failed:", err);
|
|
87
95
|
}
|
|
88
96
|
},
|
|
89
97
|
};
|