Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Keep scene diagnostics in edit answers and state the answer size honestly (issue #718)

Nguyen Xuan An6b0cd6171558
diff --git a/changes/718.md b/changes/718.md
index c03f6756..b7df432d 100644
--- a/changes/718.md
+++ b/changes/718.md
@@ -1 +1 @@
-- `scene_apply`, `scene_restore` and `mesh_edit` answers no longer carry the node inspection: they return the revision, the render status, a result per operation and the diff, and a 20-operation batch answers in under 2 KB instead of about 8 KB. Call `scene_inspect` to read the nodes (#718)
+- `scene_apply`, `scene_restore` and `mesh_edit` answers no longer carry the node inspection: they return the revision, the render status, the scene diagnostics when there are any, a result per operation and the diff. The results and diff of a 20-operation batch stay under 2 KB (the render status adds about 1 KB on top) instead of about 8 KB for the whole answer. Call `scene_inspect` to read the nodes (#718)
diff --git a/scripts/agent-preview-browser.js b/scripts/agent-preview-browser.js
index 33902dfd..5787eb8c 100644
--- a/scripts/agent-preview-browser.js
+++ b/scripts/agent-preview-browser.js
@@ -330,17 +330,24 @@ function status(record) {
return { sessionId, revision, topologyRevision, inspection: record.scene.inspect(), render };
}
-// The answer to an edit stays short: it holds no inspection, because every answer stays in the agent's context.
-// An agent that needs the node list calls scene_inspect.
+// The answer to an edit stays short: it holds no node list, because every answer stays in the agent's context.
+// An agent that needs the node list calls scene_inspect. The scene's own warnings (closed room without a bake, stale bake,
+// coplanar overlap, ignored material fields) still ride along, only when there are any.
+function sceneDiagnostics(record) {
+ const { diagnostics } = record.scene.inspect();
+ return diagnostics?.length ? { diagnostics } : {};
+}
+
function mutationStatus(record) {
try {
draw(record);
- return { ...renderStatus(record), committed: true, renderSucceeded: true };
+ return { ...renderStatus(record), ...sceneDiagnostics(record), committed: true, renderSucceeded: true };
} catch (error) {
return {
sessionId: record.sessionId,
revision: record.scene.revision,
render: record.lastRender ?? null,
+ ...sceneDiagnostics(record),
committed: true,
renderSucceeded: false,
renderError: error.message,