Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions broca/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def render(root, brain):
rows = {r["assistant"]: r for r in snapshot["assistants"]}
esc = lambda value: html.escape(str(value), quote=True)
panels, attention, history, maintenance = [], [], [], []
from broca.resources import assistant_anchors
assistant_evidence = {}
for name in cfg["assistants"]:
row = rows.get(name, {})
Expand All @@ -67,7 +68,7 @@ def render(root, brain):
"collected_at": snapshot.get("refreshed_at") or "Unknown",
"observed_at": when}
definitions = len(row.get("benchmarks", [])) if collected != "unavailable" else "Unknown"
panels.append(f'<article class="assistant-card"><h3>{link}</h3><p><strong>{esc(state)}</strong></p>'
panels.append(f'<article class="assistant-card">{assistant_anchors(root, name, repo)}<h3>{link}</h3><p><strong>{esc(state)}</strong></p>'
f'<dl><dt>Latest evidence day</dt><dd>{esc(when)}</dd><dt>Runs recorded</dt><dd>{len(runs)}</dd>'
f'<dt>Current commit</dt><dd><code>{esc(revision)}</code></dd>'
f'<dt>Evaluated commit</dt><dd><code>{esc((latest["assistant_sha"] or "Unknown")[:12] if latest else "None")}</code></dd>'
Expand Down Expand Up @@ -129,6 +130,6 @@ def render(root, brain):
'<section id="assistants"><h2>Assistants</h2><div class="assistant-grid">' + ''.join(panels) + '</div></section>' +
'<section id="attention"><h2>Next actions</h2><ul>' + ''.join(attention) + '</ul></section>' +
'<section id="history"><h2>Evaluation history</h2>' + table + '</section>' +
'<section id="maintenance"><h2>Maintenance</h2><p>Committed-file inventory; these checks do not establish response quality or scientific correctness.</p><ul>' + ''.join(maintenance) + '</ul></section>' +
'<footer>Assistant evaluation evidence · collection age and evaluation age are separate.</footer>' + footer + '</main><script>' + theme.JS + '</script></body></html>')
'<section id="maintenance"><h2>Maintenance</h2><ul>' + ''.join(maintenance) + '</ul></section>' +
'' + footer + '</main><script>' + theme.JS + '</script></body></html>')
return theme.section_layout(page)
33 changes: 18 additions & 15 deletions broca/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from pathlib import Path
from urllib.parse import urlsplit

TYPES = {'documentation': 'Documentation', 'tutorials': 'Tutorials',
'workspaces': 'Workspace', 'assistants': 'Assistant'}
TYPES = {'workspaces': 'Workspaces', 'tutorials': 'How To', 'documentation': 'Documentation'}
PURPOSE = {'documentation': 'Reference and explanations for using the software.',
'tutorials': 'Guided learning: start with the tutorial introduction.',
'workspaces': 'Runnable user examples: start with its README and setup guidance.',
Expand All @@ -27,25 +26,29 @@ def render(root, assistant_evidence):
if catalogue.get('schema_version') != 1 or not isinstance(catalogue.get('resources'), list):
raise ValueError('invalid public resource catalogue')
esc = lambda value: html.escape(str(value), quote=True)
cards = []
cards = {kind: [] for kind in TYPES}
for resource in catalogue['resources']:
kinds = [k for k in TYPES if k in resource.get('relations', [])]
if not kinds:
if not kinds or 'assistants' in resource.get('relations', []):
continue
evidence = assistant_evidence.get(resource.get('repo')) if 'assistants' in kinds else None
# Bind assistant evidence to the exact canonical remote, not a similar name.
if evidence and evidence.get('github') != resource.get('github'):
evidence = None
state = evidence['state'] if evidence else 'Inventory only — quality not evaluated'
state = 'Inventory only — quality not evaluated'
projects = ', '.join(p['name'] for p in resource['projects'])
links = ' · '.join(link(l['url'], l['label']) for l in resource['links'])
details = ('<p>Collection: ' + esc(evidence['collection']) + ' · collected ' + esc(evidence['collected_at'])
+ '</p><p>Current commit: ' + esc(evidence['revision']) + ' · latest evaluation day: '
+ esc(evidence['observed_at']) + '</p>') if evidence else '<p>Revision, collection time and upkeep evidence: unavailable for this resource.</p>'
cards.append(f'''<details id="resource-{esc(resource['id'])}"><summary>{esc(resource['name'])} · {esc(' / '.join(TYPES[k] for k in kinds))} · {esc(projects)} · {esc(state)}</summary>
details = '<p>Revision, collection time and upkeep evidence: unavailable for this resource.</p>'
cards[kinds[0]].append(f'''<details id="resource-{esc(resource['id'])}"><summary>{esc(resource['name'])} · {esc(' / '.join(TYPES[k] for k in kinds))} · {esc(projects)} · {esc(state)}</summary>
<p>{esc(' '.join(PURPOSE[k] for k in kinds))}</p><p>{links}</p>
<p>Used by: {esc(projects)}. Shared resources retain one identity; no assistant is required.</p>{details}
<p>Technical validation belongs to Heart. A successful build or runnable example does not establish explanatory quality or scientific correctness.</p>
<p>Next: inspect this resource's introduction, intended audience and known gaps with Broca before proposing a bounded documentation or evaluation task.</p></details>''')
return ('<section id="communication"><h2>Communication resources</h2><p>Documentation, tutorials, user workspaces and assistants. Project repositories own the source; Broca presents communication context and available upkeep evidence.</p>'
+ ''.join(cards) + ('' if cards else '<p>No public communication resources configured.</p>') + '</section>')
return ('<section id="communication"><h2>Communication resources</h2>'
+ ''.join(f'<details id="communication-{kind}"><summary>{TYPES[kind]}</summary>' + ''.join(rows) + '</details>' for kind, rows in cards.items() if rows) + ('' if any(cards.values()) else '<p>No public communication resources configured.</p>') + '</section>')


def assistant_anchors(root, name, github):
path = Path(root) / 'resources.json'
if not path.is_file():
return ''
resources = json.loads(path.read_text())['resources']
return ''.join('<span id="resource-' + html.escape(r['id'], quote=True) + '"></span>'
for r in resources if 'assistants' in r.get('relations', [])
and r.get('repo') == name and r.get('github') == github)
Loading
Loading