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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@viam/sdk

v0.1.5

Published

Interactive SDK for Viam - AI-powered UI interactions

Readme

@viam/sdk

Interactive SDK for Viam - AI-powered UI interactions triggered by chat.

Installation

npm install @viam/sdk

Quick Start

React

import { ViamProvider, ViamChat, useViamAction } from '@viam/sdk/react';

function App() {
  return (
    <ViamProvider
      config={{
        guiderId: 'your-guider-id',
        apiUrl: 'https://api.viam.io/api/v1', // optional
      }}
    >
      <MyApp />
      <ViamChat position="bottom-right" />
    </ViamProvider>
  );
}

function ContactButton() {
  const [isOpen, setIsOpen] = useState(false);

  // Register action - when user asks "open contact modal", this triggers
  useViamAction('act_contact_xyz123', () => {
    setIsOpen(true);
  });

  return (
    <>
      <button onClick={() => setIsOpen(true)}>Contact Us</button>
      {isOpen && <ContactModal onClose={() => setIsOpen(false)} />}
    </>
  );
}

Using ViamTarget

Wrap elements to auto-highlight and scroll when triggered:

import { ViamTarget } from '@viam/sdk/react';

function PricingSection() {
  return (
    <ViamTarget
      actionKey="act_pricing_abc123"
      onTrigger={() => console.log('User was directed to pricing!')}
    >
      <div className="pricing-section">
        <h2>Pricing</h2>
        {/* ... */}
      </div>
    </ViamTarget>
  );
}

Vanilla JavaScript

import { createViam } from '@viam/sdk';

const viam = createViam({
  guiderId: 'your-guider-id',
});

// Initialize
await viam.init();

// Register actions
viam.register('act_contact_xyz123', (payload) => {
  document.getElementById('contact-modal').classList.add('open');
});

// Send a message
const response = await viam.sendMessage('How do I contact support?');
// If message matches "contact" action, it will trigger automatically

API Reference

ViamProvider Props

| Prop | Type | Description | |------|------|-------------| | config.guiderId | string | Your Viam guider ID (required) | | config.apiUrl | string | API URL (default: http://localhost:4001/api/v1) | | onAction | (key, payload) => void | Called when any action is triggered | | onError | (error) => void | Called on errors |

ViamChat Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | position | 'bottom-right' \| 'bottom-left' \| 'inline' | 'bottom-right' | Chat widget position | | theme | 'light' \| 'dark' | 'light' | Color theme | | primaryColor | string | '#f97316' | Primary accent color | | title | string | 'Chat Assistant' | Chat header title | | placeholder | string | 'Ask a question...' | Input placeholder |

Hooks

useViam()

Returns the full Viam context with SDK instance, messages, and methods.

useViamAction(actionKey, handler, deps?)

Register an action handler that fires when the AI triggers this action.

useViamMessages()

Returns { messages, isLoading, sendMessage } for building custom chat UIs.

useViamReady()

Returns boolean indicating if SDK is initialized.

ViamTarget Props

| Prop | Type | Description | |------|------|-------------| | actionKey | string | The action key to respond to (required) | | onTrigger | (payload) => void | Called when action is triggered | | highlightStyle | CSSProperties | Custom highlight styles | | highlightDuration | number | How long to highlight (ms, default: 3000) | | scrollIntoView | boolean | Auto-scroll to element (default: true) |

Setting Up Actions

  1. Go to your Viam dashboard
  2. Navigate to your Guider → SDK tab
  3. Enable SDK integration
  4. Create actions with trigger prompts:
    • Name: "Open Contact Modal"
    • Prompts: "contact support", "get in touch", "talk to someone"
  5. Copy the generated action key (e.g., act_contact_x7y8z9)
  6. Use the key in your code with useViamAction or viam.register()

How It Works

  1. User types a message in the chat
  2. AI analyzes if message matches any configured SDK action
  3. If matched, the registered handler is called
  4. Chat displays a response confirming the action

License

MIT