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

@novasamatech/host-api

v0.6.5

Published

Host API: transport implementation for host - product integration.

Readme

@novasamatech/host-api

A protocol designed to connect Products and Host applications by providing a set of methods for communication.

Installation

npm install @novasamatech/host-api --save -E

Usage

The Host API package is composed of four main parts:

  • Protocol — JAM codecs according to proposal;
  • Provider — IPC interface, depends on environment;
  • Transport — wrapper around protocol for making actual calls;
  • Host API — wrapper around transport for direct usage of business methods.

Provider

Provider is an interface for IPC communication. You can find the definition here. The main goal is to abstract actual message send/receive logic from API. Products should not implement their own providers, it should be done inside SDKs.

Transport

Transport is a low-level wrapper around protocol and provider. It encapsulates serialization/deserialization and request/subscription logic.

import { createTransport, resultOk } from '@novasamatech/host-api';
import { provider } from './custom-provider.js';

const transport = createTransport(provider);

// requesting by consumer

const response = await transport.request('storage_read', payload);

// handling request on provider side

const stop = transport.handleRequest('storage_read', async (payload) => {
  try {
    const result = await readFromStorage(payload);
    return resultOk(result);
  } catch (e) {
    return resultErr(e);
  }
});

// subscribing by consumer

const subscription = await transport.subscribe('chat_action_subscribe', params, (payload) => {
  console.log('action received:', payload);
});

subscription.onInterrupt(() => {
  console.log('subscription interrupted');
});

subscription.unsubscribe();

// handling subscription on provider side

transport.handleSubscription('chat_action_subscribe', (params, send, interrupt) => {
  const unsubscribe = subscribeToChatActions(params, (err, action) => {
    if (err) {
      interrupt(err);
    } else {
      send(action);
    }
  });
  
  return unsubscribe;
});

Host API

Host API is a wrapper around transport that provides convenient methods for calling methods and subscribing to events. It can be used by products directly or indirectly via SDK. All requests return a ResultAsync struct from the neverthrow library.

import { createHostApi, createTransport } from '@novasamatech/host-api';
import { provider } from './custom-provider.js';

const transport = createTransport(provider);
const hostApi = createHostApi(transport);

// requesting data

const storageValue = hostApi.localStorageRead(payload);

storageValue.match(
  (data) => console.log('success:', data),
  (err) => console.log('error:', err)
);

// subscribing to events

const subscription = hostApi.chatActionSubscribe(params, (action) => {
  console.log('action received:', action);
});

subscription.onInterrupt(() => {
  console.log('subscription interrupted');
});

subscription.unsubscribe();

Custom Renderer

The protocol includes a custom renderer system for building UI component trees that can be serialized and sent across the transport. This is used for rendering custom chat messages.

Available components: Box, Column, Row, Spacer, Text, Button, TextField. Each component supports optional Modifiers (margin, padding, background, border, dimensions) and can contain children.

import { CustomRendererNode } from '@novasamatech/host-api';

Account Connection Status

Products can subscribe to account connection status changes:

const subscription = hostApi.accountConnectionStatusSubscribe(undefined, (status) => {
  // status: 'connected' | 'disconnected'
  console.log('connection status:', status);
});

Custom Chat Messages

Chat messages now support a Custom content type that carries an arbitrary payload identified by messageType. Products can handle rendering of custom messages via the productChatCustomMessageRenderSubscribe subscription, which receives the message type and payload and expects a CustomRendererNode tree in response.