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

@ahip/core

v0.2.0-preview

Published

Core validation, schema, and safety helpers for the Agent-Human Interaction Protocol.

Readme

@ahip/core

Agent-Human Interaction Protocol 的核心校验、Schema 与安全辅助工具。

AHIP item 是面向人类、agent、宿主、工具、widget 与 artifact 引用的结构化交互对象。宿主、服务端或测试套件在渲染内容或触发行为之前,都应使用本包校验与规范化 AHIP 数据。

English | 仓库首页 | 文档入口

安装

npm install @ahip/core

提供能力

  • AHIP v0.2 TypeScript 类型。
  • AHIP v0.2 JSON Schema。
  • 面向不可信输入的校验工具。
  • 面向宿主消费的规范化工具。
  • 面向不支持内容的 fallback 辅助工具。
  • 扩展标识符与 block guard 工具。

基础校验

import { validateAHIPItem } from "@ahip/core";

const result = validateAHIPItem(input);

if (!result.valid) {
  throw new Error(result.errors.join("\n"));
}

const item = result.value;

进入宿主前规范化

import { normalizeAHIPItem, validateAHIPItem } from "@ahip/core";

const validation = validateAHIPItem(input);

if (validation.valid && validation.value) {
  const normalized = normalizeAHIPItem(validation.value);
  // 将 normalized 传给渲染器或宿主流程。
}

Schema 导出

import { ahipV02Schema } from "@ahip/core";

也可以通过 package subpath 引入:

import schema from "@ahip/core/schema/ahip-v0.2.schema.json";

重要导出

  • validateAHIPItem
  • assertValidAHIPItem
  • normalizeAHIPItem
  • getAHIPValidator
  • getFallbackText
  • isExtensionIdentifier
  • isKnownBlock
  • isCustomBlock
  • CORE_BLOCK_TYPES
  • AHIPItemContentBlockAHIPActionWidgetRefArtifactRefCapabilitySet 等 TypeScript 类型

安全说明

  • 在渲染、派发 action、打开 artifact 或解析 widget 前,先校验不可信 payload。
  • 对未知的 action-like 或疑似可执行数据保持保守处理。
  • applet 与 widget 的执行必须由宿主控制。AHIP item 可以引用 applet,但本包不定义远程 applet 加载或动态代码执行。
  • 尽量保留 fallback_text,让不支持某些能力的宿主可以安全降级。

更多文档