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

@vite-hub/runtime

v0.0.4

Published

Shared runtime context, capability, policy, approval, and tracing primitives for ViteHub.

Downloads

636

Readme

@vite-hub/runtime

@vite-hub/runtime provides the shared Runtime Host Context, Runtime Capability, policy, approval, trace, error, lease, and execution-authority contracts used by ViteHub packages and custom host integrations.

Choose an import

| You are building | Install | Import | | --------------------------------------------- | ------------------------- | --------------------------------------------------- | | A ViteHub application | vite-hub | vite-hub/runtime | | A reusable package or custom host integration | @vite-hub/runtime | @vite-hub/runtime | | Node diagnostics and process lifecycle | The same selected package | vite-hub/runtime/node or @vite-hub/runtime/node |

Use the vite-hub facade when it is already your application dependency. Install this owner package directly when the integration should depend only on Runtime's portable contracts. This package does not register Vite, Nuxt, routes, providers, or Agent Definitions.

Install the owner package

pnpm add @vite-hub/runtime

The package declares Node.js 24 or newer. Import the root entry for portable Runtime contracts. When inspected, the /node entry reads Node process information and, on Linux, /proc and cgroup v2 files.

Long-lived Node services can also use createProcessReconciler() from the /node entry to coalesce event-driven work, run periodic repair, stop admission, and await tracked work during a graceful drain. Set signal: "SIGUSR2" when the service manager should trigger that drain through the vitehub-drain command included with the owner-package installation, @vite-hub/runtime. Lifecycle callbacks must return before an external caller starts drain(); calling drain() from an active callback rejects to prevent that callback from waiting on itself. Keep the status endpoint available until vitehub-drain observes the terminal drained status; process exit or endpoint loss before that acknowledgement is a failed drain.

Get a first result

Create the host context explicitly, register one Runtime Capability, and look it up through the public package entry:

import { createExecutionContext, defineCapability, getCapability } from "@vite-hub/runtime";

const values = new Map<string, unknown>();
const context = createExecutionContext({
  capabilities: {
    health: defineCapability("health", { status: "ready" }),
  },
  memo<T>(key: string, create: () => T): T {
    if (!values.has(key)) values.set(key, create());
    return values.get(key) as T;
  },
  runtime: "node",
  waitUntil(task) {
    void task.catch(console.error);
  },
});

const health = getCapability(context, "health");
console.log(`${context.runtime}:${health.kind}`);

Running the file prints:

node:health

This proves context construction and capability lookup. The waitUntil fallback only observes rejected promises in a long-lived process. It does not keep a serverless request alive. A production host must delegate background work to its provider lifetime API.

createExecutionContext() always returns a complete Execution Context. It creates fresh empty capabilities and runtimeConfig objects when the host omits them, and preserves the supplied objects when the host provides them.

Understand the boundaries

Runtime Host Context

createExecutionContext() normalizes an object supplied by the host. The host still owns runtime, memo, waitUntil, request or event data, provider bindings, and cleanup. Runtime does not discover framework globals, propagate an ambient context, or isolate concurrent requests.

Treat every value on the context as available to code that receives it. Runtime does not clone, redact, encrypt, or restrict request, event, cloudflare.env, runtimeConfig, or Runtime Capability values. Pass only the bindings and secrets needed by that operation, and do not copy secrets into traces or approval input.

Runtime Capabilities

defineCapability() and getCapability() pass a named implementation between packages. A handle is not a permission boundary: code that receives its value can call that implementation. Keep authentication, tenant checks, input validation, rate limits, and provider credentials at the application or provider boundary that owns the operation.

Policy and approvals

resolveCapabilityPolicy() evaluates a decision. An omitted policy resolves to allow; deny and require-approval have an effect only when the calling feature checks the decision before performing work. The approval interfaces are records, not a durable approval queue or trusted approver service. The host must authenticate the actor, persist and correlate decisions when required, prevent replay, and resume or reject the operation.

Traces

createTraceEventLog() is an in-memory log. Its default metadata policy omits known content-bearing attribute keys such as input, prompt, body, and output, including nested keys. This is bounded omission by key, not general secret detection. Arbitrary names such as token or authorization are not automatically redacted, and error.message is retained. { content: "content" } retains all supplied attributes.

Own trace access, retention, size limits, redaction, and durable export in the host. entries() returns the current in-memory entries; it does not persist or stream them by itself.

Execution authority and public errors

ExecutionAuthority is an immutable snapshot of the filesystem, network, environment, credentials, process, and isolation properties reported when an execution surface is resolved. It describes those properties; it does not enforce them. unknown means the provider did not prove a dimension; it never means none. An isolation label such as container or microvm is not a security rank.

ViteHubError snapshots its JSON-safe public name, code, message, details, and requestId at construction, and freezes the serialized snapshot and its details. Never put secrets in those fields; keep raw provider failures in cause. A cause is excluded from toJSON(), but remains available to code and loggers that inspect the Error instance.

Public entry points

| Import | Provides | | ------------------------ | ---------------------------------------------------------------------------------------------------- | | @vite-hub/runtime | Context, capability, policy, approval, trace, lease, diagnostic, error, and execution-authority APIs | | @vite-hub/runtime/node | Node process observations, reconciliation, and graceful-drain lifecycle primitives |

Do not import from src, dist, or ViteHub's _internal paths.

Go deeper