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

platform-sdk-baron

v0.4.4

Published

### Loading an external platform on Texts.app

Readme

platform-sdk

Loading an external platform on Texts.app

Either:

  1. Hit ⌘ J (or Ctrl+J on Windows/Linux)
  2. Type "install platform"
  3. Click "Load platform directory" (directory should point to the JavaScript files)
  4. Relaunch Texts.app

Or:

  1. Create ~/Library/Application Support/jack/config.json and open it in an editor
  • This terminal command opens the file in VS Code (works in Zsh and Fish):

    open -a "Visual Studio Code" ~/Library/App*Sup*/jack/config.json
  1. Paste in:
{
  "developer_mode": true,
  "external_platforms": [
    "/Users/kb/Dropbox/Texts/packages/platform-random"
  ]
}
  1. Each string in the external_platforms array is a path to a platform's entry point which should export a Platform object. This directory path should point to the JavaScript files (not TypeScript).

  2. Restart or launch Texts.app

Logs

Run this in Terminal.app:

/Applications/Texts.app/Contents/MacOS/Texts --log-level=dev

Creating a platform integration

A platform integration can be roughly divided into three parts:

  1. the network layer, responsible for sending network requests and subscribing to real-time events (code for this go into network-api.ts or are imported from a third party module)
  2. the mapping layer, which converts the original platform data structures into structures that Texts understands (mappers.ts)
  3. the PlatformAPI interface, which binds the network layer, mapping layer and implements an interface that Texts can call (api.ts).

Information and attributes about the platform go into the info.ts file.

Getting started

  1. It's important to get the network layer working first to avoid complicating things. Write a simple CLI script that connects to the platform, fetches the threads/messages and prints it to the console, and run it using node dist/script.js
  2. Once it's working with node, test if it runs with Electron using electron dist/script.js — this will work fine unless there are native dependencies.
  3. After getting the network layer working well, you can proceed with creating the integration. Here's a boilerplate.

There are four main objects defined by the SDK:

Message: a single message belonging to a thread

Thread: a thread that can contain many messages and many participants along with pagination information

User: a user present on the platform

Participant: a User extended with properties like isAdmin or hasExited, belonging to a thread

Building

While developing, run tsc --watch to automatically transpile TypeScript files to JavaScript on changes.

Prioritized order of implementing PlatformAPI functionality

  • Authentication (init, getCurrentUser, login, serializeSession)
  • getThreads
  • getMessages
  • sendMessage
  • ...

TypeScript typings do not need to be implemented manually for data structures returned by the server unless provided by a library.

User-Agent

platform-sdk exports a texts object. texts.constants.USER_AGENT provides the User-Agent to use for all network interactions. The browser login window will use this User-Agent constant as well.

Cookie jar

platform-sdk exports a texts object. We recommend using methods exposed by texts.createHttpClient for all network interactions since it handles the cookie jar automatically – new cookies sent by the server will automatically be updated in the jar. This jar should be serialized by serializeSession so that it's persisted.

**ReAuthError**

When the user logs out from all sessions using a regular web browser, the session will be invalid and throw an error. This error must be handled gracefully and instead ReAuthError should be thrown. This will cause Texts to ask the user to re-authenticate the account.

Electron intricacies

This is only relevant if you're depending on native dependencies.

Native deps must be recompiled for Electron since Electron ships with a patched version of Node.js. electron-rebuild lets you do this. Native deps depending on N-API don't need recompilation / electron-rebuild.

The Electron desktop app runs three processes/threads:

  • Main process (no platform code is loaded)
  • Renderer process (PlatformInfo is loaded from info.ts)
  • Worker thread (PlatformAPI is loaded from api.ts)

Native deps

If your platform integration uses native deps, for correct bundling, also list them under a nativeDeps key in package.json like this:

{
  "nativeDeps": {
    "erlpack": "^0.1.4"
  },
  "dependencies": {
    "erlpack": "^0.1.4"
  }
}

nativeDeps is a made-up name by us.