opencode-api-security-testing 5.4.4 → 5.4.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +11 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-api-security-testing",
3
- "version": "5.4.4",
3
+ "version": "5.4.6",
4
4
  "description": "API Security Testing Plugin for OpenCode - Automated vulnerability scanning and penetration testing",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/index.ts CHANGED
@@ -583,31 +583,28 @@ function checkDeps(ctx: { directory: string }): string {
583
583
  return "";
584
584
  }
585
585
 
586
- function getAgentsDir(): string {
587
- const home = process.env.HOME || process.env.USERPROFILE || "/root";
588
- return join(home, AGENTS_DIR);
586
+ // 获取插件内部的 agents 目录(而不是 ~/.config/opencode/agents/)
587
+ function getPluginAgentsDir(): string {
588
+ // 使用插件的安装目录下的 agents 文件夹
589
+ const pluginDir = dirname(dirname(__filename));
590
+ return join(pluginDir, "agents");
589
591
  }
590
592
 
591
593
  function getInjectedAgentsPrompt(): string {
592
- const agentsDir = getAgentsDir();
594
+ const agentsDir = getPluginAgentsDir();
593
595
  const agentsPath = join(agentsDir, "api-cyber-supervisor.md");
594
596
 
595
597
  if (!existsSync(agentsPath)) {
598
+ console.log(`[api-security-testing] Agent file not found: ${agentsPath}`);
596
599
  return "";
597
600
  }
598
601
 
599
602
  try {
600
603
  const content = readFileSync(agentsPath, "utf-8");
601
- return `
602
-
603
- [API Security Testing Agents Available]
604
- When performing security testing tasks, you can use the following specialized agents:
605
-
606
- ${content}
607
-
608
- To activate these agents, simply mention their name in your response (e.g., "@api-cyber-supervisor" to coordinate security testing).
609
- `;
610
- } catch {
604
+ // 不添加 UI 显示的前缀,直接返回内容(将通过 synthetic part 注入)
605
+ return content;
606
+ } catch (e) {
607
+ console.log(`[api-security-testing] Failed to read agent file: ${e}`);
611
608
  return "";
612
609
  }
613
610
  }