@agentmap/opencode 0.1.0 → 0.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.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAGjD,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAGjD,eAAO,MAAM,cAAc,EAAE,MAgC5B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -2,16 +2,34 @@
|
|
|
2
2
|
// OpenCode plugin that injects codebase map into system prompt.
|
|
3
3
|
import { generateMapYaml } from 'agentmap';
|
|
4
4
|
export const AgentMapPlugin = async ({ directory }) => {
|
|
5
|
+
let cachedYaml;
|
|
6
|
+
let lastSessionID;
|
|
5
7
|
return {
|
|
8
|
+
'chat.message': async ({ sessionID }) => {
|
|
9
|
+
if (sessionID !== lastSessionID) {
|
|
10
|
+
lastSessionID = sessionID;
|
|
11
|
+
cachedYaml = undefined;
|
|
12
|
+
}
|
|
13
|
+
},
|
|
6
14
|
'experimental.chat.system.transform': async (_input, output) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
try {
|
|
16
|
+
// Skip if already has agentmap tag
|
|
17
|
+
if (output.system.some((s) => s.includes('<agentmap>')))
|
|
18
|
+
return;
|
|
19
|
+
cachedYaml ??= await generateMapYaml({ dir: directory });
|
|
20
|
+
if (!cachedYaml.trim())
|
|
21
|
+
return;
|
|
22
|
+
output.system.push(`
|
|
23
|
+
|
|
24
|
+
<agentmap>
|
|
25
|
+
Tree of the most important files in the repo, showing descriptions and definitions:
|
|
12
26
|
|
|
13
|
-
${
|
|
27
|
+
${cachedYaml}
|
|
14
28
|
</agentmap>`);
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
console.error('[agentmap] Failed to generate map:', err);
|
|
32
|
+
}
|
|
15
33
|
},
|
|
16
34
|
};
|
|
17
35
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY;AACZ,gEAAgE;AAGhE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1C,MAAM,CAAC,MAAM,cAAc,GAAW,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAC5D,OAAO;QACL,oCAAoC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YAC7D,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY;AACZ,gEAAgE;AAGhE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1C,MAAM,CAAC,MAAM,cAAc,GAAW,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAC5D,IAAI,UAA8B,CAAA;IAClC,IAAI,aAAiC,CAAA;IAErC,OAAO;QACL,cAAc,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;YACtC,IAAI,SAAS,KAAK,aAAa,EAAE,CAAC;gBAChC,aAAa,GAAG,SAAS,CAAA;gBACzB,UAAU,GAAG,SAAS,CAAA;YACxB,CAAC;QACH,CAAC;QAED,oCAAoC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YAC7D,IAAI,CAAC;gBACH,mCAAmC;gBAC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