Commit History
-
fix(auth): use roleInOrg from whoami, drop broken members API
The Space owned by an org never let any signed-in user through to the editor, even with full org write access. Root cause: we were reading the role from \`https://huggingface.co/api/organizations/{name}/members\`, but that endpoint returns members as plain user records (\`{ user, fullname, avatarUrl, isPro, type, _id }\`) with no \`role\` field. The check \`member.role === "write" || "admin"\` was therefore always false and every org-member visitor ended up on the login screen. Switch to the \`roleInOrg\` field that whoami already returns in \`info.orgs[i]\`. It carries one of \`admin | write | contributor | read\`, exactly what we need, and we already paid for that round-trip via \`whoAmI()\`. The org-members API call is dropped entirely. Also pick up the \`resourceGroups\` field from the same payload: HF lets \`contributor\` users get \`write\`/\`admin\` on specific groups, and the Space may live in one of those groups. Treat "contributor at org level + any write/admin group" as wr…7652473 -
feat(publisher): editor pill shows who you're signed in as
Upgrade the editor quick-link from a bare pencil icon to a proper pill that contextualises the action: ┌──────────────────────────────────────────────────────┐ │ [avatar] Signed in as @tfrere [✎ Edit article] │ └──────────────────────────────────────────────────────┘ The visitor sees who they're authenticated as before clicking, which makes the "would I be writing to the real file?" question self-answering. Useful when multiple HF accounts share the same browser session, or when a collaborator wants to confirm they're not editing on someone else's behalf. Implementation: - Render placeholder content (\"@you\" + empty <img>) so the layout doesn't shift when /api/auth/status comes back. The pill is still \`hidden\` by default - no flash for anonymous visitors. - Inline script fills the <img>.src (preferring user.avatarUrl, falling back to /api/users/<name>/avatar) and the @handle, then drops the \`hidden\` attribute. - New \`.edit-pill\` styles: rounded pill, pa…2b90d0d -
feat(publisher): editor quick-link for signed-in editors
The published article and the editor share the same Space, but a visitor who already has edit rights had no way to jump from one to the other without retyping \`/editor\` in the URL bar. Add a small pencil icon top-right, mirroring the existing theme toggle on the top-left, that links to /editor. Visibility: - Hidden by default (\`<a id="edit-link" ... hidden>\`) so non- editors / anonymous visitors never see a flash. - An inline script probes \`/api/auth/status\` on load and removes the \`hidden\` attribute when \`canEdit\` is true. Fetch failures (offline preview, exported HTML opened from disk, etc.) are silently swallowed - the button just stays hidden. - Hidden under 1100px (same breakpoint as the theme toggle) so mobile / tablet layouts aren't cluttered. Styling: matches the theme toggle (40px circle, page-bg fill, 1px border, soft shadow) so the page stays balanced visually. \`mix(--primary-color)\` tint on hover hints at the destination. Snapshot updated to reflect…44626d0 -
fix(agent): disable response buffering for chat streaming
The AI SDK streams tokens chunk-by-chunk via \`streamText\` + \`toUIMessageStreamResponse\`, but on a HF Space the response went through layers that re-coalesced everything into one big payload arriving at message end: - Nginx in front of the Space buffers responses by default unless \`X-Accel-Buffering: no\` is set; - transparent gzip on the path holds chunks until the compression window fills; - TCP_NODELAY off keeps small writes in the kernel until they reach MTU. End result: the user saw \"Thinking...\" then the whole assistant reply dropped at once, masking the streaming. Fix: - Set \`X-Accel-Buffering: no\` and \`Content-Encoding: identity\` on the streamed response so proxies pass bytes through as they arrive. - Add \`Cache-Control: no-cache, no-transform\` to also block transforming/compressing intermediaries. - Call \`res.flushHeaders()\` so the browser commits to streaming mode immediately (first-byte triggers progressive rendering of the assistant bubble)…df28ae4 -
fix(agent): forbid re-pasting tool output in the text reply
After calling \`createEmbed\` / \`patchEmbed\` (embed chat) or \`insertAtCursor\` / \`applyDiff\` (main chat), the model would re-emit the just-inserted code/prose verbatim inside its text reply. The chart is already live in the preview pane and the doc is already updated, so the dump is pure noise - it pollutes the chat history, looks like a "did it stream?" stall to the user (the long reply only appears once the full text is buffered on the client), and bloats the next turn's context window. Tighten both prompts: - embed-system-prompt: new "Reply format (STRICT)" section. Caps the reply at 1-2 sentences, explicitly forbids fenced code blocks of the chart source, bullet "feature" lists and phrases like "Voici le code" / "Just paste this where you want the banner". Keeps an escape hatch for "show me the code" requests (short relevant snippet only). - system-prompt: extend the anti-patterns list with a "NEVER paste the content you just inserted/replaced back into your te…e8173b7 -
feat(editor): WYSIWYG NodeView for HfUser cards
The HfUser block was rendering as the generic AtomicView - a dashed placeholder card with three labelled inputs - which looked nothing like the actual upstream component (avatar + display name + @handle). Authors couldn't tell what the published page would look like without a round-trip through publish. Replace it with a dedicated NodeView that reproduces the exact DOM of `app/src/components/HfUser.astro` in the editor: .hf-user └─ .hf-user__left ├─ .hf-user__avatar (img or "?" placeholder when empty) └─ .hf-user__text ├─ .hf-user__name (display name) └─ .hf-user__row └─ .hf-user__username (@handle) Inline editor: - Revealed when the node is selected, or when `username` is still empty right after insertion (prompts the author to fill at least the handle). - Three rows: Username / Display name / URL. URL placeholder switches to `https://huggingface.co/<username>` once a handle is known, so the user can see they don't need to…7814104 -
fix(embed): SVG text now follows the iframe theme
Three stacked bugs were keeping the chart text black in dark mode: 1. EmbedStudio mounted both preview iframes with sandbox="allow-scripts" only (no allow-same-origin). The bootstrap script couldn't reach window.parent.document, so the cascade fell through localStorage to matchMedia(prefers-color-scheme) - which returns the OS preference, not the app theme. Result: the iframe could land on a different theme than the article. Aligned the sandbox with HtmlEmbedView ("allow-scripts allow-same-origin"). 2. The THEME_BOOTSTRAP in shared/embed-doc.ts always overwrote the srcdoc-provided data-theme attribute, even when every detection path failed. Honour the existing data-theme before falling back to matchMedia so an explicit isDark from buildEmbedSrcdoc wins. 3. SVG text/line/path don't inherit CSS color the way HTML elements do - their default fill/stroke is "black", not "currentColor". Charts that scoped colours via `body { color: var(--text-color) }` …be7d6fa -
feat(embed-studio): make agent-generated charts theme-aware
The iframe already supports live light/dark swap via CSS variables and a postMessage(setTheme) hot-swap, but the LLM kept generating charts that hardcode colours into SVG attributes (fill="#333", stroke="black", ...). Those values can't be overridden by the parent's data-theme attribute, so the chart looked correct on whatever theme the model guessed and broken on the other one. Two complementary fixes: 1. Forward the current theme (light/dark) from EmbedStudio through useEmbedChat into the request context, and surface it in the system prompt as a "Current theme" section. The model now knows which background it's painting against and can self-correct. 2. Rewrite the "Colors & theming" section of the embed system prompt with a concrete CSS pattern (scoped .d3-* rules driving fill/stroke via var(--text-color), --axis-color, --grid-color, ...) and an explicit ban on hardcoded SVG colour attributes. Add a hint about window.__chartRerender for JS-driven palettes. No…27abbe5 -
fix(agent): default back to gpt-oss-120b, pin Llama 3.3 to Together
Groq (HF Router's :fastest pick for Llama 3.3 70B) validates tool calls very strictly and was rejecting the editor's 18-tool registry with "Failed to call a function. Please adjust your prompt." Fireworks has deprecated the Llama 3.3 checkpoint; Nscale doesn't support the `tools` parameter at all. Together serves the same model with full tool-calling support, so pin Llama 3.3 to `:together`. Restore openai/gpt-oss-120b as the default - it's HF's trending tool-calling model and the reasoning-strip fix already covers the Cerebras round-trip case. Co-authored-by: Cursor <cursoragent@cursor.com>3afbbdf -
fix(agent): strip reasoning_content from history, default to Llama 3.3 70B
Reasoning models (gpt-oss-*, DeepSeek R1, ...) emit a `reasoning` UI part alongside their text answer. The AI SDK persists those parts and on the next turn round-trips them as `reasoning_content` on the assistant message - which some HF Inference Providers (notably Cerebras, the default for gpt-oss) reject with 400 wrong_api_format. The model doesn't need to see its own prior reasoning to keep the conversation going, so filter those parts out before convertToModelMessages. While we're at it, swap the default model from gpt-oss-120b to meta-llama/Llama-3.3-70B-Instruct: it doesn't emit reasoning, works across every provider exposing it, and is a more conservative starting point for first-time forkers. Co-authored-by: Cursor <cursoragent@cursor.com>e9c2c73 -
feat(agent): switch AI backend from OpenRouter to HF Inference Providers
The chat panel and embed studio now call Hugging Face Inference Providers (OpenAI-compatible router at https://router.huggingface.co/v1) via @ai-sdk/openai-compatible, using the logged-in editor's OAuth token when available and falling back to HF_TOKEN. Forking the Space no longer requires wiring an OpenRouter API key - the user's own HF token funds their own inference. - Replace @openrouter/ai-sdk-provider with @ai-sdk/openai-compatible - Forward the OAuth cookie token per request, fallback to HF_TOKEN - Refresh AVAILABLE_MODELS to HF-served, tool-calling-capable models (gpt-oss 120B/20B, Llama 3.3 70B, Qwen3 Coder 480B, DeepSeek V3.1) - Add inference-api to hf_oauth_scopes and document the new env vars (HF_INFERENCE_MODEL, expanded HF_TOKEN role) in README + SPECIFICATION - Update agent-chat tests to expect the new "Hugging Face token" error Co-authored-by: Cursor <cursoragent@cursor.com>6b6afea
-
feat(publisher): generate llms.txt Markdown twin for LLM agents
External LLMs/agents (Claude, Perplexity, ...) struggle with the heavy published HTML: theme bootstrap, KaTeX/Mermaid runtimes, ~7 inlined CSS files, TOC chrome, and D3 charts wrapped in <iframe srcdoc>. The static research-article-template already ships an `llms.txt` (Astro build plugin); the editor's publisher now does the same, walking the TipTap-JSON we already extract for the HTML/PDF pipeline. Pipeline addition (publisher/index.ts): - After writing index.html, render the same JSON to Markdown via the new markdown-renderer.ts and write `published/<doc>/llms.txt` - Re-render with the public HF meta and include it in the dataset upload commit (hf-storage.ts adds llms.txt to the file list) Routing (create-app.ts): - GET /llms.txt serves the published Markdown twin with Content-Type: text/markdown; charset=utf-8 (404 before publish) - GET /robots.txt advertises it via the `LLMs-Txt:` header, mirroring the upstream template Conventions in the renderer mirror the upstream Ast…3de227d
-
fix(publisher): render HF user card via dedicated transformer
The hfUser atomic node was serialized to an empty `<div data-component="hfUser">` placeholder with no transformer to turn it into the actual profile card, so it rendered as nothing in published articles. Add `hfUserTransformer` mirroring the upstream `HfUser.astro` (avatar + name + @handle), register it in the pipeline, ship the matching `.hf-user` styles in `_publisher.css`, and cover the three cases (full attrs, fallback to username, missing username) with unit tests. Made-with: Cursorf621e1d -
refactor(login-page): neutral title, outlined CTA, drop wordmark
- Title back to default text color (dropping the primary tint) - Switch the CTA from a filled pill to an outlined pill: 1.5px primary border, transparent background, color-mix tint on hover/active - Remove the "Research Article Template Editor" wordmark for a cleaner silhouette Made-with: Cursor0332cd4 -
feat(login-page): full HF logo, primary title, pill CTA, refined layout
- Inline the complete official Hugging Face logo SVG (face + both hugging hands), fixing the previously truncated mark in the button - Move the title to primary color and bump it to a fluid clamp size with Apple-grade letter-spacing - Replace the outlined CTA with a pill-shaped primary button: vertical gradient fill, layered inset highlights, soft elevation, 1px lift on hover with deeper shadow, slightly tighter letter-spacing - Drop the "after signing in, refresh this page" hint since the OAuth flow redirects automatically - Add a soft radial primary tint on the page background and a discreet wordmark below the CTA for brand presence - Use the SF / Source Sans Pro stack with antialiasing tuned for both light and dark modes - Simplify renderLoginPage: hint slot removed, callers now only pass title and description Made-with: Cursor7f90538 -
feat(login-page): align with app design tokens, bigger outlined HF button
- Extract a single renderLoginPage() helper used by both the editor login gate and the published-article fallback (no more duplicated inline HTML) - Use the app's primary color (OKLCH) and Source Sans Pro font, with proper light/dark via prefers-color-scheme so the page no longer looks like an unrelated dark stub - Replace the small filled button with a bigger outlined CTA (14×22 px padding, 1.5px primary border, color-mix hover) - Inline the official Hugging Face brand logo SVG (no external network dependency, no emoji fallback) - Escape user-controlled hint substitutions through a dedicated escapeHtml() Made-with: Cursord8c3c68
-
fix(ui,publisher): kill theme/color flickers and translation prompts
- Published page and its banner iframe now inline a synchronous theme bootstrap in <head>, so the first paint already uses the correct data-theme (no dark -> light flicker on navigation). - <meta name="google|robots" content="notranslate"> on both the editor (frontend/index.html) and the published article so Chrome stops proposing to translate the page to French. - CollaborationCursorV3: silence a peer's caret + label (via the .collaboration-cursor--silenced class) when that same peer also broadcasts an agentFocus. Fixes the duplicate "<Name>" + "<Name> agent" labels that stacked while a chat action was active. - Embed Studio preview container pinned to --page-bg and the iframe element forced to background: transparent + color-scheme: light dark, so the preview tracks dark mode instead of falling through to the browser's default white. - App.tsx primaryHue sync: when the Yjs settings map has no primaryHue (fresh state or after reset-article), drop the inline --p…08e4c7a -
feat(editor): embed studio with data files and agent-aware editing
Editor - New Embed Studio panel for AI-assisted chart creation: upload and manage data files (3MB limit), browse them in a dedicated viewer, and iterate on the generated HTML via a chat wired to a dedicated embed agent (embed-chat + embed-system-prompt + embed-tools + tiptap-catalog) that can create, rename and edit embeds. - Tiptap extensions for agent-driven editing: - agent-focus: Yjs-awareness ranges so every peer sees where another user's AI is working ("<Name> agent" label). - agent-highlight: local PM decoration to mark the paragraph the agent is currently rewriting. - agent-rewrite: typewriter-animated range rewrite command used by the rephrase flow. - Rephrase flow now goes through agent-rewrite (typewriter) instead of a plain replace; bold demonstration moved to the floating bubble toolbar above a selection. - SlashMenu reorganised with grouping and dev-only items dropped. - New components: DataFileViewer, FilesSidebar, UploadZone. - …8fc8501
-
feat(backend): rate-limit /api/upload to prevent anonymous abuse
Upload stays intentionally unauthenticated (covered by spec 4.1.3), so guard it with a simple per-IP sliding-window limiter (30 uploads / 60s). The limiter returns 429 with a Retry-After header and uses the X-Forwarded-For head when behind a proxy. Spec updated with the new 4.1.4 test line. Made-with: Cursor5576f9a -
refactor(backend/publisher): transformer pipeline + shared registry + shiki highlighting
- Split html-renderer post-processing into per-feature transformers (accordion, bibliography, citation, footnote, highlight-code, html-embed, mermaid) with a shared types contract - Extract embed iframe srcdoc builder, shiki config and theme resolver into backend/src/shared so the frontend can reuse the exact same palette and embed chrome - Keep the renderer entrypoint (index.ts) as an orchestrator and trim the legacy logic to the new querySelector-based scope selection (simpler + covered by updated snapshot) - Update publisher/css-resolution/security suites + snapshot to the new output Made-with: Cursor7843436 -
refactor(backend): modular server split with new routes, persistence and agent layer
- Introduce create-app factory to compose routes, middleware and Hocuspocus in isolation - Extract route modules (auth, chat, publish) and move storage logic into persistence.ts - Harden auth + HF storage integration (user token fallback, secure cookie in production) - Add embed studio AI pipeline (embed-chat, embed-tools, system prompt) and shared stream handler - Cover the new surface with api-routes, persistence and agent-chat test suites - Ship .env.example and .gitignore so new contributors can boot without guesswork Made-with: Cursorf6678ab
-
refactor: remove MUI, unify publisher pipeline, add shared component registry
Phase 1 - Publisher pipeline: - Extract ~370 lines of inline CSS from html-renderer.ts into _publisher.css - Create shared/component-defs.ts as single source of truth for component definitions - Replace 6 regex blocks in postProcess() with linkedom DOM manipulation - Add GET /api/preview/:docName for testing renders without publishing - Add 12 snapshot tests for each postProcess transformation (46 tests total) Phase 2 - Remove MUI: - Replace all MUI components with native HTML elements + custom CSS - Create _ui.css with editor chrome styles using --ed-* CSS tokens - Create Tooltip.tsx using Floating UI (lightweight replacement) - Replace @mui/icons-material with lucide-react - Delete theme.ts, remove @mui/* and @emotion/* dependencies Phase 3 - Documentation: - Add docs/ARCHITECTURE.md covering CSS layers, HF Spaces constraints, shared registry, publisher pipeline, and test coverage Made-with: Cursord15d7f7 -
fix: TOC scroll navigation in published articles
- Add scroll-behavior: smooth and scroll-padding-top: 80px to html - Add click handlers on TOC links with smooth scroll and proper offset - Guard lightbox JS against missing elements to prevent script crash that could block TOC initialization Made-with: Cursor9aec70e -
fix: server-side bibliography formatting and citation linking
- Add format-bibliography.ts: formats CSL-JSON entries server-side using citation-js, independent of client-side renderedHtml - Publisher now reads Y.Map("citations") and Y.Map("settings") directly from the Y.Doc to build bibliography at publish time - Inline citations are converted to clickable links pointing to their bibliography entry (with :target highlighting) - Supports both numeric (ieee/vancouver) and author-date styles - Falls back to client-side renderedHtml if server formatting fails - Add CSS for .citation-inline and .csl-entry:target Made-with: Cursor34087bd -
fix: enable PDF generation by adding playwright dependency
- Add playwright as a production dependency in backend - Set PLAYWRIGHT_BROWSERS_PATH in Dockerfile for reliable browser discovery - Remove silent fallback on playwright install to surface errors - Remove non-functional PDF button from editor hero (only relevant in published output) - Respect showPdf frontmatter flag in publisher pipeline Made-with: Cursor8d245e0 -
fix: generate proper footnotes section in published HTML
- Collect all inline footnotes during postProcess and replace with numbered superscript links ([1], [2], etc.) - Append a <section class="footnotes"> with ordered list at the bottom - Footer JS automatically moves this section into the footer area - Add footnote-ref styling (primary color, hover underline) - Make extractBibliographyHtml recursive to find bibliography in nested nodes - Add two demo footnotes to the default article content Made-with: Cursor77b813e -
feat: align component CSS with research-article-template
- Note: left border accent style with color-mix variants (info/success/danger) - QuoteBlock: decorative open-quote mark, large text, author/source footer - Accordion: template-matching border, bg, chevron, open state highlight - Sidenote: muted text, generous padding (matches Sidenote.astro) - Reference: proper spacing and caption styling - Stack: responsive breakpoints matching template (768/1100px) - Tables: zebra stripes, template header bg, vertical dividers - Wide/fullWidth: proper overflow layout in editor - Add PDF download button to hero meta section (using showPdf flag) - Update publisher HTML styles for all components to match template Made-with: Cursor9f7fae9 -
fix: replace undefined __dirname with DATA_DIR in ESM server
__dirname was removed during utils.ts extraction but still referenced in staticDir computation, causing a ReferenceError crash on startup. Made-with: Cursorac48bd2 -
fix: XSS escaping, DRY utils, agent undo batch, graceful shutdown
- Escape meta.licence in published HTML to prevent XSS - Extract shared sanitizeName/docPath/DATA_DIR into utils.ts (DRY) - Disable WS debug logging in production - Fix startup log message (was /collab/:doc, now /collab) - Remove unused NextFunction import in auth.ts - Remove duplicate JSDoc in publisher/index.ts - Add timeout to graceful shutdown (SIGTERM/SIGINT) - Fix agent undo batch: close batch on stream finish (onFinish) - Fix replaceSelection: return error when no text selected Made-with: Cursore371833 -
fix: prevent Y.Doc content duplication from seed race condition
The editor was seeding default content on an 800ms timer that could fire before the Hocuspocus sync completed. When the server had existing content from the HF dataset, Yjs would merge both copies (different client IDs), causing all content, authors, and affiliations to appear multiple times. Fix: only seed after the "synced" event, and check the Y.Doc fragment directly instead of ProseMirror state. Also adds /api/admin/reset-document endpoint to clear corrupted Y.Doc state. Made-with: Cursor1c21ac9 -
fix: always write published HTML locally before HF upload
The publish pipeline was uploading to HF dataset and returning immediately without updating the local copy. Since GET / serves the local file, the old HTML persisted until a container restart. Now the local copy is written first, so the published page updates instantly. HF upload still happens afterwards for persistence. Made-with: Cursorf2312e5 -
fix: align published article with template design
Theme toggle: - Replace emoji button with SVG sun/moon icons from ThemeToggle.astro - Fix id mismatch (class="theme-toggle" -> id="theme-toggle") - Add spin animation and system theme detection Hero: - Add .hero-title class to h1 so clamp font-size styles apply DOM structure: - Change <article> to <main> in content-grid to match template selectors (.content-grid main) used across _base.css, _layout.css, _table.css for typography, figures, references Component CSS: - Add styles for note, quoteBlock, sidenote, stack, reference, wide, fullWidth components (div[data-component="..."]) Code highlighting: - Load highlight.js runtime + call hljs.highlightAll() for syntax coloring in published code blocks Performance: - Debounce CommentsSidebar position updates and TOC heading extraction Made-with: Cursor0094189 -
fix: resolve @custom-media queries in publisher CSS
The publisher reads raw CSS source files that use @custom-media (e.g. --bp-content-collapse). Browsers don't support this natively - PostCSS resolves it in the Vite build but not for the publisher. This broke ALL responsive breakpoints in published HTML: the grid never collapsed, mobile TOC elements were unaffected by media queries, and the layout was broken on narrow screens. Added resolveCustomMedia() that extracts @custom-media declarations and replaces their usage with the resolved values before injection. Made-with: Cursord4a36db -
fix: robust published article restore on container rebuild
- Add detailed logging to pullPublishedAssets for diagnostics - Retry restore for anonymous visitors (dataset is public, no token needed) - Add mutex to prevent concurrent pull attempts - Add direct HTTP fetch fallback when Hub library fails - Log SPACE_ID and HF_DATASET_ID at startup Made-with: Cursorded4123 -
feat: adopt template CSS architecture, hero/TOC/color alignment
- Copy template foundation CSS (_variables, _reset, _base, _layout, _print) and component CSS (_code, _table, _tag, _card, _mermaid) - Extract hero styles from HeroArticle.astro into shared _hero.css - Extract TOC styles from TableOfContents.astro into shared _toc.css - Create _editor-tokens.css for editor-specific design tokens - Scope _reset.css and _base.css global styles to article area to avoid overriding MUI portals (Dialog, Menu, Tooltip) - Exclude _button.css and _form.css from editor (bare element selectors conflict with MUI components) - Align FrontmatterHero class names with template (.hero, .meta, .meta-container-cell, .authors, .affiliations) - Align publisher HTML renderer class names accordingly - Fix TOC sticky positioning (align-self:stretch + sticky wrapper) - Add hue-based color picker (OKLCH slider like template ColorPicker) synced via Yjs settings, driving both MUI theme and CSS variables - Align editor link styles with template (--primary-color) - Add Po…9b7d64e -
fix: rename to Research Article Template Editor
Made-with: Cursor1e2f7dc -
refactor: rename to Science Article Template Editor, remove MDX export, fix settings drawer
- Rename project from "Collab Editor" to "Science Article Template Editor" across README, package.json, HTML titles, and docs - Remove MDX export: delete to-mdx.ts, serializers, UI button, and registerComponentSerializers; use editor.getText() for agent context - Settings drawer: flatten Advanced accordion, fix toggle clipping (ml: 0), widen to 380px, use slotProps.paper (MUI v9) Made-with: Cursor20354ec
-
fix: use manage-repos scope, public dataset, remove image proxy
- Change OAuth scope from write-repos to manage-repos (required for dataset creation - this was silently failing before) - Create dataset as public instead of private - Remove token requirement from pullPublishedAssets (public reads) - Remove /api/images/* proxy route (unnecessary with public dataset) Made-with: Cursor56a5607 -
fix: lazy-restore published article using OAuth token
The startup pull fails when there's no HF_TOKEN env var (common in Spaces using OAuth only). Now the restore is attempted: 1. At startup (works if HF_TOKEN secret is set) 2. On first authenticated request (auth/status with user token) 3. On first visit to the public page (if visitor has a cookie) Uses a flag to ensure the pull only runs once successfully. Made-with: Cursor871447f -
fix: match TOC style and collapse behavior to original template
- Grid columns: 260px / 680px / 260px (matching original) - Desktop TOC: exact same styles (border-left, font-size 13px, title 14px 600, H2 links bold 700, hover underline solid muted, active underline, margin-top 12px) - Auto-collapse: sub-sections fold/unfold based on active heading, disabled on mobile (all expanded), with height transition 200ms - Mobile sidebar: same styles as original template - Class names aligned: .table-of-contents (not .toc) Made-with: Cursor03c7c65 -
feat: add Table of Contents to published article
Adapted from the research-article-template TOC system: - Desktop (>1100px): sticky sidebar on the left in a 3-column grid - Mobile (<1100px): hamburger button + sliding panel from the left - Active section tracking on scroll (h2/h3/h4) - Auto-generated IDs on headings (slugified, deduplicated) - Theme toggle now persists to localStorage - Print styles hide TOC and UI elements Made-with: Cursor35f4ea0 -
feat: restore published article from HF dataset on startup
After a container rebuild, the local data directory is empty. On boot, the server now pulls published assets (HTML, PDF, thumbnail, meta) from the HF dataset back to local storage so the published article is served immediately without needing to re-publish. Made-with: Cursord2072ce -
fix: bibliography not appearing - extract HTML before generateHTML
The renderedhtml attribute can contain > chars (valid in quoted HTML attributes) which broke the [^>]* regex in postProcess. Now we extract the bibliography HTML from the TipTap JSON tree before calling generateHTML, clear the attribute to keep the output clean, and inject the raw HTML in postProcess using the pre-extracted string. Made-with: Cursor727352b -
fix: authors, bibliography and CSS in published article
- Read authors from Y.Array("frontmatter.authors") instead of Y.Map("frontmatter") which only holds scalar fields - Read date from "published" key (matching frontend convention) - Render authors with links and affiliations in the article header - Fix bibliography: renderHTML was outputting raw HTML as a text node (escaped); now uses postProcess to decode the renderedhtml attribute - Fix CSS loading: try multiple paths so it works both in dev and in Docker production (/app/frontend-styles/) Made-with: Cursor2ea3987 -
fix: accept /collab WebSocket upgrade without trailing slash
The Hocuspocus provider connects to /collab (no trailing slash), but the upgrade handler only matched /collab/. Also add debug logging for incoming WS messages and proper error handling. Made-with: Cursor1c0ee53 -
fix: replace express-ws with native ws to fix WebSocket binary handling
express-ws bundles ws@7.5.10 while @hocuspocus/server requires ws@8.x. This version mismatch causes ERR_ENCODING_INVALID_ENCODED_DATA errors as the binary Yjs protocol messages get corrupted passing through express-ws's incompatible ws instance. Replace express-ws with native http.createServer + ws.WebSocketServer handling the upgrade event directly. This ensures a single ws@8.20.0 is used throughout, matching what Hocuspocus expects. Made-with: Cursor82092f2 -
debug: enhance publish pipeline logging
Log live Hocuspocus document state, XmlFragment content, full JSON structure, CSS loading, and meta to diagnose incomplete published articles. Made-with: Cursorf797eff -
debug: add logging to publish extraction pipeline
Made-with: Cursord9fd132 -
fix: use TiptapTransformer to extract Y.Doc content for publish
The old extractFromYDoc relied on a Y.Map("tiptap-json") that the editor never populated. Now uses @hocuspocus/transformer to properly convert the Y.XmlFragment to ProseMirror JSON using the same extensions as the server-side HTML renderer. Made-with: Cursordb4f7ee -
fix: fall back to local storage when HF dataset upload fails
Instead of returning an error when HF upload fails, the publish pipeline now falls through to local storage. This ensures publish always works even when the dataset hasn't been created yet. Made-with: Cursorfca850a