接入 DotCraft Unity 编辑器插件与受控执行链路 (#423)
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
This commit was merged in pull request #423.
This commit is contained in:
2026-09-19 12:29:27 +08:00
parent 5bf036bb81
commit 33f5ad68bf
110 changed files with 8610 additions and 214 deletions
+12
View File
@@ -2329,12 +2329,24 @@ const steps = [
command: npmCommand,
args: ['run', 'ai-game-creator-shell:check:web'],
},
{
group: 'agc-web',
label: 'agc-plugin-entry-tests',
command: npmCommand,
args: ['run', 'agc:plugins:test'],
},
{
group: 'agc-rust-crates',
label: 'ai-game-creator-shell-check-rust-crates',
command: npmCommand,
args: ['run', 'ai-game-creator-shell:check:rust:crates'],
},
{
group: 'agc-rust-crates',
label: 'agc-plugin-native-tests',
command: npmCommand,
args: ['run', 'agc:plugins:native-test'],
},
{
group: 'agc-rust-shard-1',
label: 'ai-game-creator-shell-check-rust-shard-1',
+3
View File
@@ -15,6 +15,7 @@ export const REQUIRED_WORKSPACES = Object.freeze([
'packages/agc-plugin-sdk',
'packages/shared',
'plugins/agc-cocos-editor',
'plugins/agc-unity-editor',
'tools/spine-json-export-validator',
]);
@@ -29,6 +30,7 @@ const WORKSPACE_NAMES = Object.freeze({
'packages/agc-plugin-sdk': '@genarrative/agc-plugin-sdk',
'packages/shared': '@genarrative/shared',
'plugins/agc-cocos-editor': '@genarrative/agc-plugin-cocos-editor',
'plugins/agc-unity-editor': '@genarrative/agc-plugin-unity-editor',
'tools/spine-json-export-validator':
'@genarrative/spine-json-export-validator',
});
@@ -50,6 +52,7 @@ const REQUIRED_LOCAL_DEPENDENCIES = Object.freeze({
'@genarrative/image-canvas-core',
],
'plugins/agc-cocos-editor/package.json': ['@genarrative/agc-plugin-sdk'],
'plugins/agc-unity-editor/package.json': ['@genarrative/agc-plugin-sdk'],
});
const DEPENDENCY_FIELDS = Object.freeze([
+2
View File
@@ -23,6 +23,7 @@ const workspaceNames = {
'packages/agc-plugin-sdk': '@genarrative/agc-plugin-sdk',
'packages/shared': '@genarrative/shared',
'plugins/agc-cocos-editor': '@genarrative/agc-plugin-cocos-editor',
'plugins/agc-unity-editor': '@genarrative/agc-plugin-unity-editor',
'tools/spine-json-export-validator':
'@genarrative/spine-json-export-validator',
};
@@ -37,6 +38,7 @@ const localDependencies = {
'apps/mobile-shell': { '@genarrative/shared': '0.1.0' },
'packages/image-canvas-react': { '@genarrative/image-canvas-core': '0.1.0' },
'plugins/agc-cocos-editor': { '@genarrative/agc-plugin-sdk': '0.1.0' },
'plugins/agc-unity-editor': { '@genarrative/agc-plugin-sdk': '0.1.0' },
};
afterEach(() => {
+1 -1
View File
@@ -6,7 +6,7 @@ const checks = [
{
file: 'package.json',
includes:
'"check:rustfmt": "cargo fmt --all --manifest-path server-rs/Cargo.toml -- --check && cargo fmt --all --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml -- --check"',
'"check:rustfmt": "cargo fmt --all --manifest-path server-rs/Cargo.toml -- --check && cargo fmt --all --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml -- --check && cargo fmt --all --manifest-path plugins/agc-unity-editor/native/unity-editor-bridge/Cargo.toml -- --check"',
reason: '仓库必须保留统一、只读的 Rust workspace 格式检查入口。',
},
{
@@ -15,6 +15,11 @@ export const RUSTFMT_WORKSPACES = [
prefix: 'apps/ai-game-creator-shell/src-tauri/',
manifestPath: 'apps/ai-game-creator-shell/src-tauri/Cargo.toml',
},
{
prefix: 'plugins/agc-unity-editor/native/unity-editor-bridge/',
manifestPath:
'plugins/agc-unity-editor/native/unity-editor-bridge/Cargo.toml',
},
];
/**
+3 -1
View File
@@ -37,15 +37,17 @@ describe('lint-staged Rust 格式检查的 workspace 选择', () => {
).toEqual(['apps/ai-game-creator-shell/src-tauri/Cargo.toml']);
});
test('两个 workspace 都有暂存文件时两个都查', () => {
test('多个 workspace 都有暂存文件时分别检查', () => {
expect(
selectedManifests([
'server-rs/crates/api-server/src/editor_project.rs',
'apps/ai-game-creator-shell/src-tauri/src/assets.rs',
'plugins/agc-unity-editor/native/unity-editor-bridge/src/lib.rs',
]),
).toEqual([
'server-rs/Cargo.toml',
'apps/ai-game-creator-shell/src-tauri/Cargo.toml',
'plugins/agc-unity-editor/native/unity-editor-bridge/Cargo.toml',
]);
});
+22 -1
View File
@@ -416,6 +416,12 @@ describe('project CI workflow', () => {
const webJob = jobSection('ai-game-creator-shell-web-tests');
expect(webJob).toContain('run: npm run check:native-shells:agc-web');
expect(webJob).not.toContain('cargo fetch');
expect(nativeShellGateScript).toMatch(
/group: 'agc-web',[\s\S]*?args: \['run', 'agc:plugins:test'\]/u,
);
expect(rootPackageJson.scripts?.['agc:plugins:test']).toContain(
'plugins/agc-unity-editor/src/entry.test.mjs',
);
// 壳 bin 单测按名单分 4 片,一片一个 job:每个片 job 只跑自己那片,且只预热 AGC 壳
// 自己那份锁定依赖(server-rs 那份归 crate 级 job)。
@@ -458,6 +464,12 @@ describe('project CI workflow', () => {
);
expect(cratesJob).toContain('server-rs/Cargo.toml');
expect(cratesJob).toContain('cargo fetch --locked');
expect(nativeShellGateScript).toMatch(
/group: 'agc-rust-crates',[\s\S]*?args: \['run', 'agc:plugins:native-test'\]/u,
);
expect(rootPackageJson.scripts?.['agc:plugins:native-test']).toContain(
'cargo test --locked --manifest-path plugins/agc-unity-editor/native/unity-editor-bridge/Cargo.toml',
);
// 拆开的 web / rust 两段必须还是原 `ai-game-creator-shell:check` 的同一条命令序列,
// rust 段再拆成 crate 级与壳分片两段后在聚合脚本里保持同序。
@@ -515,13 +527,22 @@ describe('project CI workflow', () => {
for (const manifest of [
'server-rs/crates/agent-runtime-core/Cargo.toml',
'server-rs/crates/agent-runtime-orchestration/Cargo.toml',
'plugins/agc-cocos-editor/native/cocos-editor-bridge/Cargo.toml',
]) {
expect(standaloneStep).toContain(manifest);
}
// 这两个 crate 没有提交 Cargo.lock,只能用不带 --locked 的 fetch:
// 这些 crate 没有提交 Cargo.lock,只能用不带 --locked 的 fetch:
// 带 --locked 会因为缺少锁文件直接失败。
expect(standaloneStep).toContain('cargo fetch \\');
expect(standaloneStep).not.toContain('cargo fetch --locked');
const unityStep = stepSection(
'ai-game-creator-shell-rust-crates',
'Prepare Unity plugin Rust dependencies',
);
expect(unityStep).toContain('cargo fetch --locked');
expect(unityStep).toContain(
'plugins/agc-unity-editor/native/unity-editor-bridge/Cargo.toml',
);
const cratesJob = jobSection('ai-game-creator-shell-rust-crates');
expect(