Repository navigation
feat(assets): add project asset bundle import and export - #1494
Robert0622 wants to merge 5 commits into
Conversation
…-list.css asset-bundle.css only styles the .asset-bundle-* dialog and builds on the shared --hui-* tokens, like the other assets-page sheets the harness already allows after issues-list.css. Without it core failed in TestIssuesListStylesheetLoadsLast. Co-Authored-By: Claude Code <noreply@anthropic.com>
crispinhu27
left a comment
There was a problem hiding this comment.
初审 head e2787a7f(base main 5c406d25)。
审查范围:资产包导出 / 预览 / 导入的 HTTP 处理、internal/repo/asset_bundle_export.go / asset_bundle_import.go 的依赖收集、ID 重写与事务保存,前端 asset-bundle.js 和 index.html 改动,以及 OpenAPI 文档。
验证(隔离工作区,不带任何凭据;web/native-chat 用占位页代替):
go build ./...、对改动包go vet通过;go test ./internal/repo ./internal/domain通过;./internal/httpapi里本 PR 的 4 个 AssetBundle 测试和 OpenAPI 测试通过。6aed7446上TestIssuesListStylesheetLoadsLast失败(CI core 当时的红灯),base 上通过。新提交e2787a7f把asset-bundle.css加进了页面级样式白名单,该测试已通过;asset-bundle.css的选择器都在.asset-bundle-*下,不会覆盖 issues-list 的样式,所以这一项没有单独提评论。./web里剩下的TestNativeChatLazyImportsAreEmbedded失败只是占位页导致的,base 上也一样失败。
阻塞问题(1 条,见行内评论):[P2] 别的项目绑到本项目共享 LOOP 上的全局规则,会让本项目导出这个 LOOP 时直接返回 400。
提交本 Review 时,新 head 的 CI(core / browser / first-run)还在跑。
CR + 部署实测:#1494 资产包导入导出(head
|
| 导出选择 | 导出完成 + 绑定提示 | 导入预览 |
|---|---|---|
![]() |
![]() |
![]() |
| 导入完成 | 目标项目里的草稿 LOOP | 损坏 JSON 被拒 |
![]() |
![]() |
![]() |
| member 被拒 | 导入 LOOP 真实运行成功 | P2:外部全局规则卡住导出 |
![]() |
![]() |
![]() |
结论:修好这条 P2 就可以合入,其余全部实测通过。token 身份是作者 Robert0622,不能自己 Approve;P2 修复后的新 head 我会再复测一次,合入需要一位非作者 Approve。
Another project may bind its own global rule to a shared LOOP. Export walked every rule on the platform, so the source project got a 400 for a rule it can neither see nor remove. Only this project's global rules now travel with the LOOP; runtime injection already ignores the others. Also from review: - Preview runs the full save in a transaction and rolls it back, so role hooks and artifact paths that only PutAgent checks fail the preview too. - A dependency that is another project's shared asset or a platform template says it must be copied into the project first. A private asset of another project still reads like a missing one. - Import returns bindings that point at the new copies, and the dialog lists each asset as name -> new ID with its follow-up items. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
新 head
部署实测(MariaDB 11.8.9 全新库、鉴权开启、native 沙箱 + 仅供测试的 bwrap 替身、CodeBuddy deepseek-v4.1-flash):
本地: 请复审 |
crispinhu27
left a comment
There was a problem hiding this comment.
复审 aaac4551:APPROVE
审查版本:head aaac455193de785dd64c1a6345c6b9a07605fa9b,base main 5c406d25;复审增量 e2787a7f..aaac4551(1 个提交,7 文件 +278/−24),并结合整个 PR diff 看了导出 / 导入 / 预览调用链。CI 16/16 通过。
历史问题
| 问题 | 结论 | 依据 |
|---|---|---|
| [P2] 别的项目绑到共享 LOOP 上的全局规则让本项目导不出这个 LOOP(discussion_r4717544659) | FIXED | 真实服务 + MariaDB 按「导出 200 → 他项目绑规则 200 → 再导出」复测:aaac4551 第三步 200 且只含本项目规则;基线 e2787a7f 同脚本仍 400。线程已回复并 resolve |
实际执行的验证(隔离用户、无凭据、合成数据)
go build ./...、go vet ./internal/repo ./internal/httpapi ./internal/domain通过go test ./internal/repo ./internal/domain通过;go test ./internal/httpapi -run 'AssetBundle|OpenAPI'(7 个资产包用例 + OpenAPI)通过;internal/engine的TestGlobalRuleInjectsIntoEveryNodeOfBoundWorkflow通过- HTTP 端到端:本项目全局规则随 LOOP 进包,导入后
workflowIds改写为新 LOOP、global保留(导入 201、预览 200);规则同时绑一个未导出 LOOP 时导出裁剪workflowIds,导入不报缺依赖;连续 3 次预览前后各表行数不变 go test ./web仅TestNativeChatLazyImportsAreEmbedded失败,缺 native-chat 构建产物,基线同样失败,与本 PR 无关
非阻塞建议(P3)
- 其他项目设为
shared:true的全局规则在运行时会注入本项目 LOOP(appendWorkflowGlobalRules按ProjectID == 本项目 || Shared判断),但导出时按ProjectID == 本项目被跳过,迁移到新项目后这类规则不会跟过去。这是合理取舍,建议在bindings或文档里提示一句「已忽略 N 条来自其他项目的共享全局规则」。 GenericLOOP 作为入口时,报错从「无法选择该类型作为资产包入口」变成「来自其他项目的共享资产或平台通用模板,请先复制到当前项目再导出」,同为 400,影响很小。
未做:浏览器端导入导出冒烟测试(以 HTTP 接口端到端替代)。以上结论只针对本次审查范围和执行过的验证。
Resolve conflicts with the latest main; keep both sides' additions (i18n dictionaries, runner/A2A rows, review-mode run header, user turn actions) without dropping either branch's behaviour. Co-Authored-By: Claude Code <noreply@anthropic.com>

















What changed
Add an Asset bundles entry to the LOOP library. Project owners and maintainers can export a single Skill, MCP server, role or LOOP, or select several assets for one download. The bundle includes project-owned dependencies and preserves Skill and MCP attachment bytes and executable modes.
The destination project previews the bundle and its connection setup before importing. Import creates project-owned copies in one transaction and rewrites their references. Imported LOOPs are drafts, and destination credential bindings are configured separately.
Compatibility
The versioned JSON format uses the existing catalog tables and supports automatic sandbox selection, inherited role executors and inline Docker sandbox definitions.
Validation
go vet -p=2 ./....The full Go run hit the 180-second package timeout in the engine and HTTP suites. The runner cancellation test also timed out when run individually, while the focused bundle and API tests passed.