33f5ad68bf
Project CI / AI game creator shell Rust shard 1/4 (push) Successful in 7m19s
Project CI / AI game creator shell Rust shard 3/4 (push) Successful in 7m26s
Project CI / AI game creator shell Rust shard 4/4 (push) Successful in 7m32s
Project CI / AI game creator shell Rust shard 2/4 (push) Successful in 7m34s
Project CI / AI game creator shell Rust smoke (push) Successful in 1m57s
Project CI / AI game creator shell Rust crates (push) Successful in 3m18s
Project CI / Native shell tests (push) Successful in 10m54s
Project CI / Backend tests (push) Successful in 12m42s
Project CI / Frontend tests (push) Successful in 13m4s
Project CI / AI game creator shell web tests (push) Successful in 5m1s
Project CI / Repository checks (push) Successful in 12m48s
AGC 原有插件系统无法直接操作已打开的 Unity Editor。本变更增加内置 `agc-unity-editor`,在 Windows x64 / Unity Mono 上支持当前项目探测、连接与 C# 执行,不向 Unity 工程安装 UPM 桥接包。 ## 主要变更 - 固定复用 DotCraft.Unity 0.4.3 的 Attach 核心,提供自包含 .NET helper,保留上游许可证、来源及修改记录。 - GUI、Runtime、DirectProject 共用 Runner 执行服务;补齐项目身份、并发、总期限、回执确认与持久不确定状态阻断。 - 现有打开项目入口支持 Unity,按项目类型及开关暴露插件和 Agent 工具。 - Windows 构建准备 helper 并随包分发;插件 JS/Rust 测试接入现有 CI 组,Jenkins 增加 .NET 10 工具链预检。 ## 验证 - .NET helper 27 项测试、自包含发布及最小环境协议 smoke 通过。 - Unity 6000.3.7f1 实机验证通过:连接、C# 执行、编译错误修复、断连重连、Domain Reload 后重新握手;真实 Runner 的 ACK、并发拒绝和跨重启阻断通过。 - 宿主 Unity、PluginHost、Cocos、MCP、工具目录与引擎识别定向回归通过;前端类型检查、插件 JS/Rust、CI 配置、格式、编码和文档门禁通过。 Linux CI 不代替 Windows helper/实机验证;发行安装包 UI smoke、其它 Unity 版本和 Unity CoreCLR 未验证。Unity 演示工程中的场景和组件已撤销,不在此 PR 范围内。 --------- Co-authored-by: kdletters <61648117+kdletters@users.noreply.github.com> Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/423
81 lines
3.5 KiB
Markdown
81 lines
3.5 KiB
Markdown
# AGC 插件工作区
|
||
|
||
本目录是 AGC 插件的工作区,每个一级子目录是一个 **Agent Plugins 包**,随 AGC 客户端分发。
|
||
|
||
```text
|
||
plugins/
|
||
├─ agc-unity-editor/ Unity Mono 编辑器桥接(Windows x64)
|
||
│ ├─ src/ AGC 插件协议入口
|
||
│ ├─ native/ 通用 EditorAdapter 与 helper 生命周期
|
||
│ └─ dotnet/ 固定版本 DotCraft Attach、helper、许可与构建脚本
|
||
└─ agc-cocos-editor/
|
||
├─ plugin.json Agent Plugins 标准清单 + AGC Runtime 扩展
|
||
├─ package.json npm workspace 成员,声明 SDK 版本契约
|
||
├─ panels/ 自包含面板 HTML
|
||
├─ src/ 运行时入口与适配器翻译
|
||
└─ native/ 插件自带 native 模块(Cargo 包)
|
||
```
|
||
|
||
## 清单格式
|
||
|
||
`plugin.json` 使用 OpenAI Agent Plugins 标准 schema,AGC 专属字段放在
|
||
`extensions.world.genarrative.agc`:
|
||
|
||
```json
|
||
{
|
||
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
||
"name": "agc-cocos-editor",
|
||
"version": "0.1.0",
|
||
"extensions": {
|
||
"com.openai": {
|
||
"interface": { "displayName": "Cocos Creator 编辑器桥接" }
|
||
},
|
||
"world.genarrative.agc": {
|
||
"apiVersion": "v1",
|
||
"entry": "./src/entry.mjs",
|
||
"adapter": "cocos-editor",
|
||
"permissions": [
|
||
"events.subscribe",
|
||
"editor.rpc",
|
||
"ui.register",
|
||
"capability.register"
|
||
],
|
||
"panels": []
|
||
}
|
||
}
|
||
}
|
||
```
|
||
|
||
约束与通用宿主一致:插件目录内最多一个 Plugin;`entry` 必须是包内普通文件;
|
||
未知权限、非法入口或不支持的 `apiVersion` 会让插件进入 `invalid` 状态,不启动进程。
|
||
|
||
## 宿主如何加载
|
||
|
||
宿主按以下顺序解析插件工作区,任一命中即生效:
|
||
|
||
1. 环境变量 `AGC_PLUGIN_WORKSPACE`(本地联调与测试)。
|
||
2. 随包资源目录 `<resource_dir>/plugins`(安装包)。
|
||
3. 开发构建的仓库 `plugins/` 目录。
|
||
|
||
工作区插件是**内置插件**:随客户端分发、不能卸载,只能通过可用开关控制是否生效。
|
||
开关状态保存在 AppData `extensions/builtin-plugins.json`,内置插件优先级高于同名
|
||
导入插件,不会被 AppData 覆盖或删除。插件运行入口由宿主以插件目录为 cwd 启动
|
||
(`.mjs` 用系统 `node`,其它入口直接执行),stdio 上使用一行一个 JSON-RPC 2.0 消息。
|
||
|
||
## 新增插件
|
||
|
||
1. 新建 `plugins/<kebab-case-name>/`,写 `plugin.json`,`name` 与目录名保持一致。
|
||
2. 运行时插件提供 `src/entry.mjs`,按 `agc.plugin.v1` 协议注册命令、面板和能力;
|
||
仅打包 Skill/MCP 的插件可以没有 `entry`,宿主会按 `package` 状态展示。
|
||
3. 需要编辑器原生能力时,在 `native/` 下放插件自己的 Cargo 包,并实现
|
||
`editor-adapter-api` 的 `EditorAdapter`;`plugin.json` 的 `adapter` 字段必须与
|
||
`EditorAdapter::id()` 一致。
|
||
4. 在根 `package.json`、`scripts/check-npm-workspaces.mjs` 登记 workspace 成员。
|
||
5. 更新 `docs/technical/` 里的插件或编辑器方案文档。
|
||
|
||
Unity 插件沿用相同开关与项目门禁。Windows 开发/发行的 `unity-editor-execute`
|
||
feature 会构建自包含 Attach helper,并只将运行文件与许可放入 staging;构建机需要
|
||
.NET 10 SDK 与 Visual Studio C++ x64 工具链,最终用户不需另装这两项。
|
||
源码来源、执行归属和验收边界见
|
||
[Unity 插件接入](../docs/technical/【技术方案】AGC Unity编辑器插件接入-2026-09-18.md)。
|