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

@se-agent/platform-core

v0.3.0

Published

Framework-agnostic shared primitives for the SE Agent platform.

Downloads

250

Readme

@se-agent/platform-core

Agent 平台跨应用共享的框架无关基础能力,可发布到私有 npm 仓库供 Admin、Studio、Workspace 使用。

能力边界

  • 平台地址注册、当前平台识别和跨平台跳转
  • Access Token 存储契约与浏览器实现
  • 远端登出与本地 Token 清理编排
  • 与后端现有协议兼容的 AES、RSA 公钥加密和请求级加密上下文

包内不包含 React/Vue 组件、路由实例、Axios/fetch 实例、业务 API、环境变量读取和 RSA 私钥。各应用负责读取自己的环境变量,再通过参数注入本包。

平台跳转

import { createPlatformNavigator } from '@se-agent/platform-core'

const navigator = createPlatformNavigator(
  {
    admin: import.meta.env.VITE_ADMIN_URL,
    studio: import.meta.env.VITE_STUDIO_URL,
    application: import.meta.env.VITE_APPLICATION_URL,
  },
  window.location,
)

navigator.to('application')

登出

import { createBrowserAccessTokenStorage, logout } from '@se-agent/platform-core'

const tokenStorage = createBrowserAccessTokenStorage()

// 默认 key:se-agent-platform:auth:v1:access-token

await logout({
  tokenStorage,
  remoteLogout: async (token) => {
    const response = await fetch('/api/logout', {
      method: 'POST',
      headers: token ? { Authorization: `Bearer ${token}` } : {},
    })
    return { ok: response.ok, status: response.status }
  },
})

即使远端接口超时或失败,本地 Token 仍会清理。

请求级加密

import { createRequestCryptoContext } from '@se-agent/platform-core'

const cryptoContext = createRequestCryptoContext({
  publicKey: import.meta.env.VITE_RSA_PUBLIC_KEY,
})

const response = await fetch('/api/sensitive', {
  method: 'POST',
  headers: { 'encrypt-key': cryptoContext.encryptedKey },
  body: cryptoContext.encrypt(JSON.stringify(payload)),
})

const data = cryptoContext.decrypt(await response.text())

每次请求创建独立上下文;不要把临时 AES Key 或上下文写入全局变量、Store、localStorage 或 sessionStorage。

开发

vp install
vp check
vp test
vp pack

只从包根入口导入,禁止使用 @se-agent/platform-core/src/*。