Skip to content

LangGraph migration #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
51 changes: 48 additions & 3 deletions pipeline/core/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import json
import logging
import re
import shutil
from pathlib import Path

Expand Down Expand Up @@ -52,6 +53,12 @@ def __init__(self, src_dir: Path, build_dir: Path) -> None:
".js",
}

# Mapping of language codes to full names for URLs
self.language_url_names = {
"python": "python",
"js": "javascript",
}

def build_all(self) -> None:
"""Build all documentation files from source to build directory.

Expand Down Expand Up @@ -127,6 +134,39 @@ def _convert_yaml_to_json(self, yaml_file_path: Path, output_path: Path) -> None
logger.exception("Failed to convert %s to JSON", yaml_file_path)
raise

def _rewrite_oss_links(self, content: str, target_language: str | None) -> str:
"""Rewrite /oss/ links to include the target language.

Args:
content: The markdown content to process.
target_language: Target language ("python" or "js") or None to skip rewriting.

Returns:
Content with rewritten links.
"""
if not target_language:
return content

def rewrite_link(match: re.Match) -> str:
"""Rewrite a single link match."""
pre = match.group(1) # Everything before the URL
url = match.group(2) # The URL
post = match.group(3) # Everything after the URL

# Only rewrite absolute /oss/ paths
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed that this is also rewriting image paths, which it should ignore

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for flagging this, pushing a fix now!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if url.startswith("/oss/"):
parts = url.split("/")
# Insert full language name after "oss"
parts.insert(2, self.language_url_names[target_language])
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this deducing the target language from the fenching? what if a link is outside of a fence?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Links work inside and outside of the fencing. I think we kind of pre-set the languages and just swap them out depending on which version of the docs we're building at the time.

url = "/".join(parts)

return f"{pre}{url}{post}"

# Match markdown links and HTML links/anchors
# This handles both [text](/oss/path) and <a href="/oss/path">
pattern = r'(\[.*?\]\(|\bhref="|")(/oss/[^")\s]+)([")\s])'
return re.sub(pattern, rewrite_link, content)

def _process_markdown_content(
self, content: str, file_path: Path, target_language: str | None = None
) -> str:
Expand All @@ -144,10 +184,15 @@ def _process_markdown_content(
The processed markdown content.
"""
try:
# Apply markdown preprocessing
return preprocess_markdown(
# First apply standard markdown preprocessing
content = preprocess_markdown(
content, file_path, target_language=target_language
)

# Then rewrite /oss/ links to include language
content = self._rewrite_oss_links(content, target_language)

return content
except Exception:
logger.exception("Failed to process markdown content from %s", file_path)
raise
Expand Down Expand Up @@ -577,4 +622,4 @@ def _copy_shared_files(self) -> None:
shutil.copy2(file_path, output_path)
copied_count += 1

logger.info("✅ Shared files copied: %d files", copied_count)
logger.info("✅ Shared files copied: %d files", copied_count)
2 changes: 1 addition & 1 deletion src/labs/swe/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The agent can be used through a web interface or triggered automatically via Git
<Card title="Setup" icon="robot" href="/labs/swe/setup/intro">
How to set up Open SWE for development
</Card>
<Card title="Examples" icon="database" href="/labs/swe/examples">
<Card title="Examples" icon="database" href="/labs/swe/usage/examples">
Examples of tasks you can try out
</Card>
<Card title="Usage" icon="database" href="/labs/swe/usage/intro">
Expand Down
4 changes: 2 additions & 2 deletions src/labs/swe/usage/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Open SWE provides two primary ways to interact with the coding agent, each desig
Interactive chat interface with manual and auto modes for direct agent
communication
</Card>
<Card title="GitHub Webhooks" icon="webhook" href="/labs/swe/usage/webhook">
<Card title="GitHub Webhooks" icon="webhook" href="/labs/swe/usage/github#github-webhook-integration">
Automated triggers through GitHub issue labels for seamless repository
integration
</Card>
Expand Down Expand Up @@ -42,7 +42,7 @@ You can explore Open SWE's capabilities using our hosted demo at [swe.langchain.
<Tip>
Start with the [Web Interface guide](/labs/swe/usage/ui) to understand Open
SWE's core capabilities, then explore [GitHub
Webhooks](/labs/swe/usage/webhook) for automated integration into your
Webhooks](/labs/swe/usage/github#github-webhook-integration) for automated integration into your
development workflow.
</Tip>

Expand Down
2 changes: 1 addition & 1 deletion src/oss/use-functional-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,7 @@ for await (const chunk of await workflow.stream([inputMessage2], {

## Workflows

* [Workflows and agent](/oss/workflows-and-agents) guide for more examples of how to build workflows using the Functional API.
* [Workflows and agent](/oss/agentic-architectures) guide for more examples of how to build workflows using the Functional API.

## Integrate with other libraries

Expand Down