npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wavelength/client-sdk

v0.2.0

Published

Wavelength Hub Client SDK - Build interactive plugins and enhance content experiences

Readme

🌊 Wavelength Client SDK

Build powerful plugins and interactive experiences for the Wavelength Hub platform.

🚀 Quick Start

<!-- Include the SDK in your plugin -->
<script src="https://hub.wavelength.com/sdk/wavelength-hub.js"></script>

<script>
  (async () => {
    // Check if Hub API is available
    if (!window.WavelengthHub) {
      console.error('WavelengthHub API not found');
      return;
    }

    // Get current tenant info
    const tenant = await WavelengthHub.tenant.current();
    console.log('Tenant:', tenant.name);

    // Detect narrative mode
    const isNarrative = await WavelengthHub.state.isNarrativeMode();
    if (isNarrative) {
      console.log('Narrative mode is active - adjusting UI');
    }

    // Listen for narrative changes
    WavelengthHub.state.onNarrativeChange((isActive, info) => {
      console.log('Narrative state changed:', isActive);
    });
  })();
</script>

📦 Installation

For Plugin Development

The SDK is automatically injected into your plugin pages. Just declare API access in your game.json:

{
  "type": "client-sdk-plugin",
  "apiAccess": ["tenant", "theme", "content", "chat", "state"]
}

For NPM Projects

npm install @wavelength/client-sdk
import WavelengthHub from '@wavelength/client-sdk';

// Use the SDK
const tenant = await WavelengthHub.tenant.current();

🎯 Core APIs

Tenant API

Access tenant information and configuration:

const tenant = await WavelengthHub.tenant.current();
// { id, name, slug, description, ... }

const settings = await WavelengthHub.tenant.settings();
// { theme, features, customization, ... }

State API

Detect and respond to application state changes:

// Check narrative mode
const isNarrative = await WavelengthHub.state.isNarrativeMode();

// Get narrative info
const info = await WavelengthHub.state.getNarrativeInfo();
// { id, title, chapter, ... }

// Subscribe to changes
const unsubscribe = WavelengthHub.state.onNarrativeChange((isActive, info) => {
  if (isActive) {
    // Hide non-essential UI during narrative
  } else {
    // Restore UI
  }
});

Content API

Detect and interact with current content:

const content = await WavelengthHub.content.detect();
// { type: 'character', id: 'lenny', title: 'Lenny', ... }

const details = await WavelengthHub.content.get('character', 'lenny');
// Full character details

Theme API

Access and respond to theme changes:

const theme = await WavelengthHub.theme.current();
// { primaryColor, secondaryColor, fontFamily, ... }

WavelengthHub.theme.onChange((newTheme) => {
  // Update plugin UI to match theme
});

Chat API

Integrate with the Hub's AI chat system:

const response = await WavelengthHub.chat.send(
  'Tell me about Lenny's conducting style'
);
console.log(response.response);

🎼 Example: Narrative-Aware Plugin

(async () => {
  'use strict';

  // Check narrative mode before initializing UI
  const isNarrative = await WavelengthHub.state.isNarrativeMode();
  
  if (isNarrative) {
    console.log('Narrative active - deferring plugin UI');
    
    // Wait for narrative to end
    WavelengthHub.state.onNarrativeChange((isActive) => {
      if (!isActive) {
        initializePlugin();
      }
    });
    
    return;
  }

  // Safe to show plugin UI
  initializePlugin();

  function initializePlugin() {
    // Create your plugin interface
    const widget = document.createElement('div');
    widget.innerHTML = '<h3>My Plugin</h3>';
    document.body.appendChild(widget);
  }
})();

📚 Documentation

🎨 Example Plugins

Bernstein Lore Master

Educational overlay plugin demonstrating:

  • Narrative mode detection
  • Character connection system
  • Interactive timeline
  • YouTube integration

See examples/bernstein-lore-master for the complete implementation.

🏗️ Building Plugins

  1. Create plugin structure:
my-plugin/
├── game.json       # Plugin metadata
├── plugin.json     # Additional config
├── index.js        # Entry point
└── assets/         # CSS, images, etc.
  1. Configure API access in game.json:
{
  "name": "My Plugin",
  "type": "client-sdk-plugin",
  "apiAccess": ["tenant", "state", "content"],
  "entryPoint": "index.js"
}
  1. Use the SDK in index.js:
(async () => {
  if (!window.WavelengthHub) return;
  
  const tenant = await WavelengthHub.tenant.current();
  // Build your experience
})();
  1. Upload to /admin/games/sandbox

🔒 Making Repositories Private

To protect your plugin code:

# On GitHub, go to Settings > Danger Zone > Change visibility
# Or via GitHub CLI:
gh repo edit --visibility private

🤝 Contributing

This SDK is maintained by the Wavelength development team. For questions or feature requests, please contact [email protected].

📄 License

MIT License - See LICENSE for details.

🌟 Version History

  • v0.2.0 - Added State API with narrative mode detection
  • v0.1.0 - Initial release with Tenant, Theme, Content, and Chat APIs

Ready to build amazing experiences? Start with the Quick Reference or explore the examples! 🚀