Skip to content

Commit 4002cdf

Browse files
committed
Add drafting previews and bundle-local render evidence
1 parent a80142e commit 4002cdf

67 files changed

Lines changed: 1839 additions & 342 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎config/agents_config.yaml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ defaults:
105105
- '**'
106106
agents:
107107
engineer_planner:
108+
drafting_mode: "off"
108109
filesystem_permissions:
109110
read:
110111
allow:
@@ -117,6 +118,8 @@ agents:
117118
- benchmark_definition.yaml
118119
- benchmark_assembly_definition.yaml
119120
- assembly_definition.yaml
121+
- solution_plan_evidence_script.py
122+
- solution_plan_technical_drawing_script.py
120123
- plan.md
121124
- todo.md
122125
- journal.md
@@ -130,6 +133,8 @@ agents:
130133
- journal.md
131134
- assembly_definition.yaml
132135
- benchmark_definition.yaml
136+
- solution_plan_evidence_script.py
137+
- solution_plan_technical_drawing_script.py
133138
deny:
134139
- skills/**
135140
- utils/**
@@ -142,6 +147,7 @@ agents:
142147
- list_files
143148
- read_file
144149
- inspect_media
150+
- preview_drawing
145151
- write_file
146152
- edit_file
147153
- invoke_cots_search_subagent
@@ -369,6 +375,8 @@ agents:
369375
- manufacturing_config.yaml
370376
- benchmark_definition.yaml
371377
- benchmark_assembly_definition.yaml
378+
- benchmark_plan_evidence_script.py
379+
- benchmark_plan_technical_drawing_script.py
372380
- plan.md
373381
- todo.md
374382
- journal.md
@@ -384,6 +392,8 @@ agents:
384392
- journal.md
385393
- benchmark_definition.yaml
386394
- benchmark_assembly_definition.yaml
395+
- benchmark_plan_evidence_script.py
396+
- benchmark_plan_technical_drawing_script.py
387397
- renders/**
388398
deny:
389399
- skills/**
@@ -500,6 +510,8 @@ agents:
500510
- benchmark_definition.yaml
501511
- benchmark_assembly_definition.yaml
502512
- assembly_definition.yaml
513+
- solution_plan_evidence_script.py
514+
- solution_plan_technical_drawing_script.py
503515
- plan.md
504516
- todo.md
505517
- journal.md

‎config/prompts.yaml‎

Lines changed: 34 additions & 16 deletions
Large diffs are not rendered by default.

‎config/skills_repo.lock.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"branch": "main",
33
"head_commit": "10f9e7cf12d114fe1535c3dee7347378c0a71d73",
44
"origin_url": "https://github.com/MRiabov/Problemologist-skills",
5-
"recorded_at_utc": "2026-04-02T10:48:03Z",
5+
"recorded_at_utc": "2026-04-02T10:50:06Z",
66
"skills_repo_path": "skills"
77
}

‎controller/activities/preview.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ async def preview_render_activity(
3939
rgb=params.rgb,
4040
depth=params.depth,
4141
segmentation=params.segmentation,
42+
drafting=params.drafting,
4243
rendering_type=params.rendering_type,
4344
bundle_base64=params.bundle_base64,
4445
smoke_test_mode=params.smoke_test_mode,

‎controller/agent/benchmark/render_seed.py‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,12 @@ async def seed_benchmark_review_preview_bundle(
124124
environment_version=environment_version,
125125
)
126126
manifest_json = manifest.model_dump_json(indent=2)
127+
bundle_manifest_path = (
128+
Path(canonical_render_paths[0]).parent / "render_manifest.json"
129+
)
127130
await asyncio.wait_for(
128131
worker_client.write_file(
129-
"renders/render_manifest.json",
132+
str(bundle_manifest_path),
130133
manifest_json,
131134
overwrite=True,
132135
bypass_agent_permissions=True,
@@ -135,7 +138,22 @@ async def seed_benchmark_review_preview_bundle(
135138
)
136139
await asyncio.wait_for(
137140
broadcast_file_update(
138-
str(session_id), "renders/render_manifest.json", manifest_json
141+
str(session_id), str(bundle_manifest_path), manifest_json
139142
),
140143
timeout=2.0,
141144
)
145+
root_manifest_path = "renders/render_manifest.json"
146+
if root_manifest_path != str(bundle_manifest_path):
147+
await asyncio.wait_for(
148+
worker_client.write_file(
149+
root_manifest_path,
150+
manifest_json,
151+
overwrite=True,
152+
bypass_agent_permissions=True,
153+
),
154+
timeout=5.0,
155+
)
156+
await asyncio.wait_for(
157+
broadcast_file_update(str(session_id), root_manifest_path, manifest_json),
158+
timeout=2.0,
159+
)

‎controller/agent/node_entry_validation.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,7 @@ async def validate_seeded_workspace_handoff_artifacts(
10131013
benchmark_definition=benchmark_definition_model,
10141014
assembly_definition=benchmark_assembly_definition_model,
10151015
manufacturing_config=manufacturing_config_model,
1016+
planner_node_type=AgentName.BENCHMARK_PLAN_REVIEWER,
10161017
)
10171018
errors.extend(
10181019
_seeded_schema_error(

‎controller/agent/nodes/base.py‎

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -219,50 +219,6 @@ async def _list_current_revision_render_paths(self) -> list[str]:
219219
if not current_revision:
220220
return []
221221

222-
manifest_candidates = [
223-
"renders/benchmark_renders/render_manifest.json",
224-
"renders/engineer_renders/render_manifest.json",
225-
"renders/final_preview_renders/render_manifest.json",
226-
"renders/render_manifest.json",
227-
"workspace/renders/benchmark_renders/render_manifest.json",
228-
"workspace/renders/engineer_renders/render_manifest.json",
229-
"workspace/renders/final_preview_renders/render_manifest.json",
230-
"workspace/renders/render_manifest.json",
231-
]
232-
for candidate in manifest_candidates:
233-
if not await self.ctx.worker_client.exists(
234-
candidate, bypass_agent_permissions=True
235-
):
236-
continue
237-
try:
238-
manifest_raw = await self.ctx.worker_client.read_file(
239-
candidate, bypass_agent_permissions=True
240-
)
241-
render_manifest = RenderManifest.model_validate_json(manifest_raw)
242-
except Exception:
243-
continue
244-
245-
if not render_manifest.revision:
246-
continue
247-
if render_manifest.revision.strip().lower() != current_revision.lower():
248-
continue
249-
250-
preview_paths = [
251-
path.lstrip("/")
252-
for path in render_manifest.preview_evidence_paths
253-
if path and path.lower().endswith((".png", ".jpg", ".jpeg"))
254-
]
255-
if preview_paths:
256-
return sorted(dict.fromkeys(preview_paths))
257-
258-
artifact_paths = [
259-
path.lstrip("/")
260-
for path in render_manifest.artifacts.keys()
261-
if path and path.lower().endswith((".png", ".jpg", ".jpeg"))
262-
]
263-
if artifact_paths:
264-
return sorted(dict.fromkeys(artifact_paths))
265-
266222
index_candidates = (
267223
"renders/render_index.jsonl",
268224
"workspace/renders/render_index.jsonl",
@@ -317,6 +273,48 @@ async def _list_current_revision_render_paths(self) -> list[str]:
317273
if artifact_paths:
318274
return sorted(dict.fromkeys(artifact_paths))
319275

276+
manifest_candidates = [
277+
"renders/benchmark_renders/render_manifest.json",
278+
"renders/engineer_renders/render_manifest.json",
279+
"renders/final_preview_renders/render_manifest.json",
280+
"workspace/renders/benchmark_renders/render_manifest.json",
281+
"workspace/renders/engineer_renders/render_manifest.json",
282+
"workspace/renders/final_preview_renders/render_manifest.json",
283+
]
284+
for candidate in manifest_candidates:
285+
if not await self.ctx.worker_client.exists(
286+
candidate, bypass_agent_permissions=True
287+
):
288+
continue
289+
try:
290+
manifest_raw = await self.ctx.worker_client.read_file(
291+
candidate, bypass_agent_permissions=True
292+
)
293+
render_manifest = RenderManifest.model_validate_json(manifest_raw)
294+
except Exception:
295+
continue
296+
297+
if not render_manifest.revision:
298+
continue
299+
if render_manifest.revision.strip().lower() != current_revision.lower():
300+
continue
301+
302+
preview_paths = [
303+
path.lstrip("/")
304+
for path in render_manifest.preview_evidence_paths
305+
if path and path.lower().endswith((".png", ".jpg", ".jpeg"))
306+
]
307+
if preview_paths:
308+
return sorted(dict.fromkeys(preview_paths))
309+
310+
artifact_paths = [
311+
path.lstrip("/")
312+
for path in render_manifest.artifacts.keys()
313+
if path and path.lower().endswith((".png", ".jpg", ".jpeg"))
314+
]
315+
if artifact_paths:
316+
return sorted(dict.fromkeys(artifact_paths))
317+
320318
return []
321319

322320
async def _ensure_current_revision_render_inspection(self) -> list[str]:

‎controller/agent/prompt_manager.py‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import structlog
77
from pydantic import BaseModel, ConfigDict, Field
88

9+
from shared.agents.config import DraftingMode, load_agents_config
910
from shared.enums import AgentName
1011
from shared.skills import build_skill_catalog_lines
1112

@@ -23,6 +24,7 @@ class PromptAppendices(BaseModel):
2324
model_config = ConfigDict(extra="allow")
2425

2526
shared: str = ""
27+
drafting: dict[str, str] = Field(default_factory=dict)
2628
backend: dict[str, str] = Field(default_factory=dict)
2729

2830

@@ -55,8 +57,29 @@ class PromptManager:
5557

5658
def __init__(self) -> None:
5759
self._prompt_source = PromptSourceConfig.model_validate(load_prompts())
60+
try:
61+
self._agents_config = load_agents_config()
62+
except Exception:
63+
self._agents_config = None
5864
self._skill_catalog = "\n".join(build_skill_catalog_lines()).strip()
5965

66+
def _drafting_mode_active(self) -> bool:
67+
if self._agents_config is None:
68+
return False
69+
try:
70+
mode = self._agents_config.get_drafting_mode(AgentName.ENGINEER_PLANNER)
71+
except Exception:
72+
return False
73+
return mode in (DraftingMode.DRAFTING, DraftingMode.DRAWING)
74+
75+
@staticmethod
76+
def _supports_drafting_appendix(role_key: str) -> bool:
77+
return role_key in {
78+
"engineer_planner",
79+
"engineer_plan_reviewer",
80+
"engineer_coder",
81+
}
82+
6083
def _resolve_role_key(self, template_name: str | AgentName) -> str:
6184
if isinstance(template_name, AgentName):
6285
key = self._ROLE_KEY_MAP.get(template_name.value, template_name.value)
@@ -92,8 +115,12 @@ def render(
92115
prompt_sections = [
93116
role_prompt,
94117
self._prompt_source.appendices.shared.strip(),
95-
backend_appendix.strip(),
96118
]
119+
if self._drafting_mode_active() and self._supports_drafting_appendix(role_key):
120+
drafting_appendix = self._prompt_source.appendices.drafting.get(role_key)
121+
if drafting_appendix:
122+
prompt_sections.append(drafting_appendix.strip())
123+
prompt_sections.append(backend_appendix.strip())
97124
if runtime_context and runtime_context.strip():
98125
prompt_sections.append(runtime_context.strip())
99126
# CLI-backed Codex runs already get the skill files through the workspace

0 commit comments

Comments
 (0)