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

@stream-kit/core

v0.2.0-alpha.11

Published

Platform-neutral runtime utilities for Stream Kit plugins

Readme

@stream-kit/core

Platform-neutral runtime utilities shared by Stream Kit, first-party plugins, and external plugins.

This package has no Svelte, Tauri, or UI dependencies. Optional Twurple peer dependencies provide types for Twitch chat payloads.

When to use it

Import from @stream-kit/core when you need runtime helpers inside handler, trigger, or command logic:

import {
	getFieldValue,
	interpolateVariables,
	parseCommand,
	matchCommandPattern
} from '@stream-kit/core';

Import the plugin contract and app API types from @stream-kit/plugin instead. See the Plugin Authoring API.

@stream-kit/plugin re-exports most helpers from this package for convenience, but importing from @stream-kit/core directly keeps plugin bundles smaller when you only need helpers.

Installation

External plugins should add both packages as dev dependencies and externalize them at build time:

npm install --save-dev @stream-kit/core @stream-kit/plugin

At runtime the Stream Kit app host resolves @stream-kit/core from the plugin import map. Do not bundle this package into your plugin entry.

Exports

Variable interpolation

| Export | Description | |--------|-------------| | interpolateVariables | Replace {variable} placeholders in strings | | contextToVariables | Convert a handler trigger context to a variable map | | contextValueToVariableString | Serialize a context value for variable storage |

Handler fields

| Export | Description | |--------|-------------| | getFieldValue | Read a value from a handler field instance by key | | getOneOfFieldValue | Read the active variant of a one-of field | | isOneOfFieldValue | Type guard for one-of field values | | resolveFieldText | Resolve text/variable field content to a string | | resolveOneOfFieldText | Resolve one-of field text to a string |

Chat commands

| Export | Description | |--------|-------------| | parseCommand | Parse a command definition string | | parseCommandMessage | Parse command tokens from a chat message | | matchCommandPattern | Match a message against a command pattern | | extractCommandArgNames | List named <placeholder> tokens in a pattern | | hasCommandArgPlaceholders | Check whether a pattern uses argument placeholders | | RESERVED_COMMAND_ARG_NAMES | Built-in argument names you should not override | | enrichChatMessageWithCommand | Attach parsed command data to a chat message context | | findCommandConditionPattern | Extract a condition pattern from command context |

Cron / schedule

| Export | Description | |--------|-------------| | computeCronNextRun | Calculate the next run time for a cron expression | | isValidCronExpression | Validate cron syntax | | normalizeCronExpression | Normalize user input to canonical form | | getCronValidationError | Human-readable validation error | | getCronNextRunLabel | Formatted label for the next scheduled run | | getCronFieldCount | Number of fields in the expression | | splitCronParts | Split an expression into field parts | | getLocalTimezone | Detect the local IANA timezone | | CRON_FIELD_COUNT, CRON_FIELD_KEYS, DEFAULT_CRON_PRESETS | Constants and presets |

Types

| Export | Description | |--------|-------------| | HandlerTriggerContext | Context passed to handler execute functions | | HandlerFieldInstance, HandlerFieldValue, … | Handler field value types | | CommandMatch, ParsedCommandMessage | Command parsing results | | TwitchChatMessage, TwitchChatUserInfo, … | Twitch chat payload shapes | | CronFieldKey, CronPreset | Schedule-related types |

Example

import { getFieldValue, interpolateVariables } from '@stream-kit/core';
import type { HandlerExecuteFn } from '@stream-kit/plugin';

const execute: HandlerExecuteFn = async (handler, context) => {
	const template = getFieldValue(handler.fields, 'message');
	const text =
		typeof template === 'string'
			? interpolateVariables(template, context.variables)
			: '';

	await context.next({ message: text });
};

Monorepo development

pnpm --filter @stream-kit/core build
pnpm --filter @stream-kit/core check
pnpm --filter @stream-kit/core dev

Further reading