Skip to content

plasmate-labs/copilot-plasmate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plasmate Copilot Extension

A GitHub Copilot extension that provides web browsing capabilities using Plasmate - the browser engine for AI agents.

Plasmate converts HTML to a Semantic Object Model (SOM), providing 10-100x token compression compared to raw HTML. This makes it ideal for AI agents that need to efficiently browse and understand web content.

Installation

Prerequisites

  1. Plasmate CLI - Install from plasmate.app or build from source:

    # From the Plasmate repository
    cargo build --release
  2. Node.js 18+

Install the Extension

# Clone the repository
git clone https://github.com/plasmate/copilot-plasmate.git
cd copilot-plasmate

# Install dependencies
npm install

# Build
npm run build

Register with GitHub Copilot

  1. Go to GitHub Copilot Extensions
  2. Click "Add Extension"
  3. Select "Local Extension"
  4. Point to this directory

Or use the GitHub CLI:

gh copilot extension add ./copilot-extension.json

Tools

plasmate_fetch_page

Fetch a web page and return structured content using Plasmate's Semantic Object Model.

@plasmate fetch https://docs.github.com/en/copilot

Parameters:

  • url (required) - The URL to fetch
  • format - Output format: som (default), text, or json
  • selector - CSS selector to extract specific elements

plasmate_extract_text

Extract readable text content from a web page, similar to reader mode.

@plasmate extract text from https://blog.example.com/article

Parameters:

  • url (required) - The URL to extract text from
  • selector - CSS selector to limit scope
  • maxLength - Maximum text length in characters

plasmate_extract_links

Extract all links from a web page with metadata.

@plasmate get all links from https://docs.example.com

Parameters:

  • url (required) - The URL to extract links from
  • selector - CSS selector to limit scope
  • pattern - Regex pattern to filter links
  • internalOnly - Only return same-domain links

plasmate_search_web

Search the web and optionally fetch result pages.

@plasmate search "rust async web scraping"

Parameters:

  • query (required) - Search query
  • maxResults - Maximum results (default: 5, max: 10)
  • fetchResults - Fetch and parse each result page

Configuration

Set these environment variables to customize behavior:

Variable Description Default
PLASMATE_PATH Path to plasmate binary plasmate
PLASMATE_TIMEOUT Request timeout (ms) 30000
DEBUG Enable debug logging false

Usage Examples

Fetch documentation

@plasmate fetch the React hooks documentation

I'll help you understand React hooks. Let me fetch the documentation.

Research a topic

@plasmate search "best practices for TypeScript error handling" and summarize

I'll search and compile information about TypeScript error handling best practices.

Extract API documentation structure

@plasmate get all internal links from https://api.example.com/docs that contain "/v2/"

I'll extract the v2 API documentation structure for you.

Read an article

@plasmate extract the main text from https://blog.example.com/post/123

Let me get the article content for you.

Development

# Install dependencies
npm install

# Run in development mode
npm run dev

# Type check
npm run typecheck

# Lint
npm run lint

# Build for production
npm run build

How It Works

  1. Copilot invokes a tool - When you ask Copilot to browse the web, it calls one of the Plasmate tools

  2. Plasmate fetches the page - The extension invokes the Plasmate CLI to fetch and parse the web page

  3. HTML becomes SOM - Plasmate converts the HTML to a Semantic Object Model, preserving meaning while dramatically reducing tokens

  4. Copilot receives structured data - The compressed, semantic representation is returned to Copilot for analysis

Architecture

GitHub Copilot
     │
     ▼
┌─────────────────────┐
│ Copilot Extension   │
│   (This package)    │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐
│   Plasmate CLI      │
│ (Browser engine)    │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐
│   Web Page (HTML)   │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐
│ Semantic Object     │
│ Model (10-100x      │
│ compression)        │
└─────────────────────┘

License

MIT

About

GitHub Copilot SDK extension for Plasmate - give Copilot structured web browsing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors