diff --git a/plugins/deta/.codex-plugin/plugin.json b/plugins/deta/.codex-plugin/plugin.json index f952917..ba75481 100644 --- a/plugins/deta/.codex-plugin/plugin.json +++ b/plugins/deta/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "deta", - "version": "0.2.2", + "version": "0.2.3", "description": "DETA \u5efa\u7b51\u6027\u80fd\u8bbe\u8ba1\u63d2\u4ef6\uff1a\u4ee5 AML \u4e3a\u552f\u4e00\u4e8b\u5b9e\u6e90\u7f16\u8f91\u5efa\u7b51\u6a21\u578b\uff0c\u7ecf GSA \u7f16\u8bd1\u4e3a\u5efa\u7b51\u6a21\u578b\u5e76\u505a\u89c4\u5219\u6821\u9a8c\u3002", "author": { "name": "DETA", diff --git a/plugins/deta/README.md b/plugins/deta/README.md index f797fdf..3ad2913 100644 --- a/plugins/deta/README.md +++ b/plugins/deta/README.md @@ -73,9 +73,12 @@ my-project/ 3. 引擎校验 apply_design() → 编译 AML 为建筑模型(服务端工作区内的最新版本) validate_model() → 语法/几何问题,逐条修复后重新 push + 编译 envelope_stats() / query_spatial_graph() → 围护结构与空间邻接 -4. Studio 查看 打开返回的 studioUrl;已有相同 URL 的标签优先复用, - 不要为同一项目重复开新标签 -5. 反向核对 pull_project({ projectId }) → { files, projectId, studioUrl } +4. Studio 查看 在右侧内置浏览器面板打开返回的 studioUrl + (https://deta.city/design/,例:云项目 11 → https://deta.city/design/11); + 已有相同 URL 的标签优先复用,不要为同一项目重复开新标签,也不要 goto 重载已有标签 +5. 跑模拟 在面板里的 Studio 界面运行(分析/模拟面板、GH 模板)——模拟由 Studio 执行, + 本插件 MCP 不执行模拟;面板首次使用需先登录一次 deta.city +6. 反向核对 pull_project({ projectId }) → { files, projectId, studioUrl } (工作区为空时 files 为 {}) ``` diff --git a/plugins/deta/skills/aml-design/SKILL.md b/plugins/deta/skills/aml-design/SKILL.md index e8823eb..5cb3988 100644 --- a/plugins/deta/skills/aml-design/SKILL.md +++ b/plugins/deta/skills/aml-design/SKILL.md @@ -39,11 +39,40 @@ description: 以 AML 为唯一事实源读写建筑模型并编译校验。当 `files` 至少含 `aml.xml`;路径必须是工作区相对路径(绝对路径、`..` 穿越会被拒绝); 单次载荷上限 1 MiB。传 `projectId` 会同时把本项目绑定到云项目 (写入服务端工作区 `deta.json`,之后 `generate_aml` / `pull_project` 也带同一深链)。 -- 返回的 `studioUrl`(`https://deta.city/design/`):**用内置浏览器打开, - 已有相同 URL 的标签优先复用,不要重复开新标签**。 +- 返回的 `studioUrl`(`https://deta.city/design/`,例:云项目 11 → `https://deta.city/design/11`): + **在宿主右侧的内置浏览器面板打开**(做法见下一节);已有相同 URL 的标签优先复用,不要重复开新标签。 - 反向核对 / 拉回云端工作区用 `pull_project`(返回 `{ files, projectId?, studioUrl? }`, 工作区为空时 `files` 为 `{}`)。 +## 在右侧面板打开 Studio,并在其中跑模拟 + +Studio 就是 ant-model(deta.city 上的建筑性能应用)。在 Codex 右侧内置浏览器面板打开它之后, +看模型、跑模拟、看结果图层都在面板里完成;本插件的 MCP 只负责把本地改动推上去,不执行模拟。 + +打开步骤(用宿主内置浏览器 = browser 插件的 `iab`): + +1. 取 `studioUrl`:本机项目目录 `deta.json` 里的 `projectId`,或 `push_project(…, projectId)` 的返回值。 + 形如 `https://deta.city/design/`(门户页负责登录态同步,再以 `cloudProjectId` 内嵌 Studio)。 +2. 按 browser 插件技能(`control-in-app-browser`)的 Bootstrap 初始化,再取内置浏览器句柄: + `const iab = await agent.browsers.get("iab");`,并先读一次 `await iab.documentation()`。 +3. 先 `await iab.tabs.list()` 看是否已有该 URL 的标签:**有就复用,不要调 `goto` 重载** + (重载会丢面板里正在进行的操作);没有才 `const tab = await iab.tabs.new(); await tab.goto(studioUrl);` +4. 打开后告诉用户「Studio 已在右侧面板打开(项目名/ID)」,并说明模拟在面板里运行。 + +在面板里跑模拟: + +- 模拟入口在 Studio 界面内(分析/模拟面板、GH 模板等)。**默认交给用户在面板里操作**—— + 模拟参数与结果解读属设计决策,不要代替用户点。 +- 用户明确要你代跑时:先 `await tab.ax.write()` 取当前界面元素,再 `await tab.ax.click(<元素序号>)` + 逐步操作;每一步后重新取一次状态确认,**不要凭记忆点坐标**。 +- 结果出来后用 `await tab.ax.write("both")` 或 `await tab.screenshot()` 确认图层与数值,再向用户汇报。 + +前置与故障: + +- 面板未登录 deta.city:先在面板里登录一次(门户把登录态写进 `ant_token` cookie 后,Studio 才会自动加载项目)。 +- 没有 `projectId`:Studio 打开的是空项目。先在门户创建云项目拿到 ID,再 `push_project(…, projectId)` 绑定。 +- 宿主没有内置浏览器(CLI 等形态):直接把 `studioUrl` 给用户,让他自己打开,不要假装已经打开。 + ## 铁律 1. **AML 是建筑语义的唯一事实源**。任何几何或属性变更都必须落到 AML 文本, @@ -73,7 +102,8 @@ description: 以 AML 为唯一事实源读写建筑模型并编译校验。当 5. **校**:`validate_model` 做语法与规则校验,逐条读取错误码并修复,不得跳过; 规则类问题用 `analyze_gsa_issues` / `analyze_rules_compliance`。 6. **看**:需要几何指标用 `envelope_stats`(围护结构/外窗面积)或 `query_spatial_graph` - (空间邻接与查询);要在浏览器看效果就用返回的 `studioUrl`(复用已有标签)。 + (空间邻接与查询);要看模型、**跑模拟**、看结果图层,就在右侧面板打开 `studioUrl` + (见「在右侧面板打开 Studio,并在其中跑模拟」一节),模拟在 Studio 界面里运行。 ## 错误处理