deploy: update Space from deploy_preflight --push
Browse filesFiles changed (12)
347 unmodified lines348349350347 unmodified lines[stderr] 2026-06-14 08:27:24 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:27:24 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:27:24 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report347 unmodified lines348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491347 unmodified lines[stderr] 2026-06-14 08:27:24 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:27:24 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:27:24 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:38:21 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:38:21 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:38:21 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:38:51 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:38:52 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:38:52 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:39:24 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:39:25 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:39:25 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:39:37 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:39:37 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:39:37 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:39:43 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:39:44 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:39:44 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:40:08 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:40:08 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:40:08 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:42:15 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:42:15 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:42:15 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:42:17 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:42:17 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:42:17 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:42:27 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:42:27 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:42:27 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:42:32 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:42:33 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:42:33 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:42:37 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:42:37 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:42:38 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:42:38 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:42:41 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:42:42 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:42:42 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:42:49 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:42:49 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:42:49 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:42:52 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:42:52 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:42:53 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:42:53 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:42:58 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:42:58 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:42:58 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:43:12 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:43:13 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:43:13 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:43:21 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:43:22 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:43:22 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:43:25 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:43:31 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:43:34 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:43:34 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:43:34 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:43:50 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:43:50 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:43:50 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:43:52 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:43:52 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:43:52 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:44:05 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:44:05 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:44:05 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:44:14 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:44:14 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:44:14 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:44:20 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:44:20 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:44:20 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:47:55 INFO [watchfiles.main:308] 2 changes detected[stderr] 2026-06-14 08:47:55 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:47:55 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:47:59 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:48:00 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:48:00 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:48:08 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:48:09 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:48:09 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:48:13 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:48:14 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:48:14 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:48:25 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:48:25 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:48:25 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:48:31 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:48:31 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:48:31 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:48:36 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:48:37 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:48:37 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:48:40 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:48:41 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:48:41 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:48:43 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:48:43 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:48:43 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:48:46 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:48:46 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:48:46 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:48:48 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:48:48 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:48:48 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:48:50 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:48:50 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:48:50 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:48:55 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:48:56 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:48:56 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:49:02 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:49:50 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:54:18 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:54:19 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:54:19 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:54:40 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:54:40 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:54:40 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:54:45 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:54:45 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:54:45 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:55:09 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:55:10 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:55:10 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:55:29 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:55:29 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:55:29 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:55:56 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:55:57 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:55:57 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:56:52 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:56:53 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:56:53 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:57:00 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:57:00 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:57:00 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report[stderr] 2026-06-14 08:57:08 INFO [watchfiles.main:308] 1 change detected[stderr] 2026-06-14 08:57:09 WARNING [codeboarding_pro.analysis_controller:506] Skipping incremental update: full analysis artifacts not ready yet[stderr] 2026-06-14 08:57:09 INFO [codeboarding_pro.analysis_controller:314] No cached analysis results; skipping health report
17 unmodified lines1819202122232423 unmodified lines48495051525354119 unmodified lines1741751761771781791807 unmodified lines18818919019119219325 unmodified lines21922022122222322422522622722822923023123223323423523623723823931 unmodified lines2712722732742752762772782792802812822832842852864 unmodified lines29129229329429529629729829930030130230330430530650 unmodified lines35735835936036136236310 unmodified lines37437537637737837938038138218 unmodified lines40140240340440540640740840941041141241341441541641741841942042142219 unmodified lines44244344444544644744844945045145245345445519 unmodified lines47547647747847948022 unmodified lines5035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375386 unmodified lines5455465475485495505511 unmodified line55355455555655755855956056156256356456556656756822 unmodified lines5915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246251 unmodified line6276286296306316326336346353 unmodified lines63964064164264364464564664764864965065165265365465565665765865966066166266366414 unmodified lines6796806816826836846856866876886896906916926936946958 unmodified lines7047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517521 unmodified line75475575675775875976076176276376476576676776876977077177277377477577677777877978029 unmodified lines81081181281381481581619 unmodified lines8368378388398408418428438448458461 unmodified line84884985085185285385485585685785885986086186286386417 unmodified linesimport osimport randomimport uuidimport gradio as gr23 unmodified linesfrom core.nodes import render_node_cardsfrom core.reflect import reflect_on_jobfrom core.spine import SpineValidatorfrom learn.loop import run_sessionfrom learn.policy import LearnedPolicy, cell_keyfrom core.viewer import (GEO_READS,119 unmodified linesdef reset_learnings():"""Reset the live ledger + learned policy to the curated baseline (seed + ingested),clearing this session's accumulated runs. Wired to the persistent Reset on every tab."""removed = LEDGER.reset_to_baseline()POLICY.reset()gr.Info(f"Reset to baseline β cleared {removed} runtime lesson(s) + the learned policy.")7 unmodified linesgr.update(visible=False), # print results_group (re-hide)"", # real_log_msgstudio_log_html(), # studio_log)25 unmodified linesdef build_start(part):"""Instant feedback when BUILD is clicked: jump to Build, show ONE consolidatedloader, hide the (stale) results until the model returns. No part β stay put."""if not (part and part.get("geometry")):gr.Warning("Load a part on the BUILD tab first β quick-load Benchy, generate a primitive, or drop a mesh.")return (gr.update(),) * 9return (gr.Tabs(selected="build"), # tabsloader("SLICING THE PART Β· reading precedent, proposing settings, running checks"), # build_loadergr.update(visible=False), # build_results (hide until ready)gr.update(interactive=True), # to_print_btn (un-gate)gr.update(visible=False), # override_btn (hide)"", # second_opinion_panel (clear stale verdict)gr.update(value="Engineer's Read"), # read_toggle (reset to the read)gr.update(visible=True), # eng_read_groupgr.update(visible=False), # second_op_group)31 unmodified linesdef warm_up_pending() -> str:return ("<div class='ce-sub' style='font-size:12px;'>MODEL Β· ""warming up (first load can take ~30s on ZeroGPU)β¦</div>")def warm_up_cb() -> str:return f"<div class='ce-sub' style='font-size:12px;'>MODEL Β· {llm.warm_up()}</div>"def _model_callout() -> str:"""Hover callout next to the model switcher (replaces the full-width info block)."""return ("<span class='ce-callout' tabindex='0'>" + icon("info") + " MODEL INFO""<span class='ce-tip'>The <b>LoRA v2/v3</b> adapters serve via ZeroGPU on the Space; "4 unmodified linesdef select_model(choice: str) -> str:"""Model switcher (backend by learn/finetune via _apply_model_choice). Applies thechosen backend, then reports the model actually serving. The LoRA v2/v3 adapters servethrough ZeroGPU on the Space (and fall back gracefully if the GPU/deps aren't present);Base is the stock Gemma 4 E4B; Modal API is the remote endpoint."""choice = choice or MODEL_OPTIONS[0]try:_apply_model_choice(choice)except Exception:passreturn f"<div class='ce-sub' style='font-size:12px;'>MODEL Β· {choice} Β· {llm.backend_status()}</div>"# ββ simulated environment (this is a sim lab β conditions are generated, overridable) ββ50 unmodified linesrec = advise(job, env, retrieved, references, policy_note)spine = SPINE.check(rec.advice.settings, material)hint = steepest_overhang_hint(mesh) if geometry_type in ("overhang", "bridge") else Nonevp_html = virtual_printer_html(mesh, f"{material} Β· {geometry_type}") # init on BUILDprecedent = precedent_eval_html(retrieved, env)if retrieved:10 unmodified linesconfirm_vis = gr.update(visible=spine.requires_approval)approval_md = ("**HITL gate:** the Spine clamped a boundary setting β review, then **Confirm & Print**."if spine.requires_approval else "Within safe envelope β ready when you are.")session_id = uuid.uuid4().hexstate = {"job": job.model_dump(), "env": env.model_dump(), "settings": spine.settings.model_dump(),"advice": rec.advice.model_dump(), "label": part.get("label"), "session_id": session_id}# ββ field log (Space only β gated on HF_TOKEN; local/offline no-ops) ββfield_log.log_build(18 unmodified linesf"**Chief Engineer O'Brien:** {rec.advice.reasoning}", # reasoningrisk_callouts_html(rec.advice.risks, hint) + placement_callout(material, bed_position), # riskssettings_panel_html(spine.settings, material), # settings (LCARS panel)f"{spine_md}\n\n{approval_md}" if spine_md else approval_md, # spine notesgcode_panel_html(spine.settings, material), # g-code (LCARS panel)confirm_vis, # confirm visibilityrender_node_cards(env, working=True), # node cardsstate, # statevp_html, # virtual print (animates once)gr.update(value=1), # reset layer scrubberlayer_image(mesh, 1), # initial scrubbed layer"", # build_loader (clear)gr.update(visible=True), # build_results (reveal))def second_opinion(state):"""A SEPARATE Inspector persona critiques the plan before any print runs. A'dispute' verdict GATES β PRINT until acknowledged; caution/concur are advisory."""if not state or "advice" not in state:return ("<div class='ce-sub'>Build a job first β then I'll give the plan a second look.</div>",gr.update(interactive=True), gr.update(visible=False))19 unmodified linesreturn panel, gr.update(interactive=True), gr.update(visible=False)def toggle_read(choice, state):"""Segmented toggle on Build: flip between Engineer's Read and Second Opinion,showing one panel at a time. The opinion is computed lazily on first reveal."""if str(choice).lower().startswith("engineer"):return (gr.update(visible=True), gr.update(visible=False),gr.update(), gr.update(), gr.update())panel, to_print, override = second_opinion(state)return (gr.update(visible=False), gr.update(visible=True), panel, to_print, override)def ack_override(state):19 unmodified linesf"{icon('printer')} {PRINTER}</div>")def _simulated_result_panel(sess, run_summary, material, geometry_type, env, label) -> str:"""Two-zone outcome β the dominant SIMULATED RESULT zone (the compact LOG A REALPRINT zone is static UI below). Shows the final outcome, the climb, whether the22 unmodified lines)def run_print(state, iterations):"""PRINT: run THIS job (inherited from Build) through the closed loop. Eachiteration: policy proposes β Spine vetoes β the deterministic world prints βthe Inspector grades that outcome β policy + ledger learn. Slider 1 = a singleprint. Results reveal only after the run (progressive reveal)."""if not state or "job" not in state:gr.Warning("Build a job first (BUILD β SLICE), then print it here.")return (gr.update(),) * 9job = Job(**state["job"])env = Environment(**state["env"])material, geometry_type = job.material, job.geometry_typekey = cell_key(material, geometry_type, env)before_html = policy_cell_html(POLICY.cell_stats(material, geometry_type, env), key)sess = run_session(job, env, int(iterations), POLICY, LEDGER)after = POLICY.cell_stats(material, geometry_type, env)verdicts = [inspector.grade_iteration(geometry_type, r.result) for r in sess.records]run_summary = inspector.summarize_run(sess.records, material=material, geometry=geometry_type)traj = sess.trajectoryfirst = sess.first_successfield_log.log_event("print_run", {"material": material, "geometry": geometry_type,"env_temp": env.temp, "env_humidity": env.humidity,"iterations": len(sess.records), "q_start": round(traj[0], 3),"q_end": round(traj[-1], 3), "first_clean": first,"inspector_stance": run_summary.stance})# ββ deliberation log: World simulates -> La Forge grades, per iteration; then verdict ββctx = _delib_ctx(job, env)loop_turns = []for r, g in zip(sess.records, verdicts):clamp = " (Spine clamped a setting)" if r.clamped else ""loop_turns.append({"agent": "World", "act": "simulate", "stance": r.result.outcome,"content": f"Iteration {r.n}: {r.result.detail}.{clamp} Policy: {r.learned}."})6 unmodified lines], ctx)headline = (f"**{state.get('label') or geometry_type} Β· {material} @ {env.temp:.0f}Β°C / {env.humidity:.0f}% RH** β "f"started at quality **{traj[0]:.2f}** ({sess.records[0].result.outcome}); "+ (f"first clean print at **iteration {first}**, now **{traj[-1]:.2f}**."if first else f"still improving β best **{max(traj):.2f}** after {len(traj)} runs.")+ " The Engineer proposed; a separate simulated world reported the outcome; the **Inspector** "1 unmodified line)policy_html = (f"{before_html}<div style='text-align:center;color:var(--ao-orange);font-size:11px;"f"letter-spacing:2px;'>{icon('arrow')} LEARNED</div>{policy_cell_html(after, key)}")outcome = _simulated_result_panel(sess, run_summary, material, geometry_type, env, state.get("label"))return (gr.update(visible=True), # results_group (reveal)headline, # p_headlinequality_curve_html(traj), # p_curveiteration_log_html(sess.records, verdicts), # p_log (with inspector grades)policy_html, # p_policyoutcome, # outcome_panel (SIMULATED RESULT zone)ledger_html(), # ledger_panelrender_node_cards(env, working=False), # node_cardsinspector_panel(run_summary, label="LA FORGE Β· RUN VERDICT"), # review_summary)22 unmodified linesdef _action_bar(reset_btn_label="RESET", primary_label=None, primary_variant="primary",primary_id=None):"""Build the consistent top-right action bar (small primary + persistent Reset).Both buttons are scale=0 so they DON'T stretch full-width."""with gr.Row(elem_classes=["ce-actionbar"]):reset = gr.Button(reset_btn_label, elem_classes=["ce-pillbtn", "ce-act"], scale=0)primary = Noneif primary_label:primary = gr.Button(primary_label, variant=primary_variant,elem_classes=["ce-act"], elem_id=primary_id, scale=0)return reset, primary# outputs touched by Reset (shared by the persistent Reset on every tab)def _reset_outputs(ledger_panel, node_cards, review_summary, p_curve, p_policy, p_log,p_headline, outcome_panel, results_group, real_log_msg, studio_log):return [ledger_panel, node_cards, review_summary, p_curve, p_policy, p_log,p_headline, outcome_panel, results_group, real_log_msg, studio_log]def build() -> gr.Blocks:with gr.Blocks(title="Microfactory Node: 3D Printer") as demo:gr.HTML(command_bar(llm.backend_status()))# header row: dropdown + warm button only (NO background tints, NO stretching)with gr.Row(elem_id="ce-modelswitch"):model_select = gr.Dropdown(MODEL_OPTIONS, value=MODEL_OPTIONS[0],show_label=False, container=False,elem_classes=["ce-modeldd"], scale=0)warm_btn = gr.Button("WARM UP", elem_classes=["ce-pillbtn", "ce-icon-bolt"], scale=0)model_status = gr.HTML(_status_html(), elem_classes=["ce-status-inline"])state = gr.State()part = gr.State({"geometry": None, "mesh": None, "label": None, "read": None})1 unmodified linewith gr.Tabs() as tabs:# βββββββββββββββββββββββββ BUILD Β· define the job ββββββββββββββββββββββββwith gr.Tab("LOAD", id="studio"):# Top row: ENVIRONMENT readout (left) + RESET/SLICE (right) on the same line.with gr.Row(elem_classes=["ce-actionbar", "ce-envbar"]):sensors_readout = gr.HTML(elem_classes=["ce-envbar-readout"])roll_btn = gr.Button("RANDOMIZE",elem_classes=["ce-pillbtn", "ce-icon-shuffle"], scale=0)gr.HTML("<button class='ce-pillbtn ce-icon-sliders' "3 unmodified lines"text-transform:uppercase;letter-spacing:.5px;font-size:12px;""font-weight:700;cursor:pointer;display:inline-flex;""align-items:center;gap:6px;'>OVERRIDE</button>")# spacer pushes the action buttons to the right edgegr.HTML("<div style='flex:1;'></div>")reset_s = gr.Button("RESET", elem_classes=["ce-pillbtn", "ce-act"], scale=0)run_btn = gr.Button("SLICE", variant="primary",elem_classes=["ce-act"], elem_id="ce-run", scale=0)# 2-column setup: BUILD-PLATE POSITION | MATERIAL# (NOTES moved into PART card; ENVIRONMENT moved into action bar above)with gr.Row(equal_height=False, elem_classes=["ce-loadrow"]):with gr.Column(scale=2, min_width=320):gr.HTML(rule("BUILD-PLATE POSITION"))gr.HTML("<div class='ce-sub' style='margin:-2px 0 4px;'>""edges/corners run cooler β warp/adhesion risk</div>")bed_position = gr.Radio(BED_POSITIONS, value="center", show_label=False,elem_classes=["ce-pills"])with gr.Column(scale=1, min_width=220):gr.HTML(rule("MATERIAL"))material = gr.Radio(MATERIALS, value="PLA", show_label=False, elem_classes=["ce-pills"])gr.HTML(_model_callout())# OVERRIDE ENVIRONMENT popup (hidden by default; toggled via JS)gr.HTML("<div class='ce-popup-backdrop' data-popup-backdrop='override'></div>")with gr.Group(elem_classes=["ce-popup"], elem_id="ce-popup-override"):14 unmodified lineswith gr.Column(scale=3, elem_classes=["ce-part-viewer-col"]):part_placeholder = gr.HTML(_viewer_placeholder())model3d = gr.Model3D(value=None, label="", height=360, visible=False)# NOTES moved here β lives next to the part view alwaysdescription = gr.Textbox(label="NOTES (OPTIONAL)",placeholder="e.g. 45Β° bracket, 60mm tall",elem_classes=["ce-notes-inline"])# intro + job log moved DOWN into the part areagr.HTML(tab_intro("Load the part, set the material and the room, then ""<b>SLICE</b> to read the engineer's pre-flight check. ""You give it the part, the material, and the room; it ""infers what kind of part this is."))studio_log = gr.HTML(studio_log_html())# RIGHT: dropzone TOP, then two matching-style mesh-source buttonswith gr.Column(scale=1, elem_classes=["ce-part-actions-col"]):mesh_in = gr.File(file_types=[".stl", ".glb", ".obj"],label="UPLOAD MESH", show_label=False,8 unmodified linesshow_label=False, elem_classes=["ce-pills"])gen_size = gr.Number(value=30, label="SIZE (mm)", elem_classes=["ce-num"])gen_btn = gr.Button("GENERATE", elem_classes=["ce-pillbtn"], scale=0)# βββββββββββββββββ SLICE Β· slice + analyze + pre-flight check βββββββββββββwith gr.Tab("SLICE", id="build"):reset_b, to_print_btn = _action_bar(primary_label="PRINT (RUN ITERATIONS)")gr.HTML(tab_intro("The pre-flight check, <b>before it prints</b>: slice the part, read ""precedent, flag failures, and get a second opinion. Then β PRINT."))build_loader = gr.HTML()with gr.Group(visible=False, elem_classes=["ce-part-card"]) as build_results:# slice + motion preview side by side β grouped like LOAD's PART cardgr.HTML(rule("SLICE Β· CROSS-SECTION"))with gr.Row(equal_height=False, elem_classes=["ce-part-row"]):with gr.Column(scale=3):vp_layer = gr.Image(label="", height=360, show_label=False)with gr.Column(scale=1, elem_classes=["ce-vslider"]):vp_slider = gr.Slider(1, SCRUB_LAYERS, value=1, step=1, label="LAYER")with gr.Column(scale=1, min_width=280):gr.HTML(rule("MOTION PREVIEW"))vprint = gr.HTML()gr.HTML("<div class='ce-sub' style='padding:0 12px;'>Slide the LAYER control through real cross-sections of ""<i>this</i> part at full mesh fidelity; the preview animates the rise.</div>")# Engineer's Read β Second Opinion (one panel at a time)backend = gr.Markdown()gr.HTML(rule("THE READ"))read_toggle = gr.Radio(["Engineer's Read", "Second Opinion"],value="Engineer's Read", show_label=False,elem_classes=["ce-seg"])with gr.Group(visible=True, elem_classes=["ce-card"]) as eng_read_group:precedent = gr.HTML(elem_id="ce-precedent")reasoning = gr.Markdown(elem_id="ce-reasoning")risks = gr.HTML()gr.HTML(rule("VALIDATION + G-CODE"))spine_notes = gr.Markdown()with gr.Row(equal_height=False):settings_html = gr.HTML()gcode_html = gr.HTML()confirm_btn = gr.Button("CONFIRM & PRINT", elem_id="ce-confirm", visible=False)with gr.Group(visible=False, elem_classes=["ce-card"]) as second_op_group:gr.HTML("<div class='ce-sub' style='padding:0 12px;'>A separate inspector β <b>La Forge</b> β reviews ""the plan before it prints: O'Brien is an optimist, La Forge is not.</div>")second_opinion_panel = gr.HTML()override_btn = gr.Button("PRINT ANYWAY (I'VE REVIEWED THE OBJECTION)",visible=False, elem_classes=["ce-pillbtn"])# ββββββββββββββββββββ PRINT Β· run it, iterate, grade βββββββββββββββββββββwith gr.Tab("PRINT", id="print"):1 unmodified linegr.HTML(tab_intro("Print <b>this job</b> (inherited from Build). The Engineer proposes β ""the Spine vetoes β a <b>simulated world</b> prints β the <b>Inspector ""grades</b> β policy + ledger learn. Quality compounds failβclean."))p_job = gr.HTML(job_readout(None))with gr.Group(elem_classes=["ce-card"]):gr.HTML(rule("RUN"))p_iters = gr.Slider(1, 16, value=8, step=1,label="ITERATIONS (1 = a single print)")gr.HTML("<div class='ce-sub'>Press <b>PRINT</b> (top right) to run. The Inspector ""grades each run as part of the iteration.</div>")with gr.Group(visible=False) as results_group:p_headline = gr.Markdown()with gr.Row():with gr.Column(scale=3):gr.HTML(rule("QUALITY PER ITERATION"))p_curve = gr.HTML()with gr.Column(scale=2):gr.HTML(rule("ITERATION LOG"))p_log = gr.HTML()gr.HTML(rule("LEARNED POLICY CELL"))p_policy = gr.HTML()gr.HTML(rule("OUTCOME"))outcome_panel = gr.HTML()# compact secondary zone (~20%): log a REAL print back into the ledgerwith gr.Row(elem_classes=["ce-card"]):with gr.Column(scale=1):29 unmodified lines# ββ wiring ββreset_outs = _reset_outputs(ledger_panel, node_cards, review_summary, p_curve, p_policy,p_log, p_headline, outcome_panel, results_group, real_log_msg,studio_log)preview_outs = [part, model3d, part_status, part_placeholder]foot_in = [part, material, temp, humidity, bed_position]benchy_btn.click(load_benchy, None, preview_outs).then(status_footer, foot_in, [footer])19 unmodified lines# Two-step BUILD: instant loader + tab-switch, then the heavy model call (reveals# the results), then refresh the inherited-job readout on the Print tab.build_start_outs = [tabs, build_loader, build_results, to_print_btn, override_btn,second_opinion_panel, read_toggle, eng_read_group, second_op_group]build_outs = [backend, precedent, reasoning, risks, settings_html, spine_notes,gcode_html, confirm_btn, node_cards, state, vprint, vp_slider, vp_layer,build_loader, build_results]run_btn.click(build_start, [part], build_start_outs).then(build_job, [part, material, description, temp, humidity, bed_position, model_select],build_outs).then(job_readout, [state], [p_job])1 unmodified linevp_slider.change(scrub_layer, [vp_slider, part], [vp_layer])read_toggle.change(toggle_read, [read_toggle, state],[eng_read_group, second_op_group, second_opinion_panel,to_print_btn, override_btn])override_btn.click(ack_override, state, [to_print_btn, override_btn])to_print_btn.click(lambda: gr.Tabs(selected="print"), None, [tabs]).then(None, None, None, js=_SCROLL_TOP)tabs.select(job_readout, [state], [p_job])# PRINT: run the loop on THIS job (slider 1 = single print), or log a real outcome.print_outs = [results_group, p_headline, p_curve, p_log, p_policy, outcome_panel,ledger_panel, node_cards, review_summary]p_run.click(run_print, [state, p_iters], print_outs).then(None, None, None, js=_SCROLL_TOP)for btn, oc in [(b_clean, "success"), (b_sag, "failed_sag"), (b_string, "failed_stringing")]:btn.click(record_outcome, [gr.State(oc), state], [real_log_msg, ledger_panel, node_cards])17 unmodified lines18192021222324252623 unmodified lines50515253545556119 unmodified lines1761771781791801811821837 unmodified lines19119219319419519619719819920020120220325 unmodified lines22923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825931 unmodified lines2912922932942952962972982993003013023033043053063073083093103113123133143153163173183193204 unmodified lines32532632732832933033133233333433533633733850 unmodified lines38939039139239339439539610 unmodified lines40740840941041141241341441541641718 unmodified lines43643743843944044144244344444544644744844945045145245345445545645719 unmodified lines47747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751819 unmodified lines53853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561622 unmodified lines6396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007016 unmodified lines7087097107117127137141 unmodified line71671771871972072172272372472572672772872973073173273322 unmodified lines7567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118121 unmodified line8148158168178188198208218228238248258268278288298308318328338348353 unmodified lines83984084184284384484584684784814 unmodified lines8638648658668678688698708718728738748758 unmodified lines8848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379381 unmodified line94094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399429 unmodified lines1024102510261027102810291030103119 unmodified lines1051105210531054105510561057105810591060106110621 unmodified line106410651066106710681069107010711072107310741075107610771078107910801081108210831084108517 unmodified linesimport osimport randomimport timeimport uuidfrom pathlib import Pathimport gradio as gr23 unmodified linesfrom core.nodes import render_node_cardsfrom core.reflect import reflect_on_jobfrom core.spine import SpineValidatorfrom learn.loop import run_iteration, SessionResultfrom learn.policy import LearnedPolicy, cell_keyfrom core.viewer import (GEO_READS,119 unmodified linesdef reset_learnings():"""Reset the live ledger + learned policy to the curated baseline (seed + ingested),clearing this session's accumulated runs. Also clears the loaded part and hides theresult groups so the next run starts from a clean LOAD tab."""removed = LEDGER.reset_to_baseline()POLICY.reset()gr.Info(f"Reset to baseline β cleared {removed} runtime lesson(s) + the learned policy.")7 unmodified linesgr.update(visible=False), # print results_group (re-hide)"", # real_log_msgstudio_log_html(), # studio_log{"geometry": None, "mesh": None, "label": None, "read": None}, # part stategr.update(value=None, visible=False), # model3dgr.update(visible=True), # part_placeholder"", # part_statusgr.update(visible=False), # build_resultsgr.update(visible=False), # read_resultsgr.Tabs(selected="studio"), # tabs back to LOAD)25 unmodified linesdef build_start(part):"""Instant feedback when BUILD is clicked: jump to Build, reveal the slicer +virtual print preview immediately, and show the read panel in a loading statewhile the model runs. No part β stay put."""if not (part and part.get("geometry")):gr.Warning("Load a part on the BUILD tab first β quick-load Benchy, generate a primitive, or drop a mesh.")return (gr.update(),) * 13mesh = part.get("mesh")label = part.get("label") or "PART"vp_html = virtual_printer_html(mesh, caption=f"{label} Β· virtual print preview")layer_img = layer_image(mesh, 1)return (gr.Tabs(selected="build"), # tabsgr.update(visible=True), # build_results (reveal)gr.update(visible=True), # read_results (reveal, loading state)loader("READING THE PLAN Β· O'Brien is checking precedent and proposing settings"),# read_loadervp_html, # vprintgr.update(value=1), # vp_slider resetlayer_img, # vp_layergr.update(interactive=True), # to_print_btn (un-gate)gr.update(visible=False), # override_btn (hide)"", # second_opinion_panel (clear stale)gr.update(value="Engineer's Read"), # read_toggle (reset to the read)gr.update(visible=True), # eng_read_groupgr.update(visible=False), # second_op_group)31 unmodified linesdef warm_up_pending() -> str:"""Header icon stays; the warm-up intent is signaled by a toast."""gr.Info("Warming up the model (first load can take ~30s on ZeroGPU)β¦")return _model_icon()def warm_up_cb() -> str:"""After warm-up, keep the info icon in the header."""return _model_icon()def _model_icon() -> str:"""Small info-icon callout for the header row. No text β the dropdown + warm-upbutton already give enough context; the tooltip explains the backends."""return ("<span class='ce-callout' tabindex='0'>" + icon("info") + """<span class='ce-tip'>The <b>LoRA v2/v3</b> adapters serve via ZeroGPU on the Space; ""<b>Base</b> is the stock Gemma 4 E4B; <b>Modal API</b> is the remote endpoint. ""Local users: pull the LoRA from HF Hub ""(kylebrodeur/microfactory-node-lora-v2 / -v3-qat) or via ollama.</span></span>")def _model_callout() -> str:"""Legacy full-width model callout (used when more explanatory text is wanted)."""return ("<span class='ce-callout' tabindex='0'>" + icon("info") + " MODEL INFO""<span class='ce-tip'>The <b>LoRA v2/v3</b> adapters serve via ZeroGPU on the Space; "4 unmodified linesdef select_model(choice: str) -> str:"""Model switcher: apply the chosen backend, then return the info icon so theheader stays compact."""choice = choice or MODEL_OPTIONS[0]try:_apply_model_choice(choice)except Exception:passreturn _model_icon()# ββ simulated environment (this is a sim lab β conditions are generated, overridable) ββ50 unmodified linesrec = advise(job, env, retrieved, references, policy_note)spine = SPINE.check(rec.advice.settings, material)hint = steepest_overhang_hint(mesh) if geometry_type in ("overhang", "bridge") else Nonevp_html = virtual_printer_html(mesh, settings=spine.settings,caption=f"{material} Β· {geometry_type}") # init on BUILDprecedent = precedent_eval_html(retrieved, env)if retrieved:10 unmodified linesconfirm_vis = gr.update(visible=spine.requires_approval)approval_md = ("**HITL gate:** the Spine clamped a boundary setting β review, then **Confirm & Print**."if spine.requires_approval else "Within safe envelope β ready when you are.")spine_notes_text = f"{spine_md}\n\n{approval_md}" if spine_md else approval_mdsession_id = uuid.uuid4().hexstate = {"job": job.model_dump(), "env": env.model_dump(), "settings": spine.settings.model_dump(),"advice": rec.advice.model_dump(), "label": part.get("label"), "session_id": session_id,"spine_notes": spine_notes_text}# ββ field log (Space only β gated on HF_TOKEN; local/offline no-ops) ββfield_log.log_build(18 unmodified linesf"**Chief Engineer O'Brien:** {rec.advice.reasoning}", # reasoningrisk_callouts_html(rec.advice.risks, hint) + placement_callout(material, bed_position), # riskssettings_panel_html(spine.settings, material), # settings (LCARS panel)spine_notes_text, # spine notesgcode_panel_html(spine.settings, material), # g-code (LCARS panel)confirm_vis, # confirm visibilityrender_node_cards(env, working=True), # node cardsstate, # statevirtual_printer_html(mesh, settings=spine.settings,caption=f"{material} Β· {geometry_type}"), # vprint (refined caption)gr.update(value=1), # reset layer scrubberlayer_image(mesh, 1), # initial scrubbed layer"", # read_loader (clear))def _compute_second_opinion(state):"""Run the Inspector (La Forge) critique once. Returns the raw tuple used bythe UI: (panel_html, to_print_update, override_update)."""if not state or "advice" not in state:return ("<div class='ce-sub'>Build a job first β then I'll give the plan a second look.</div>",gr.update(interactive=True), gr.update(visible=False))19 unmodified linesreturn panel, gr.update(interactive=True), gr.update(visible=False)def second_opinion(state):"""Idempotent wrapper: if La Forge already weighed in on this build, return thecached verdict; otherwise compute it once and store it in state."""if state and state.get("second_opinion"):return state["second_opinion"]result = _compute_second_opinion(state)if state:state["second_opinion"] = resultreturn resultdef toggle_read(choice, state):"""Segmented toggle on Build: flip between Engineer's Read and Second Opinion,showing one panel at a time. The opinion is computed lazily on first reveal andthen cached for the rest of the build. While it computes, the Second Opinion panelshows a mini-loader so the user knows La Forge is reviewing the plan."""if str(choice).lower().startswith("engineer"):yield (gr.update(visible=True), gr.update(visible=False),"", gr.update(), gr.update(), state)returncached = state.get("second_opinion") if state else Noneif cached:panel, to_print, override = cachedyield (gr.update(visible=False), gr.update(visible=True), panel, to_print, override, state)return# show in-place loader while the Inspector runsyield (gr.update(visible=False), gr.update(visible=True),loader("CONSULTING LA FORGE", stages=["reading the engineer's plan","checking precedent and risks","comparing settings to the safe envelope","drafting the pre-print verdict",]), gr.update(interactive=True), gr.update(visible=False), state)panel, to_print, override = _compute_second_opinion(state)state = (state or {}) | {"second_opinion": (panel, to_print, override)}yield (gr.update(visible=False), gr.update(visible=True), panel, to_print, override, state)def ack_override(state):19 unmodified linesf"{icon('printer')} {PRINTER}</div>")def plan_card_html(state):"""THE PLAN card: Spine-validated proposed settings + Spine notes for the current job."""if not state or "settings" not in state:return ("<div class='ce-sub'>No plan built yet. Go to <b>BUILD</b> β define a part β ""<b>SLICE</b>, then return here to print it.</div>")settings = PrintSettings(**state["settings"])material = state["job"]["material"]html = settings_panel_html(settings, material)notes = state.get("spine_notes") or ""if notes:html += ("<div class='ce-sub' style='margin-top:6px;'>" +notes.replace("\n", "<br>") + "</div>")return htmldef plan_verdict_html(state):"""La Forge's pre-print stance if already computed on the SLICE tab."""if not state or "settings" not in state:return ("<div class='ce-sub'>Build a job first to get La Forge's pre-print stance.</div>")cached = state.get("second_opinion")if cached:return cached[0]return ("<div class='ce-sub'>" + icon("search") +" Run the Inspector (<b>Second Opinion</b>) on the SLICE tab for a pre-print stance.</div>")def _print_plan_values(state):"""Return the Engineer's proposed settings values (or safe defaults) for VARY sliders."""defaults = {"nozzle_temp": 200, "bed_temp": 60, "fan_pct": 80, "retraction_mm": 4.5}if not state or "settings" not in state:return defaultss = state["settings"]return {k: s.get(k, defaults[k]) for k in defaults}def apply_overrides(state, nozzle, bed, fan, retract):"""Compare VARY slider values to the Engineer's plan. If anything changed, build anoverride PrintSettings and log that the operator defied the plan. Returns the overridedict (or None when the plan is unchanged)."""if not state or "settings" not in state:return Noneplan = PrintSettings(**state["settings"])diffs = {}if abs(float(nozzle) - plan.nozzle_temp) > 1e-6:diffs["nozzle_temp"] = float(nozzle)if abs(float(bed) - plan.bed_temp) > 1e-6:diffs["bed_temp"] = float(bed)if abs(float(fan) - plan.fan_pct) > 1e-6:diffs["fan_pct"] = float(fan)if abs(float(retract) - plan.retraction_mm) > 1e-6:diffs["retraction_mm"] = float(retract)if not diffs:state.pop("print_overrides", None)return Noneoverrides = plan.model_copy(update=diffs)state["print_overrides"] = overrides.model_dump()job = Job(**state["job"])env = Environment(**state["env"])field_log.log_event("print_override", {"material": job.material, "geometry": job.geometry_type,"env_temp": env.temp, "env_humidity": env.humidity,"settings": overrides.model_dump(),})if state.get("session_id"):deliberation_log.log_turns(state["session_id"], "preflight", [{"agent": "Operator", "act": "override","content": (f"Overrode the Engineer: nozzle {overrides.nozzle_temp:.0f}Β°C, "f"bed {overrides.bed_temp:.0f}Β°C, fan {overrides.fan_pct:.0f}%, "f"retraction {overrides.retraction_mm:.1f}mm.")},], _delib_ctx(job, env))return overrides.model_dump()def _simulated_result_panel(sess, run_summary, material, geometry_type, env, label) -> str:"""Two-zone outcome β the dominant SIMULATED RESULT zone (the compact LOG A REALPRINT zone is static UI below). Shows the final outcome, the climb, whether the22 unmodified lines)def run_print(state, iterations, nozzle, bed, fan, retract, progress=gr.Progress()):"""PRINT: run THIS job (inherited from Build) through the closed loop.Now a generator so the iteration log + quality chart + policy cell fill inlive as each iteration completes. Per-iteration timing is shown next to each row."""if not state or "job" not in state:gr.Warning("Build a job first (BUILD β SLICE), then print it here.")yield (gr.update(),) * 9returnjob = Job(**state["job"])env = Environment(**state["env"])material, geometry_type = job.material, job.geometry_typekey = cell_key(material, geometry_type, env)before_html = policy_cell_html(POLICY.cell_stats(material, geometry_type, env), key)overrides_dict = apply_overrides(state, nozzle, bed, fan, retract)overrides = PrintSettings(**overrides_dict) if overrides_dict else Nonerecords, verdicts, timings = [], [], []n_iters = int(iterations)start_iter = time.perf_counter()for i in range(1, n_iters + 1):progress(i / n_iters, desc=f"Iteration {i}/{n_iters}")record = run_iteration(job, env, POLICY, LEDGER, i, overrides=overrides)verdict = inspector.grade_iteration(geometry_type, record.result)elapsed = time.perf_counter() - start_iterstart_iter = time.perf_counter()records.append(record)verdicts.append(verdict)timings.append(elapsed)yield (gr.update(visible=True), # results_group"", # outcome_panel"", # p_headlinequality_curve_html([r.result.quality for r in records]), # p_curveiteration_log_html(records, verdicts, timings), # p_logpolicy_cell_html(POLICY.cell_stats(material, geometry_type, env), key), # p_policygr.update(), # ledger_panelgr.update(), # node_cards"", # review_summary)after = POLICY.cell_stats(material, geometry_type, env)run_summary = inspector.summarize_run(records, material=material, geometry=geometry_type)traj = [r.result.quality for r in records]first = next((r.n for r in records if r.result.outcome == "success"), None)field_log.log_event("print_run", {"material": material, "geometry": geometry_type,"env_temp": env.temp, "env_humidity": env.humidity,"iterations": len(records), "q_start": round(traj[0], 3),"q_end": round(traj[-1], 3), "first_clean": first,"inspector_stance": run_summary.stance,"used_override": overrides is not None,"override_settings": overrides.model_dump() if overrides else None})# ββ deliberation log: World simulates -> La Forge grades, per iteration; then verdict ββctx = _delib_ctx(job, env)loop_turns = []for r, g in zip(records, verdicts):clamp = " (Spine clamped a setting)" if r.clamped else ""loop_turns.append({"agent": "World", "act": "simulate", "stance": r.result.outcome,"content": f"Iteration {r.n}: {r.result.detail}.{clamp} Policy: {r.learned}."})6 unmodified lines], ctx)headline = (f"**{state.get('label') or geometry_type} Β· {material} @ {env.temp:.0f}Β°C / {env.humidity:.0f}% RH** β "f"started at quality **{traj[0]:.2f}** ({records[0].result.outcome}); "+ (f"first clean print at **iteration {first}**, now **{traj[-1]:.2f}**."if first else f"still improving β best **{max(traj):.2f}** after {len(traj)} runs.")+ " The Engineer proposed; a separate simulated world reported the outcome; the **Inspector** "1 unmodified line)policy_html = (f"{before_html}<div style='text-align:center;color:var(--ao-orange);font-size:11px;"f"letter-spacing:2px;'>{icon('arrow')} LEARNED</div>{policy_cell_html(after, key)}")outcome = _simulated_result_panel(SessionResult(job=job, env=env, records=records),run_summary, material, geometry_type, env, state.get("label"))yield (gr.update(visible=True), # results_groupoutcome, # outcome_panelheadline, # p_headlinequality_curve_html(traj), # p_curveiteration_log_html(records, verdicts, timings), # p_logpolicy_html, # p_policyledger_html(), # ledger_panelrender_node_cards(env, working=False), # node_cardsinspector_panel(run_summary, label="LA FORGE Β· RUN VERDICT"), # review_summary)22 unmodified linesdef _action_bar(reset_btn_label="RESET", primary_label=None, primary_variant="primary",primary_id=None, primary_arrow=True):"""Build the consistent top-right action bar (small primary + persistent Reset).Both buttons are scale=0 so they DON'T stretch full-width. Primary buttons geta right-side arrow icon by default to signal "proceed to next stage"."""with gr.Row(elem_classes=["ce-actionbar"]):reset = gr.Button(reset_btn_label, elem_classes=["ce-pillbtn", "ce-act"], scale=0)primary = Noneif primary_label:primary_classes = ["ce-act"]if primary_arrow:primary_classes.append("ce-icon-arrow-after")primary = gr.Button(primary_label, variant=primary_variant,elem_classes=primary_classes, elem_id=primary_id, scale=0)return reset, primarydef refresh_print_tab(state):"""Refresh the PRINT tab's plan + verdict readouts whenever the tab is visited."""return job_readout(state), plan_card_html(state), plan_verdict_html(state)def open_vary_panel(state):"""Open the VARY override panel and seed the sliders with the Engineer's plan."""vals = _print_plan_values(state)return (gr.update(visible=True),gr.update(value=vals["nozzle_temp"]),gr.update(value=vals["bed_temp"]),gr.update(value=vals["fan_pct"]),gr.update(value=vals["retraction_mm"]))# outputs touched by Reset (shared by the persistent Reset on every tab)def _reset_outputs(ledger_panel, node_cards, review_summary, p_curve, p_policy, p_log,p_headline, outcome_panel, results_group, real_log_msg, studio_log,part, model3d, part_placeholder, part_status, build_results,read_results, tabs):return [ledger_panel, node_cards, review_summary, p_curve, p_policy, p_log,p_headline, outcome_panel, results_group, real_log_msg, studio_log,part, model3d, part_placeholder, part_status, build_results, read_results, tabs]def build() -> gr.Blocks:with gr.Blocks(title="Microfactory Node: 3D Printer") as demo:gr.HTML(command_bar(llm.backend_status()))# header row: dropdown + warm button + info icon only (NO background tints, NO stretching)with gr.Row(elem_id="ce-modelswitch"):model_select = gr.Dropdown(MODEL_OPTIONS, value=MODEL_OPTIONS[0],show_label=False, container=False,elem_classes=["ce-modeldd"], scale=0)warm_btn = gr.Button("WARM UP", elem_classes=["ce-pillbtn", "ce-icon-bolt"], scale=0)model_status = gr.HTML(_model_icon(), elem_classes=["ce-status-inline"])state = gr.State()part = gr.State({"geometry": None, "mesh": None, "label": None, "read": None})1 unmodified linewith gr.Tabs() as tabs:# βββββββββββββββββββββββββ BUILD Β· define the job ββββββββββββββββββββββββwith gr.Tab("LOAD", id="studio"):# Top row: ENVIRONMENT + POSITION + MATERIAL readouts on the left,# RANDOMIZE / OVERRIDE / RESET / SLICE on the right.with gr.Row(elem_classes=["ce-actionbar", "ce-envbar"]):sensors_readout = gr.HTML(elem_classes=["ce-envbar-readout"])with gr.Column(elem_classes=["ce-inline-group"]):gr.HTML("<div class='ce-inline-label'>POSITION""<span class='ce-callout' tabindex='0'>" + icon("info", size=10) +"<span class='ce-tip'>edges/corners run cooler β warp/adhesion risk</span>""</span></div>")bed_position = gr.Radio(BED_POSITIONS, value="center", show_label=False,elem_classes=["ce-pills"])with gr.Column(elem_classes=["ce-inline-group"]):gr.HTML("<div class='ce-inline-label'>MATERIAL</div>")material = gr.Radio(MATERIALS, value="PLA", show_label=False, elem_classes=["ce-pills"])# spacer pushes the action buttons to the right edgegr.HTML("<div style='flex:1;'></div>")roll_btn = gr.Button("RANDOMIZE",elem_classes=["ce-pillbtn", "ce-icon-shuffle"], scale=0)gr.HTML("<button class='ce-pillbtn ce-icon-sliders' "3 unmodified lines"text-transform:uppercase;letter-spacing:.5px;font-size:12px;""font-weight:700;cursor:pointer;display:inline-flex;""align-items:center;gap:6px;'>OVERRIDE</button>")reset_s = gr.Button("RESET", elem_classes=["ce-pillbtn", "ce-act"], scale=0)run_btn = gr.Button("SLICE", variant="primary",elem_classes=["ce-act"], elem_id="ce-run", scale=0)# OVERRIDE ENVIRONMENT popup (hidden by default; toggled via JS)gr.HTML("<div class='ce-popup-backdrop' data-popup-backdrop='override'></div>")with gr.Group(elem_classes=["ce-popup"], elem_id="ce-popup-override"):14 unmodified lineswith gr.Column(scale=3, elem_classes=["ce-part-viewer-col"]):part_placeholder = gr.HTML(_viewer_placeholder())model3d = gr.Model3D(value=None, label="", height=360, visible=False)# intro + job log moved DOWN into the part areagr.HTML(tab_intro("Load the part, set the material and the room, then ""<b>SLICE</b> to read the engineer's pre-flight check. ""You give it the part, the material, and the room; it ""infers what kind of part this is."))studio_log = gr.HTML(studio_log_html())# RIGHT: dropzone + mesh-source buttons + NOTESwith gr.Column(scale=1, elem_classes=["ce-part-actions-col"]):mesh_in = gr.File(file_types=[".stl", ".glb", ".obj"],label="UPLOAD MESH", show_label=False,8 unmodified linesshow_label=False, elem_classes=["ce-pills"])gen_size = gr.Number(value=30, label="SIZE (mm)", elem_classes=["ce-num"])gen_btn = gr.Button("GENERATE", elem_classes=["ce-pillbtn"], scale=0)description = gr.Textbox(label="NOTES (OPTIONAL)",placeholder="e.g. 45Β° bracket, 60mm tall",elem_classes=["ce-notes-inline"])# βββββββββββββββββ SLICE Β· slice + analyze + pre-flight check βββββββββββββwith gr.Tab("SLICE", id="build"):reset_b, to_print_btn = _action_bar(primary_label="PRINT (RUN ITERATIONS)")gr.HTML(tab_intro("The pre-flight check, <b>before it prints</b>: slice the part, read ""precedent, flag failures, and get a second opinion. Then β PRINT."))with gr.Group(visible=False, elem_classes=["ce-part-card"]) as build_results:# slice + motion preview side by side β grouped like LOAD's PART cardgr.HTML(rule("SLICE Β· CROSS-SECTION"))with gr.Row(equal_height=False, elem_classes=["ce-part-row"]):with gr.Column(scale=3):vp_layer = gr.Image(label="", height=360, show_label=False)with gr.Column(scale=1, elem_classes=["ce-vp"]):gr.HTML(rule("MOTION PREVIEW"))vprint = gr.HTML()with gr.Column(elem_classes=["ce-hslider"]):vp_slider = gr.Slider(1, SCRUB_LAYERS, value=1, step=1,show_label=False, container=False)gr.HTML("<div class='ce-sub' style='padding:0 12px;'>Scrub through real cross-sections of ""<i>this</i> part at full mesh fidelity. The preview animates the layer rise ""while the read loads below.</div>")# Engineer's Read β Second Opinion (one panel at a time)with gr.Group(visible=False, elem_classes=["ce-card"]) as read_results:backend = gr.Markdown()gr.HTML(rule("THE READ"))read_loader = gr.HTML()read_toggle = gr.Radio(["Engineer's Read", "Second Opinion"],value="Engineer's Read", show_label=False,elem_classes=["ce-seg"])with gr.Group(visible=True, elem_classes=["ce-card"]) as eng_read_group:precedent = gr.HTML(elem_id="ce-precedent")reasoning = gr.Markdown(elem_id="ce-reasoning")risks = gr.HTML()gr.HTML(rule("VALIDATION + G-CODE"))spine_notes = gr.Markdown()with gr.Row(equal_height=False):settings_html = gr.HTML()gcode_html = gr.HTML()confirm_btn = gr.Button("CONFIRM & PRINT", elem_id="ce-confirm", visible=False)with gr.Group(visible=False, elem_classes=["ce-card"]) as second_op_group:gr.HTML("<div class='ce-sub' style='padding:0 12px;'>A separate inspector β <b>La Forge</b> β reviews ""the plan before it prints: O'Brien is an optimist, La Forge is not.</div>")second_opinion_panel = gr.HTML()override_btn = gr.Button("PRINT ANYWAY (I'VE REVIEWED THE OBJECTION)",visible=False, elem_classes=["ce-pillbtn"])# ββββββββββββββββββββ PRINT Β· run it, iterate, grade βββββββββββββββββββββwith gr.Tab("PRINT", id="print"):1 unmodified linegr.HTML(tab_intro("Print <b>this job</b> (inherited from Build). The Engineer proposes β ""the Spine vetoes β a <b>simulated world</b> prints β the <b>Inspector ""grades</b> β policy + ledger learn. Quality compounds failβclean."))# ENVBAR: job readout | iteration chip | VARYwith gr.Row(elem_classes=["ce-actionbar", "ce-envbar"]):p_job = gr.HTML(job_readout(None), elem_classes=["ce-envbar-readout"])p_iter_readout = gr.HTML("<div class='ce-sub' style='text-align:center;'><b>8</b> ITERATIONS</div>")gr.HTML("<div style='flex:1;'></div>")vary_btn = gr.Button("VARY", elem_classes=["ce-pillbtn"], scale=0)# THE PLAN cardwith gr.Group(elem_classes=["ce-card"]) as plan_card:gr.HTML(rule("THE PLAN"))plan_settings = gr.HTML()plan_verdict = gr.HTML()# ITERATIONS hslider + explainerwith gr.Column(elem_classes=["ce-hslider"]):p_iters = gr.Slider(1, 16, value=8, step=1, show_label=False, container=False)gr.HTML("<div class='ce-sub' style='margin:-8px 0 10px;'>""1 = single print Β· 4 = quick convergence Β· 8 = balanced climb Β· 16 = full convergence run""</div>")# VARY override panelwith gr.Group(visible=False, elem_classes=["ce-card"]) as vary_group:gr.HTML(rule("OPERATOR OVERRIDE"))gr.HTML("<div class='ce-sub' style='border-left:3px solid var(--ao-red);padding:6px 10px;'>"+ icon("alert") + " You are overriding the Engineer's plan. The run will use ""these settings instead of the Spine-validated proposal.</div>")with gr.Row():p_nozzle = gr.Slider(150, 300, value=200, step=1,label="NOZZLE Β°C", elem_classes=["ce-num"])p_bed = gr.Slider(40, 120, value=60, step=1,label="BED Β°C", elem_classes=["ce-num"])p_fan = gr.Slider(0, 100, value=80, step=1,label="FAN %", elem_classes=["ce-num"])p_retract = gr.Slider(0, 10, value=4.5, step=0.1,label="RETRACTION mm", elem_classes=["ce-num"])reset_plan_btn = gr.Button("RESET TO ENGINEER'S PLAN", elem_classes=["ce-pillbtn"])with gr.Group(visible=False) as results_group:gr.HTML(rule("OUTCOME"))outcome_panel = gr.HTML()p_headline = gr.Markdown()gr.HTML(rule("QUALITY PER ITERATION"))p_curve = gr.HTML()gr.HTML(rule("ITERATION LOG"))p_log = gr.HTML()gr.HTML(rule("LEARNED POLICY CELL"))p_policy = gr.HTML()# compact secondary zone (~20%): log a REAL print back into the ledgerwith gr.Row(elem_classes=["ce-card"]):with gr.Column(scale=1):29 unmodified lines# ββ wiring ββreset_outs = _reset_outputs(ledger_panel, node_cards, review_summary, p_curve, p_policy,p_log, p_headline, outcome_panel, results_group, real_log_msg,studio_log, part, model3d, part_placeholder, part_status,build_results, read_results, tabs)preview_outs = [part, model3d, part_status, part_placeholder]foot_in = [part, material, temp, humidity, bed_position]benchy_btn.click(load_benchy, None, preview_outs).then(status_footer, foot_in, [footer])19 unmodified lines# Two-step BUILD: instant loader + tab-switch, then the heavy model call (reveals# the results), then refresh the inherited-job readout on the Print tab.build_start_outs = [tabs, build_results, read_results, read_loader, vprint, vp_slider,vp_layer, to_print_btn, override_btn, second_opinion_panel,read_toggle, eng_read_group, second_op_group]build_outs = [backend, precedent, reasoning, risks, settings_html, spine_notes,gcode_html, confirm_btn, node_cards, state, vprint, vp_slider, vp_layer,read_loader]run_btn.click(build_start, [part], build_start_outs).then(build_job, [part, material, description, temp, humidity, bed_position, model_select],build_outs).then(job_readout, [state], [p_job])1 unmodified linevp_slider.change(scrub_layer, [vp_slider, part], [vp_layer])read_toggle.change(toggle_read, [read_toggle, state],[eng_read_group, second_op_group, second_opinion_panel,to_print_btn, override_btn, state])override_btn.click(ack_override, state, [to_print_btn, override_btn])to_print_btn.click(lambda: gr.Tabs(selected="print"), None, [tabs]).then(None, None, None, js=_SCROLL_TOP)tabs.select(refresh_print_tab, [state], [p_job, plan_settings, plan_verdict])# PRINT: run the loop on THIS job (slider 1 = single print), or log a real outcome.print_outs = [results_group, outcome_panel, p_headline, p_curve, p_log, p_policy,ledger_panel, node_cards, review_summary]p_run.click(lambda: gr.update(visible=False), None, [vary_group]).then(run_print, [state, p_iters, p_nozzle, p_bed, p_fan, p_retract], print_outs).then(None, None, None, js=_SCROLL_TOP)p_iters.change(lambda v: f"<div class='ce-sub' style='text-align:center;'><b>{int(v)}</b> ITERATIONS</div>",[p_iters], [p_iter_readout])vary_btn.click(open_vary_panel, [state], [vary_group, p_nozzle, p_bed, p_fan, p_retract])reset_plan_btn.click(open_vary_panel, [state], [vary_group, p_nozzle, p_bed, p_fan, p_retract])for btn, oc in [(b_clean, "success"), (b_sag, "failed_sag"), (b_string, "failed_stringing")]:btn.click(record_outcome, [gr.State(oc), state], [real_log_msg, ledger_panel, node_cards])
15 unmodified lines1617181920212223242515 unmodified lines# Conservative per-material starting points for the offline/parse-fail fallback._FALLBACK_SETTINGS: dict[str, dict[str, float]] = {"PLA": {"nozzle_temp": 205, "bed_temp": 60, "retraction_mm": 5, "fan_pct": 100, "first_layer_fan_pct": 0},"PETG": {"nozzle_temp": 235, "bed_temp": 80, "retraction_mm": 4, "fan_pct": 40, "first_layer_fan_pct": 0},"ABS": {"nozzle_temp": 245, "bed_temp": 100, "retraction_mm": 4, "fan_pct": 20, "first_layer_fan_pct": 0},"TPU": {"nozzle_temp": 228, "bed_temp": 50, "retraction_mm": 2, "fan_pct": 40, "first_layer_fan_pct": 0},}_GEOMETRY_RISK = {"overhang": ("underside of the overhang", "sag", "steep overhangs droop before the layer freezes", "overhang"),15 unmodified lines1617181920212223242515 unmodified lines# Conservative per-material starting points for the offline/parse-fail fallback._FALLBACK_SETTINGS: dict[str, dict[str, float]] = {"PLA": {"nozzle_temp": 205, "bed_temp": 60, "retraction_mm": 5, "fan_pct": 100, "first_layer_fan_pct": 0, "layer_height": 0.20},"PETG": {"nozzle_temp": 235, "bed_temp": 80, "retraction_mm": 4, "fan_pct": 40, "first_layer_fan_pct": 0, "layer_height": 0.20},"ABS": {"nozzle_temp": 245, "bed_temp": 100, "retraction_mm": 4, "fan_pct": 20, "first_layer_fan_pct": 0, "layer_height": 0.20},"TPU": {"nozzle_temp": 228, "bed_temp": 50, "retraction_mm": 2, "fan_pct": 40, "first_layer_fan_pct": 0, "layer_height": 0.24},}_GEOMETRY_RISK = {"overhang": ("underside of the overhang", "sag", "steep overhangs droop before the layer freezes", "overhang"),
36 unmodified lines37383940414236 unmodified linesretraction_mm: floatfan_pct: floatfirst_layer_fan_pct: floatclass RiskRegion(BaseModel):36 unmodified lines3738394041424336 unmodified linesretraction_mm: floatfan_pct: floatfirst_layer_fan_pct: floatlayer_height: float = 0.2 # mm β drives virtual-print preview cross-sectionsclass RiskRegion(BaseModel):
26 unmodified lines2728293031323326 unmodified lines"reasoning": "2-4 sentences. START with your evaluation of the prior jobs: what transfers, what doesn't, and why. Then the decision.","settings": {"nozzle_temp": <C>, "bed_temp": <C>, "retraction_mm": <mm>,"fan_pct": <0-100>, "first_layer_fan_pct": <0-100>},"risks": [{"location": "where on the part", "risk": "sag|stringing|adhesion|warping|delamination",26 unmodified lines2728293031323326 unmodified lines"reasoning": "2-4 sentences. START with your evaluation of the prior jobs: what transfers, what doesn't, and why. Then the decision.","settings": {"nozzle_temp": <C>, "bed_temp": <C>, "retraction_mm": <mm>,"fan_pct": <0-100>, "first_layer_fan_pct": <0-100>, "layer_height": <mm, e.g. 0.12-0.28>},"risks": [{"location": "where on the part", "risk": "sag|stringing|adhesion|warping|delamination",
22 unmodified lines23242526272822 unmodified lines"retraction_mm": (0.5, 8.0),"fan_pct": (0.0, 100.0),"first_layer_fan_pct": (0.0, 30.0),}22 unmodified lines2324252627282922 unmodified lines"retraction_mm": (0.5, 8.0),"fan_pct": (0.0, 100.0),"first_layer_fan_pct": (0.0, 30.0),"layer_height": (0.08, 0.60),}
201 unmodified lines202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232352 unmodified lines585586587588589590125 unmodified lines716717718719720721201 unmodified lines.ce-icon-arrow::before {{ -webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14 M13 5l7 7-7 7'/></svg>"); mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14 M13 5l7 7-7 7'/></svg>"); }}/* Arrow AFTER text (right-side icon β indicates "next step"). For buttons whoselabel means "proceed to next stage" (SLICE β, PRINT β, REFRESH β). */.ce-icon-arrow-after::after {{content:""; display:inline-block; width:14px; height:14px;margin-left:8px; vertical-align:-2px;background:currentColor; -webkit-mask-size:contain; mask-size:contain;-webkit-mask-repeat:no-repeat; mask-repeat:no-repeat;-webkit-mask-position:center; mask-position:center;-webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14 M13 5l7 7-7 7'/></svg>");mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14 M13 5l7 7-7 7'/></svg>");}}/* Inside a Gradio button the label is nested in a <span> β attach to button sothe ::after lands at the end of the visible label, not after the wrapper. */.ce-icon-arrow-after button::after, button.ce-icon-arrow-after::after {{content:""; display:inline-block; width:14px; height:14px;margin-left:8px; vertical-align:-2px;background:currentColor; -webkit-mask-size:contain; mask-size:contain;-webkit-mask-repeat:no-repeat; mask-repeat:no-repeat;-webkit-mask-position:center; mask-position:center;-webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14 M13 5l7 7-7 7'/></svg>");mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14 M13 5l7 7-7 7'/></svg>");}}/* But ALSO put one inside the inner span so it appears flush with the label text */.ce-icon-arrow-after button span::after {{content:"\2192"; margin-left:6px; font-weight:900; opacity:.95;}}/* ββ TAB ICONS (CSS-only via :nth-child on the four workflow tabs) ββ *//* Tab bar order is fixed: LOAD Β· SLICE Β· PRINT Β· REVIEW. Each gets its own icon352 unmodified lines/* model switcher pills sit in the header row β KEEP concise, don't conflict with main rule */#ce-modelswitch .ce-seg label {{ font-size:11px !important; padding:5px 12px !important; }}/* hover callout (info icon next to the model switcher) */.ce-callout { position:relative; display:inline-flex; align-items:center; gap:4px; cursor:help;color:var(--ao-orange); font-size:11px; letter-spacing:1px; text-transform:uppercase; }125 unmodified lines"thermo": ("M14 14V5a2 2 0 10-4 0v9a4 4 0 104 0z", False),"droplet": ("M12 2.5C12 2.5 5 10 5 14a7 7 0 0014 0c0-4-7-11.5-7-11.5z", False),"target": ("M12 2v3 M12 19v3 M2 12h3 M19 12h3 M12 7a5 5 0 100 10 5 5 0 000-10z", False),"printer": ("M6 9V2h12v7 M6 18H4a2 2 0 01-2-2v-4a2 2 0 012-2h16a2 2 0 012 2v4a2 2 0 01-2 2h-2 ""M6 14h12v8H6z", False),"play": ("M6 4l14 8-14 8V4z", True),201 unmodified lines202203204205206207208209210211212213214215216217218219220221352 unmodified lines574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621125 unmodified lines747748749750751752753754201 unmodified lines.ce-icon-arrow::before {{ -webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14 M13 5l7 7-7 7'/></svg>"); mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14 M13 5l7 7-7 7'/></svg>"); }}/* Arrow AFTER text (right-side icon β indicates "next step"). For buttons whoselabel means "proceed to next stage" (SLICE β, PRINT β, REFRESH β).Gradio wraps each button in a .wrap; elem_classes lands on that wrapper, so wetarget the label <span> inside the <button> and append the arrow as an SVGmask-image pseudo-element. */.ce-icon-arrow-after button {{ display:inline-flex !important; align-items:center !important; gap:4px !important; }}.ce-icon-arrow-after button span::after {{content:""; display:inline-block; width:14px; height:14px; flex:0 0 14px;margin-left:4px; vertical-align:-2px;background:currentColor; -webkit-mask-size:contain; mask-size:contain;-webkit-mask-repeat:no-repeat; mask-repeat:no-repeat;-webkit-mask-position:center; mask-position:center;-webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14 M13 5l7 7-7 7'/></svg>");mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14 M13 5l7 7-7 7'/></svg>");}}/* ββ TAB ICONS (CSS-only via :nth-child on the four workflow tabs) ββ *//* Tab bar order is fixed: LOAD Β· SLICE Β· PRINT Β· REVIEW. Each gets its own icon352 unmodified lines/* model switcher pills sit in the header row β KEEP concise, don't conflict with main rule */#ce-modelswitch .ce-seg label {{ font-size:11px !important; padding:5px 12px !important; }}/* compact inline pill groups inside the envbar (BUILD-PLATE POSITION + MATERIAL) */.ce-envbar .ce-inline-group { display:flex !important; flex-direction:column !important;gap:3px !important; margin:0 10px !important; }.ce-envbar .ce-inline-label { color:var(--ao-orange); font-size:10px !important;letter-spacing:1.5px; text-transform:uppercase; font-weight:700;display:flex !important; align-items:center !important; gap:4px; }.ce-envbar .ce-inline-label .ce-callout { font-size:10px !important; }.ce-envbar .ce-inline-label .ce-tip { width:280px; top:120%; }/* inline pills are smaller than the full-width ones */.ce-envbar .ce-pills label { padding:4px 10px !important; font-size:11px !important; }.ce-envbar .ce-pills label span { display:inline-flex !important; align-items:center !important;gap:5px !important; }/* pill icons by value (small, before the label text) */.ce-pills label:has(input[value="center"]) span::before,.ce-pills label:has(input[value="edge"]) span::before,.ce-pills label:has(input[value="corner"]) span::before,.ce-pills label:has(input[value="PLA"]) span::before,.ce-pills label:has(input[value="PETG"]) span::before,.ce-pills label:has(input[value="ABS"]) span::before,.ce-pills label:has(input[value="TPU"]) span::before {content:""; display:inline-block; width:11px; height:11px; flex:0 0 11px;background:currentColor; -webkit-mask-size:contain; mask-size:contain;-webkit-mask-repeat:no-repeat; mask-repeat:no-repeat;-webkit-mask-position:center; mask-position:center; }.ce-pills label:has(input[value="center"]) span::before {-webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 2v3 M12 19v3 M2 12h3 M19 12h3 M12 7a5 5 0 100 10 5 5 0 000-10z'/></svg>");mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 2v3 M12 19v3 M2 12h3 M19 12h3 M12 7a5 5 0 100 10 5 5 0 000-10z'/></svg>"); }.ce-pills label:has(input[value="edge"]) span::before {-webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 4h16v16H4z M4 4v16'/></svg>");mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 4h16v16H4z M4 4v16'/></svg>"); }.ce-pills label:has(input[value="corner"]) span::before {-webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 4h16v16H4z M4 4v7 M4 4h7'/></svg>");mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 4h16v16H4z M4 4v7 M4 4h7'/></svg>"); }.ce-pills label:has(input[value="PLA"]) span::before,.ce-pills label:has(input[value="PETG"]) span::before,.ce-pills label:has(input[value="ABS"]) span::before,.ce-pills label:has(input[value="TPU"]) span::before {-webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 2.5C12 2.5 5 10 5 14a7 7 0 0014 0c0-4-7-11.5-7-11.5z'/></svg>");mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 2.5C12 2.5 5 10 5 14a7 7 0 0014 0c0-4-7-11.5-7-11.5z'/></svg>"); }/* tighten space below the envbar so the PART card sits directly under it */.ce-envbar { margin-bottom:2px !important; }/* hover callout (info icon next to the model switcher) */.ce-callout { position:relative; display:inline-flex; align-items:center; gap:4px; cursor:help;color:var(--ao-orange); font-size:11px; letter-spacing:1px; text-transform:uppercase; }125 unmodified lines"thermo": ("M14 14V5a2 2 0 10-4 0v9a4 4 0 104 0z", False),"droplet": ("M12 2.5C12 2.5 5 10 5 14a7 7 0 0014 0c0-4-7-11.5-7-11.5z", False),"target": ("M12 2v3 M12 19v3 M2 12h3 M19 12h3 M12 7a5 5 0 100 10 5 5 0 000-10z", False),"edge": ("M4 4h16v16H4z M4 4v16", False),"corner": ("M4 4h16v16H4z M4 4v7 M4 4h7", False),"printer": ("M6 9V2h12v7 M6 18H4a2 2 0 01-2-2v-4a2 2 0 012-2h16a2 2 0 012 2v4a2 2 0 01-2 2h-2 ""M6 14h12v8H6z", False),"play": ("M6 4l14 8-14 8V4z", True),
287 unmodified lines28828929029129229334 unmodified lines3283293303313323333343353362 unmodified lines3393403413423433441 unmodified line346347348349350351352287 unmodified lines"""Short snippet whose header lines come from the proposed settings."""return "\n".join([f"; Chief Engineer β start g-code for {material} (header tied to recommendation)",f"M140 S{settings.bed_temp:.0f} ; set bed",f"M104 S{settings.nozzle_temp:.0f} ; set nozzle",f"M190 S{settings.bed_temp:.0f} ; wait for bed",34 unmodified lines)def iteration_log_html(records, verdicts=None) -> str:"""Per-iteration log. `verdicts` (optional, aligned to records) adds the QAInspector's terse grade on each run β the second voice in the loop."""rows = []for i, r in enumerate(records):clean = r.result.outcome == "success"2 unmodified linesif verdicts and i < len(verdicts) and verdicts[i] is not None:v = verdicts[i]insp = (f"<br><span style='color:{v.color};'>{icon('search')} inspector [{v.stance}]: {v.headline}</span>")rows.append(f"<div style='font-family:ui-monospace,monospace;font-size:11px;border-left:3px solid {col};"f"background:var(--ao-surface);padding:5px 10px;margin:3px 0;color:var(--ao-text);'>"1 unmodified linef"noz {r.settings.nozzle_temp:.0f}Β°C bed {r.settings.bed_temp:.0f}Β°C fan {r.settings.fan_pct:.0f}% "f"ret {r.settings.retraction_mm:.1f}mm"+ (" Β· <span style='color:var(--ao-orange);'>spine-clamped</span>" if r.clamped else "")+ f"<br><span style='color:var(--ao-outline);'>β³ {r.learned}</span>{insp}</div>")return "".join(rows)287 unmodified lines28828929029129229329434 unmodified lines3293303313323333343353363373382 unmodified lines3413423433443453463473483493501 unmodified line352353354355356357358287 unmodified lines"""Short snippet whose header lines come from the proposed settings."""return "\n".join([f"; Chief Engineer β start g-code for {material} (header tied to recommendation)",f"; layer height {settings.layer_height:.2f} mm",f"M140 S{settings.bed_temp:.0f} ; set bed",f"M104 S{settings.nozzle_temp:.0f} ; set nozzle",f"M190 S{settings.bed_temp:.0f} ; wait for bed",34 unmodified lines)def iteration_log_html(records, verdicts=None, timings=None) -> str:"""Per-iteration log. `verdicts` (optional, aligned to records) adds the QAInspector's terse grade on each run β the second voice in the loop.`timings` (optional, aligned to records) adds per-iteration elapsed ms."""rows = []for i, r in enumerate(records):clean = r.result.outcome == "success"2 unmodified linesif verdicts and i < len(verdicts) and verdicts[i] is not None:v = verdicts[i]insp = (f"<br><span style='color:{v.color};'>{icon('search')} inspector [{v.stance}]: {v.headline}</span>")timing = ""if timings and i < len(timings):timing = (f"<span style='float:right;color:var(--ao-outline);'>"f"+{timings[i]*1000:.0f}ms</span>")rows.append(f"<div style='font-family:ui-monospace,monospace;font-size:11px;border-left:3px solid {col};"f"background:var(--ao-surface);padding:5px 10px;margin:3px 0;color:var(--ao-text);'>"1 unmodified linef"noz {r.settings.nozzle_temp:.0f}Β°C bed {r.settings.bed_temp:.0f}Β°C fan {r.settings.fan_pct:.0f}% "f"ret {r.settings.retraction_mm:.1f}mm"+ (" Β· <span style='color:var(--ao-orange);'>spine-clamped</span>" if r.clamped else "")+ f"{timing}<br><span style='color:var(--ao-outline);'>β³ {r.learned}</span>{insp}</div>")return "".join(rows)
19 unmodified lines20212223242526107 unmodified lines13413513613713813914014114214314414514614714814915015115215315415519 unmodified lines_ISO = 0.55 # oblique projection skew, matches sim/virtual_printerdef _projected_layers(mesh_path: str | Path, layer_height_mm: float = 0.8,max_layers: int = 44, max_segs_per_layer: int = 520) -> dict:"""Slice the mesh and return projected 2D polylines per layer + bounds.107 unmodified linesreturn np.asarray(img)def virtual_printer_html(mesh_path: str | Path | None, caption: str = "") -> str:"""A live virtual-printer canvas for the cockpit (animated by VP_JS)."""if not mesh_path or not Path(str(mesh_path)).exists():return ("<div class='ce-rule'>VIRTUAL PRINT</div>""<div class='ce-sub'>run a recommendation to slice the part β</div>")data = _projected_layers(mesh_path)if not data:return ("<div class='ce-rule'>VIRTUAL PRINT</div>""<div class='ce-sub'>mesh too thin to slice.</div>")payload = json.dumps(data).replace("'", "'")return ("<div class='ce-rule'>VIRTUAL PRINT</div>""<div style='border:1px solid var(--ao-outline-dim);background:#0a0c14;'>"f"<canvas class='ce-vp' width='520' height='300' data-vp='{payload}' ""style='width:100%;height:auto;display:block;'></canvas></div>"f"<div class='ce-sub' style='margin-top:2px;'>{caption} Β· real cross-sections of ""this part, layer by layer (motion preview β not a slicer)</div>")19 unmodified lines20212223242526107 unmodified lines13413513613713813914014114214314414514614714814915015115215315415515615715815916016116216319 unmodified lines_ISO = 0.55 # oblique projection skew, matches sim/virtual_printerdef _projected_layers(mesh_path: str | Path, layer_height_mm: float = 0.2,max_layers: int = 44, max_segs_per_layer: int = 520) -> dict:"""Slice the mesh and return projected 2D polylines per layer + bounds.107 unmodified linesreturn np.asarray(img)def virtual_printer_html(mesh_path: str | Path | None,settings: "PrintSettings | None" = None,caption: str = "") -> str:"""A live virtual-printer canvas for the cockpit (animated by VP_JS).Uses the layer height from the proposed PrintSettings so the preview is tiedto the actual recommendation rather than a hard-coded default."""if not mesh_path or not Path(str(mesh_path)).exists():return ("<div class='ce-rule'>VIRTUAL PRINT</div>""<div class='ce-sub'>run a recommendation to slice the part β</div>")layer_height = settings.layer_height if settings else 0.2data = _projected_layers(mesh_path, layer_height_mm=layer_height)if not data:return ("<div class='ce-rule'>VIRTUAL PRINT</div>""<div class='ce-sub'>mesh too thin to slice.</div>")payload = json.dumps(data).replace("'", "'")lh_note = f"{layer_height:.2f} mm layers"return ("<div class='ce-rule'>VIRTUAL PRINT</div>""<div style='border:1px solid var(--ao-outline-dim);background:#0a0c14;'>"f"<canvas class='ce-vp' width='520' height='300' data-vp='{payload}' ""style='width:100%;height:auto;display:block;'></canvas></div>"f"<div class='ce-sub' style='margin-top:2px;'>{caption} Β· {lh_note} Β· real cross-sections of ""this part, layer by layer (motion preview β not a slicer)</div>")
12345678910111213141516171819202122232425262728291 unmodified line3132333435363738394041424344{"session_id": "abs-overhang-edge", "track": "preflight", "turn": 1, "agent": "O'Brien", "role": "Chief Engineer", "act": "propose", "stance": "", "content": "No close precedent exists, so I reason from ABS properties and the current environment. ABS is prone to warping and requires high thermal management; 26Β°C ambient is acceptable but not ideal. The overhang geometry demands careful temperature control to prevent sag or delamination. We must set temps aggressively to keep the plastic fluid enough for the overhang while minimizing residual stress.\nProposed: nozzle 255Β°C, bed 100Β°C, fan 30%, first-layer fan 0%, retraction 4.0mm.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:07+00:00"}{"session_id": "abs-overhang-edge", "track": "preflight", "turn": 2, "agent": "Spine", "role": "Safety Spine", "act": "veto", "stance": "clear", "content": "Within the safe envelope for this material β no clamp.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:14+00:00"}{"session_id": "abs-overhang-edge", "track": "preflight", "turn": 3, "agent": "La Forge", "role": "QA Inspector", "act": "second_opinion", "stance": "dispute", "content": "Temperatures are too aggressive and unvalidated. β The proposed high temps increase warping risk significantly, especially with unknown thermal chamber performance.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:21+00:00"}{"session_id": "abs-overhang-edge", "track": "preflight", "turn": 4, "agent": "Operator", "role": "Operator", "act": "override", "stance": "override", "content": "Acknowledged La Forge's objection. Proceeding to print on the operator's call.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:28+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 5, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "failed_sag", "content": "Iteration 1: sag (quality 0.19, dominant cost: sag). Policy: ABS/overhang/mid/humid: sag (q=0.19) β learned: fan_pct +12, nozzle_temp -3.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:35+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 6, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "confirmed", "content": "Failed on sagging β exactly as called. β Quality 0.19. The Engineer's risk flag was right; the loop now has the lesson.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:42+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 7, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "failed_sag", "content": "Iteration 2: sag (quality 0.27, dominant cost: sag). Policy: ABS/overhang/mid/humid: sag (q=0.27) β learned: fan_pct +12, nozzle_temp -3.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:49+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 8, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "confirmed", "content": "Failed on sagging β exactly as called. β Quality 0.27. The Engineer's risk flag was right; the loop now has the lesson.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:56+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 9, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "failed_sag", "content": "Iteration 3: sag (quality 0.33, dominant cost: sag). Policy: ABS/overhang/mid/humid: sag (q=0.33) β learned: fan_pct +12, nozzle_temp -3.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:01:03+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 10, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "confirmed", "content": "Failed on sagging β exactly as called. β Quality 0.33. The Engineer's risk flag was right; the loop now has the lesson.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:01:10+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 11, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "failed_sag", "content": "Iteration 4: warp (quality 0.34, dominant cost: warp). Policy: ABS/overhang/mid/humid: warp (q=0.34) β learned: fan_pct -10.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:01:17+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 12, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "missed", "content": "Failed on warping β and it wasn't flagged. β Quality 0.34. The Engineer didn't predict this mode. That gap is what the next iteration has to close.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:01:24+00:00"}{"session_id": "abs-overhang-edge", "track": "review", "turn": 13, "agent": "La Forge", "role": "QA Inspector", "act": "verdict", "stance": "caution", "content": "Improving but not yet clean (best 0.34). β Quality rose 0.19 β 0.34 over 4 runs but never crossed the bar. More iterations or a different lever needed β the loop is learning, slowly.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:01:31+00:00"}{"session_id": "petg-overhang-center", "track": "preflight", "turn": 1, "agent": "O'Brien", "role": "Chief Engineer", "act": "propose", "stance": "", "content": "The prior job [1] is the closest precedent, involving PETG and an overhang. The lesson learnedβthat PETG needs a cooling compromiseβis critical here. I will maintain the fan settings from that job's failure analysis (60-70% over overhang) because it directly addresses the material/geometry interaction. Since the environment (24Β°C, 55% RH) is very close to the precedent's conditions, the core temperature and cooling strategy remains valid.\nProposed: nozzle 245Β°C, bed 85Β°C, fan 65%, first-layer fan 0%, retraction 5.0mm.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:01:38+00:00"}{"session_id": "petg-overhang-center", "track": "preflight", "turn": 2, "agent": "Spine", "role": "Safety Spine", "act": "veto", "stance": "clear", "content": "Within the safe envelope for this material β no clamp.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:01:45+00:00"}{"session_id": "petg-overhang-center", "track": "preflight", "turn": 3, "agent": "La Forge", "role": "QA Inspector", "act": "second_opinion", "stance": "caution", "content": "Cooling compromise ignores thermal gradient risk. β The 65% fan setting risks rapid cooling and warping on PETG overhangs, especially if local drafts exceed ambient control.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:01:52+00:00"}{"session_id": "petg-overhang-center", "track": "print-loop", "turn": 4, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 1: clean print (quality 0.73). Policy: PETG/overhang/mid/mid: success (q=0.73) β holding policy.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:01:59+00:00"}{"session_id": "petg-overhang-center", "track": "print-loop", "turn": 5, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.73). β Engineer flagged sag; the settings covered it. Credit the call β or it was conservative.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:06+00:00"}{"session_id": "petg-overhang-center", "track": "print-loop", "turn": 6, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 2: clean print (quality 0.73). Policy: PETG/overhang/mid/mid: success (q=0.73) β holding policy.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:13+00:00"}{"session_id": "petg-overhang-center", "track": "print-loop", "turn": 7, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.73). β Engineer flagged sag; the settings covered it. Credit the call β or it was conservative.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:20+00:00"}{"session_id": "petg-overhang-center", "track": "print-loop", "turn": 8, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 3: clean print (quality 0.73). Policy: PETG/overhang/mid/mid: success (q=0.73) β holding policy.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:27+00:00"}{"session_id": "petg-overhang-center", "track": "print-loop", "turn": 9, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.73). β Engineer flagged sag; the settings covered it. Credit the call β or it was conservative.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:34+00:00"}{"session_id": "petg-overhang-center", "track": "review", "turn": 10, "agent": "La Forge", "role": "QA Inspector", "act": "verdict", "stance": "concur", "content": "Converged to clean by iteration 1. β PETG/overhang climbed 0.73 β 0.73. The compounding is real: each simulated outcome tightened the policy and the next run was better-informed.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:41+00:00"}{"session_id": "pla-adhesion-center", "track": "preflight", "turn": 1, "agent": "O'Brien", "role": "Chief Engineer", "act": "propose", "stance": "", "content": "The closest precedent [1] shows that cold ambient temperature (19Β°C) severely compromised first-layer adhesion, requiring a significant bed bump and fan shutdown. Since the current room is 21Β°C, which is only slightly warmer than the failed job's environment, we must apply the core lesson: prioritize thermal energy transfer to the build plate. We will maintain the elevated bed temperature and disable cooling for initial layers to maximize bonding strength.\nProposed: nozzle 215Β°C, bed 60Β°C, fan 0%, first-layer fan 0%, retraction 5.0mm.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:02:48+00:00"}{"session_id": "pla-adhesion-center", "track": "preflight", "turn": 2, "agent": "Spine", "role": "Safety Spine", "act": "veto", "stance": "clear", "content": "Within the safe envelope for this material β no clamp.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:02:55+00:00"}{"session_id": "pla-adhesion-center", "track": "preflight", "turn": 3, "agent": "La Forge", "role": "QA Inspector", "act": "second_opinion", "stance": "caution", "content": "Thermal gradient assumption is weak. β A slight ambient bump does not guarantee adhesion success. The print environment must be stable, not just marginally improved.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:02+00:00"}{"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 4, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 1: clean print (quality 1.00). Policy: PLA/adhesion/mid/mid: success (q=1.00) β holding policy.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:09+00:00"}{"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 5, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=1.00). β Engineer flagged adhesion; the settings covered it. Credit the call β or it was conservative.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:16+00:00"}{"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 6, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 2: clean print (quality 1.00). Policy: PLA/adhesion/mid/mid: success (q=1.00) β holding policy.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:23+00:00"}1 unmodified line{"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 8, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 3: clean print (quality 1.00). Policy: PLA/adhesion/mid/mid: success (q=1.00) β holding policy.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:37+00:00"}{"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 9, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=1.00). β Engineer flagged adhesion; the settings covered it. Credit the call β or it was conservative.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:44+00:00"}{"session_id": "pla-adhesion-center", "track": "review", "turn": 10, "agent": "La Forge", "role": "QA Inspector", "act": "verdict", "stance": "concur", "content": "Converged to clean by iteration 1. β PLA/adhesion climbed 1.00 β 1.00. The compounding is real: each simulated outcome tightened the policy and the next run was better-informed.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:51+00:00"}{"session_id": "tpu-stringing-edge", "track": "preflight", "turn": 1, "agent": "O'Brien", "role": "Chief Engineer", "act": "propose", "stance": "", "content": "No close precedent exists. TPU is flexible and prone to stringing because of its high elasticity and low melt strength, especially when ambient conditions are humid (65% RH). The goal is minimizing oozing without compromising print speed or layer adhesion. We need a balance: enough heat to flow the material but not so much that it overheats and degrades, and aggressive cooling where possible.\nProposed: nozzle 230Β°C, bed 45Β°C, fan 60%, first-layer fan 0%, retraction 1.5mm.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:03:58+00:00"}{"session_id": "tpu-stringing-edge", "track": "preflight", "turn": 2, "agent": "Spine", "role": "Safety Spine", "act": "veto", "stance": "clear", "content": "Within the safe envelope for this material β no clamp.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:05+00:00"}{"session_id": "tpu-stringing-edge", "track": "preflight", "turn": 3, "agent": "La Forge", "role": "QA Inspector", "act": "second_opinion", "stance": "dispute", "content": "High heat settings for TPU are risky overkill. β 230Β°C nozzle risks degradation and excessive ooze. Lower it and manage cooling/retraction better.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:12+00:00"}{"session_id": "tpu-stringing-edge", "track": "preflight", "turn": 4, "agent": "Operator", "role": "Operator", "act": "override", "stance": "override", "content": "Acknowledged La Forge's objection. Proceeding to print on the operator's call.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:19+00:00"}{"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 5, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 1: clean print (quality 0.86). Policy: TPU/stringing/mid/humid: success (q=0.86) β holding policy.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:26+00:00"}{"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 6, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.86). β Engineer flagged stringing; the settings covered it. Credit the call β or it was conservative.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:33+00:00"}{"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 7, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 2: clean print (quality 0.86). Policy: TPU/stringing/mid/humid: success (q=0.86) β holding policy.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:40+00:00"}{"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 8, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.86). β Engineer flagged stringing; the settings covered it. Credit the call β or it was conservative.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:47+00:00"}{"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 9, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 3: clean print (quality 0.86). Policy: TPU/stringing/mid/humid: success (q=0.86) β holding policy.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:54+00:00"}{"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 10, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.86). β Engineer flagged stringing; the settings covered it. Credit the call β or it was conservative.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:05:01+00:00"}{"session_id": "tpu-stringing-edge", "track": "review", "turn": 11, "agent": "La Forge", "role": "QA Inspector", "act": "verdict", "stance": "concur", "content": "Converged to clean by iteration 1. β TPU/stringing climbed 0.86 β 0.86. The compounding is real: each simulated outcome tightened the policy and the next run was better-informed.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:05:08+00:00"}12345678910111213141516171819202122232425262728291 unmodified line31323334353637383940414243{"session_id": "abs-overhang-edge", "track": "preflight", "turn": 1, "agent": "O'Brien", "role": "Chief Engineer", "act": "propose", "stance": "", "content": "No close precedent exists. ABS is high warp material, and overhangs amplify this risk significantly. The room temp (26Β°C) is moderate but requires active thermal management to prevent warping during cooling. We must maintain a stable thermal gradient from the bed up through the print area. I will use established ABS parameters for adhesion and minimize forced air.\nProposed: nozzle 255Β°C, bed 100Β°C, fan 30%, first-layer fan 0%, retraction 4.0mm.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:07+00:00"}{"session_id": "abs-overhang-edge", "track": "preflight", "turn": 2, "agent": "Spine", "role": "Safety Spine", "act": "veto", "stance": "clear", "content": "Within the safe envelope for this material β no clamp.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:14+00:00"}{"session_id": "abs-overhang-edge", "track": "preflight", "turn": 3, "agent": "La Forge", "role": "QA Inspector", "act": "second_opinion", "stance": "caution", "content": "Thermal management remains a guess, not a plan. β The reliance on ambient room temp and moderate bed temps doesn't guarantee stability. Warping risk is unflagged until it happens.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:21+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 4, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "failed_sag", "content": "Iteration 1: sag (quality 0.19, dominant cost: sag). Policy: ABS/overhang/mid/humid: sag (q=0.19) β learned: fan_pct +12, nozzle_temp -3.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:28+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 5, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "confirmed", "content": "Failed on sagging β exactly as called. β Quality 0.19. The Engineer's risk flag was right; the loop now has the lesson.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:35+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 6, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "failed_sag", "content": "Iteration 2: sag (quality 0.27, dominant cost: sag). Policy: ABS/overhang/mid/humid: sag (q=0.27) β learned: fan_pct +12, nozzle_temp -3.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:42+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 7, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "confirmed", "content": "Failed on sagging β exactly as called. β Quality 0.27. The Engineer's risk flag was right; the loop now has the lesson.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:49+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 8, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "failed_sag", "content": "Iteration 3: sag (quality 0.33, dominant cost: sag). Policy: ABS/overhang/mid/humid: sag (q=0.33) β learned: fan_pct +12, nozzle_temp -3.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:56+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 9, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "confirmed", "content": "Failed on sagging β exactly as called. β Quality 0.33. The Engineer's risk flag was right; the loop now has the lesson.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:01:03+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 10, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "failed_sag", "content": "Iteration 4: warp (quality 0.34, dominant cost: warp). Policy: ABS/overhang/mid/humid: warp (q=0.34) β learned: fan_pct -10.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:01:10+00:00"}{"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 11, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "missed", "content": "Failed on warping β and it wasn't flagged. β Quality 0.34. The Engineer didn't predict this mode. That gap is what the next iteration has to close.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:01:17+00:00"}{"session_id": "abs-overhang-edge", "track": "review", "turn": 12, "agent": "La Forge", "role": "QA Inspector", "act": "verdict", "stance": "caution", "content": "Improving but not yet clean (best 0.34). β Quality rose 0.19 β 0.34 over 4 runs but never crossed the bar. More iterations or a different lever needed β the loop is learning, slowly.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:01:24+00:00"}{"session_id": "petg-overhang-center", "track": "preflight", "turn": 1, "agent": "O'Brien", "role": "Chief Engineer", "act": "propose", "stance": "", "content": "The prior job [1] is highly relevant, showing PETG overhang sag at 23Β°C. Since the current environment (24Β°C, 55% RH) is only slightly warmer and drier, the lesson about cooling compromise remains critical. I must maintain the fan setting high enough to stabilize the plastic but low enough not to induce thermal stress or excessive warping on PETG. The overhang geometry dictates careful management of cooling rates.\nProposed: nozzle 245Β°C, bed 85Β°C, fan 60%, first-layer fan 0%, retraction 5.0mm.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:01:31+00:00"}{"session_id": "petg-overhang-center", "track": "preflight", "turn": 2, "agent": "Spine", "role": "Safety Spine", "act": "veto", "stance": "clear", "content": "Within the safe envelope for this material β no clamp.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:01:38+00:00"}{"session_id": "petg-overhang-center", "track": "preflight", "turn": 3, "agent": "La Forge", "role": "QA Inspector", "act": "second_opinion", "stance": "dispute", "content": "Overhang sag and environment are not solved by minor temperature tweaks. β The proposed fan settings fail to account for PETG's inherent thermal instability. Adhesion risk remains high regardless of the slight environmental shift.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:01:45+00:00"}{"session_id": "petg-overhang-center", "track": "preflight", "turn": 4, "agent": "Operator", "role": "Operator", "act": "override", "stance": "override", "content": "Acknowledged La Forge's objection. Proceeding to print on the operator's call.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:01:52+00:00"}{"session_id": "petg-overhang-center", "track": "print-loop", "turn": 5, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 1: clean print (quality 0.73). Policy: PETG/overhang/mid/mid: success (q=0.73) β holding policy.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:01:59+00:00"}{"session_id": "petg-overhang-center", "track": "print-loop", "turn": 6, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.73). β Engineer flagged sag; the settings covered it. Credit the call β or it was conservative.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:06+00:00"}{"session_id": "petg-overhang-center", "track": "print-loop", "turn": 7, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 2: clean print (quality 0.73). Policy: PETG/overhang/mid/mid: success (q=0.73) β holding policy.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:13+00:00"}{"session_id": "petg-overhang-center", "track": "print-loop", "turn": 8, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.73). β Engineer flagged sag; the settings covered it. Credit the call β or it was conservative.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:20+00:00"}{"session_id": "petg-overhang-center", "track": "print-loop", "turn": 9, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 3: clean print (quality 0.73). Policy: PETG/overhang/mid/mid: success (q=0.73) β holding policy.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:27+00:00"}{"session_id": "petg-overhang-center", "track": "print-loop", "turn": 10, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.73). β Engineer flagged sag; the settings covered it. Credit the call β or it was conservative.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:34+00:00"}{"session_id": "petg-overhang-center", "track": "review", "turn": 11, "agent": "La Forge", "role": "QA Inspector", "act": "verdict", "stance": "concur", "content": "Converged to clean by iteration 1. β PETG/overhang climbed 0.73 β 0.73. The compounding is real: each simulated outcome tightened the policy and the next run was better-informed.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:41+00:00"}{"session_id": "pla-adhesion-center", "track": "preflight", "turn": 1, "agent": "O'Brien", "role": "Chief Engineer", "act": "propose", "stance": "", "content": "The prior job [1] (PLA/adhesion @ 19Β°C, 38% RH) is highly relevant because the current ambient temperature (21Β°C) is still cool relative to optimal printing conditions, and adhesion failure was the primary issue. The lesson that cold ambient air compromises first-layer bonding remains valid. Therefore, we must maintain a high bed temp and minimize cooling effects on the first few layers.\nProposed: nozzle 215Β°C, bed 60Β°C, fan 30%, first-layer fan 0%, retraction 5.0mm.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:02:48+00:00"}{"session_id": "pla-adhesion-center", "track": "preflight", "turn": 2, "agent": "Spine", "role": "Safety Spine", "act": "veto", "stance": "clear", "content": "Within the safe envelope for this material β no clamp.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:02:55+00:00"}{"session_id": "pla-adhesion-center", "track": "preflight", "turn": 3, "agent": "La Forge", "role": "QA Inspector", "act": "second_opinion", "stance": "caution", "content": "The ambient conditions are not a guarantee. β Relying on past environmental data to predict adhesion success is thin. Watch for drafts or humidity spikes.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:02+00:00"}{"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 4, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 1: clean print (quality 1.00). Policy: PLA/adhesion/mid/mid: success (q=1.00) β holding policy.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:09+00:00"}{"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 5, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=1.00). β Engineer flagged adhesion; the settings covered it. Credit the call β or it was conservative.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:16+00:00"}{"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 6, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 2: clean print (quality 1.00). Policy: PLA/adhesion/mid/mid: success (q=1.00) β holding policy.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:23+00:00"}1 unmodified line{"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 8, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 3: clean print (quality 1.00). Policy: PLA/adhesion/mid/mid: success (q=1.00) β holding policy.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:37+00:00"}{"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 9, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=1.00). β Engineer flagged adhesion; the settings covered it. Credit the call β or it was conservative.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:44+00:00"}{"session_id": "pla-adhesion-center", "track": "review", "turn": 10, "agent": "La Forge", "role": "QA Inspector", "act": "verdict", "stance": "concur", "content": "Converged to clean by iteration 1. β PLA/adhesion climbed 1.00 β 1.00. The compounding is real: each simulated outcome tightened the policy and the next run was better-informed.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:51+00:00"}{"session_id": "tpu-stringing-edge", "track": "preflight", "turn": 1, "agent": "O'Brien", "role": "Chief Engineer", "act": "propose", "stance": "", "content": "No close precedent exists (TPU/stringing). TPU is flexible and prone to stringing due to its viscoelastic nature, especially when printed at ambient temperatures. The high humidity (65% RH) will exacerbate this by increasing surface tackiness. We must minimize the time the plastic spends in the air after extrusion while maintaining flow. I'll keep the nozzle temp low but stable, increase retraction slightly for better cleanup, and use a moderate fan to help cool the stringing areas quickly.\nProposed: nozzle 230Β°C, bed 45Β°C, fan 60%, first-layer fan 0%, retraction 3.0mm.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:03:58+00:00"}{"session_id": "tpu-stringing-edge", "track": "preflight", "turn": 2, "agent": "Spine", "role": "Safety Spine", "act": "veto", "stance": "clear", "content": "Within the safe envelope for this material β no clamp.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:05+00:00"}{"session_id": "tpu-stringing-edge", "track": "preflight", "turn": 3, "agent": "La Forge", "role": "QA Inspector", "act": "second_opinion", "stance": "caution", "content": "Humidity risk outweighs temperature adjustments. β 65% RH and TPU are a poor pairing. Focus on enclosure or drying, not just retraction settings.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:12+00:00"}{"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 4, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 1: clean print (quality 0.86). Policy: TPU/stringing/mid/humid: success (q=0.86) β holding policy.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:19+00:00"}{"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 5, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.86). β Engineer flagged stringing; the settings covered it. Credit the call β or it was conservative.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:26+00:00"}{"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 6, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 2: clean print (quality 0.86). Policy: TPU/stringing/mid/humid: success (q=0.86) β holding policy.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:33+00:00"}{"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 7, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.86). β Engineer flagged stringing; the settings covered it. Credit the call β or it was conservative.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:40+00:00"}{"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 8, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 3: clean print (quality 0.86). Policy: TPU/stringing/mid/humid: success (q=0.86) β holding policy.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:47+00:00"}{"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 9, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.86). β Engineer flagged stringing; the settings covered it. Credit the call β or it was conservative.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:54+00:00"}{"session_id": "tpu-stringing-edge", "track": "review", "turn": 10, "agent": "La Forge", "role": "QA Inspector", "act": "verdict", "stance": "concur", "content": "Converged to clean by iteration 1. β TPU/stringing climbed 0.86 β 0.86. The compounding is real: each simulated outcome tightened the policy and the next run was better-informed.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:05:01+00:00"}
66 unmodified lines676869707172737466 unmodified linesdef run_iteration(job: Job, env: Environment, policy: LearnedPolicy, ledger: LedgerManager,n: int, record: bool = True) -> IterationRecord:proposed = policy.propose(job.material, job.geometry_type, env)checked = _SPINE.check(proposed, job.material)settings = checked.settingsresult = simulate(settings, job, env)66 unmodified lines676869707172737466 unmodified linesdef run_iteration(job: Job, env: Environment, policy: LearnedPolicy, ledger: LedgerManager,n: int, record: bool = True, overrides: PrintSettings | None = None) -> IterationRecord:proposed = overrides if overrides is not None else policy.propose(job.material, job.geometry_type, env)checked = _SPINE.check(proposed, job.material)settings = checked.settingsresult = simulate(settings, job, env)
85 unmodified lines86878889909192939468 unmodified lines16316416516616716885 unmodified liness = PrintSettings(nozzle_temp=205, bed_temp=60, retraction_mm=5, fan_pct=100, first_layer_fan_pct=0)g = gcode_readout(s, "PLA")assert "M104 S205" in g and "M140 S60" in g, gprint("β g-code header is populated from proposed settings")def test_ingest_distiller():from pathlib import Path as _Pfrom ingest.distill import parse_prusa_ini, parse_klipper_cfg, parse_marlin_config68 unmodified linestest_reflect_appends()test_retrieval_orders_by_env_distance()test_gcode_readout_ties_to_settings()test_ingest_distiller()test_precedent_eval_narration()test_simulator_physical_and_deterministic()85 unmodified lines868788899091929394959697989910010110210310410510610710810911011111268 unmodified lines18118218318418518618785 unmodified liness = PrintSettings(nozzle_temp=205, bed_temp=60, retraction_mm=5, fan_pct=100, first_layer_fan_pct=0)g = gcode_readout(s, "PLA")assert "M104 S205" in g and "M140 S60" in g, gassert "layer height 0.20 mm" in g, gprint("β g-code header is populated from proposed settings")# GIF export button removed; keep motion preview tests via UI smoke if needed.def test_virtual_printer_html_ties_to_settings():from core.widgets import virtual_printer_htmlfrom core.viewer import generate_primitivefrom core.models import PrintSettingsmesh, _geo = generate_primitive("box", 20)default_html = virtual_printer_html(mesh)assert "0.20 mm layers" in default_html, default_htmlfine = PrintSettings(nozzle_temp=200, bed_temp=60, retraction_mm=4.5, fan_pct=80,first_layer_fan_pct=0, layer_height=0.12)fine_html = virtual_printer_html(mesh, settings=fine)assert "0.12 mm layers" in fine_html, fine_htmlprint("β virtual-print preview layer height follows PrintSettings")def test_ingest_distiller():from pathlib import Path as _Pfrom ingest.distill import parse_prusa_ini, parse_klipper_cfg, parse_marlin_config68 unmodified linestest_reflect_appends()test_retrieval_orders_by_env_distance()test_gcode_readout_ties_to_settings()test_virtual_printer_html_ties_to_settings()test_ingest_distiller()test_precedent_eval_narration()test_simulator_physical_and_deterministic()
.codeboarding/logs/wrapper-server.log+141
app.py+358-137
core/chief_engineer.py+4-4
core/models.py+1
core/prompts.py+1-1
core/spine.py+1
core/theme.py+52-19
core/viewer.py+9-3
core/widgets.py+13-5
dist/deliberation/deliberations.jsonl+33-34
learn/loop.py+2-2
test_core.py+19