feat: 实现Operation-Agent核心功能及电商平台适配器

refactor: 重构项目结构,分离server和dashboard代码
style: 统一代码风格,修复lint警告
test: 添加平台适配器工厂测试用例
ci: 更新CI/CD流程,增加语义验证和性能测试
docs: 添加语义中心文档,定义统一数据模型和状态机
This commit is contained in:
2026-03-19 15:23:56 +08:00
parent aa2cf560c6
commit 8de9ea0aaa
41 changed files with 5615 additions and 497 deletions

View File

@@ -0,0 +1,20 @@
export enum PlatformType {
AMAZON = 'amazon',
SHOPEE = 'shopee',
ALIEXPRESS = 'aliexpress',
TIKTOK = 'tiktok',
EBAY = 'ebay',
LAZADA = 'lazada',
WISH = 'wish',
SHEIN = 'shein',
JD_WORLDWIDE = 'jd_worldwide',
WALMART = 'walmart',
ETSY = 'etsy',
TARGET = 'target',
NEWEGG = 'newegg',
CDISCOUNT = 'cdiscount',
ALLEGRO = 'allegro',
OTTO = 'otto',
RAKUTEN = 'rakuten',
QOO10 = 'qoo10'
}

View File

@@ -0,0 +1,6 @@
export enum StoreStatus {
PENDING = 'pending',
ACTIVE = 'active',
INACTIVE = 'inactive',
SUSPENDED = 'suspended'
}

View File

@@ -0,0 +1,33 @@
export enum OperationAgentEvent {
// 店铺相关事件
STORE_BOUND = 'operation_agent.store.bound',
STORE_BIND_FAILED = 'operation_agent.store.bind.failed',
STORE_ACTIVATED = 'operation_agent.store.activated',
STORE_DEACTIVATED = 'operation_agent.store.deactivated',
// 商品相关事件
PRODUCTS_SYNCED = 'operation_agent.products.synced',
PRODUCTS_SYNC_FAILED = 'operation_agent.products.sync.failed',
PRODUCT_PRICE_UPDATED = 'operation_agent.product.price.updated',
PRODUCT_PRICE_UPDATE_FAILED = 'operation_agent.product.price.update.failed',
PRODUCT_STOCK_UPDATED = 'operation_agent.product.stock.updated',
PRODUCT_STOCK_UPDATE_FAILED = 'operation_agent.product.stock.update.failed',
PRODUCT_LISTED = 'operation_agent.product.listed',
PRODUCT_LIST_FAILED = 'operation_agent.product.list.failed',
PRODUCT_DELISTED = 'operation_agent.product.delisted',
PRODUCT_DELIST_FAILED = 'operation_agent.product.delist.failed',
// 订单相关事件
ORDERS_SYNCED = 'operation_agent.orders.synced',
ORDERS_SYNC_FAILED = 'operation_agent.orders.sync.failed',
// 平台适配器相关事件
ADAPTER_AUTHORIZED = 'operation_agent.adapter.authorized',
ADAPTER_AUTH_FAILED = 'operation_agent.adapter.auth.failed',
ADAPTER_API_ERROR = 'operation_agent.adapter.api.error',
// 系统相关事件
AGENT_STARTED = 'operation_agent.started',
AGENT_STOPPED = 'operation_agent.stopped',
AGENT_HEARTBEAT = 'operation_agent.heartbeat'
}

View File

@@ -0,0 +1,26 @@
export interface OrderItem {
productId: string;
quantity: number;
price: number;
}
export interface ShippingAddress {
name: string;
address: string;
city: string;
state: string;
zip: string;
country: string;
}
export interface Order {
id: string;
customerId: string;
totalAmount: number;
status: string;
items: OrderItem[];
shippingAddress: ShippingAddress;
paymentMethod: string;
createdAt: Date;
updatedAt: Date;
}

View File

@@ -0,0 +1,13 @@
export interface Product {
id: string;
name: string;
sku: string;
price: number;
stock: number;
description: string;
images: string[];
categories: string[];
attributes: Record<string, any>;
createdAt: Date;
updatedAt: Date;
}

View File

@@ -0,0 +1,8 @@
export interface ShopInfo {
id: string;
name: string;
description: string;
status: string;
createdAt: Date;
updatedAt: Date;
}