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

@atlisp/agent

v0.6.1

Published

Multi-Agent System for @lisp CAD operations

Downloads

7,344

Readme

@lisp Agent — 多智能体 CAD 协作系统

基于 LangGraph 的多智能体(Multi-Agent)系统,为 @lisp CAD 环境提供 AI 驱动的自动化能力。

架构概览

CLI (index.js) ──── HTTP Server (server.js)
     │                       │
  TUI ──── ChatApp.jsx       │
     │                  AgentManager
     │                  ┌─────┼────┬─────┬─────┬─────┬─────┐
     │                  │     │    │     │     │     │     │
     │            lisp- cad-  draw- know- diag- code- test-
     │            engin. des.  anal. ledge nosis reviewer gener.
     │                  │     │    │     │     │     │
     │                  └── MCP Client ── CAD
     │                       │
                    LLM Provider ── OpenAI API

智能体(Agent)一览

| Agent | 命令 | 工作流 | |-------|------|--------| | lisp-engineer | /code | 需求→函数推荐→代码→安全检查→测试→修复→文档 | | cad-designer | /design | 需求→连接CAD→环境设置→绘图→执行→验证→总结 | | drawing-analyst | /analyze | 连接→提取数据→图片分析→分析→报告 | | knowledge-manager | /knowledge | 对话整理→代码归集→技能提炼→报告 | | diagnostics | /diagnose | 连接→环境检测→诊断→报告 | | code-reviewer | /review | 静态检查→AI审查→CAD编译测试→报告 | | drawing-comparator | /compare | 连接→数据提取→比对→差异报告 | | test-generator | atlisp-agent test-generate | 代码解析→测试生成→执行验证 |

新增功能

函数库智能推荐

根据需求自动推荐相关 @lisp 函数,集成到 lisp-engineer 工作流中。

Code Interpreter

在 CAD 内安全执行生成的 AutoLISP 代码,包含:

  • 危险函数检测(vl-file-delete, shell, command 等)
  • 括号/引号匹配检查
  • 超时控制(默认 30s)

多模态支持

  • DWG 元数据提取(通过 MCP)
  • 图片上传分析(Base64 编码后传给 LLM)

Agent 协作工作流

支持 YAML/JSON 格式定义多 Agent 编排:

workflow:
  name: "批量图纸审查"
  steps:
    - agent: drawing-analyst
      input: "分析 {file}"
      output_var: analysis
    - agent: code-reviewer
      input: "审查 {analysis.code}"

缓存与监控

  • LLM 响应缓存(可配置 TTL)
  • MCP 工具缓存 TTL 可配置
  • 运行时监控模块(Agent 运行统计、Token 消耗)

快速开始

# 安装依赖
npm install
npm run build

# 首次运行:自动触发配置向导
node dist/index.js

# 或手动触发配置向导
node dist/index.js --setup

# CLI 交互模式(Ink TUI,自动调度)
node dist/index.js chat

# CLI 指定工作流(非交互式,直接输出结果)
node dist/index.js code "生成一个绘制矩形的 AutoLISP 命令"
node dist/index.js design "绘制一个 A3 图框"
node dist/index.js analyze "分析当前图纸"

# 函数推荐
node dist/index.js funlib recommend "创建图层"
node dist/index.js funlib search "layer"
node dist/index.js funlib categories

# HTTP 服务模式
node dist/server.js

TUI 界面

node dist/index.js chat 启动 Ink/React 终端 UI:

┌──────────────────────────────────────────────────────────────────┐
│  atlisp-agent  (自动调度模式)  https://atlisp.cn                │
│  ↑ N 条更早的消息 (PgUp翻页)                                      │
│  ┌─────────────────────────────────────────────┐│
│  │ [系统] atlisp-agent 已启动                    ││
│  │ [用户] 画一个五边形                           ││
│  │   🎨 ───                                    ││
│  │     状态: completed                          ││
│  │     摘要: ...                                ││
│  │   💻 ───                                    ││
│  │     状态: completed                          ││
│  │     代码:                                    ││
│  │       (defun c:pentagon () ...)  ← 语法着色  ││
│  └─────────────────────────────────────────────┘│
│  ↓ N 条更新的消息 (PgDn翻页)                      │
│  ───────────────────────────────────────────────│
│  > 画一个五边形▌  /code /design /clear          │
│  ───────────────────────────────────────────────│
│  Ctrl+C:退出  ↑↓:历史  PgUp,PgDn:翻页   MCP: 已连接 │
│  ←→:光标  Tab:补全  /clear                       │
└─────────────────────────────────────────────────┘

快捷键

| 按键 | 功能 | |------|------| | | 命令历史浏览 | | PgUp PgDn | 日志区域翻页 | | | 输入光标移动 | | Home End | 光标到行首/行尾 | | Tab | 命令自动补全 | | Ctrl+C | 退出 | | 鼠标滚轮 | 日志区域滚动 |

内置命令

| 命令 | 说明 | |------|------| | /code <需求> | 强制使用 lisp-engineer | | /design <需求> | 强制使用 cad-designer | | /analyze <需求> | 强制使用 drawing-analyst | | /all <任务> | 多团队协调(自动分解并发执行) | | /knowledge <内容> | 强制使用 knowledge-manager | | /diagnose | 运行环境诊断 | | /review <代码> | 代码审查 | | /compare [请求] | 图纸比对 | | /recommend <需求> | 函数推荐 | | /funlib search <关键词> | 搜索函数 | | /agents | 列出所有可用 Agent | | /tokens | 查看 Token 用量 | | /history | 历史会话 | | /clear | 清屏 | | exit / quit | 退出 |

特性

  • AutoLISP 语法着色code 字段及 Markdown 代码块 (```lisp) 自动语法高亮
  • 命令历史 — 最多 50 条,/ 切换
  • 光标编辑//Home/End 移动,支持任意位置插入/删除
  • 自动滚动 — 新消息自动跟随,翻页后暂停,PgDn 恢复
  • 鼠标滚轮 — 支持 SGR 鼠标协议的终端可滚轮翻页
  • MCP 状态栏 — 状态栏右侧实时显示 MCP 连接状态(已连接/连接失败/连接中...)
  • MCP 连接重试 — 启动时连接失败自动指数退避重试(3次,1s/2s/4s),并在日志区显示连接状态
  • HTTP 请求超时 — HTTP/Streamable-HTTP 模式默认 30s 超时,防止请求挂起

首次运行引导

首次运行时,系统会自动检测配置文件是否存在或 apiKey 是否为空,若检测到首次运行将自动触发配置向导:

node dist/index.js
# 或手动触发
node dist/index.js --setup

配置向导会询问以下内容:

| 项目 | 说明 | 默认值 | |------|------|--------| | LLM API Key | 必填,大语言模型访问密钥 | (无) | | LLM Base URL | LLM API 端点地址 | http://atlisp.org:11434/v1 | | LLM Model | 使用的模型名称 | minimax-m2.5:cloud | | MCP 连接模式 | CAD 通信协议 | Windows: stdio / Linux: streamable-http | | MCP URL | HTTP 模式端点地址 | http://localhost:8110 | | MCP Command | stdio 模式命令 | npx | | MCP Args | stdio 模式参数 | @atlisp/mcp --stdio |

配置完成后会保存至 ~/.atlisp/atlisp.json

配置

配置文件位于 ~/.atlisp/atlisp.json(自动生成),支持 JSON / YAML 格式及 .env 环境变量覆盖:

{
  "agent": { "verbose": false, "maxIterations": 5 },
  "llm": {
    "provider": "openai",
    "baseURL": "http://atlisp.org:11434/v1",
    "model": "minimax-m2.5:cloud",
    "apiKey": "",
    "temperature": 0.1,
    "maxTokens": 65536
  },
  "mcp": {
    "mode": "stdio",
    "url": "http://localhost:8110",
    "command": "npx",
    "args": ["@atlisp/mcp", "--stdio"]
  }
}

环境变量

| 变量 | 说明 | 默认值 | |------|------|--------| | LLM_CACHE | 启用 LLM 缓存 | true | | LLM_CACHE_TTL | LLM 缓存 TTL (ms) | 3600000 |

HTTP API(server.js)

| 端点 | 方法 | 说明 | |------|------|------| | /chat | POST | 自动调度对话 | | /agent/lisp-engineer | POST | AutoLISP 代码生成 | | /agent/cad-designer | POST | CAD 设计绘图 | | /agent/drawing-analyst | POST | 图纸分析 | | /agent/knowledge-manager | POST | 知识管理 | | /agents | GET | 列出所有 Agent | | /health | GET | 健康检查 | | /usage | GET | Token 用量统计 | | /mcp-status | GET | MCP 连接状态 |

项目结构

agent/
├── index.js                  # CLI 入口(commander)
├── server.js                 # HTTP 服务(Express)
├── config.js                 # 配置加载(JSON/YAML/.env)
├── llm.js                    # LLM 抽象层(支持缓存)
├── mcp-client.js             # MCP 客户端(stdio/http/streamable-http)
├── mcp-pool.js               # MCP 连接池
├── agent-manager.js          # 意图识别 & 智能体调度中心
├── workflow-engine.js        # 多 Agent 工作流引擎
├── monitor.js                # 运行时监控统计
├── funlib-cache.js           # @lisp 函数库缓存
├── agents/                   # 各智能体实现
│   ├── lisp-engineer/        #   代码生成团队
│   ├── cad-designer/         #   CAD 设计团队
│   ├── drawing-analyst/      #   图纸分析团队
│   ├── knowledge-manager/    #   知识管理团队
│   ├── diagnostics/          #   诊断团队
│   ├── code-reviewer/        #   代码审查团队
│   ├── drawing-comparator/   #   图纸比对团队
│   └── test-generator/       #   测试生成团队
├── ui/                       # TUI 界面组件(Ink + React)
│   ├── ChatApp.jsx           #   主界面组件
│   └── SyntaxHighlight.jsx   #   AutoLISP 语法着色器
├── tools/
│   ├── mcp-tools.js          #   MCP 工具封装(缓存可配置)
│   ├── lisp-utils.js         #   Lisp 语法检查/格式化工具
│   ├── funlib-recommender.js #   函数智能推荐
│   ├── code-interpreter.js   #   代码解释器(安全检查)
│   └── multimodal-processor.js # 多模态处理
├── providers/                # LLM 提供商
│   ├── openai.js
│   ├── deepseek.js
│   ├── anthropic.js
│   ├── ollama.js
│   ├── vllm.js
│   └── gemini.js
├── shared/
│   ├── prompt-templates.js   #   LLM 提示词模板
│   └── tool-descriptions.js  #   MCP 工具描述
├── test/
│   ├── agent-manager.test.js
│   ├── code-interpreter.test.js
│   └── workflow-engine.test.js
└── web/                      # Web UI
    ├── index.html
    ├── app.js
    └── style.css

技术栈

  • 运行时: Node.js 18+
  • TUI: Ink v7 + React 19
  • AI 框架: LangGraph / LangChain (@langchain/langgraph, @langchain/core)
  • LLM: 兼容 OpenAI API 协议的任意提供商
  • CAD 通信: MCP(Model Context Protocol,通过 npx @atlisp/mcp
  • 构建: esbuild
  • 测试: vitest

测试

npm test

许可

ISC