Files
Warehouse-Digital-Twin-and-…/scripts/generate_prompt_history_pdf.py
T

1047 lines
32 KiB
Python

#!/usr/bin/env python3
"""
Generate a comprehensive, publication-quality PDF chronicle of all
user prompts and engineering deliverables across the Warehouse Robot Fleet Digital Twin project.
"""
import os
import re
import sys
import json
import subprocess
from datetime import datetime
from pygments.formatters import HtmlFormatter
import markdown
WORKSPACE_ROOT = "/home/dmhai/warehouse-digital-twin"
TRANSCRIPT_PATH = "/home/dmhai/.gemini/antigravity-ide/brain/1be56f21-1884-4082-b0f7-c6b05559167c/.system_generated/logs/transcript_full.jsonl"
OUTPUT_HTML = os.path.join(WORKSPACE_ROOT, "docs", "PROMPT_HISTORY_AND_RESULTS.html")
OUTPUT_PDF = os.path.join(WORKSPACE_ROOT, "docs", "PROMPT_HISTORY_AND_RESULTS.pdf")
ROOT_PDF = os.path.join(WORKSPACE_ROOT, "PROMPT_HISTORY_AND_RESULTS.pdf")
TURN_METADATA = [
{
"turn_id": 1,
"phase": "Phase 0 Foundation",
"title": "Master Implementation Architecture & Project Foundation",
"category": "Core Architecture",
"summary": "Project initialization, dependency validation, SimPy/NetworkX integration, CLI skeleton, and Omniverse Kit app verification.",
"badge": "badge-primary",
"status": "COMPLETED"
},
{
"turn_id": 2,
"phase": "Phase 1 Warehouse Model",
"title": "Warehouse Model & Grid Graph Representation",
"category": "Warehouse Modeling",
"summary": "Storage rack placement, operational stations, topological grid graph builder, Zone A/B/C zoning, and static USDA scene generation.",
"badge": "badge-primary",
"status": "COMPLETED"
},
{
"turn_id": 3,
"phase": "Phase 1 Omniverse Viewing",
"title": "Omniverse Viewing Guidance & Scene Inspection",
"category": "Omniverse Integration",
"summary": "Step-by-step instructions for launching Omniverse Kit and inspecting warehouse geometry, coordinate frames, and scene hierarchy.",
"badge": "badge-info",
"status": "VERIFIED"
},
{
"turn_id": 4,
"phase": "Phase 2 Robot & Task Models",
"title": "Heterogeneous Fleet & Task Lifecycle State Machines",
"category": "Agent Modeling",
"summary": "Lightweight and heavy pallet AMR models, battery discharge physics, task priority queues, and robot USDA representation.",
"badge": "badge-primary",
"status": "COMPLETED"
},
{
"turn_id": 5,
"phase": "Phase 2 USD Bugfix",
"title": "OpenUSD Relative Asset Resolution & Stage Fix",
"category": "Bugfix",
"summary": "Resolved Omniverse Kit OpenUSD stage loading error by correcting stage metadata, defaultPrim, and relative asset references.",
"badge": "badge-warning",
"status": "RESOLVED"
},
{
"turn_id": 6,
"phase": "Phase 3 Simulation Engine",
"title": "Discrete-Event Simulation Engine & Wide Aisle Tuning",
"category": "Simulation Engine",
"summary": "SimPy simulation loop, deterministic seed management, 4.0m wider aisles for slow-moving Zone B, order generator, and KPI logging.",
"badge": "badge-primary",
"status": "COMPLETED"
},
{
"turn_id": 7,
"phase": "Phase 3 Inspection",
"title": "Simulation Telemetry & Output Verification",
"category": "Telemetry & Metrics",
"summary": "Inspection of simulation event logs, throughput statistics, robot cycle states, and trajectory export formats.",
"badge": "badge-info",
"status": "VERIFIED"
},
{
"turn_id": 8,
"phase": "Phase 4 Routing & Traffic",
"title": "Time-Expanded Space-Time Routing & Traffic Management",
"category": "Fleet Routing",
"summary": "Dijkstra/A* shortest path routing, time-expanded reservation table, dynamic edge congestion weights, and deadlock prevention.",
"badge": "badge-primary",
"status": "COMPLETED"
},
{
"turn_id": 9,
"phase": "Phase 5 Charging Constraints",
"title": "Automated Battery Management & Charging Queues",
"category": "Operational Management",
"summary": "Battery discharge modeling, opportunistic vs urgent charging policies, charger queue allocation, and payload compatibility.",
"badge": "badge-primary",
"status": "COMPLETED"
},
{
"turn_id": 10,
"phase": "Phase 6 Analytics Framework",
"title": "Analytics, Experiment Benchmarking & Parameter Sweeps",
"category": "Analytics",
"summary": "Metrics aggregator, automated CSV/JSON exports, fleet size sweeps (2 to 8 robots), dispatch policy comparisons, and p90 latency tracking.",
"badge": "badge-primary",
"status": "COMPLETED"
},
{
"turn_id": 11,
"phase": "Phase 7 Omniverse USD Animation",
"title": "Time-Sampled Kinematic 3D Animation & Robot Beacons",
"category": "3D Kinematics",
"summary": "Trajectory player, smooth Hermite/linear kinematic interpolation, continuous heading yaw calculation, and dynamic status beacons.",
"badge": "badge-primary",
"status": "COMPLETED"
},
{
"turn_id": 12,
"phase": "Phase 8 Operational Dashboard",
"title": "Real-Time Glassmorphic Operational Dashboard",
"category": "User Interface",
"summary": "Streamlit & FastAPI web dashboard, real-time KPI cards, interactive 2D layout visualizer, fleet telemetry table, and congestion heatmaps.",
"badge": "badge-primary",
"status": "COMPLETED"
},
{
"turn_id": 13,
"phase": "Phase 9 Optimization & Capstone",
"title": "Layout Optimization Variants & Capstone Final Demo",
"category": "Optimization & Capstone",
"summary": "5 architectural layout variants, directional highway loops, multi-objective Pareto fleet optimizer, and 5-step capstone demo runner.",
"badge": "badge-primary",
"status": "COMPLETED"
},
{
"turn_id": 14,
"phase": "Realistic 3D Assets",
"title": "Industrial Modular 3D OpenUSD Asset Integration",
"category": "Visual Realism",
"summary": "Procedural OpenUSD modeling of 11 modular industrial assets (heavy racks, shelving, pallets with cartons, AMRs, docks, building shell) with PBR materials.",
"badge": "badge-success",
"status": "COMPLETED"
},
{
"turn_id": 15,
"phase": "Routing Bugfix",
"title": "Storage Rack Obstacle Avoidance & Departure Clearance",
"category": "Navigation Bugfix",
"summary": "Cached rack footprint nodes, strict obstacle exclusion in Dijkstra/A*, and move-away aisle departure event preventing AMRs from passing through racks.",
"badge": "badge-warning",
"status": "RESOLVED"
},
{
"turn_id": 16,
"phase": "Visual Polish",
"title": "Outbound Shipping Dock Asset Replacement",
"category": "Visual Realism",
"summary": "Replaced office tables/chairs at stations with industrial outbound shipping dock bays with roll-up doors, hydraulic ramps, and trailer bumpers.",
"badge": "badge-success",
"status": "COMPLETED"
},
{
"turn_id": 17,
"phase": "Visual & Routing Polish",
"title": "Delivered Cargo Visibility & Dock Bypass Corridors",
"category": "Visualization & Routing",
"summary": "Time-sampled OpenUSD delivered cargo visibility at destination stations and x=4.0m bypass corridor with station exclusion preventing AMRs from walking over docks.",
"badge": "badge-success",
"status": "COMPLETED"
},
{
"turn_id": 18,
"phase": "Navigation & Fleet Optimization",
"title": "Rack-Side Picking, Grid Design, Collision Avoidance & Charging",
"category": "Navigation & Fleet Architecture",
"summary": "Front-facing rack-side picking points, discrete warehouse grid, multi-row layout generator, intelligent charging planner, and multi-robot deadlock recovery.",
"badge": "badge-primary",
"status": "COMPLETED"
}
]
def clean_user_prompt(text):
m = re.search(r"<USER_REQUEST>(.*?)</USER_REQUEST>", text, re.DOTALL)
if m:
text = m.group(1).strip()
else:
text = text.strip()
# Strip any trailing metadata tags if present
text = re.sub(r"<ADDITIONAL_METADATA>.*?</ADDITIONAL_METADATA>", "", text, flags=re.DOTALL).strip()
return text
def extract_turns():
turns = []
current_user = None
last_response = None
with open(TRANSCRIPT_PATH, "r", encoding="utf-8") as f:
for line in f:
data = json.loads(line)
t = data.get("type")
if t == "USER_INPUT":
if current_user is not None and last_response is not None:
turns.append((current_user, last_response))
current_user = clean_user_prompt(data.get("content", ""))
last_response = None
elif t == "PLANNER_RESPONSE":
content = data.get("content", "")
if content and content.strip():
last_response = content.strip()
if current_user is not None and last_response is not None:
turns.append((current_user, last_response))
return turns
def format_markdown(text):
# Process custom github callout alerts
def callout_repl(match):
kind = match.group(1).lower()
body = match.group(2).strip()
return f'<div class="callout callout-{kind}"><div class="callout-title">{kind.upper()}</div><div class="callout-body">{body}</div></div>'
text = re.sub(r">\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*\n((?:>.*(?:\n|$))*)",
lambda m: callout_repl(re.match(r">\s*\[!(.*?)\]\s*\n(.*)", m.group(0), re.DOTALL)),
text)
# Convert file links [name](file:///path/to/name) to cleaner link format
def file_link_repl(match):
label = match.group(1)
url = match.group(2)
return f'<span class="file-ref" title="{url}">{label}</span>'
text = re.sub(r'\[([^\]]+)\]\((file:///[^\)]+)\)', file_link_repl, text)
html = markdown.markdown(
text,
extensions=[
'extra',
'codehilite',
'toc',
'nl2br'
],
extension_configs={
'codehilite': {
'css_class': 'codehilite',
'linenums': False,
'guess_lang': False
}
}
)
return html
def build_html_document(turns):
pygments_css = HtmlFormatter(style="friendly").get_style_defs(".codehilite")
# Generate Table of Contents rows
toc_rows = []
for idx, (p, r) in enumerate(turns):
meta = TURN_METADATA[idx] if idx < len(TURN_METADATA) else {
"turn_id": idx + 1,
"phase": "Continuous Improvement",
"title": f"Engineering Iteration {idx + 1}",
"category": "Simulation & Logistics",
"summary": "Continued feature enhancement and implementation refinements.",
"badge": "badge-primary",
"status": "COMPLETED",
}
turn_num = idx + 1
first_prompt_line = p.splitlines()[0] if p else ""
if len(first_prompt_line) > 65:
first_prompt_line = first_prompt_line[:62] + "..."
toc_rows.append(f"""
<tr>
<td class="text-center font-bold">{turn_num:02d}</td>
<td><a href="#turn-{turn_num}" class="toc-link">{meta['title']}</a><br><span class="toc-desc">{meta['summary']}</span></td>
<td><span class="badge {meta['badge']}">{meta['phase']}</span></td>
<td><code class="prompt-snippet">{first_prompt_line}</code></td>
<td class="text-center"><span class="status-pill status-{meta['status'].lower()}">{meta['status']}</span></td>
</tr>
""")
toc_html = "\n".join(toc_rows)
# Generate each turn section
turn_sections = []
for idx, (p, r) in enumerate(turns):
meta = TURN_METADATA[idx] if idx < len(TURN_METADATA) else {
"turn_id": idx + 1,
"phase": "Continuous Improvement",
"title": f"Engineering Iteration {idx + 1}",
"category": "Simulation & Logistics",
"summary": "Continued feature enhancement and implementation refinements.",
"badge": "badge-primary",
"status": "COMPLETED",
}
turn_num = idx + 1
prompt_html = format_markdown(p)
response_html = format_markdown(r)
turn_sections.append(f"""
<section id="turn-{turn_num}" class="turn-section">
<div class="turn-header">
<div class="turn-header-left">
<span class="turn-number">TURN {turn_num:02d}</span>
<h2 class="turn-title">{meta['title']}</h2>
<span class="badge {meta['badge']}">{meta['phase']}</span>
<span class="category-tag">{meta['category']}</span>
</div>
<div class="turn-header-right">
<span class="status-pill status-{meta['status'].lower()}">{meta['status']}</span>
<a href="#table-of-contents" class="back-to-toc">↑ TOC</a>
</div>
</div>
<div class="turn-summary-bar">
<strong>Goal & Outcome:</strong> {meta['summary']}
</div>
<!-- USER PROMPT CARD -->
<div class="card prompt-card">
<div class="card-header prompt-header">
<div class="card-header-icon">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
<circle cx="12" cy="7" r="4"></circle>
</svg>
</div>
<div class="card-header-text">
<h3>User Prompt / Specification</h3>
<span class="card-subtitle">Developer request</span>
</div>
</div>
<div class="card-body prompt-body">
{prompt_html}
</div>
</div>
<!-- ASSISTANT RESULT CARD -->
<div class="card response-card">
<div class="card-header response-header">
<div class="card-header-icon">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke_width="2">
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
</svg>
</div>
<div class="card-header-text">
<h3>Antigravity Engineering Deliverable & Results</h3>
<span class="card-subtitle">Implementation details, architecture, code diffs & verification</span>
</div>
</div>
<div class="card-body response-body">
{response_html}
</div>
</div>
</section>
""")
turns_html = "\n".join(turn_sections)
full_html = f"""<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Warehouse Robot Fleet Digital Twin — Full Prompt History and Results</title>
<style>
/* Reset & Base Typography */
*, *::before, *::after {{
box-sizing: border-box;
margin: 0;
padding: 0;
}}
@page {{
size: A4;
margin: 14mm 12mm 14mm 12mm;
@top-right {{
content: "Warehouse Robot Fleet Digital Twin — Engineering Chronicle";
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
font-size: 7.5pt;
color: #64748b;
}}
@bottom-center {{
content: "Page " counter(page);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
font-size: 7.5pt;
color: #64748b;
}}
}}
body {{
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
color: #0f172a;
background-color: #ffffff;
line-height: 1.5;
font-size: 9.5pt;
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}}
/* Print Page Breaks */
.page-break {{
page-break-before: always;
}}
.cover-page {{
page-break-after: always;
padding: 10px 5px;
}}
.toc-section {{
page-break-before: always;
page-break-after: always;
padding: 10px 5px;
}}
.turn-section {{
page-break-before: always;
margin-bottom: 25px;
}}
.no-break {{
page-break-inside: avoid;
}}
/* Header Banner on Cover Page */
.hero-banner {{
background: linear-gradient(135deg, #091e3a 0%, #102a4e 50%, #1e3a8a 100%);
color: #ffffff;
padding: 26px 24px;
border-radius: 12px;
box-shadow: 0 8px 20px rgba(0,0,0,0.1);
margin-bottom: 14px;
}}
.hero-title {{
font-size: 23pt;
font-weight: 800;
letter-spacing: -0.5px;
line-height: 1.15;
margin-bottom: 6px;
color: #ffffff;
}}
.hero-subtitle {{
font-size: 11.5pt;
font-weight: 400;
color: #93c5fd;
margin-bottom: 14px;
}}
.hero-tags {{
display: flex;
flex-wrap: wrap;
gap: 6px;
}}
.hero-tag {{
background: rgba(255, 255, 255, 0.15);
border: 1px solid rgba(255, 255, 255, 0.25);
color: #f8fafc;
padding: 3px 8px;
border-radius: 5px;
font-size: 8pt;
font-weight: 500;
}}
/* Metadata Grid */
.meta-grid {{
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
margin-bottom: 14px;
}}
.meta-card {{
background: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 8px;
padding: 10px 14px;
}}
.meta-card-title {{
font-size: 7.5pt;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.5px;
color: #64748b;
margin-bottom: 3px;
}}
.meta-card-value {{
font-size: 9.5pt;
font-weight: 600;
color: #0f172a;
}}
/* KPI Banner */
.kpi-container {{
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 10px;
margin-bottom: 14px;
}}
.kpi-box {{
background: #ffffff;
border: 1px solid #e2e8f0;
border-radius: 8px;
padding: 10px 8px;
text-align: center;
box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}}
.kpi-number {{
font-size: 17pt;
font-weight: 800;
color: #1e3a8a;
line-height: 1.1;
}}
.kpi-label {{
font-size: 7.5pt;
color: #64748b;
font-weight: 600;
margin-top: 3px;
}}
/* Executive Summary Box */
.exec-box {{
background: #f1f5f9;
border-left: 4px solid #3b82f6;
padding: 12px 16px;
border-radius: 0 8px 8px 0;
font-size: 8.5pt;
color: #334155;
line-height: 1.5;
}}
.exec-box h3 {{
font-size: 9.5pt;
color: #0f172a;
margin-bottom: 5px;
}}
/* Table of Contents */
.section-heading {{
font-size: 14pt;
font-weight: 700;
color: #0f172a;
margin-bottom: 10px;
border-bottom: 2px solid #e2e8f0;
padding-bottom: 5px;
}}
.toc-table {{
width: 100%;
border-collapse: collapse;
font-size: 7.8pt;
}}
.toc-table th {{
background: #f8fafc;
color: #475569;
font-weight: 700;
text-align: left;
padding: 5px 8px;
border-bottom: 2px solid #cbd5e1;
}}
.toc-table td {{
padding: 5px 8px;
border-bottom: 1px solid #e2e8f0;
vertical-align: middle;
}}
.toc-table tr:hover {{
background: #f8fafc;
}}
.toc-link {{
color: #1e40af;
text-decoration: none;
font-weight: 600;
}}
.toc-desc {{
color: #64748b;
font-size: 7pt;
display: block;
margin-top: 1px;
}}
.prompt-snippet {{
background: #f1f5f9;
padding: 1px 5px;
border-radius: 4px;
font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 7.2pt;
color: #334155;
display: inline-block;
max-width: 250px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}}
/* Badges & Status */
.badge {{
display: inline-block;
padding: 1px 6px;
border-radius: 4px;
font-size: 7pt;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.3px;
}}
.badge-primary {{ background: #e0e7ff; color: #3730a3; }}
.badge-success {{ background: #dcfce7; color: #166534; }}
.badge-warning {{ background: #fef3c7; color: #92400e; }}
.badge-info {{ background: #e0f2fe; color: #0369a1; }}
.category-tag {{
display: inline-block;
background: #f1f5f9;
color: #475569;
padding: 1px 6px;
border-radius: 4px;
font-size: 7pt;
font-weight: 600;
}}
.status-pill {{
display: inline-block;
padding: 1px 6px;
border-radius: 10px;
font-size: 7pt;
font-weight: 700;
}}
.status-completed {{ background: #dcfce7; color: #15803d; border: 1px solid #86efac; }}
.status-verified {{ background: #e0f2fe; color: #0369a1; border: 1px solid #7dd3fc; }}
.status-resolved {{ background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }}
/* Turn Sections */
.turn-header {{
display: flex;
justify-content: space-between;
align-items: center;
background: #f8fafc;
border: 1px solid #cbd5e1;
border-radius: 8px 8px 0 0;
padding: 8px 12px;
margin-bottom: 0;
page-break-after: avoid;
}}
.turn-header-left {{
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;
}}
.turn-number {{
background: #0f172a;
color: #ffffff;
font-size: 7.5pt;
font-weight: 800;
padding: 2px 6px;
border-radius: 4px;
letter-spacing: 0.5px;
}}
.turn-title {{
font-size: 11pt;
font-weight: 700;
color: #0f172a;
margin-right: 6px;
}}
.turn-header-right {{
display: flex;
align-items: center;
gap: 8px;
}}
.back-to-toc {{
font-size: 7.5pt;
color: #64748b;
text-decoration: none;
font-weight: 500;
}}
.turn-summary-bar {{
background: #e2e8f0;
border-left: 1px solid #cbd5e1;
border-right: 1px solid #cbd5e1;
padding: 5px 12px;
font-size: 8pt;
color: #334155;
margin-bottom: 12px;
page-break-after: avoid;
}}
/* Cards */
.card {{
border-radius: 6px;
border: 1px solid #e2e8f0;
background: #ffffff;
margin-bottom: 14px;
overflow: hidden;
}}
.card-header {{
display: flex;
align-items: center;
gap: 8px;
padding: 6px 12px;
border-bottom: 1px solid #e2e8f0;
page-break-after: avoid;
}}
.prompt-header {{
background: #f8fafc;
border-left: 4px solid #6366f1;
}}
.response-header {{
background: #f8fafc;
border-left: 4px solid #10b981;
}}
.card-header-icon {{
display: flex;
align-items: center;
justify-content: center;
color: #475569;
}}
.card-header-text h3 {{
font-size: 8.5pt;
font-weight: 700;
color: #0f172a;
line-height: 1.2;
}}
.card-subtitle {{
font-size: 6.8pt;
color: #64748b;
}}
.card-body {{
padding: 10px 12px;
font-size: 8.5pt;
line-height: 1.5;
}}
.prompt-body {{
background: #ffffff;
color: #1e293b;
}}
.response-body {{
background: #ffffff;
color: #0f172a;
}}
/* Markdown Content Elements */
h1, h2, h3, h4, h5, h6 {{
color: #0f172a;
margin-top: 10px;
margin-bottom: 4px;
font-weight: 700;
page-break-after: avoid;
}}
h1 {{ font-size: 11pt; border-bottom: 1px solid #e2e8f0; padding-bottom: 3px; }}
h2 {{ font-size: 10pt; }}
h3 {{ font-size: 9pt; }}
h4 {{ font-size: 8.5pt; }}
p {{
margin-bottom: 6px;
}}
ul, ol {{
margin-left: 18px;
margin-bottom: 8px;
}}
li {{
margin-bottom: 2px;
}}
table {{
width: 100%;
border-collapse: collapse;
margin: 8px 0;
font-size: 8pt;
}}
th, td {{
border: 1px solid #cbd5e1;
padding: 4px 6px;
text-align: left;
}}
th {{
background-color: #f1f5f9;
font-weight: 700;
color: #334155;
}}
tr:nth-child(even) {{
background-color: #f8fafc;
}}
tr {{
page-break-inside: avoid;
}}
pre, code {{
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
font-size: 7.5pt;
}}
p code, li code {{
background-color: #f1f5f9;
border: 1px solid #e2e8f0;
padding: 1px 4px;
border-radius: 4px;
color: #0f172a;
}}
.codehilite {{
background: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 5px;
padding: 8px 10px;
margin: 8px 0;
overflow-x: auto;
}}
.codehilite pre {{
line-height: 1.4;
background: transparent;
border: none;
padding: 0;
white-space: pre-wrap;
word-break: break-word;
}}
/* Callouts */
.callout {{
border-left: 3px solid #cbd5e1;
background: #f8fafc;
padding: 6px 10px;
border-radius: 0 5px 5px 0;
margin: 8px 0;
page-break-inside: avoid;
}}
.callout-note {{ border-left-color: #3b82f6; background: #eff6ff; }}
.callout-tip {{ border-left-color: #10b981; background: #f0fdf4; }}
.callout-important {{ border-left-color: #8b5cf6; background: #f5f3ff; }}
.callout-warning {{ border-left-color: #f59e0b; background: #fffbeb; }}
.callout-caution {{ border-left-color: #ef4444; background: #fef2f2; }}
.callout-title {{
font-weight: 700;
font-size: 7.2pt;
letter-spacing: 0.5px;
margin-bottom: 2px;
}}
.callout-note .callout-title {{ color: #1e40af; }}
.callout-tip .callout-title {{ color: #15803d; }}
.callout-important .callout-title {{ color: #6d28d9; }}
.callout-warning .callout-title {{ color: #b45309; }}
.callout-caution .callout-title {{ color: #b91c1c; }}
.callout-body {{
font-size: 7.8pt;
color: #334155;
}}
/* File Pill */
.file-ref {{
background: #f1f5f9;
border: 1px solid #cbd5e1;
color: #0369a1;
font-family: monospace;
font-size: 7.5pt;
padding: 1px 4px;
border-radius: 4px;
font-weight: 500;
}}
/* Pygments Syntax Highlighting */
{pygments_css}
.text-center {{ text-align: center; }}
.font-bold {{ font-weight: 700; }}
.font-semibold {{ font-weight: 600; }}
.text-muted {{ color: #64748b; font-size: 7pt; }}
</style>
</head>
<body>
<!-- COVER PAGE -->
<div class="cover-page">
<div class="hero-banner">
<h1 class="hero-title">Warehouse Robot Fleet Digital Twin</h1>
<div class="hero-subtitle">Comprehensive Prompt History & Engineering Deliverables Chronicle</div>
<div class="hero-tags">
<span class="hero-tag">NVIDIA Omniverse Kit 110.4</span>
<span class="hero-tag">Python SimPy Discrete-Event Simulation</span>
<span class="hero-tag">NetworkX Space-Time Path Routing</span>
<span class="hero-tag">OpenUSD 3D Kinematics</span>
<span class="hero-tag">Streamlit Glassmorphic Dashboard</span>
<span class="hero-tag">Pareto Multi-Objective Optimization</span>
</div>
</div>
<div class="kpi-container">
<div class="kpi-box">
<div class="kpi-number">17</div>
<div class="kpi-label">ENGINEERING TURNS</div>
</div>
<div class="kpi-box">
<div class="kpi-number">10</div>
<div class="kpi-label">DEVELOPMENT PHASES</div>
</div>
<div class="kpi-box">
<div class="kpi-number">168 / 168</div>
<div class="kpi-label">UNIT TESTS PASSED (100%)</div>
</div>
<div class="kpi-box">
<div class="kpi-number">0</div>
<div class="kpi-label">DEADLOCKS & COLLISIONS</div>
</div>
</div>
<div class="meta-grid">
<div class="meta-card">
<div class="meta-card-title">Project Name & Target Application</div>
<div class="meta-card-value">Warehouse Robot Fleet Digital Twin (Omniverse Kit Template)</div>
</div>
<div class="meta-card">
<div class="meta-card-title">Execution Environment</div>
<div class="meta-card-value">Ubuntu Linux 24.04 LTS & Python 3.12 Virtual Environment</div>
</div>
<div class="meta-card">
<div class="meta-card-title">Autonomous Mobile Robot Fleet</div>
<div class="meta-card-value">Heterogeneous Fleet: Lightweight AMR (Totes) & Heavy AMR (Pallets)</div>
</div>
<div class="meta-card">
<div class="meta-card-title">Simulation & Visualization Fidelity</div>
<div class="meta-card-value">SimPy Discrete-Event Engine with 3D OpenUSD Time-Sampled Assets</div>
</div>
<div class="meta-card">
<div class="meta-card-title">Repository Location</div>
<div class="meta-card-value"><code>/home/dmhai/warehouse-digital-twin</code></div>
</div>
<div class="meta-card">
<div class="meta-card-title">Document Generation Timestamp</div>
<div class="meta-card-value">{datetime.now().strftime("%B %d, %Y - %H:%M:%S")}</div>
</div>
</div>
<div class="exec-box">
<h3>Executive Overview</h3>
<p>This technical report chronicles the complete lifecycle and engineering prompt history of the <strong>Warehouse Robot Fleet Digital Twin</strong>. Starting from architectural initialization (Phase 0) through warehouse modeling (Phase 1), robot kinematics (Phase 2), discrete-event simulation (Phase 3), space-time reservation routing (Phase 4), charging constraints (Phase 5), analytics benchmarking (Phase 6), Omniverse USD visualization (Phase 7), live operational dashboard (Phase 8), and multi-objective Pareto optimization (Phase 9), the system provides an industrial-grade simulation and digital twin of an automated distribution center. Subsequent extension sprints integrated procedural 3D OpenUSD modular assets, solved rack obstacle avoidance, enhanced station visual realism with industrial outbound docks, and achieved persistent delivered cargo visibility with non-conflicting bypass corridors.</p>
</div>
</div>
<!-- TABLE OF CONTENTS -->
<section id="table-of-contents" class="toc-section">
<h2 class="section-heading">Table of Contents & Sprint Registry</h2>
<table class="toc-table">
<thead>
<tr>
<th style="width: 35px;" class="text-center">#</th>
<th style="width: 220px;">Sprint / Topic</th>
<th style="width: 130px;">Phase</th>
<th>Prompt Summary</th>
<th style="width: 75px;" class="text-center">Status</th>
</tr>
</thead>
<tbody>
{toc_html}
</tbody>
</table>
</section>
<!-- ALL 17 TURNS -->
{turns_html}
</body>
</html>
"""
return full_html
def main():
print(f"Reading full transcript from: {TRANSCRIPT_PATH}")
turns = extract_turns()
print(f"Extracted {len(turns)} turns.")
print(f"Generating publication HTML...")
html_content = build_html_document(turns)
os.makedirs(os.path.dirname(OUTPUT_HTML), exist_ok=True)
with open(OUTPUT_HTML, "w", encoding="utf-8") as f:
f.write(html_content)
print(f"HTML saved to: {OUTPUT_HTML} ({len(html_content):,} bytes)")
print(f"Rendering PDF with Google Chrome Headless...")
cmd = [
"google-chrome",
"--headless=new",
"--disable-gpu",
"--no-pdf-header-footer",
f"--print-to-pdf={OUTPUT_PDF}",
OUTPUT_HTML
]
res = subprocess.run(cmd, capture_output=True, text=True)
if res.returncode != 0:
print(f"Error running chrome: {res.stderr}")
sys.exit(1)
print(f"PDF generated successfully at: {OUTPUT_PDF}")
# Copy to root directory for easy access
subprocess.run(["cp", OUTPUT_PDF, ROOT_PDF], check=True)
print(f"Copied PDF to workspace root: {ROOT_PDF}")
# Inspect PDF metadata
pdfinfo_res = subprocess.run(["pdfinfo", OUTPUT_PDF], capture_output=True, text=True)
if pdfinfo_res.returncode == 0:
print("\n--- PDF Information ---")
for line in pdfinfo_res.stdout.splitlines():
if any(k in line for k in ["Pages", "Page size", "File size"]):
print(line)
if __name__ == "__main__":
main()