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

@agentic-os/core

v0.1.0

Published

Agentic OS Core - Bus-based agent system implementation

Readme

@agentic-os/core

Agentic OS 核心系统 - 基于总线架构的 Agent 系统实现。

架构概览

┌──────────────────────────────────────────────────────────┐
│              System Bus Controller                       │
│  - invoke(callerId, abilityId, input)                    │
│  - Ability Discovery (list/schema/inspect)               │
└──────────────────────────────────────────────────────────┘
         ▲          ▲          ▲          ▲          ▲
         │          │          │          │          │
┌────────┴────┐ ┌──┴─────┐ ┌──┴───────┐ ┌┴──────┐ ┌─┴────────┐
│   Shell     │ │  Task  │ │  Model   │ │Ledger │ │   Bus    │
│  (HTTP API) │ │ Manager│ │ Manager  │ │(Mock) │ │   Ctrl   │
├─────────────┤ ├────────┤ ├──────────┤ ├───────┤ ├──────────┤
│shell:send   │ │task:   │ │model:llm │ │ldg:   │ │bus:list  │
│             │ │spawn   │ │model:list│ │task:* │ │bus:      │
│             │ │send    │ │model:    │ │msg:*  │ │abilities │
│             │ │cancel  │ │register  │ │call:* │ │bus:schema│
│             │ │active  │ │          │ │       │ │          │
└─────────────┘ └────────┘ └──────────┘ └───────┘ └──────────┘

核心模块

System Bus (/src/bus)

  • 能力注册和调用
  • 调用者追踪
  • 输入验证(JSON Schema)
  • Bus Controller 能力(bus:list, bus:abilities, bus:schema, bus:inspect)

Shell (/src/shell)

  • HTTP API (POST /send, GET /stream/:taskId)
  • SSE 连接管理
  • 消息片段化和流式输出
  • 能力:shell:send

Task Manager (/src/task)

  • 任务生命周期管理
  • 执行循环(LLM 调用 → 工具执行 → 循环)
  • 内存中的任务注册表
  • 能力:task:spawn, task:send, task:cancel, task:active

Model Manager (/src/model)

  • OpenAI 适配器
  • 流式响应累积
  • 模型注册和管理
  • 能力:model:llm, model:list, model:register

Ledger (/src/ledger)

  • Mock 实现(所有查询返回空结果)
  • 接受保存操作但不持久化
  • 能力:ldg:task:, ldg:call:, ldg:msg:*

安装

从 monorepo 根目录:

bun install

或者在 packages/core 目录:

cd packages/core
bun install

使用

启动示例

// example.ts
import { createAgenticOS } from './src/index';

const agenticOS = await createAgenticOS({
  port: 3000,
  models: {
    models: [
      {
        id: 'gpt4',
        type: 'llm',
        provider: 'openai',
        endpoint: 'https://api.openai.com/v1',
        model: 'gpt-4-turbo-preview',
        temperature: 0.7,
      },
    ],
    defaultLLM: 'gpt4',
  },
});

await agenticOS.start();
bun run dev

使用 HTTP API

创建新任务:

curl -X POST http://localhost:3000/send \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello, help me analyze some data"}'

# 响应:{"taskId": "task-...", "status": "running"}

流式接收任务输出:

curl -N http://localhost:3000/stream/task-xxx

API 文档

POST /send

发送用户消息,创建或追加到任务。

请求:

{
  "message": "用户消息内容",
  "taskId": "task-123"  // 可选,省略则创建新任务
}

响应:

{
  "taskId": "task-123",
  "status": "running"
}

GET /stream/:taskId

建立 SSE 连接以接收任务的流式输出。

事件类型:

  • start - 连接建立
  • content - 内容片段
  • tool_call - 工具调用
  • tool_result - 工具结果
  • message_complete - 消息完成
  • end - 任务结束

开发

运行测试

bun test

代码质量检查

# 运行 ESLint 检查
bun run lint

# 自动修复可修复的问题
bun run lint:fix

文档

详细文档请查看 docs/ 目录:

MVP 限制

当前 MVP 版本的限制:

  1. 无持久化:使用 Mock Ledger,重启后所有状态丢失
  2. 无智能路由:每个新消息总是创建新任务
  3. 单一 LLM 提供商:只支持 OpenAI
  4. 无 Memory:没有跨任务知识共享
  5. 无恢复能力:不支持从崩溃中恢复

许可证

MIT License