opencode-api-security-testing 5.4.4 → 5.4.5
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/package.json +1 -1
- package/src/index.ts +11 -14
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -583,31 +583,28 @@ function checkDeps(ctx: { directory: string }): string {
|
|
|
583
583
|
return "";
|
|
584
584
|
}
|
|
585
585
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
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 =
|
|
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
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
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
|
}
|