@ghilteras/opencode-agent-memory 1.0.0 → 2.0.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/README.md +21 -7
- package/package.json +7 -3
- package/src/doctor.test.ts +183 -0
- package/src/doctor.ts +87 -0
- package/src/journal-doctor.ts +11 -0
- package/src/journal.test.ts +197 -180
- package/src/journal.ts +72 -128
- package/src/plugin-disabled.test.ts +22 -9
- package/src/plugin.test.ts +147 -51
- package/src/plugin.ts +20 -1
- package/src/test-suite.test.ts +15 -0
- package/src/tools.test.ts +2 -2
- package/src/tools.ts +3 -3
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { expect, test } from "bun:test";
|
|
2
|
+
import * as fs from "node:fs/promises";
|
|
3
|
+
|
|
4
|
+
// Guards the two-process test split in package.json: every test file in
|
|
5
|
+
// src/ must be listed in exactly one group, or it silently never runs.
|
|
6
|
+
const CORE = ["doctor.test.ts", "embeddings.test.ts", "journal.test.ts", "test-suite.test.ts", "tools.test.ts"];
|
|
7
|
+
const PLUGIN = ["plugin-disabled.test.ts", "plugin.test.ts"];
|
|
8
|
+
|
|
9
|
+
test("every test file is covered by the test:core/test:plugin split", async () => {
|
|
10
|
+
const files = (await fs.readdir(import.meta.dir))
|
|
11
|
+
.filter((f) => f.endsWith(".test.ts"))
|
|
12
|
+
.sort();
|
|
13
|
+
const covered = [...CORE, ...PLUGIN].sort();
|
|
14
|
+
expect(files).toEqual(covered);
|
|
15
|
+
});
|
package/src/tools.test.ts
CHANGED
|
@@ -31,7 +31,7 @@ describe("v2 journal tools", () => {
|
|
|
31
31
|
expect([JournalWrite(baseStore, context).name, JournalRead(baseStore).name, JournalSearch(baseStore).name]).toEqual(["journal_write", "journal_read", "journal_search"]);
|
|
32
32
|
expect(JournalWrite(baseStore, context).description).toContain("append-only");
|
|
33
33
|
expect(JournalRead(baseStore).description).toContain("by its ID");
|
|
34
|
-
expect(JournalSearch(baseStore).description).toContain("
|
|
34
|
+
expect(JournalSearch(baseStore).description).toContain("lexical OR matching");
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
test("journal_write description preserves its behavioral guidance", () => {
|
|
@@ -95,7 +95,7 @@ describe("v2 journal tools", () => {
|
|
|
95
95
|
}
|
|
96
96
|
expect(writeResult.content).toContain("Journal entry created:");
|
|
97
97
|
expect(readResult.content).toContain("Body");
|
|
98
|
-
expect(searchResult.content).toContain("Found 1 entries");
|
|
98
|
+
expect(searchResult.content).toContain("Found 1 candidate entries");
|
|
99
99
|
});
|
|
100
100
|
|
|
101
101
|
test("retains bounded tag inventory output formatting", async () => {
|
package/src/tools.ts
CHANGED
|
@@ -76,11 +76,11 @@ export function JournalRead(store: JournalStore): ToolDefinition {
|
|
|
76
76
|
export function JournalSearch(store: JournalStore): ToolDefinition {
|
|
77
77
|
return {
|
|
78
78
|
name: "journal_search",
|
|
79
|
-
description: "
|
|
79
|
+
description: "Find candidate journal entries by lexical OR matching query words in titles and bodies. Candidates are not relevance claims. All filters are optional and combined with AND logic. Use with no arguments to list recent entries. Use offset to paginate. Before starting complex tasks, search the journal for relevant past context. The journal is global across all projects but each entry records which project it was written from.",
|
|
80
80
|
input: {
|
|
81
81
|
type: "object",
|
|
82
82
|
properties: {
|
|
83
|
-
text: { type: "string", description: "
|
|
83
|
+
text: { type: "string", description: "Query words for lexical candidate matching in titles and bodies" },
|
|
84
84
|
project: { type: "string", description: "Filter by project directory" },
|
|
85
85
|
tags: { type: "string", description: "Comma-separated tags; all must match" },
|
|
86
86
|
limit: { type: "integer", minimum: 1, description: "Maximum entries to return" },
|
|
@@ -99,7 +99,7 @@ export function JournalSearch(store: JournalStore): ToolDefinition {
|
|
|
99
99
|
const tagsLine = formatTagsInUse(result.allTags);
|
|
100
100
|
if (!result.entries.length) return { content: `No journal entries found.${tagsLine}` };
|
|
101
101
|
const offset = (input.offset as number | undefined) ?? 0;
|
|
102
|
-
const header = `Found ${result.total} entries (showing ${offset + 1}–${offset + result.entries.length}):`;
|
|
102
|
+
const header = `Found ${result.total} candidate entries (showing ${offset + 1}–${offset + result.entries.length}):`;
|
|
103
103
|
const lines = result.entries.map((entry) => `${entry.id}\n ${entry.title}${entry.tags.length ? ` [${entry.tags.join(", ")}]` : ""}\n ${entry.created.toISOString()}`);
|
|
104
104
|
return { content: `${header}${tagsLine}\n\n${lines.join("\n\n")}` };
|
|
105
105
|
},
|