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

@di-code/plugin-runtime

v0.2.6

Published

Provider-neutral runtime contracts for di-code plugins

Readme

@di-code/plugin-runtime

@di-code/plugin-runtime 提供可插拔运行时的 Provider-neutral 基元:Context、Fiber、typed service key、生命周期状态、runtime event、capability view、诊断和 owner-aware contribution registry。它不依赖 coding-agent,也不连接 CLI、Provider、文件工具或产品实现。

安装:

npm install @di-code/plugin-runtime

外部插件通常通过 @di-code/plugin-sdk 导入;直接使用本包适合构建宿主或运行时测试。

import { createRootContext, createServiceKey, type PluginDefinition } from "@di-code/plugin-runtime";

const statusKey = createServiceKey<string>("example.status");
const context = createRootContext({ mode: "test", trustedProject: true });

await context.plugin(
	{
		name: "example.status",
		apply: (ctx) => ctx.set(statusKey, "ready"),
	} satisfies PluginDefinition<undefined>,
	undefined,
);

console.log(context.require(statusKey));
await context.dispose();

异步 apply 的 service 在 Fiber active 前不可见;apply 失败会回滚其贡献。Fiber.dispose() 会 abort signal、等待 in-flight setup、逆序运行 disposer、聚合 cleanup error,并且可重复调用。普通 child Context 继承父 service;child({ isolate: true }) 不继承,用于 Session 等私有 scope。

EventBus<E> 按 priority 降序和稳定注册顺序调度。非 critical handler 失败会被隔离并写入 diagnostic;critical handler 失败会终止 gate 并 reject。CapabilityView 继续用于宿主 facade 的声明检查,但不构成 Node.js sandbox;信任后的默认插件可直接使用宿主进程 API。诊断会脱敏 token、secret、authorization 和 api_key 文本。

ContributionRegistry 及 provider、tool、command、session、renderer、RPC 和 resource contribution contract 会将注册所有权绑定到 Fiber;重复、保留和跨 kind namespace 冲突会失败。只使用 package 根入口,不导入 src 或 dist 私有路径。