feat: 增加共享 Agent Browser 调试能力
需求:在 AI 编程会话中让用户与 Agent 共享同一浏览器页面,并查看控制台与网络信息。 实现:新增沙箱浏览器内核、Host API/渲染器面板、OpenCode 工具接入及安全边界测试。
This commit is contained in:
@@ -34,6 +34,7 @@ const SUPERPOWERS_REPO_DIR = 'superpowers';
|
||||
const SUPERPOWERS_BUNDLES_DIR = 'superpowers-bundles';
|
||||
const SUPERPOWERS_ACTIVE_MANIFEST = 'superpowers-active.json';
|
||||
export const BUNDLED_COURSE_SKILL_IDS = [
|
||||
'agent-browser',
|
||||
'deploy-publish-check',
|
||||
'designer-design-spec',
|
||||
'dev-build-test',
|
||||
@@ -63,6 +64,16 @@ export function resolveBundledCourseSkillsDir(input: BundledSuperpowersPathInput
|
||||
: join(input.appPath, '.opencode', 'skills');
|
||||
}
|
||||
|
||||
export function resolveBundledAgentBrowserPluginPath(input: BundledSuperpowersPathInput): string {
|
||||
return join(
|
||||
resolveBundledCourseSkillsDir(input),
|
||||
'agent-browser',
|
||||
'.opencode',
|
||||
'plugins',
|
||||
'niancode-agent-browser.js',
|
||||
);
|
||||
}
|
||||
|
||||
export function getManagedOpencodeConfigDir(userDataDir: string): string {
|
||||
return join(userDataDir, 'opencode', 'niancode-config');
|
||||
}
|
||||
@@ -266,3 +277,15 @@ export function ensureBundledCourseSkills(options: EnsureBundledCourseSkillsOpti
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export function ensureBundledAgentBrowserPlugin(options: {
|
||||
managedConfigDir: string;
|
||||
sourcePath?: string;
|
||||
}): boolean {
|
||||
const sourcePath = options.sourcePath?.trim();
|
||||
if (!sourcePath || !existsSync(sourcePath)) return false;
|
||||
const targetPluginsDir = join(options.managedConfigDir, 'plugins');
|
||||
mkdirSync(targetPluginsDir, { recursive: true });
|
||||
cpSync(sourcePath, join(targetPluginsDir, 'niancode-agent-browser.js'), { force: true });
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user