From 7bdaf37c59573317d3693178c1287882989d3aa2 Mon Sep 17 00:00:00 2001 From: welsberr Date: Tue, 7 Apr 2026 04:09:09 +0000 Subject: [PATCH] Added literature explorer example --- .gitignore | 1 + examples/literature-explorer/demo-token.md | 2 + examples/literature-explorer/index.html | 299 +++++++++++++++++- .../literature-explorer.js | 18 +- src/citegeist/app_api.py | 37 +++ src/citegeist/app_server.py | 73 ++++- src/citegeist/batch.py | 12 + src/citegeist/bootstrap.py | 225 ++++++++++++- src/citegeist/cli.py | 132 +++++++- src/citegeist/expand.py | 188 +++++++---- src/citegeist/storage.py | 32 +- src/citegeist/talkorigins.py | 12 + tests/test_app_api.py | 107 ++++++- tests/test_app_server.py | 142 ++++++++- tests/test_batch.py | 90 ++++++ tests/test_bootstrap.py | 164 ++++++++++ tests/test_topic_expand.py | 97 ++++++ 17 files changed, 1542 insertions(+), 89 deletions(-) create mode 100644 examples/literature-explorer/demo-token.md diff --git a/.gitignore b/.gitignore index 6ed0479..301a038 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ __pycache__/ *.pyc *.egg-info/ library.sqlite3 +ops/ diff --git a/examples/literature-explorer/demo-token.md b/examples/literature-explorer/demo-token.md new file mode 100644 index 0000000..83ae8e5 --- /dev/null +++ b/examples/literature-explorer/demo-token.md @@ -0,0 +1,2 @@ + +abd358981999c08a4f777efa4f38f2d4990c42e3421342cf9e9b460bf9700e41 diff --git a/examples/literature-explorer/index.html b/examples/literature-explorer/index.html index e0e8433..d555117 100644 --- a/examples/literature-explorer/index.html +++ b/examples/literature-explorer/index.html @@ -52,6 +52,8 @@ position: sticky; top: 1rem; align-self: start; + max-height: calc(100vh - 2rem); + overflow-y: auto; } .content { @@ -191,6 +193,8 @@ .status.error { color: var(--danger); } .status.ok { color: var(--accent-2); } + .status.note { color: #5d4716; } + .meta-grid { display: grid; gap: 0.5rem; @@ -382,6 +386,61 @@ margin-top: 0.75rem; } + .api-reference { + display: grid; + gap: 0.85rem; + } + + .summary-box { + margin-top: 0.75rem; + padding: 0.8rem 0.9rem; + border-radius: 16px; + background: rgba(255, 255, 255, 0.74); + border: 1px solid rgba(73, 57, 35, 0.11); + display: grid; + gap: 0.35rem; + } + + .summary-box strong { + color: var(--ink); + } + + .endpoint-card { + border-radius: 18px; + border: 1px solid rgba(73, 57, 35, 0.11); + background: rgba(255, 255, 255, 0.74); + padding: 0.95rem 1rem; + display: grid; + gap: 0.55rem; + } + + .endpoint-head { + display: flex; + gap: 0.6rem; + align-items: center; + flex-wrap: wrap; + } + + .endpoint-method { + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 4.4rem; + padding: 0.28rem 0.55rem; + border-radius: 999px; + background: var(--accent-2); + color: #f7fbfb; + font-size: 0.78rem; + font-weight: 700; + letter-spacing: 0.04em; + } + + .endpoint-path { + font-family: "IBM Plex Mono", "SFMono-Regular", monospace; + font-size: 0.9rem; + color: var(--ink); + } + @media (max-width: 1080px) { .shell { grid-template-columns: 1fr; } .sidebar { position: static; } @@ -403,11 +462,16 @@

Bridge

+
+
Not connected.
@@ -442,10 +506,47 @@ +
+ + + +
+
+ + + +
+
+ Bootstrap Policy +

Use graph-limited bootstrap when you want topic seeding and expansion in one pass. The same expansion policy applies to preview and commit.

+
@@ -471,6 +572,7 @@ +
+ + + +
+
+ Expansion Policy +

Use cites to bias toward newer work, or both for broader graph growth. Recursive rounds stop once the recent-entry target is met.

+
@@ -579,14 +699,83 @@

Graph View

Load a topic to view a small local network around its first few entries.
+ +
+

API Reference

+
+
+
+ GET + /api/healthz +
+

Health check endpoint. Does not require a bearer token.

+
+
+
+ GET + /api/capabilities +
+

Returns the available operation names and preview-capable actions. Requires Authorization: Bearer <token>.

+
+
+
+ POST + /api/call +
+

RPC-style API entry point for search, topic loading, graph traversal, extraction, verification, and topic BibTeX export.

+
{ + "method": "expand_topic", + "params": { + "topic_slug": "acraniates", + "relation_type": "cites", + "max_rounds": 3, + "recent_years": 5, + "target_recent_entries": 10 + } +}
+
+
+
+ POST + /api/call bootstrap policy +
+

Bootstrap also accepts expansion policy controls when you want bounded topic seeding plus graph growth in one step.

+
{ + "method": "bootstrap", + "params": { + "topic": "abiogenesis", + "topic_slug": "abiogenesis", + "expansion_mode": "cites", + "expansion_rounds": 3, + "recent_years": 5, + "target_recent_entries": 5, + "max_expanded_entries": 100, + "max_expand_seconds": 20 + } +}
+
+
+
+ AUTH + Bearer token +
+

Set the token in the sidebar once. The demo stores it in localStorage and attaches it to subsequent /api/* requests.

+
+
+