File size: 10,583 Bytes
0eb210c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74ee21a
 
0eb210c
 
 
74ee21a
0eb210c
 
74ee21a
 
 
 
0eb210c
74ee21a
0eb210c
74ee21a
0eb210c
74ee21a
0eb210c
 
 
74ee21a
 
 
 
 
0eb210c
 
 
 
 
 
 
 
 
 
 
 
 
74ee21a
0eb210c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3748545
0eb210c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#!/usr/bin/env python3
"""Build a concise, judge-facing ProofFrame brief from public-safe reports."""

from __future__ import annotations

import argparse
import json
from datetime import datetime, timezone
from pathlib import Path
from typing import Any


ROOT = Path(__file__).resolve().parents[1]
SCHEMA = "proofframe.judge_brief.v1"
DEFAULT_JSON = ROOT / "docs" / "assets" / "judge-brief.json"
DEFAULT_MD = ROOT / "docs" / "assets" / "judge-brief.md"


def utc_now() -> str:
    return datetime.now(timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z")


def load_json(path: Path) -> dict[str, Any]:
    try:
        return json.loads(path.read_text(encoding="utf-8"))
    except (FileNotFoundError, json.JSONDecodeError):
        return {}


def task_statuses(root: Path) -> dict[str, str]:
    data = load_json(root / "tasks.json")
    return {
        str(task.get("id", "")).upper(): str(task.get("status", "missing"))
        for task in data.get("tasks", [])
    }


def safe_list(value: Any) -> list[str]:
    if isinstance(value, list):
        return [str(item) for item in value]
    if value:
        return [str(value)]
    return []


def build_brief(root: Path = ROOT) -> dict[str, Any]:
    root = root.resolve()
    packet = load_json(root / "docs" / "assets" / "devpost-submission-packet.json")
    award = load_json(root / "docs" / "assets" / "award-readiness-report.json")
    control = load_json(root / "docs" / "assets" / "final-submission-control.json")
    launch = load_json(root / "docs" / "assets" / "final-launch-plan.json")
    public_sync = load_json(root / "docs" / "assets" / "public-space-sync-report.json")
    event_snapshot = load_json(root / "docs" / "assets" / "devpost-event-snapshot.json")
    statuses = task_statuses(root)
    final_gate_ready = bool(control.get("safe_to_submit"))
    final_closure = award.get("readiness_interpretation", {})
    b2_done = statuses.get("T020") == "done"
    genblaze_done = statuses.get("T021") == "done"
    safe_claims = [
        "ProofFrame is a working provenance and approval desk for generated media.",
        "The public demo is credential-free and runs in deterministic local/mock mode.",
        "The repository includes Backblaze B2-compatible storage and Genblaze provider paths for GMICloud, OpenAI, and a credential-free local Pipeline provider.",
        "Every public claim is gated by reports, task status, and secret-scan artifacts.",
    ]
    if b2_done:
        safe_claims.append("Backblaze B2 live storage proof is captured in the sanitized evidence package.")
    if genblaze_done:
        safe_claims.append("Genblaze Pipeline proof is captured with the credential-free local image provider and B2-backed manifests.")
    if final_gate_ready:
        safe_claims.append("The final submission gate is complete.")
    not_yet_claimed = []
    if not b2_done:
        not_yet_claimed.append("Completed Backblaze B2 live storage proof.")
    if not genblaze_done:
        not_yet_claimed.append("Completed Genblaze live generation proof.")
    if statuses.get("T042") != "done":
        not_yet_claimed.append("Submitted Devpost project receipt.")
    integration_status = (
        "Backblaze B2 and Genblaze Pipeline proof are captured; final public video and Devpost receipt remain gated."
        if b2_done and genblaze_done
        else "Backblaze B2 and Genblaze integration code paths are implemented and gated; live proofs remain explicit final blockers."
    )
    return {
        "schema": SCHEMA,
        "created_at": utc_now(),
        "project": packet.get("project_name", "ProofFrame"),
        "tagline": packet.get("tagline", "A provenance-first vault for generated media."),
        "one_liner": packet.get("one_liner"),
        "judge_opening_30s": (
            "ProofFrame is not another image generator. It is a media operations desk that turns "
            "each generated asset into a reviewable packet: prompt, provider/model metadata, "
            "storage reference, checksum, approval state, risk note, manifest, and exportable evidence."
        ),
        "why_it_can_win": [
            "Storage and provenance are the product surface, not a hidden implementation detail.",
            integration_status,
            "The app feels useful after the hackathon: teams can approve, reject, search, export, and audit generated media.",
            "Fail-closed reports make the submission defensible and prevent overclaiming before live proof.",
        ],
        "status": {
            "packet_mode": packet.get("mode"),
            "safe_to_submit": final_gate_ready,
            "launch_mode": launch.get("mode"),
            "current_phase": launch.get("current_phase"),
            "next_command": launch.get("next_command"),
            "award_mode": award.get("mode"),
            "award_score": award.get("score"),
            "award_max_score": award.get("max_score"),
            "final_closure_score": final_closure.get("final_closure_score"),
            "final_closure_max_score": final_closure.get("final_closure_max_score"),
            "public_space_mode": public_sync.get("mode"),
            "event_submission_open": (event_snapshot.get("validation") or {}).get("submission_open"),
        },
        "links": {
            "public_demo": packet.get("demo_url"),
            "repository": packet.get("repository_url"),
            "devpost_video": packet.get("video_url"),
        },
        "safe_claims": safe_claims,
        "not_yet_claimed": not_yet_claimed,
        "judge_walkthrough": [
            "Open the public demo in judge mode and create the one-click Judge Demo packet.",
            "Inspect generated assets, provider/model fields, storage references, checksums, and approval state.",
            "Approve or reject an asset and download the evidence ZIP.",
            "Read the final control and launch plan reports to see exactly what remains before final sponsor proof.",
        ],
        "evidence_artifacts": [
            "docs/assets/devpost-form-kit.md",
            "docs/assets/final-submission-control.md",
            "docs/assets/final-launch-plan.md",
            "docs/assets/award-readiness-report.md",
            "docs/assets/public-space-sync-report.md",
            "docs/assets/submission-bundle-manifest.md",
        ],
        "tasks": {
            task_id: statuses.get(task_id, "missing")
            for task_id in ["T020", "T021", "T040", "T041", "T041A", "T042"]
        },
        "copy_blocks": {
            "devpost_intro": (
                "ProofFrame makes generated media operationally trustworthy: the demo creates "
                "media packets that include prompts, provider/model metadata, storage references, "
                "checksums, review state, risk notes, and downloadable manifests."
            ),
            "judge_note": (
                "Current public demo is safe local/mock mode. Final sponsor claims stay gated until "
                "Backblaze B2 live storage proof, Genblaze live generation proof, final video, audit, "
                "and Devpost receipt are complete."
            ),
        },
    }


def render_markdown(brief: dict[str, Any]) -> str:
    status = brief["status"]
    lines = [
        "# ProofFrame Judge Brief",
        "",
        f"Created: `{brief['created_at']}`",
        f"Tagline: {brief['tagline']}",
        f"Public demo: {brief['links']['public_demo']}",
        f"Repository: {brief['links']['repository']}",
        "",
        "## 30-Second Opening",
        "",
        brief["judge_opening_30s"],
        "",
        "## Why It Can Win",
        "",
    ]
    lines.extend(f"- {item}" for item in brief["why_it_can_win"])
    lines.extend(
        [
            "",
            "## Current Status",
            "",
            f"- Packet mode: `{status['packet_mode']}`",
            f"- Safe to submit: `{str(status['safe_to_submit']).lower()}`",
            f"- Launch phase: `{status['current_phase']}`",
            f"- Next command: `{status['next_command']}`",
            f"- Award readiness: `{status['award_score']}/{status['award_max_score']}` ({status['award_mode']})",
            f"- Final closure: `{status['final_closure_score']}/{status['final_closure_max_score']}`",
            f"- Public Space: `{status['public_space_mode']}` (see `docs/assets/public-space-sync-report.md` for runtime sha)",
            f"- Devpost submission open: `{status['event_submission_open']}`",
            "",
            "## Safe Claims",
            "",
        ]
    )
    lines.extend(f"- {item}" for item in brief["safe_claims"])
    lines.extend(["", "## Not Yet Claimed", ""])
    if brief["not_yet_claimed"]:
        lines.extend(f"- {item}" for item in brief["not_yet_claimed"])
    else:
        lines.append("- None.")
    lines.extend(["", "## Judge Walkthrough", ""])
    lines.extend(f"- {item}" for item in brief["judge_walkthrough"])
    lines.extend(["", "## Evidence Artifacts", ""])
    lines.extend(f"- `{item}`" for item in brief["evidence_artifacts"])
    lines.extend(["", "## Copy Blocks", ""])
    for key, value in brief["copy_blocks"].items():
        lines.extend([f"### {key}", "", value, ""])
    return "\n".join(lines).rstrip() + "\n"


def write_outputs(brief: dict[str, Any], json_path: Path, markdown_path: Path) -> None:
    json_path.parent.mkdir(parents=True, exist_ok=True)
    markdown_path.parent.mkdir(parents=True, exist_ok=True)
    json_path.write_text(json.dumps(brief, indent=2) + "\n", encoding="utf-8")
    markdown_path.write_text(render_markdown(brief), encoding="utf-8")


def build_parser() -> argparse.ArgumentParser:
    parser = argparse.ArgumentParser(description="Build a public-safe ProofFrame judge brief.")
    parser.add_argument("--root", type=Path, default=ROOT)
    parser.add_argument("--json-out", type=Path, default=DEFAULT_JSON)
    parser.add_argument("--markdown-out", type=Path, default=DEFAULT_MD)
    return parser


def main() -> None:
    args = build_parser().parse_args()
    brief = build_brief(args.root)
    write_outputs(brief, args.json_out, args.markdown_out)
    print(
        json.dumps(
            {
                "ok": True,
                "schema": brief["schema"],
                "safe_to_submit": brief["status"]["safe_to_submit"],
                "current_phase": brief["status"]["current_phase"],
                "json": str(args.json_out),
                "markdown": str(args.markdown_out),
            },
            indent=2,
        )
    )


if __name__ == "__main__":
    main()