mirror of
https://github.com/onestardao/WFGY.git
synced 2026-04-28 19:50:17 +00:00
155 lines
No EOL
6.5 KiB
Text
155 lines
No EOL
6.5 KiB
Text
{
|
|
"nbformat": 4,
|
|
"nbformat_minor": 0,
|
|
"metadata": {
|
|
"colab": {
|
|
"provenance": []
|
|
},
|
|
"kernelspec": {
|
|
"name": "python3",
|
|
"display_name": "Python 3"
|
|
},
|
|
"language_info": {
|
|
"name": "python"
|
|
}
|
|
},
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"# ============================================================\n",
|
|
"# WFGY RAG 16 Problem Map · Colab Wave 0 MVP (Single Cell)\n",
|
|
"# ============================================================\n",
|
|
"#\n",
|
|
"# This notebook:\n",
|
|
"# - Loads wfgy_problem_catalog_v1.json\n",
|
|
"# - Loads wfgy_debug_packet_v1.json\n",
|
|
"# - Extracts example_packet\n",
|
|
"# - Prints a structured Wave 0 triage summary\n",
|
|
"#\n",
|
|
"# No LLM is used.\n",
|
|
"# Purpose: prove JSON specs are machine-readable and tool-friendly.\n",
|
|
"# ============================================================\n",
|
|
"\n",
|
|
"import requests\n",
|
|
"\n",
|
|
"CATALOG_URL = \"https://raw.githubusercontent.com/onestardao/WFGY/main/ProblemMap/specs/wfgy_problem_catalog_v1.json\"\n",
|
|
"PACKET_URL = \"https://raw.githubusercontent.com/onestardao/WFGY/main/ProblemMap/specs/wfgy_debug_packet_v1.json\"\n",
|
|
"\n",
|
|
"\n",
|
|
"def load_json(url: str) -> dict:\n",
|
|
" response = requests.get(url, timeout=30)\n",
|
|
" response.raise_for_status()\n",
|
|
" return response.json()\n",
|
|
"\n",
|
|
"\n",
|
|
"def indent_block(text: str, prefix: str = \" \") -> str:\n",
|
|
" if not text:\n",
|
|
" return \"\"\n",
|
|
" return \"\\n\".join(prefix + line for line in text.splitlines())\n",
|
|
"\n",
|
|
"\n",
|
|
"def summarize_case(case_obj: dict, catalog: dict) -> str:\n",
|
|
" lines = []\n",
|
|
"\n",
|
|
" lines.append(\"=== WFGY RAG 16 Problem Map · Wave 0 Triage Summary ===\")\n",
|
|
" lines.append(\"\")\n",
|
|
"\n",
|
|
" env = case_obj.get(\"environment\", {}) or {}\n",
|
|
" lines.append(f\"System : {env.get('system', 'unknown-system')}\")\n",
|
|
" lines.append(f\"Project : {env.get('project', 'unknown-project')}\")\n",
|
|
" lines.append(f\"Run ID : {env.get('run_id', 'unknown-run-id')}\")\n",
|
|
" if env.get(\"run_url\"):\n",
|
|
" lines.append(f\"Run URL : {env.get('run_url')}\")\n",
|
|
" lines.append(\"\")\n",
|
|
"\n",
|
|
" question = (case_obj.get(\"Q\") or \"\").strip()\n",
|
|
" if question:\n",
|
|
" lines.append(\"Question:\")\n",
|
|
" lines.append(indent_block(question))\n",
|
|
" lines.append(\"\")\n",
|
|
"\n",
|
|
" metrics = case_obj.get(\"metrics\", {}) or {}\n",
|
|
" if metrics:\n",
|
|
" lines.append(\"Metrics:\")\n",
|
|
" for k, v in metrics.items():\n",
|
|
" lines.append(f\" - {k}: {v}\")\n",
|
|
" lines.append(\"\")\n",
|
|
"\n",
|
|
" labels = case_obj.get(\"labels\", {}) or {}\n",
|
|
" lines.append(\"Labels:\")\n",
|
|
" lines.append(f\" primary : {labels.get('primary', [])}\")\n",
|
|
" lines.append(f\" secondary : {labels.get('secondary', [])}\")\n",
|
|
" lines.append(f\" modes : {labels.get('modes', [])}\")\n",
|
|
" lines.append(f\" types : {labels.get('types', [])}\")\n",
|
|
" if labels.get(\"confidence\") is not None:\n",
|
|
" lines.append(f\" confidence: {labels.get('confidence')}\")\n",
|
|
" lines.append(\"\")\n",
|
|
"\n",
|
|
" wave0_ids = catalog.get(\"wave0_scope\", {}).get(\"modes\", [])\n",
|
|
" all_modes = catalog.get(\"modes\", [])\n",
|
|
" mode_lookup = {m[\"id\"]: m for m in all_modes if isinstance(m, dict)}\n",
|
|
"\n",
|
|
" lines.append(\"Wave 0 Modes In Scope (1, 2, 5, 8):\")\n",
|
|
" for mid in wave0_ids:\n",
|
|
" meta = mode_lookup.get(mid, {})\n",
|
|
" lines.append(f\" - {mid} {meta.get('code','')} {meta.get('short_name','')}\")\n",
|
|
" lines.append(\"\")\n",
|
|
"\n",
|
|
" selected_modes = labels.get(\"modes\", [])\n",
|
|
" if selected_modes:\n",
|
|
" lines.append(\"Selected Modes For This Case:\")\n",
|
|
" for mid in selected_modes:\n",
|
|
" meta = mode_lookup.get(mid, {})\n",
|
|
" lines.append(f\" - {mid} {meta.get('code','')} {meta.get('short_name','')}\")\n",
|
|
" lines.append(\"\")\n",
|
|
"\n",
|
|
" fix_plan = case_obj.get(\"fix_plan\", {}) or {}\n",
|
|
" if fix_plan:\n",
|
|
" lines.append(\"Fix Plan:\")\n",
|
|
" if fix_plan.get(\"target_modes\"):\n",
|
|
" lines.append(f\" target_modes : {fix_plan.get('target_modes')}\")\n",
|
|
" if fix_plan.get(\"selected_modes\"):\n",
|
|
" lines.append(f\" selected_modes: {fix_plan.get('selected_modes')}\")\n",
|
|
"\n",
|
|
" if fix_plan.get(\"fixes\"):\n",
|
|
" lines.append(\" fixes:\")\n",
|
|
" for f in fix_plan[\"fixes\"]:\n",
|
|
" lines.append(f\" - {f}\")\n",
|
|
"\n",
|
|
" if fix_plan.get(\"verification_tests\"):\n",
|
|
" lines.append(\" verification_tests:\")\n",
|
|
" for t in fix_plan[\"verification_tests\"]:\n",
|
|
" lines.append(f\" - {t}\")\n",
|
|
" lines.append(\"\")\n",
|
|
"\n",
|
|
" triage_notes = (case_obj.get(\"triage_notes\") or \"\").strip()\n",
|
|
" if triage_notes:\n",
|
|
" lines.append(\"Triage Notes:\")\n",
|
|
" lines.append(indent_block(triage_notes))\n",
|
|
" lines.append(\"\")\n",
|
|
"\n",
|
|
" return \"\\n\".join(lines)\n",
|
|
"\n",
|
|
"\n",
|
|
"print(\"Loading WFGY JSON specs...\")\n",
|
|
"catalog = load_json(CATALOG_URL)\n",
|
|
"packet_spec = load_json(PACKET_URL)\n",
|
|
"example_case = packet_spec.get(\"example_packet\", {}) or {}\n",
|
|
"\n",
|
|
"print(\"Catalog URL :\", CATALOG_URL)\n",
|
|
"print(\"Packet URL :\", PACKET_URL)\n",
|
|
"print(\"\")\n",
|
|
"\n",
|
|
"print(summarize_case(example_case, catalog))\n",
|
|
"\n",
|
|
"print(\"=== Wave 0 JSON MVP Execution Complete ===\")"
|
|
],
|
|
"metadata": {
|
|
"id": "RU4fKt-349sA"
|
|
},
|
|
"execution_count": null,
|
|
"outputs": []
|
|
}
|
|
]
|
|
} |