opencode-rag-plugin 1.3.2 → 1.3.6
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 +121 -423
- package/dist/chunker/pdf.js +25 -4
- package/dist/chunker/pdf.js.map +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +72 -40
- package/dist/cli.js.map +1 -1
- package/dist/core/config.js +7 -7
- package/dist/core/config.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/opencode/create-read-tool.d.ts +2 -3
- package/dist/opencode/create-read-tool.js +66 -106
- package/dist/opencode/create-read-tool.js.map +1 -1
- package/dist/opencode/read-fallback.d.ts +0 -12
- package/dist/opencode/read-fallback.js +3 -63
- package/dist/opencode/read-fallback.js.map +1 -1
- package/dist/opencode/read-format.d.ts +55 -6
- package/dist/opencode/read-format.js +98 -10
- package/dist/opencode/read-format.js.map +1 -1
- package/dist/tui.js +97 -6
- package/dist/tui.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,27 +1,26 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
1
2
|
import { tool } from "@opencode-ai/plugin/tool";
|
|
2
3
|
import { retrieve } from "../retriever/retriever.js";
|
|
3
4
|
import { normalizeReadArgs, resolveWorkspacePath } from "./tool-args.js";
|
|
4
5
|
import { buildReadQuery } from "./read-query.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import { formatHybridReadOutput } from "./read-format.js";
|
|
7
|
+
import { retrievalErrorMessage } from "./read-fallback.js";
|
|
7
8
|
/**
|
|
8
9
|
* Create the RAG-backed read tool for OpenCode plugin registration.
|
|
9
10
|
*
|
|
10
|
-
* The tool
|
|
11
|
-
*
|
|
12
|
-
* relevant indexed chunks instead of full file contents.
|
|
11
|
+
* The tool always returns full file contents. When RAG chunks are available
|
|
12
|
+
* for the file, they are appended as supplementary context after the file.
|
|
13
13
|
*/
|
|
14
14
|
export function createRagReadTool(options) {
|
|
15
15
|
const { worktree, config, embedder, store, sessionLastMessage, sessionRetrievalCache, keywordIndex } = options;
|
|
16
16
|
const openCodeCfg = config.openCode;
|
|
17
17
|
const maxContextChunks = openCodeCfg.maxContextChunks;
|
|
18
18
|
const maxReadOutputChars = openCodeCfg.maxReadOutputChars ?? 20000;
|
|
19
|
-
const noResultsBehavior = openCodeCfg.readNoResultsBehavior ?? "hint";
|
|
20
19
|
const retrievalTopK = maxContextChunks * 4;
|
|
21
20
|
const readRelatedFilesMax = openCodeCfg.readRelatedFilesMax ?? 5;
|
|
22
21
|
return tool({
|
|
23
|
-
description: "Read file contents from the workspace. Returns
|
|
24
|
-
"
|
|
22
|
+
description: "Read file contents from the workspace. Returns full file contents with " +
|
|
23
|
+
"relevant RAG context appended when available. " +
|
|
25
24
|
"Provide a file path and optionally a query/reason, line range, or both.",
|
|
26
25
|
args: {
|
|
27
26
|
filePath: tool.schema.string().optional(),
|
|
@@ -35,127 +34,88 @@ export function createRagReadTool(options) {
|
|
|
35
34
|
reason: tool.schema.string().optional(),
|
|
36
35
|
},
|
|
37
36
|
async execute(args, ctx) {
|
|
37
|
+
let resolvedPath;
|
|
38
|
+
let normalized;
|
|
38
39
|
try {
|
|
39
40
|
// 1. Normalize and validate arguments
|
|
40
|
-
|
|
41
|
+
normalized = normalizeReadArgs(args);
|
|
41
42
|
// 2. Resolve workspace path
|
|
42
|
-
|
|
43
|
-
// 3.
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
43
|
+
resolvedPath = resolveWorkspacePath(worktree, normalized.filePath);
|
|
44
|
+
// 3. Always read the full file from disk
|
|
45
|
+
const fileContent = await fs.readFile(resolvedPath, "utf-8");
|
|
46
|
+
// 4. Run retrieval (best-effort — RAG is supplementary)
|
|
47
|
+
let ragChunks = [];
|
|
48
|
+
let relatedFiles = [];
|
|
49
|
+
try {
|
|
50
|
+
const sessionID = ctx?.sessionID;
|
|
51
|
+
const messageText = sessionID ? sessionLastMessage?.get(sessionID) ?? "" : "";
|
|
52
|
+
const count = await store.count();
|
|
53
|
+
if (count > 0) {
|
|
54
|
+
let rawResults;
|
|
55
|
+
if (sessionID && sessionRetrievalCache) {
|
|
56
|
+
const cached = sessionRetrievalCache.get(sessionID);
|
|
57
|
+
if (cached && cached.messageText === messageText) {
|
|
58
|
+
rawResults = cached.rawResults;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const retrievalQuery = buildSessionQuery(messageText, resolvedPath, normalized);
|
|
62
|
+
rawResults = await retrieve(retrievalQuery, embedder, store, { topK: retrievalTopK, keywordIndex });
|
|
63
|
+
sessionRetrievalCache.set(sessionID, { messageText, rawResults });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
const retrievalQuery = buildReadQuery({
|
|
68
|
+
query: normalized.query,
|
|
69
|
+
filePath: resolvedPath,
|
|
70
|
+
startLine: normalized.startLine,
|
|
71
|
+
endLine: normalized.endLine,
|
|
72
|
+
});
|
|
73
|
+
rawResults = await retrieve(retrievalQuery, embedder, store, { topK: retrievalTopK, keywordIndex });
|
|
74
|
+
}
|
|
75
|
+
// Collect related files from raw results (before filtering)
|
|
76
|
+
relatedFiles = collectRelatedFiles(rawResults, resolvedPath, readRelatedFilesMax);
|
|
77
|
+
// Filter to the requested file
|
|
78
|
+
const filtered = rawResults.filter((r) => r.chunk.metadata.filePath === resolvedPath);
|
|
79
|
+
// Apply line-range overlap filtering
|
|
80
|
+
const lineFiltered = applyLineRangeFilter(filtered, normalized.startLine, normalized.endLine);
|
|
81
|
+
// Sort by score descending and limit
|
|
82
|
+
lineFiltered.sort((a, b) => b.score - a.score);
|
|
83
|
+
ragChunks = lineFiltered.slice(0, maxContextChunks);
|
|
76
84
|
}
|
|
77
85
|
}
|
|
78
|
-
|
|
79
|
-
//
|
|
80
|
-
retrievalQuery = buildReadQuery({
|
|
81
|
-
query: normalized.query,
|
|
82
|
-
filePath: resolvedPath,
|
|
83
|
-
startLine: normalized.startLine,
|
|
84
|
-
endLine: normalized.endLine,
|
|
85
|
-
});
|
|
86
|
-
rawResults = await retrieve(retrievalQuery, embedder, store, { topK: retrievalTopK, keywordIndex });
|
|
87
|
-
}
|
|
88
|
-
// 6. Collect related files from raw results (before filtering)
|
|
89
|
-
const relatedFiles = collectRelatedFiles(rawResults, resolvedPath, readRelatedFilesMax);
|
|
90
|
-
if (rawResults.length === 0) {
|
|
91
|
-
const output = getNoResultsMessage(noResultsBehavior, resolvedPath);
|
|
92
|
-
return {
|
|
93
|
-
title: "Read (OpenCodeRAG)",
|
|
94
|
-
output,
|
|
95
|
-
metadata: {
|
|
96
|
-
tool: "read",
|
|
97
|
-
filePath: resolvedPath,
|
|
98
|
-
chunks: 0,
|
|
99
|
-
indexed: true,
|
|
100
|
-
},
|
|
101
|
-
};
|
|
86
|
+
catch {
|
|
87
|
+
// Retrieval failed — continue with just the file contents
|
|
102
88
|
}
|
|
103
|
-
//
|
|
104
|
-
|
|
105
|
-
// 8. If file has no results, use no-results behavior
|
|
106
|
-
if (filtered.length === 0) {
|
|
107
|
-
let output = getNoResultsMessage(noResultsBehavior, resolvedPath);
|
|
108
|
-
if (readRelatedFilesMax > 0 && relatedFiles.length > 0) {
|
|
109
|
-
output += "\n\n" + formatRelatedFiles(relatedFiles);
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
title: "Read (OpenCodeRAG)",
|
|
113
|
-
output,
|
|
114
|
-
metadata: {
|
|
115
|
-
tool: "read",
|
|
116
|
-
filePath: resolvedPath,
|
|
117
|
-
chunks: 0,
|
|
118
|
-
indexed: true,
|
|
119
|
-
},
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
// 9. Apply line-range overlap filtering
|
|
123
|
-
const lineFiltered = applyLineRangeFilter(filtered, normalized.startLine, normalized.endLine);
|
|
124
|
-
// Re-sort by score descending
|
|
125
|
-
lineFiltered.sort((a, b) => b.score - a.score);
|
|
126
|
-
// 10. Format output
|
|
127
|
-
let output = formatReadOutput({
|
|
89
|
+
// 5. Format output: full file + optional RAG context
|
|
90
|
+
const output = formatHybridReadOutput({
|
|
128
91
|
filePath: resolvedPath,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
92
|
+
fileContent,
|
|
93
|
+
startLine: normalized.startLine,
|
|
94
|
+
endLine: normalized.endLine,
|
|
95
|
+
ragChunks,
|
|
96
|
+
relatedFiles,
|
|
132
97
|
maxChars: maxReadOutputChars,
|
|
133
98
|
});
|
|
134
|
-
//
|
|
135
|
-
if (readRelatedFilesMax > 0 && relatedFiles.length > 0) {
|
|
136
|
-
output += "\n\n" + formatRelatedFiles(relatedFiles);
|
|
137
|
-
}
|
|
138
|
-
// 12. Return
|
|
99
|
+
// 6. Return
|
|
139
100
|
return {
|
|
140
|
-
title: `Read
|
|
101
|
+
title: `Read — ${resolvedPath}`,
|
|
141
102
|
output,
|
|
142
103
|
metadata: {
|
|
143
104
|
tool: "read",
|
|
144
105
|
filePath: resolvedPath,
|
|
145
|
-
chunks:
|
|
146
|
-
|
|
147
|
-
indexed: true,
|
|
106
|
+
chunks: ragChunks.length,
|
|
107
|
+
indexed: ragChunks.length > 0,
|
|
148
108
|
},
|
|
149
109
|
};
|
|
150
110
|
}
|
|
151
111
|
catch (err) {
|
|
152
112
|
const message = err instanceof Error ? err.message : String(err);
|
|
153
113
|
return {
|
|
154
|
-
title: "Read
|
|
114
|
+
title: "Read",
|
|
155
115
|
output: retrievalErrorMessage(message),
|
|
156
116
|
metadata: {
|
|
157
117
|
tool: "read",
|
|
158
|
-
filePath:
|
|
118
|
+
filePath: resolvedPath,
|
|
159
119
|
error: message,
|
|
160
120
|
},
|
|
161
121
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-read-tool.js","sourceRoot":"","sources":["../../src/opencode/create-read-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGhD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"create-read-tool.js","sourceRoot":"","sources":["../../src/opencode/create-read-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGhD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAA0C,MAAM,kBAAkB,CAAC;AAClG,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAqB3D;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAA2B;IAE3B,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAC/G,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC;IACpC,MAAM,g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O,EAAE,CAAC;IAE1D,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE5C,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACrC,IAAI,EAAE,KAAK,aAAa;YAAE,SAAS;QACnC,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClC,IAAI,OAAO,KAAK,SAAS,IAAI,CAAC,CAAC,KAAK,GAAG,OAAO,EAAE,CAAC;YAC/C,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;SACnC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;SACjD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;SACjC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import type { ReadNoResultsBehavior } from "../core/config.js";
|
|
2
|
-
/**
|
|
3
|
-
* Fallback message when no OpenCodeRAG index exists or the index is empty.
|
|
4
|
-
*/
|
|
5
|
-
export declare function missingIndexMessage(): string;
|
|
6
|
-
/**
|
|
7
|
-
* Fallback message when the requested file has no indexed chunks.
|
|
8
|
-
*/
|
|
9
|
-
export declare function fileNotIndexedMessage(filePath: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Fallback message when no relevant chunks matched the read request.
|
|
12
|
-
*/
|
|
13
|
-
export declare function noRelevantChunksMessage(): string;
|
|
14
2
|
/**
|
|
15
3
|
* Error message wrapper for retrieval failures.
|
|
16
4
|
*/
|
|
@@ -1,69 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fallback message when no OpenCodeRAG index exists or the index is empty.
|
|
3
|
-
*/
|
|
4
|
-
export function missingIndexMessage() {
|
|
5
|
-
return [
|
|
6
|
-
"OpenCodeRAG read override active.",
|
|
7
|
-
"Full file read suppressed.",
|
|
8
|
-
"",
|
|
9
|
-
"No OpenCodeRAG index was found or the index is empty.",
|
|
10
|
-
"",
|
|
11
|
-
"Run:",
|
|
12
|
-
"",
|
|
13
|
-
"```bash",
|
|
14
|
-
"npx tsx src/cli.ts index",
|
|
15
|
-
"```",
|
|
16
|
-
"",
|
|
17
|
-
"Then retry the read request.",
|
|
18
|
-
].join("\n");
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Fallback message when the requested file has no indexed chunks.
|
|
22
|
-
*/
|
|
23
|
-
export function fileNotIndexedMessage(filePath) {
|
|
24
|
-
return [
|
|
25
|
-
"OpenCodeRAG read override active.",
|
|
26
|
-
"Full file read suppressed.",
|
|
27
|
-
"",
|
|
28
|
-
"No indexed chunks were found for:",
|
|
29
|
-
`- ${filePath}`,
|
|
30
|
-
"",
|
|
31
|
-
"Possible reasons:",
|
|
32
|
-
"- The file extension is not included.",
|
|
33
|
-
"- The directory is excluded.",
|
|
34
|
-
"- The index is stale.",
|
|
35
|
-
"- The file was created after the last indexing run.",
|
|
36
|
-
"",
|
|
37
|
-
"Run:",
|
|
38
|
-
"",
|
|
39
|
-
"```bash",
|
|
40
|
-
"npx tsx src/cli.ts index",
|
|
41
|
-
"```",
|
|
42
|
-
].join("\n");
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Fallback message when no relevant chunks matched the read request.
|
|
46
|
-
*/
|
|
47
|
-
export function noRelevantChunksMessage() {
|
|
48
|
-
return [
|
|
49
|
-
"OpenCodeRAG read override active.",
|
|
50
|
-
"Full file read suppressed.",
|
|
51
|
-
"",
|
|
52
|
-
"No relevant chunks were found for this read request.",
|
|
53
|
-
"",
|
|
54
|
-
"Try:",
|
|
55
|
-
"- Ask a more specific question.",
|
|
56
|
-
"- Run the index again.",
|
|
57
|
-
"- Request a smaller line range if range fallback is enabled.",
|
|
58
|
-
].join("\n");
|
|
59
|
-
}
|
|
60
1
|
/**
|
|
61
2
|
* Error message wrapper for retrieval failures.
|
|
62
3
|
*/
|
|
63
4
|
export function retrievalErrorMessage(shortError) {
|
|
64
5
|
return [
|
|
65
6
|
"OpenCodeRAG retrieval failed.",
|
|
66
|
-
"Full file read suppressed.",
|
|
67
7
|
"",
|
|
68
8
|
"Error:",
|
|
69
9
|
shortError,
|
|
@@ -78,13 +18,13 @@ export function getNoResultsMessage(behavior, filePath) {
|
|
|
78
18
|
throw new Error("OpenCodeRAG read: no indexed chunks found." +
|
|
79
19
|
(filePath ? ` File: ${filePath}` : ""));
|
|
80
20
|
case "empty":
|
|
81
|
-
return "
|
|
21
|
+
return "No indexed chunks found.";
|
|
82
22
|
case "hint":
|
|
83
23
|
default:
|
|
84
24
|
if (filePath) {
|
|
85
|
-
return
|
|
25
|
+
return `No indexed chunks found for ${filePath}.`;
|
|
86
26
|
}
|
|
87
|
-
return
|
|
27
|
+
return "No relevant chunks found.";
|
|
88
28
|
}
|
|
89
29
|
}
|
|
90
30
|
//# sourceMappingURL=read-fallback.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-fallback.js","sourceRoot":"","sources":["../../src/opencode/read-fallback.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"read-fallback.js","sourceRoot":"","sources":["../../src/opencode/read-fallback.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAkB;IACtD,OAAO;QACL,+BAA+B;QAC/B,EAAE;QACF,QAAQ;QACR,UAAU;KACX,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAA+B,EAC/B,QAAiB;IAEjB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,OAAO;YACV,MAAM,IAAI,KAAK,CACb,4CAA4C;gBAC1C,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACzC,CAAC;QACJ,KAAK,OAAO;YACV,OAAO,0BAA0B,CAAC;QACpC,KAAK,MAAM,CAAC;QACZ;YACE,IAAI,QAAQ,EAAE,CAAC;gBACb,OAAO,+BAA+B,QAAQ,GAAG,CAAC;YACpD,CAAC;YACD,OAAO,2BAA2B,CAAC;IACvC,CAAC;AACH,CAAC"}
|
|
@@ -15,22 +15,71 @@ export interface FormatReadOutputOptions {
|
|
|
15
15
|
maxChars: number;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Format RAG retrieval results for the
|
|
18
|
+
* Format RAG retrieval results for the opencode-rag-context tool output.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* - Includes request metadata (file path, query, chunk count).
|
|
23
|
-
* - Formats each chunk with file path, line range, score, and code block.
|
|
24
|
-
* - Enforces maxChars limit and appends truncation notice.
|
|
20
|
+
* Includes request metadata (file path, query, chunk count) and formats
|
|
21
|
+
* each chunk with file path, line range, score, and code block.
|
|
25
22
|
*
|
|
26
23
|
* Returns a string ready to return as the tool output.
|
|
27
24
|
*/
|
|
28
25
|
export declare function formatReadOutput(options: FormatReadOutputOptions): string;
|
|
26
|
+
/**
|
|
27
|
+
* Options for formatting hybrid read output (full file + RAG context).
|
|
28
|
+
*/
|
|
29
|
+
export interface FormatHybridReadOutputOptions {
|
|
30
|
+
/** Absolute file path. */
|
|
31
|
+
filePath: string;
|
|
32
|
+
/** Full file content (or already sliced). */
|
|
33
|
+
fileContent: string;
|
|
34
|
+
/** Optional start line (1-indexed). */
|
|
35
|
+
startLine?: number;
|
|
36
|
+
/** Optional end line (1-indexed). */
|
|
37
|
+
endLine?: number;
|
|
38
|
+
/** RAG search results to append as context. */
|
|
39
|
+
ragChunks: SearchResult[];
|
|
40
|
+
/** Related files to suggest. */
|
|
41
|
+
relatedFiles: RelatedFileEntry[];
|
|
42
|
+
/** Maximum output character count. */
|
|
43
|
+
maxChars: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Format hybrid read output: full file contents followed by optional RAG context.
|
|
47
|
+
*
|
|
48
|
+
* The output:
|
|
49
|
+
* - Always includes the full file contents in a code block.
|
|
50
|
+
* - Appends relevant RAG chunks as supplementary context when available.
|
|
51
|
+
* - Appends related file suggestions when available.
|
|
52
|
+
* - Enforces maxChars limit (truncates RAG section first).
|
|
53
|
+
*/
|
|
54
|
+
export declare function formatHybridReadOutput(options: FormatHybridReadOutputOptions): string;
|
|
29
55
|
/** A related file entry with path and score. */
|
|
30
56
|
export interface RelatedFileEntry {
|
|
31
57
|
filePath: string;
|
|
32
58
|
score: number;
|
|
33
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Options for formatting a direct file fallback.
|
|
62
|
+
*/
|
|
63
|
+
export interface FormatFileFallbackOptions {
|
|
64
|
+
/** Absolute file path. */
|
|
65
|
+
filePath: string;
|
|
66
|
+
/** Raw file content (full file). */
|
|
67
|
+
content: string;
|
|
68
|
+
/** Optional start line (1-indexed). */
|
|
69
|
+
startLine?: number;
|
|
70
|
+
/** Optional end line (1-indexed). */
|
|
71
|
+
endLine?: number;
|
|
72
|
+
/** Reason why fallback was used. */
|
|
73
|
+
reason: string;
|
|
74
|
+
/** Maximum output character count. */
|
|
75
|
+
maxChars?: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Format raw file contents as a fallback when no RAG chunks are available.
|
|
79
|
+
*
|
|
80
|
+
* Applies optional line-range slicing and enforces maxChars limit.
|
|
81
|
+
*/
|
|
82
|
+
export declare function formatFileFallback(options: FormatFileFallbackOptions): string;
|
|
34
83
|
/**
|
|
35
84
|
* Format a list of related files as a lightweight suggestion section.
|
|
36
85
|
*
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Format RAG retrieval results for the
|
|
2
|
+
* Format RAG retrieval results for the opencode-rag-context tool output.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* - Includes request metadata (file path, query, chunk count).
|
|
7
|
-
* - Formats each chunk with file path, line range, score, and code block.
|
|
8
|
-
* - Enforces maxChars limit and appends truncation notice.
|
|
4
|
+
* Includes request metadata (file path, query, chunk count) and formats
|
|
5
|
+
* each chunk with file path, line range, score, and code block.
|
|
9
6
|
*
|
|
10
7
|
* Returns a string ready to return as the tool output.
|
|
11
8
|
*/
|
|
12
9
|
export function formatReadOutput(options) {
|
|
13
10
|
const { filePath, retrievalQuery, results, maxChunks, maxChars } = options;
|
|
14
|
-
const header =
|
|
11
|
+
const header = buildContextHeader(filePath, retrievalQuery, results.length, maxChunks);
|
|
15
12
|
let output = header;
|
|
16
13
|
const limited = results.slice(0, maxChunks);
|
|
17
14
|
for (let i = 0; i < limited.length; i++) {
|
|
@@ -35,10 +32,70 @@ export function formatReadOutput(options) {
|
|
|
35
32
|
}
|
|
36
33
|
return output;
|
|
37
34
|
}
|
|
38
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Format hybrid read output: full file contents followed by optional RAG context.
|
|
37
|
+
*
|
|
38
|
+
* The output:
|
|
39
|
+
* - Always includes the full file contents in a code block.
|
|
40
|
+
* - Appends relevant RAG chunks as supplementary context when available.
|
|
41
|
+
* - Appends related file suggestions when available.
|
|
42
|
+
* - Enforces maxChars limit (truncates RAG section first).
|
|
43
|
+
*/
|
|
44
|
+
export function formatHybridReadOutput(options) {
|
|
45
|
+
const { filePath, fileContent, startLine, endLine, ragChunks, relatedFiles, maxChars } = options;
|
|
46
|
+
const lang = guessLanguage(filePath);
|
|
47
|
+
// Build the full file code block
|
|
48
|
+
const lines = fileContent.split("\n");
|
|
49
|
+
const sliceStart = startLine !== undefined ? startLine - 1 : 0;
|
|
50
|
+
const sliceEnd = endLine !== undefined ? endLine : lines.length;
|
|
51
|
+
const sliced = lines.slice(sliceStart, sliceEnd);
|
|
52
|
+
const fileBlock = "```" + lang + "\n" + sliced.join("\n") + "\n```";
|
|
53
|
+
// Build the RAG context section
|
|
54
|
+
let ragSection = "";
|
|
55
|
+
if (ragChunks.length > 0) {
|
|
56
|
+
const minScore = ragChunks[ragChunks.length - 1].score;
|
|
57
|
+
const maxScore = ragChunks[0].score;
|
|
58
|
+
const ragLines = [
|
|
59
|
+
"\n---\n",
|
|
60
|
+
`**Related code chunks** _(${ragChunks.length} chunk${ragChunks.length === 1 ? "" : "s"}, relevance ${minScore.toFixed(2)}\u2013${maxScore.toFixed(2)})_\n`,
|
|
61
|
+
];
|
|
62
|
+
for (let i = 0; i < ragChunks.length; i++) {
|
|
63
|
+
const r = ragChunks[i];
|
|
64
|
+
ragLines.push(formatChunk(i + 1, r));
|
|
65
|
+
}
|
|
66
|
+
ragSection = ragLines.join("\n");
|
|
67
|
+
}
|
|
68
|
+
// Build related files section
|
|
69
|
+
let relatedSection = "";
|
|
70
|
+
if (relatedFiles.length > 0) {
|
|
71
|
+
relatedSection = "\n\n" + formatRelatedFiles(relatedFiles);
|
|
72
|
+
}
|
|
73
|
+
// Assemble output with maxChars enforcement
|
|
74
|
+
let output = fileBlock;
|
|
75
|
+
// Try adding RAG section
|
|
76
|
+
if (ragSection && (output + ragSection).length <= maxChars) {
|
|
77
|
+
output += ragSection;
|
|
78
|
+
}
|
|
79
|
+
else if (ragSection) {
|
|
80
|
+
// Truncate RAG chunks to fit
|
|
81
|
+
const available = maxChars - output.length - 100; // leave room for truncation notice
|
|
82
|
+
if (available > 200) {
|
|
83
|
+
output += ragSection.slice(0, available) + "\n\n---\nRAG context truncated.";
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Try adding related files section
|
|
87
|
+
if (relatedSection && (output + relatedSection).length <= maxChars) {
|
|
88
|
+
output += relatedSection;
|
|
89
|
+
}
|
|
90
|
+
// Final safety truncation
|
|
91
|
+
if (output.length > maxChars) {
|
|
92
|
+
output = output.slice(0, maxChars) + "\n\n---\nOutput truncated.";
|
|
93
|
+
}
|
|
94
|
+
return output;
|
|
95
|
+
}
|
|
96
|
+
function buildContextHeader(filePath, retrievalQuery, totalResults, maxChunks) {
|
|
39
97
|
const parts = [
|
|
40
|
-
"OpenCodeRAG
|
|
41
|
-
"Full file read suppressed. Returning relevant indexed chunks instead.",
|
|
98
|
+
"OpenCodeRAG context",
|
|
42
99
|
"",
|
|
43
100
|
"Requested file:",
|
|
44
101
|
`- ${filePath}`,
|
|
@@ -71,6 +128,37 @@ function formatChunk(index, result) {
|
|
|
71
128
|
lines.push("```");
|
|
72
129
|
return lines.join("\n");
|
|
73
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Format raw file contents as a fallback when no RAG chunks are available.
|
|
133
|
+
*
|
|
134
|
+
* Applies optional line-range slicing and enforces maxChars limit.
|
|
135
|
+
*/
|
|
136
|
+
export function formatFileFallback(options) {
|
|
137
|
+
const { filePath, content, startLine, endLine, maxChars } = options;
|
|
138
|
+
const lines = content.split("\n");
|
|
139
|
+
const sliceStart = startLine !== undefined ? startLine - 1 : 0;
|
|
140
|
+
const sliceEnd = endLine !== undefined ? endLine : lines.length;
|
|
141
|
+
const sliced = lines.slice(sliceStart, sliceEnd);
|
|
142
|
+
const lang = guessLanguage(filePath);
|
|
143
|
+
const codeBlock = "```" + lang + "\n" + sliced.join("\n") + "\n```";
|
|
144
|
+
let output = codeBlock;
|
|
145
|
+
if (maxChars && output.length > maxChars) {
|
|
146
|
+
output = output.slice(0, maxChars) + "\n\n---\nOutput truncated.";
|
|
147
|
+
}
|
|
148
|
+
return output;
|
|
149
|
+
}
|
|
150
|
+
function guessLanguage(filePath) {
|
|
151
|
+
const ext = filePath.split(".").pop()?.toLowerCase() ?? "";
|
|
152
|
+
const map = {
|
|
153
|
+
ts: "typescript", tsx: "typescript", js: "javascript", jsx: "javascript",
|
|
154
|
+
py: "python", rb: "ruby", go: "go", rs: "rust", java: "java",
|
|
155
|
+
kt: "kotlin", swift: "swift", c: "c", cpp: "cpp", h: "c", hpp: "cpp",
|
|
156
|
+
cs: "csharp", php: "php", sh: "bash", bash: "bash", zsh: "bash",
|
|
157
|
+
md: "markdown", json: "json", yaml: "yaml", yml: "yaml", xml: "xml",
|
|
158
|
+
html: "html", css: "css", scss: "scss", sql: "sql", toml: "toml",
|
|
159
|
+
};
|
|
160
|
+
return map[ext] ?? "";
|
|
161
|
+
}
|
|
74
162
|
/**
|
|
75
163
|
* Format a list of related files as a lightweight suggestion section.
|
|
76
164
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-format.js","sourceRoot":"","sources":["../../src/opencode/read-format.ts"],"names":[],"mappings":"AAkBA
|
|
1
|
+
{"version":3,"file":"read-format.js","sourceRoot":"","sources":["../../src/opencode/read-format.ts"],"names":[],"mappings":"AAkBA;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgC;IAC/D,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE3E,MAAM,MAAM,GAAG,kBAAkB,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACvF,IAAI,MAAM,GAAG,MAAM,CAAC;IAEpB,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,CAAC,CAAC;YAAE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