完成 Editor Agent Mock Agent P1 收尾
接入 Web Project 契约、SpacetimeDB 表与 api-server 控制面 新增 Mock Agent、静态构建 runner 与独立预览网关 补齐 /editor/agent 前端页面、服务客户端和 SSE 订阅 修复 sandbox 预览资源跨域加载并补充并发保护 接入本地 dev 预览端口漂移与服务身份初始化 更新 P1 技术方案、验收清单和 Hermes 共享记忆
This commit is contained in:
@@ -2254,3 +2254,11 @@
|
||||
- 处理:租约持有 `Arc<SpacetimeConnectionPool>` 并实现 `Drop` 统一复位槽位/归还连接;槽位改 `AtomicBool` CAS 抢占,删除自旋循环(持有 permit 必然命中空闲槽位)。任何新的"显式归还"资源在 async 取消语义下都要先想 Drop 兜底。
|
||||
- 验证:`cargo test -p spacetime-client --manifest-path server-rs/Cargo.toml --lib`(`dropped_lease_releases_slot_and_permit`、`acquire_times_out_at_pool_acquire_when_pool_is_busy`)。
|
||||
- 关联:`server-rs/crates/spacetime-client/src/lib.rs`、`docs/【后端架构】SpacetimeDB连接池租约Drop兜底与取消安全-2026-06-11.md`。
|
||||
|
||||
## Web Project preview sandbox 资源响应必须带 CORS
|
||||
|
||||
- 现象:`/editor/agent` 的 preview iframe 已切到独立 `http://127.0.0.1:3104/p/<token>/`,但 iframe 内 JS / CSS 模块加载失败,浏览器控制台提示 origin `null` 被 CORS 拦截,按钮点击 smoke 看不到预览内容。
|
||||
- 原因:P1 iframe 按安全边界只允许 `sandbox="allow-scripts"`,不加 `allow-same-origin`;浏览器会把 iframe 文档放进 opaque origin,模块脚本和样式再从 preview gateway 加载时需要资源响应显式允许跨域。
|
||||
- 处理:preview gateway 服务 artifact 的成功响应统一带 `Access-Control-Allow-Origin: *`,但仍保留独立 origin、`sandbox="allow-scripts"` 和 CSP `connect-src 'none'`,不要为了修加载问题放宽 iframe sandbox。
|
||||
- 验证:`cargo test -p api-server web_project --manifest-path server-rs/Cargo.toml`,并用浏览器 smoke 确认 iframe 中计数按钮从 `已点击 0 次` 变为 `已点击 1 次`。
|
||||
- 关联:`server-rs/crates/api-server/src/web_project_preview_gateway.rs`、`docs/technical/【测试用例】AIWeb工程静态预览MVP验收清单-2026-06-13.md`。
|
||||
|
||||
Reference in New Issue
Block a user