{key}
- Template
{template}- Draft
{output}- Prefill
- {prefill} artifact refs
#!/usr/bin/env python3 """Render Markdown and HTML artifacts for world-class submission kits.""" from typing import Any from html_rendering import html_text SCRIPT_INTERFACE = "internal-module" SCRIPT_INTERFACE_REASON = "Shared renderer for world-class submission kit Markdown and HTML artifacts." def render_readme(report: dict[str, Any]) -> str: commands = report["commands"] lines = [ "# World-Class Evidence Submission Kit", "", f"Generated at: `{report['generated_at']}`", "", "This kit contains editable drafts for human and external evidence packets. Drafts are not accepted evidence.", "", "## Workflow", "", "1. Run the real provider, human review, native permission, or native client telemetry work first.", "2. Edit the matching JSON draft with only aggregate artifact references and provenance metadata.", "3. Set `template_only` to `false` only after real evidence exists.", "4. Set attestation booleans truthfully; do not include credentials, raw prompts, raw outputs, transcripts, notes, or private user content.", "5. Validate the packet before asking the ledger reviewer to set `attestation.ledger_reviewer`, `attestation.ledger_reviewed_at`, and `attestation.ledger_reviewer_approved` truthfully.", "6. Optional artifact prefill only inserts SHA-256 digests for current local aggregate artifacts; it does not mark a draft as real evidence.", "", "## Commands", "", f"- validate intake: `{commands['validate_intake']}`", f"- review submission: `{commands['review_submission']}`", f"- refresh ledger: `{commands['refresh_ledger']}`", f"- guard public claims: `{commands['guard_claim']}`", "", "## Operator Handoff", "", "Follow these steps in order when handing the kit from operator to reviewer. Handoff rows are procedural and never count as completion evidence.", "", "| Step | Status | Command | Completion signal |", "| --- | --- | --- | --- |", ] for item in report.get("operator_handoff", []): command = item.get("command") or "manual" lines.append( f"| `{item['step_id']}` | `{item['status']}` | `{command}` | {item['completion_signal']} |" ) lines.extend( [ "", "## Drafts", "", "| Evidence | Draft | Status | Prefilled refs |", "| --- | --- | --- | ---: |", ] ) for item in report["files"]: lines.append( f"| `{item['evidence_key']}` | `{item['output_path']}` | `{item['status']}` | `{item.get('prefilled_artifact_ref_count', 0)}` |" ) lines.extend( [ "", "## Evidence Matrix", "", "This matrix combines draft, artifact, and source-check readiness into one operator action list. Matrix rows are guidance only; they do not count as completion evidence.", "", "| Evidence | Stage | Draft | Submission refs | Supporting assets | Source checks | Next action |", "| --- | --- | --- | ---: | ---: | ---: | --- |", ] ) for item in report.get("evidence_matrix", []): lines.append( f"| `{item['evidence_key']}` | `{item['stage']}` | `{item['draft_status']}` | " f"`{item.get('submission_ref_ready_count', 0)}/{item.get('submission_ref_total_count', 0)}` | " f"`{item.get('supporting_artifact_ready_count', 0)}/{item.get('supporting_artifact_total_count', 0)}` | " f"`{item['source_pass_count']}/{item['source_check_count']}` | {item['next_action']} |" ) lines.extend(["", "## Execution Runbook", ""]) for item in report.get("evidence_items", []): must_collect = item.get("must_collect", {}) if isinstance(item.get("must_collect", {}), dict) else {} runbook = must_collect.get("runbook", []) lines.extend(["", f"### {item.get('label', item.get('evidence_key', 'Evidence'))}", ""]) if runbook: for step in runbook: lines.append(f"- `{step}`" if str(step).startswith("python3 ") or "=" in str(step) else f"- {step}") else: lines.append("- No source runbook listed.") lines.extend( [ "", "## Artifact Checklist", "", "Use these paths and SHA-256 digests when filling `artifact_refs`. Glob patterns are expanded into concrete files; submissions must reference concrete paths, not globs.", "", "| Evidence | Role | Path | Status | SHA-256 |", "| --- | --- | --- | --- | --- |", ] ) for item in report.get("artifact_checklist", []): digest = item.get("sha256") or "n/a" lines.append( f"| `{item['evidence_key']}` | `{item.get('artifact_role', 'supporting-evidence')}` | " f"`{item['path']}` | `{item['status']}` | `{digest}` |" ) lines.extend( [ "", "## Source Evidence Snapshot", "", "These checks explain why a draft is not ready for ledger acceptance yet. They mirror current aggregate reports and do not accept evidence by themselves.", "", "| Evidence | Check | Current | Expected | Status |", "| --- | --- | --- | --- | --- |", ] ) for item in report.get("source_checklist", []): lines.append( f"| `{item['evidence_key']}` | {item['label']} | `{item['actual']}` | `{item['expected']}` | `{item['status']}` |" ) lines.extend( [ "", "## Anti-Overclaim", "", "- This kit never marks ledger evidence as accepted.", "- Planned work, metadata fallback, pending review, and local command-runner output remain non-evidence.", "- A valid intake packet means ready for ledger review, not world-class completion.", ] ) return "\n".join(lines).rstrip() + "\n" def render_html_list(values: list[Any], empty: str) -> str: if not values: return f"
{html_text(command)}No submission drafts were requested.
' return "".join( """{template}{output}No required artifacts were listed for the requested evidence.
' return "".join( """{pattern}{sha}No source checks were listed for the requested evidence.
' return "".join( """{field}{actual}{expected}No evidence matrix rows were generated.
' return "".join( """{action}
No operator handoff steps were generated.
' return "".join( """{step}{command}{blocking}
{html_text(item.get('blocking_reason', ''))}
{html_text(item.get('evidence_key', ''))}{html_text(item.get('submission_path', ''))}Use this cockpit to prepare human and external evidence packets. Drafts are not accepted evidence, artifact prefill only inserts local SHA-256 digests, and this page never changes the ledger result.
These ordered steps make the operator-to-reviewer handoff auditable. They are procedural guardrails and never count as world-class evidence.
The matrix separates submission artifact_refs from supporting assets, then combines draft status, source checks, and the next operator action. It is guidance only and never counts as accepted evidence.
Rows marked submission-ref are the paths expected in artifact_refs. Supporting-evidence rows help reviewers audit the packet but do not all need to be copied into the submission. Glob patterns are expanded for operator convenience only.
This section shows current aggregate source checks. It explains remaining blockers without changing the ledger.