修复 AGC 画布素材卡「引用」无消费者:新增活跃聊天输入区注册表(Issue #602) #605
Open
suzmii
wants to merge 4 commits from
fix/agc-canvas-reference-insert into master
pull from: fix/agc-canvas-reference-insert
merge into: GenarrativeAI:master
GenarrativeAI:master
GenarrativeAI:feat/game-works-management
GenarrativeAI:fix/agc-composer-layout
GenarrativeAI:fix/home-project-naming-async
GenarrativeAI:contract-lease-refactor
GenarrativeAI:feat/pricing-plan
GenarrativeAI:feat/play-count-with-cache
GenarrativeAI:feat/pricing-plan-limit
GenarrativeAI:codex/payment-service-20261003
GenarrativeAI:codex/profile-invite-gate-fix
GenarrativeAI:codex/profile-invite-entry
GenarrativeAI:feat/agc-ui-motion-ux
GenarrativeAI:feat/ui-editor-model-override
GenarrativeAI:fix/agc-release-gate-channel
GenarrativeAI:fix/dev-loopback-token-trust
GenarrativeAI:feat/tribo3d-integeration
GenarrativeAI:fix/api-timeout
GenarrativeAI:codex/admin-gray-game-publish
GenarrativeAI:codex/remove-agc-codex-restrictions
GenarrativeAI:feat/gptimage2to2.5
GenarrativeAI:backup/agc-macos-dualarch-node-runtime
GenarrativeAI:feat/Crt_Ws
GenarrativeAI:codex/preview-llm-router-config
GenarrativeAI:fix/stroke-width-regression-from-285
GenarrativeAI:agent-organize
GenarrativeAI:feat/game-agent-canvas-resource-workbench-v2
GenarrativeAI:feat/agc-new-workflow
GenarrativeAI:fix/agc-release-version-sync
GenarrativeAI:codex/shared-components-followup
GenarrativeAI:codex/game-agent-runtime-interaction-design
GenarrativeAI:feat/spine-sequence-export-v2
GenarrativeAI:codex/game-agent-run
GenarrativeAI:codex/ui-spritesheet-durable-transaction-latest
GenarrativeAI:feat/art-agent-more-tools
GenarrativeAI:codex/editor-canvas-null-source-repair
GenarrativeAI:hotfix/editor-layout-2mib
GenarrativeAI:codex/showcase
No Reviewers
Labels
Clear labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Breaking change that won't be backward compatible
Something is not working
Documentation changes
Improve existing functionality
New functionality
This is security issue
Issue or pull request related to testing
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Low
4
The priority is low
Priority
Medium
3
The priority is medium
Reviewed
Confirmed
1
Issue has been confirmed
Reviewed
Duplicate
2
This issue or pull request already exists
Reviewed
Invalid
3
Invalid issue
Reviewed
Won't Fix
3
This issue won't be fixed
Status
Abandoned
3
Somebody has started to work on this but abandoned work
Status
Blocked
1
Something is blocking this issue or pull request
Status
Need More Info
2
Feedback is required to reproduce issue or to continue work
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: GenarrativeAI/Genarrative#605
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "fix/agc-canvas-reference-insert"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题
资源画布选中已登记素材后点选中工具条的「引用」没有任何反应:聊天输入框不出现
@素材名芯片、也没有提示。普通项目(directProjectMode)必现,立项策划链路复现不出来。根因(Issue #602 正文):引用插入的 window 事件只有一个消费者 ——
App.tsx里的chatComposerRef.current?.insertReferences(...),而chatComposerRef只赋给PlanningChatView。2026-09-22 DirectProject 拆分引入的directProjectMode提前 return 让普通项目走不到那条赋值 → ref 恒为null,可选链静默吞掉整次点击。同一批合并冲突还把 2026-09-21 的RESOURCE_REFERENCE_INSERT_MANY_EVENT监听整段丢了,拖拽批量引用连消费者都没有。改动(采用 issue 推荐方案)
features/project-workspace/activeChatComposer.ts:模块级只保存当前挂载的那一个输入区句柄({ insertReferences(refs), focus() });registerActiveChatComposer返回注销函数、注销时校验身份(旧句柄不会清掉新句柄),并在检测到第二个输入区注册时留一条 dev 告警(不改运行时语义);insertChatReferences在空批次 / 无输入区 / 句柄报「这一批没插进去」三种情况返回false。DirectProjectComposer用useImperativeHandle暴露DirectProjectComposerHandle(按 ref 转发内部句柄,句柄本身稳定)。DirectProjectChatView挂载期间注册按 ref 转发的句柄(注册时不读输入区是否就位,因此不依赖父子 effect 顺序)、卸载注销;PlanningChatView同样注册(两条链路互斥渲染,同一时刻只有一个句柄)。App.tsx收敛为一处监听:单条 + 批量两个事件都走insertChatReferences;空批次直接返回(没有要插的东西,不报成「没有输入区」);返回false时 dev 下console.warn(可选加固,已实现)。chatComposerRef只保留给策划输入盒自己的getDraft/clear,不再承担跨面板插入。前后对照
App.tsx单处监听 → 注册表里的当前输入区 → 草稿出现@素材名芯片,光标落在插入之后;连点两次按顺序追加。测试(原有用例只断言「事件被派发」,已升级为端到端)
tests/appSurface/project-development.suite.ts:渲染真实 DirectProject 聊天面(不再用<div>项目总控</div>桩),键盘 + 鼠标两条通路点「引用」后断言form.project-chat-composer草稿里出现[data-resource-reference-id="scene-hero"],且第二枚接在第一枚之后。tests/resourceCanvasChatReferenceDrop.test.tsx:换成真实 DirectProject 聊天面;多选拖拽断言整批一次落进草稿、顺序 = 拖动集合顺序;保留 4 条拖拽用例的「零坐标写入」断言;新增未登记素材不出「引用」按钮、拖拽落点与落点提示都给原因的用例。tests/appSurface/design-agent.suite.ts:新增策划链路(PlanningChatView)引用插入不回归用例。验证(合并 master 后实跑)
npx vitest run apps/ai-game-creator-shell/tests→ 197 passed | 1 skipped(198 文件)、1918 passed | 17 skipped(1935 用例)npx vitest run tests/activeChatComposer.test.ts tests/resourceCanvasChatReferenceDrop.test.tsx→ 2 files / 12 passednpx vitest run tests/appSurface.test.ts -t 引用→ 4 passednpm run agc:typecheck(含 master 新增的check:tests:types)→ exit 0npm run check:encoding、git diff --check、eslint--max-warnings 0(改动文件)→ 全部通过分支状态
a22e8ee44(修复)→f4ada5061(自审加固:ref 转发注册 + 插入成功语义)→455b265a7(合并 master #601 的测试替身收口与 tests 类型门禁)→3f18e3dc7(评审三条 P2 收口)。installTauriRuntime/resetTauriRuntime与类型收窄(ResourceReference过滤),保留本分支的真实聊天面挂载与草稿断言;App的 props 类型未导出,两处 chat 节点改用AppComponent别名以通过新类型门禁。tests/activeChatComposer.test.ts钉注册表合同(空批次 / 无输入区 / 句柄报落空 / 注销身份校验 / 重复注册告警 / 乱序注销)。边界与剩余风险
insertChatReferences)与注册表语义一致,本次不做。check:nginx-spa-routes(缺/pay、/profile/payment)、external_mcp::semantic32 vs 30、http_tracing偶发、AGC Rust shard 4/4 两个断言;由上游fix/ci-master-red分支处理,因此本分支 CI 仍会部分红,属预期。View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.