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

@alga-psa/extension-runtime

v0.3.0

Published

Utility types and helper functions for Alga extension components compiled with [`componentize-js`](https://github.com/bytecodealliance/componentize-js).

Readme

@alga-psa/extension-runtime

Utility types and helper functions for Alga extension components compiled with componentize-js.

Installation

npm install @alga-psa/extension-runtime

Usage

import { Handler, jsonResponse } from '@alga-psa/extension-runtime';

export const handler: Handler = async (request, host) => {
  const secret = await host.secrets.get('alga_api_key');
  await host.logging.info(`Handling request for ${request.context.tenantId}`);
  return jsonResponse({ ok: true, secret, path: request.http.path });
};

The helpers mirror the WIT definitions in ee/runner/wit/extension-runner.wit.

Host Bindings

The HostBindings interface provides access to host capabilities:

Context

host.context.get(): Promise<ContextData>

Get execution context (tenant, extension, request IDs).

Secrets

host.secrets.get(key: string): Promise<string>
host.secrets.list(): Promise<string[]>

Access install-scoped secrets. Requires cap:secrets.get.

HTTP

host.http.fetch(request: HttpRequest): Promise<HttpResponse>

Make outbound HTTP requests. Requires cap:http.fetch.

Storage

host.storage.get(namespace: string, key: string): Promise<Uint8Array | null>
host.storage.put(entry: StorageEntry): Promise<void>
host.storage.delete(namespace: string, key: string): Promise<void>
host.storage.list(namespace: string): Promise<StorageEntry[]>

Key-value storage. Requires cap:storage.kv.

Logging

host.logging.info(message: string): Promise<void>
host.logging.warn(message: string): Promise<void>
host.logging.error(message: string): Promise<void>

Emit structured logs. Requires cap:log.emit.

UI Proxy

host.uiProxy.callRoute(route: string, payload?: Uint8Array): Promise<Uint8Array>

Call host-mediated proxy routes for UI flows. Requires cap:ui.proxy.

User

host.user.getUser(): Promise<UserData>

Get current user information. Requires cap:user.read (granted by default).

interface UserData {
  tenantId: string;
  clientName: string;
  userId: string;
  userEmail: string;
  userName: string;
  userType: string;  // "internal" or "client"
}

Scheduler

host.scheduler.list(): Promise<ScheduleInfo[]>
host.scheduler.get(scheduleId: string): Promise<ScheduleInfo | null>
host.scheduler.create(input: CreateScheduleInput): Promise<CreateScheduleResult>
host.scheduler.update(scheduleId: string, input: UpdateScheduleInput): Promise<UpdateScheduleResult>
host.scheduler.delete(scheduleId: string): Promise<DeleteScheduleResult>
host.scheduler.getEndpoints(): Promise<EndpointInfo[]>

Manage scheduled tasks. Requires cap:scheduler.manage.

Helper Functions

jsonResponse

jsonResponse(body: unknown, init?: Partial<ExecuteResponse>): ExecuteResponse

Create a JSON response with proper headers.

emptyResponse

emptyResponse(status?: number): ExecuteResponse

Create an empty response (default status 204).

createMockHostBindings

createMockHostBindings(overrides?: Partial<HostBindings>): HostBindings

Create mock host bindings for testing.

Using WIT Imports

When building with jco componentize, host capabilities are imported from WIT modules. Create a wrapper index.ts:

// Import WIT functions
// @ts-ignore
import { getUser } from 'alga:extension/user';
// @ts-ignore
import { logInfo } from 'alga:extension/logging';

// Build HostBindings
const host: HostBindings = {
  user: { getUser: async () => getUser() },
  logging: { info: async (msg) => logInfo(msg), /* ... */ },
  // ... other bindings
};

export async function handler(request: ExecuteRequest): Promise<ExecuteResponse> {
  return myHandler(request, host);
}

See User Host API Guide for complete examples.

Building

Run npm run build before publishing.