Research-Stack/plugins/inspect_project_options.py
Brandon Schneider 2aef54d052 chore: commit accumulated working tree changes
Lean: update Semantics modules, add new numerics/physics data files
Hardware: update FPGA bitstreams (tangnano9k_uart_loopback)
Infra: k3s-flake tests, netcup-vps configuration, VCN compute substrate
Docs: ARCHITECTURE, specs, citation updates
2026-05-30 00:10:02 -05:00

72 lines
2.8 KiB
Python

import sqlite3
import shutil
import asyncio
from playwright.async_api import async_playwright
def get_tokens():
db_path = "/run/user/1000/psd/allaun-firefox-tobv72sv.default-release/storage/default/https+++contextstream.io/ls/data.sqlite"
temp_db = "/home/allaun/.gemini/antigravity/scratch/ls_temp.sqlite"
shutil.copy(db_path, temp_db)
conn = sqlite3.connect(temp_db)
cursor = conn.cursor()
cursor.execute("SELECT key, value FROM data WHERE key IN ('auth_token', 'refresh_token');")
tokens = {}
for key, val in cursor.fetchall():
tokens[key] = val.decode('utf-8', errors='ignore')
conn.close()
return tokens
async def main():
tokens = get_tokens()
auth_token = tokens.get("auth_token")
refresh_token = tokens.get("refresh_token")
async with async_playwright() as p:
browser = await p.chromium.launch(headless=True)
context = await browser.new_context()
page = await context.new_page()
await page.goto("https://contextstream.io")
await page.wait_for_timeout(2000)
await page.evaluate("""([auth, refresh]) => {
localStorage.setItem('auth_token', auth);
localStorage.setItem('refresh_token', refresh);
}""", [auth_token, refresh_token])
await page.goto("https://contextstream.io/dashboard?stage=skills")
await page.wait_for_timeout(4000)
# Click the project dropdown trigger (which says 'llm_wiki')
print("Clicking project trigger...")
await page.locator("text=llm_wiki").first.click()
await page.wait_for_timeout(2000)
# Query all portal or dropdown items
print("Searching for project options in dropdown...")
elements = await page.locator("div, span, button, a").all()
options = []
for el in elements:
try:
text = await el.inner_text()
if "Research" in text or "Stack" in text or "llm_wiki" in text:
# Let's clean the text and check if it's a short text option
lines = [l.strip() for l in text.split('\n') if l.strip()]
if lines and len(lines) <= 2:
option_text = " | ".join(lines)
tag = await el.evaluate("e => e.tagName")
options.append((tag, option_text))
except Exception:
pass
# Remove duplicates
unique_options = list(set(options))
print(f"Found {len(unique_options)} unique potential options:")
for tag, opt in unique_options:
print(f" Tag: {tag} - Option: '{opt}'")
await browser.close()
if __name__ == "__main__":
asyncio.run(main())