JSPM

@optima-chat/optima-agent

0.1.76
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3607
  • Score
    100M100P100Q129220F
  • License MIT

基于 Claude Agent SDK 的电商运营 AI 助手

Package Exports

  • @optima-chat/optima-agent
  • @optima-chat/optima-agent/dist/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@optima-chat/optima-agent) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Optima Agent

基于 Claude Agent SDK 的电商运营 AI 助手。

npm version License: MIT

快速开始

安装

npm install -g @optima-chat/optima-agent

认证

export ANTHROPIC_API_KEY=your-api-key

或使用 Claude Code 的认证(~/.claude/)。

使用

# 交互模式
optima

# 单次查询
optima -p "查看商品列表"

# 服务器模式
optima serve --port 3000

功能特性

核心能力

  • 店铺管理 - 查看和更新店铺信息
  • 商品管理 - 创建、编辑、查询商品
  • 订单处理 - 发货、退款、订单查询
  • 库存管理 - 监控库存、调整数量
  • 国际化 - 多语言翻译管理
  • 店铺配置 - 首页、集合、商品详情页
  • 图像/视频 - AI 生成产品图片和视频
  • 广告投放 - Google Ads 管理
  • 选品调研 - Amazon 产品分析
  • 数据分析 - 销售数据和趋势

Stream 模式特性

  • Context 使用可视化(进度条显示)
  • Skills 加载状态追踪
  • Session token 统计(按模型分类)
  • 对话计时
  • 命令菜单(/help, /model, /context, /clear

可用 Skills

Skill 用途
merchant 店铺信息管理
product 商品管理
order 订单处理
inventory 库存管理
i18n 国际化翻译
storefront 店铺前台配置
comfy 图像/视频生成
ads Google Ads 广告
scout Amazon 选品调研
bi 数据分析

配置

项目根目录可选配置:

OPTIMA.json - 配置选项

{
  "model": "claude-sonnet-4-5-20250929",
  "maxTurns": 50
}

OPTIMA.md - 自定义 System Prompt

# 项目规则

- 使用简体中文
- 优先使用现有库存

API 使用

import { OptimaAgent } from '@optima-chat/optima-agent';

const agent = new OptimaAgent({
  model: 'claude-sonnet-4-5-20250929',
  maxTurns: 50,
});

for await (const event of agent.chat('查看商品列表')) {
  if (event.type === 'assistant') {
    console.log(event.message);
  }
}

// 重置会话
agent.reset();

技术架构

┌─────────────────────────────────────────────────────────────────┐
│                        用户界面层                                │
│  ┌──────────────────┐              ┌──────────────────┐        │
│  │   终端 CLI       │              │   HTTP Server    │        │
│  │  (Stream Mode)   │              │   (WebSocket)    │        │
│  └────────┬─────────┘              └────────┬─────────┘        │
└───────────┼──────────────────────────────────┼──────────────────┘
            │                                  │
            └──────────────┬───────────────────┘
                           ▼
┌─────────────────────────────────────────────────────────────────┐
│                      Optima Agent 核心                           │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │                  Claude Agent SDK                          │  │
│  │  • 流式输出  • 上下文管理  • Hooks  • 会话恢复             │  │
│  └───────────────────────────────────────────────────────────┘  │
│                             │                                    │
│  ┌──────────────┬──────────┴──────────┬──────────────┐         │
│  │              │                      │              │         │
│  ▼              ▼                      ▼              ▼         │
│ Skills      System Prompt          Tools         MCP Server    │
│ (10个)      (引导逻辑)           (Bash/Read..)    (Memory)      │
└──────────────────────┬──────────────────────────────────────────┘
                       │
        ┌──────────────┼──────────────┐
        ▼              ▼               ▼
┌─────────────┐  ┌──────────┐  ┌──────────────┐
│ commerce    │  │  comfy   │  │ google-ads   │
│   -cli      │  │   -cli   │  │    -cli      │  ...
│             │  │          │  │              │
│ 商品·订单   │  │ 图像·视频 │  │   广告投放    │
└─────────────┘  └──────────┘  └──────────────┘

技术栈

  • 核心: Claude Agent SDK v0.1.55
  • 语言: TypeScript
  • UI: 自定义终端渲染
  • 工具集成: 5 个专业 CLI 工具

开发

# 安装依赖
npm install

# 开发模式
npm run dev

# 构建
npm run build

# 类型检查
npm run typecheck

License

MIT