BossAgents Main Platform Cognitive Map
This document is a structured cognitive overview of the C:\www\wwwroot\bossagents project.
BossAgents is the "Left Help Right Arm" main platform (port 3006), which interfaces with cms/workbuddy-claw-wechat-publisher (port 8088): the former is the digital employee's "brain + spine", while the latter is the content digital employee's "mouth + frontend".
Source: Based on actual reading of source code (server.js, server/digital-staff/, server/boss-scheduler/, server/core/capability-runtime.js, server/boss-scheduler/profiles/local.yaml, src/router/index.js, etc.) and recent git changes.
I. Project Positioning
| Project | Description |
|---|---|
| Name | BossAgents · Left Help Right Arm — AI-Driven Enterprise PLM Platform |
| Description | SCSAI PLM BOM Management System — Enterprise PLM integration, supporting full BOM lifecycle management, change management, supplier management, digital employee platform |
| Tech Stack | Vue 3 + Vite (Frontend 5173) + Node.js (Backend 3006) + SQLite/MySQL |
| Core Modules | Data Asset Management, Process Specification Management, BOM Management, Digital Staff |
| Main Entry | node server.js (Backend 3006) / npm run dev:vite (Frontend 5173) |
| Package Manager | pnpm@10.22.0 |
| Relationship with workbuddy | workbuddy proxies to this platform via /api/bossagents-proxy on port 3006, with fallback to mock real data if down |
One-sentence Positioning
"Enable every manufacturing enterprise to have its own digital staff" — An AI-driven enterprise PLM platform for the manufacturing industry.
Core Narrative (Six Value Dimensions from handleHome on the homepage):
- Asset Value Quantification (860k Assets · 101.5M Valuation)
- Relationship Network Discovery (730k Relationships · Process→Operation→Step→Technical Parameters)
- Quality Health Check & Diagnosis (One-click Repair)
- AI Intelligent Insights (Trend Identification + Report Generation)
- Digital Staff Collaboration (11 Active Staff · 4300+ n8n Workflows)
- Business Process Traceability (110k Traceable Process Documents)
II. Code Structure
bossagents/
├─ server.js # ★★★ 5269 行主服务入口(API 路由全在这)
├─ app/ # Express 风格的 router 模块(boss/dispatch/feishu 等已迁移至此)
│ ├─ router.js
│ ├─ middleware.js
│ └
│ └ routes/ boss.js capability.js dispatch.js feishu.js messages.js
├─ core/ # SCSAI 集成层(Vue/TS)
│ ├─ SCSAIAuthenticator.js / SCSAICoreWrapper.js / SCSAIDataService.js
│ ├─ SCSAIDependencyLoader/Manager/Resolver.js
│ ├─ SCSAIFileLoader.js / SCSAIPathMapper.js / SCSAIVuePlugin.js
│ └ RealSCSAIWrapper.js / GlobalObjectsPatch.js / Logger.js / SCSAI-config.js
│ └ auth/ EnhancedUnifiedAuthManager.ts / UnifiedAuthManager.ts
│ └ external/ XmlCompatibility.js
│ └ middleware/ UnifiedAuthMiddleware.ts
│ └ router/ UnifiedRouterManager.ts
├─ server/ # ★★★ 后端业务模块
│ ├─ digital-staff/ # Digital Staff"大脑"(详见下文)
│ ├─ boss-scheduler/ # Digital Staff"脊柱"(详见下文)
│ ├─ core/ # 业务能力引擎(详见下文)
│ ├─ routes/ # 路由模块(digital-staff-routes.js 等)
│ ├─ agents/ # 决策智能体(comparison/decision/inventory-alert/quotation-parser)
│ ├─ channels/ # 渠道适配(openclaw/wechat)
│ ├─ services/ # 服务层(audit-log 等)
│ ├─ utils/ # 工具(SCSAI-client / i18n / logger)
│ ├─ shared/ # 共享(i18n)
│ ├─ config/ # 配置文件(models / item-type-registry / extraction-prompts / domain-templates)
│ ├─ data/ # SQLite DB + JSON 数据(bossagents.db / aml.db / digital-staff-*.json)
│ └ __tests__/ _deprecated/
├─ src/ # Vue3 前端
│ ├─ router/index.js # 580 行路由(60+ 页面)
│ ├─ views/ # 页面组件(60+ 个 .vue)
│ └ components/ composables/ services/ stores/ i18n/ utils/
├─ MTClaw/ # MTClaw 思想加速子项目(OpenClaw 插件 + Python skills)
├─ SCIOT/ # SCIOT 工业数据(SOLIDCAD ERP)
├─ bossagents-miniapp/ # 微信小程序前端
├─ config.yaml # 服务端配置
├─ .env / .env.example # 环境变量
├─ DATA_ASSET_PLATFORM_DESIGN.md / SYSTEM_STATUS_REPORT.md / VALUE_DEMO_PLAN.md # 设计文档
└─ REFACTOR_PLAN_V2/V3/V4.md # 重构计划
三、数字员工三大层(最关键,记牢)
BossAgents 的数字员工是 三层架构:大脑 → 脊柱 → 能力。这是和 workbuddy 那种"单个 handler 一个员工"完全不同的体系化设计。
┌──────────────────────────────────────────────────────────────┐
│ L3 业务员工层(YAML Profile 定义) │
│ server/boss-scheduler/profiles/local.yaml │
│ 30+ 个员工:DS-BOSS-001 ~ DS-NEWS-001 │
│ 每个员工:id/name/cron/worker/capability/llm/keywords │
└──────────────────────────────────────────────────────────────┘
↓ runOnce(staffId, intent, parameters)
┌──────────────────────────────────────────────────────────────┐
│ L2 调度层(LiteScheduler) │
│ server/boss-scheduler/lite-scheduler.js (2323 行) │
│ cron 触发 + 互斥锁 + 队列 + Loop/Goal + Pipeline │
│ 分发路径:Worker / Capability / Pipeline / Loop / Generic │
└──────────────────────────────────────────────────────────────┘
↓ _runCapabilityPath
┌──────────────────────────────────────────────────────────────┐
│ L1 能力层(CapabilityRuntime) │
│ server/core/capability-runtime.js (2012 行) │
│ 六大能力:identify / validate / repair / optimize / │
│ compare / generate + inspect/valuate/collect/import │
│ 规则引擎优先 → LLM 降级 │
└──────────────────────────────────────────────────────────────┘
↓
┌──────────────────────────────────────────────────────────────┐
│ L0 智能层(LLMBrain + LLMRouter) │
│ server/digital-staff/llm-brain.js(863 行) │
│ server/digital-staff/llm-router.js(694 行) │
│ server/digital-staff/smart-llm-router.js(1277 行) │
│ MTClaw 思想:Worker(小模型 ~70ms)/ Solver(大模型 ~500ms) │
│ 70%+ 走 Worker,7 倍加速 │
└──────────────────────────────────────────────────────────────┘
3.1 L0 智能层 — server/digital-staff/
| 文件 | 行数 | 职责 |
|---|---|---|
| llm-brain.js | 863 | LLMBrain class, singleton getGlobalInstance(). Configuration priority: LLM_ > DIGITAL_STAFF_LLM_ > config > default. Detects MTClaw acceleration (port 18790) |
| llm-router.js | 694 | LLMRouter + InferenceServiceDetector, Worker/Solver division of labor |
| smart-llm-router.js | 1277 | SmartLLMRouter, intelligent scheduling layer (circuit breaker / retry / cache) |
| smart-llm-bridge.js | 96 | Bridge |
| index.js | 2712 | Legacy digital employee core scheduler (cron + SCSAI + capability SDK), replaced by LiteScheduler, retained for compatibility |
| loader.js | 13 | Loader → Always returns boss-scheduler (unified architecture) |
| staff-manager.js | 555 | StaffManager — Digital employee configuration CRUD (creates tables digital_staff / staff_tasks / staff_execution_logs) |
| task-board.js | 321 | Task board |
| config-manager.js | 249 | Configuration management |
| keyword-matcher.js | 148 | Keyword matcher (legacy, replaced by staff-router) |
| conversation-engine.js | 410 | Conversation engine |
| conversation-manager.js | 213 | Conversation Manager |
| correction-learner.js | 311 | Self-Evolving Learner |
| ascend-npu.js | 495 | Ascend NPU Adaptation |
| chipwise-handler.js | 506 | Chip Design-Specific Handler |
| plm-brain-handler.js | 529 | PLM Document Brain Handler |
| collaboration-scheduler.js | 276 | Collaboration Scheduler |
| collaboration-rules.yaml | — | Collaboration Rules |
3.2 L2 Scheduling Layer — server/boss-scheduler/
lite-scheduler.js (2323 lines) — LiteScheduler class, core methods:
| Method | Line | Responsibility |
|---|---|---|
| runOnce(staffId, intent, parameters) | 2096 | Main entry: execute a single staff task |
| resumeStaff(staffId, resumeId, choice) | 2243 | Resume a task paused by ConfirmNeededError |
| _runWorker(staff, intent, parameters) | 1374 | Dispatcher: Select path based on staff configuration |
| _dispatchWorkerPath | 874 | Worker path (special worker) |
| _runLoopGoalPath | 907 | Loop/Goal path |
| _runPipelinePath | 945 | Pipeline path (multi-capability series) |
| _runWorkerScriptPath | 1025 | Worker script path |
| _runCapabilityPath | 1065 | Capability path → Invoke CapabilityRuntime |
| _runDecomposedSteps | 1245 | Execute decomposed steps |
| _runGenericPath | 1349 | Generic fallback |
| _processStaffTasks | 1491 | Process task queue |
| _runLoopAction | 1521 | Loop action execution |
| _checkGoalCondition | 1808 | Goal condition check |
| _executeGoalSuccess/Failure | 1874/1918 | Goal success/failure actions |
| _sendNotification / _createAlert | 1968/1987 | Notification/Alert |
| _withStaffMutex | 768 | Staff Mutex Lock |
| _checkLoopCondition / _evaluateCondition | 609/640 | Loop Condition Evaluation |
| _getStaffContext | 670 | Staff Context |
| _detectLocalServicesAsync | 170 | Detect Local Services (Ollama/MTClaw) |
| _callMTClaw | 366 | Call MTClaw |
Supporting Files:
| File | Responsibility |
|---|---|
| index.js (226 lines) | Entry point, exports LiteScheduler |
| staff-registry.js | Loads staff definitions from YAML Profile (supports GBK decoding, disable filtering) |
| staff-router.js (520 lines) | Shared routing module — unified keyword matching / parameter extraction / Banner metadata, used by AiWorkbench (frontend) / feishu-router / DigitalStaff detail page across three ends |
| task-queue.js | SQLite queue |
| collaboration-chain.js | Chain collaboration (onComplete triggers downstream staff) |
| feishu-router.js | Feishu Channel Router |
| health-self-heal.js | Self-Healing |
| workers/ | 20 Worker Implementations (see table below) |
| profiles/ | YAML Employee Definitions (local/asset-catalog/automation-presets/health-check/mtclaw-tools/valuation) |
20 Workers (server/boss-scheduler/workers/):
| Worker File | Corresponding Employee ID | Responsibility |
|---|---|---|
| data-clerk.js | DS-BOSS-001 | Data Clerk — Sync SCSAI objects to local cache |
| system-health.js | DS-BOSS-002 | System Ops Engineer — Inspect DB/SCSAI/template/rule consistency |
| procurement.js | DS-PROC-001 | Procurement Assistant — Full process of inquiry/price comparison/order placement |
| content.js | DS-CONTENT-001 | Content Generator — Official account article/composition/de-AI-ify/publish |
| SCSAI-creator.js | DS-SCSAI-001 | SCSAI Engineer — Create business objects |
| cost-optimizer.js | DS-COST-001 | Cost Optimizer — BOM Cost Analysis |
| data-caretaker.js | DS-OPS-001 | Data Caretaker — Cleanup/Archive/Monitor |
| report-analyst.js | DS-REPORT-001 | Report Analyst — Visualization + Email |
| report-i18n.js | — | Report i18n |
| vendor-review.js | DS-VEN-001 | Vendor Steward — Performance Review |
| ecr-worker.js | DS-ECR-001 | ECR Auditor — Change Review |
| process-worker.js | DS-PROCESS-OPT-001 | Process Optimization — 16-Step Workflow |
| biz-analyst.js | DS-BIZ-001 | Business Brain — Executive Daily Brief |
| stock-manager.js | DS-STOCK-001 | Inventory Steward — Level Inspection |
| doc-worker.js | DS-DOC-001 | Document Digital Worker — Generation/QA |
| mkt-worker.js | — | Marketing |
| pm-worker.js | — | Project Management |
| equip-worker.js | — | Equipment |
| auto-loop-worker.js | DS-AUTO-LOOP-001 | Closed-Loop Engine — Content Link/Share/Self-Evolution |
| system-health.js | — | System Health |
3.3 L1 Capability Layer — server/core/capability-runtime.js (2012 lines)
The CapabilityRuntime class, which packages six basic capabilities into a unified interface, with rule engine priority → LLM fallback.
Core capability methods (10):
| Method | Line | Capability | Description |
|---|---|---|---|
| identify(context, options) | 872 | Identify | Query/identify object type and attributes |
| validate(context, options) | 835 | Validate | Audit consistency |
| repair(context, options) | 952 | Repair | Fix data quality issues |
| optimize(context, options) | 1126 | Optimize | Optimize process parameters |
| compare(context, options) | 1212 | Compare | BOM/supplier diff comparison |
| generate(context, options) | 1276 | Generate | Content/document generation |
| inspect(context, options) | 1660 | Health Check | Five-Dimensional Health Score |
| import(context, options) | 187 | Import | EXCEL/CSV/JSON/XML Import |
| valuate(context, options) | 580 | Valuation | Three-Stage Cost/Revenue/Market Valuation |
| collect(context, options) | 732 | Collection | Multi-Source Data Collection |
Statistical counters: ruleEngineHits / llmWorkerHits / llmSolverHits / totalCalls / byCapability — used to evaluate rule engine hit rate.
Core supporting modules (server/core/, 50+ modules):
- rule-engine.js / rule-engine-core.js / rule-evolution.js / rule-simulator.js / rule-workbench-service.js / rule-intent-interpreter.js — the full rule engine suite
- unified-asset-service.js — Unified Data Asset Service (core, dashboard API)
- unified-schema.js / unified-validator.js — Schema/Validation
- capability-dispatcher.js — Capability Dispatcher
- relationship-capability.js / relationship-checklist.js / relationship-resolver.js — Relationship Resolution
- health-inspector.js / health-patrol.js / health-scanner.js — Health Inspection
- asset-valuator.js / asset-catalog-service.js — Valuation/Cataloging
- object-importer.js / object-modeler.js — Object Import/Modeling
- document-generator.js / docs-converter.js / doc-chat-service.js — Document
- content-engine.js / content-publisher.js / content-audit-engine.js / content-asset-manager.js / content-calendar-manager.js — Content Engine
- marketing-service.js / marketing-loop-engine.js — Marketing
- auto-loop-service.js / automation-service.js — Automated Closed Loop
- workflow-executor.js / workflow-to-schema.js — Workflow
- intent-engine.js / intent-classifier.js / smart-intent-recognizer.js / rule-intent-interpreter.js — Intent Recognition
- correction-learner.js / evolution-engine.js — Self-Evolution
- knowledge-indexer.js / knowledge-search.js / domain-knowledge-extractor.js / product-knowledge-integrator.js — Knowledge
- llm-process-generator.js / llm-process-exporter.js / llm-process-knowledge.js / llm-process-store.js — LLM Process
- phosphorus-asset-service.js / phosphorus-kb-builder.js — Phosphorus Chemical Demo
- bom-demo-builder.js / bom-process-linker.js — BOM
- process-spec-generator.js / SCSAI-process-sync.js / SCSAI-rule-sync.js — Process Specification
- change-chain-engine.js — Change Chain
- share-service.js — Sharing
- tenant-content-adapter.js / user-asset-service.js / platform-service.js — Tenant/User/Platform
- prompt-template-manager.js — Prompt Template
- scirot-rules-bridge.js — SCIOT Rules Bridge
- staff-capability-portrait.js / staff-domain-mapper.js — Staff Capability Portrait
- industrial-data-asset-overview.js — Industrial Data Asset Overview
- context-injector.js / data-collection-service.js / data-service-api.js / execution-to-content.js / alignment-engine.js / ai-reasoning-visualizer.js / behavior-service.js / generation-task-manager.js / enterprise-rules.js — Various Auxiliary Modules
4. YAML Profile: Employee Master List (server/boss-scheduler/profiles/local.yaml)
local.yaml defines 30+ employees, categorized by type:
4.1 IT/Data Infrastructure Class
| ID | Name | cron | worker | capability | llm |
|---|---|---|---|---|---|
| DS-BOSS-001 | Xiao Zhi - Data Clerk | 0 /2 | data-clerk | identify | false |
| DS-BOSS-002 | Xiao Zhi - System Operations Engineer | 0 /3 | system-health | identify | false |
| DS-IMPORT-001 | Xiao Zhi - Data Import Specialist | 0 /10 | — | import | true |
| DS-OPS-001 | Xiao Zhi - Data Caretaker | 0 2 * | data-caretaker | identify | false |
| DS-COLLECT-001 | Xiao Zhi - Data Collector | 0 /4 | — | collect | false |
| DS-IDENTIFY-001 | Xiao Zhi - Asset Identifier | — | — | identify | true |
4.2 Procurement/Supply Chain
| ID | Name | cron | worker | capability | llm |
|---|---|---|---|---|---|
| DS-PROC-001 | XiaoZhi-Procurement Assistant | — | procurement | create | true (MTClaw) |
| DS-VEN-001 | XiaoZhi-Supplier Manager | 0 /2 | vendor-review | inspect | false (MTClaw) |
| DS-COST-001 | XiaoZhi-Cost Optimizer | — | cost-optimizer | compare | true |
| DS-STOCK-001 | XiaoZhi-Inventory Manager | 0 /2 | stock-manager | identify | false |
| DS-SUPPLY-001 | XiaoZhi-Supply Chain Manager | 0 /4 | — | pipeline | true |
4.3 Engineering/Process/Change
| ID | Name | cron | worker | capability | llm |
|---|---|---|---|---|---|
| DS-SCSAI-001 | XiaoZhi-SCSAI Engineer | — | SCSAI-creator | create | true |
| DS-ECR-001 | Zhi-ECR Reviewer | 0 /4 | ecr-worker | validate | true |
| DS-PROCESS-OPT-001 | Zhi-Process Optimizer | 0 9 1-5 | process-optimizer | optimize | true (16-step workflow) |
| DS-ECO-001 | Zhi-Change Analyst | — | — | compare | true |
| DS-PLM-BRAIN-001 | Zhi-PLM Document Brain | — | — | analyze | true |
4.4 Quality/Evaluation
| ID | Name | cron | worker | capability | llm |
|---|---|---|---|---|---|
| DS-REVIEW-001 | Zhi-Document Reviewer | 0 /6 | — | validate | false |
| DS-INSPECT-001 | Zhi-Data Inspector | 0 8 1 | — | inspect | true |
| DS-REPAIR-001 | Zhi-Data Repairer | — | — | repair | true |
| DS-VALUATION-001 | Xiao Zhi - Data Valuator | — | — | valuate | true |
4.5 Business/Reporting/Document/Content Category
| ID | Name | cron | worker | capability | llm |
|---|---|---|---|---|---|
| DS-BIZ-001 | Xiao Zhi - Business Brain | 0 8 * * * | biz-analyst | identify | true (Pipeline+Collaboration) |
| DS-REPORT-001 | Xiao Zhi - Report Analyst | 0 8 * * 1 | report-analyst | generate | true |
| DS-DOC-001 | Xiao Zhi - Document Digital Employee | 0 */4 * * * | doc | generate | true |
| DS-CONTENT-001 | Xiao Zhi - Content Generator | — | content | generate | true |
| DS-AUTO-LOOP-001 | Xiao Zhi - Closed-Loop Engine | 0 */4 * * * | auto-loop | generate | true (Loop) |
4.6 Chip Design Category (ChipWise, 6 total)
| ID | Name | capability | Description |
|---|---|---|---|
| DS-CHIP-001 | Chip Intelligence Identifier | chip_identify | RISC-V specification identification |
| DS-CHIP-002 | Chip Creation Master | chip_create | RTL Code Generation |
| DS-CHIP-003 | Chip Repair Master | chip_repair | Verilog Repair |
| DS-CHIP-004 | Chip Comparison Master | chip_compare | RTL Version Comparison |
| DS-CHIP-005 | Chip Optimization Master | chip_optimize | PPA Optimization |
| DS-CHIP-006 | Chip Generation Master | chip_generate | Documentation + Test Generation |
| DS-CHIP-007 | Chip Edge Master | chip_edge | RISC-V Development Board Deployment |
4.7 General Office (7 items)
| ID | Name | capability | Description |
|---|---|---|---|
| DS-KNOWLEDGE-001 | XiaoZhi - Knowledge Base Assistant | knowledge_rag | Local Vector Retrieval |
| DS-WORKFLOW-001 | XiaoZhi - Workflow Assistant | workflow_automation | Schedule/To-do/Email |
| DS-ANALYTICS-001 | XiaoZhi - Data Analytics Assistant | data_analytics | NL→SQL/Pandas |
| DS-HEALTH-001 | XiaoZhi - Health Advisor | health_advisor | Health Tracking |
| DS-VISION-001 | XiaoZhi-Vision Analysis Assistant | vision_analysis | OCR/Image Understanding |
| DS-WRITER-001 | XiaoZhi-Writing Assistant | writing_assistant | Polishing/Translation |
| DS-NEWS-001 | XiaoZhi-News Digest Assistant | news_digest | Industry News Subscription |
4.8 Loop Engineering Patterns (4 Examples)
| ID | Name | Pattern | Description |
|---|---|---|---|
| DS-PROC-LOOP-001 | XiaoZhi-Price Monitor | Monitoring Type | Triggers re-quotation if price increase exceeds 5% |
| DS-BOSS-LOOP-001 | XiaoZhi-Goal Tracker | Goal-Driven Type (/goal) | Monthly sales target of 1 million tracking |
| DS-VEN-LOOP-001 | XiaoZhi-Data Repair Agent | Self-Repairing Type | Automatically completes missing supplier fields |
| DS-STOCK-LOOP-001 | XiaoZhi-Inventory Alert Agent | Monitoring Type | Automatically generates purchase requisitions for low stock |
Loop Engineering Three Patterns:
- Monitoring Type — cron + condition → action pipeline
- Goal-Driven Type (goal) — verification_condition + interval + on_success/on_failure
- Self-healing type — action pipeline (identify→repair→validate) + max_iterations + retry_delay
5. Overall server.js Routing Table (5269 lines, handleRequest at lines 1372-5008)
5.1 Digital Staff API (/api/digital-staff/*, 40+ endpoints)
Run Control:
- GET /api/digital-staff/run — Manually trigger a single staff
- POST /api/digital-staff/run — Same as above
- POST /api/digital-staff/run-internal — Internal trigger
- POST /api/digital-staff/start / stop / toggle — Start/Stop/Toggle
- POST /api/digital-staff/reload — Reload configuration
Status/Monitoring:
- GET /api/digital-staff/status — Status
- GET /api/digital-staff/health — Health
- GET /api/digital-staff/dashboard — Dashboard
- GET /api/digital-staff/runs / run-detail — Run history
- GET /api/digital-staff/logs / POST /logs/delete — Logs
- GET /api/digital-staff/logs/stream — SSE Real-time Log Stream (registerSSEClient)
Confirmation/Recovery (Human-Machine Collaboration):
- GET /api/digital-staff/pending-confirms — Pending Confirmation List
- POST /api/digital-staff/confirm — Confirm Decision (Resume after ConfirmNeededError pause)
- GET/POST /api/digital-staff/resume — Resume Execution
Configuration CRUD (server/routes/digital-staff-routes.js):
- GET /api/digital-staff/list / /:id — List/Details
- POST /api/digital-staff — Create
- PUT /api/digital-staff/:id — Update
- DELETE /api/digital-staff/:id — Delete
- POST /api/digital-staff/:id/enable — Enable
- GET /api/digital-staff/:id/rules-prompts — Rules and Prompts
- GET/POST /api/digital-staff/config — Read/Write Configuration
- GET /api/digital-staff/llm-config — LLM Configuration
Task Management:
- GET /api/digital-staff/tasks / /:id — Task List/Details
- POST /api/digital-staff/tasks — Create Task
- GET /api/digital-staff/task-stats — Task Statistics
Loop/Goal:
- GET /api/digital-staff/loops / /:id — Loop List/Details
- POST /api/digital-staff/loops — Create Loop
- PUT/DELETE /api/digital-staff/loops/:id — Update/Delete
- GET /api/digital-staff/goals / /:id — Goal Status
- POST /api/digital-staff/goals/:id/reset — Reset Goal
Matching/Import-Export:
- POST /api/digital-staff/match — Keyword Match Employee
- GET /api/digital-staff/import/formats / POST /import — Import
- POST /api/digital-staff/export / GET /export/formats — Export
MTClaw/Router:
- GET /api/digital-staff/mtclaw/stats / POST /mtclaw/test — MTClaw Statistics/Test
- GET /api/digital-staff/router/stats / POST /router/test — LLM Router Statistics/Test
5.2 Business APIs (in order of appearance in server.js)
| Prefix | Description |
|---|---|
| /api/bom/* | BOM Management (version/import/search/config/cron/object-graph/generate-nested/save-nested) — line 693 handleBomApi |
| /api/audit/* | Audit Logs |
| /api/vendor/ / /api/vendor-part/ | Vendor |
| /api/customer/* | Customer |
| /api/change/stats | Change Statistics |
| /api/messages/stream | SSE Message Stream |
| /api/miniapp/gst/* | Mini Program GST (10+ sub-paths for product/order/payment/course/anchor, etc.) |
| /api/wechat/* | WeChat Channel |
| /api/auth/ /api/admin/enterprises /api/enterprise/ | Authentication/Enterprise |
| /api/ai/agent/ /api/ai-agent/ | AI Agent |
| /api/asr/recognize | Speech Recognition |
| /api/content/* | Content Digital Employee API |
| /api/employee/* | Employee |
| /api/unified/* | Unified Assets (Core of Data Asset Platform) |
| /api/object-modeler/* | Object Modeling |
| /api/tenant/quota | Tenant Quota |
| /api/sciot/parts | SCIOT Parts |
| /api/dashboard/* | Dashboard (asset-overview / today-governance) |
| /api/SCSAI/query | SCSAI Query (SOAP Proxy) |
| /api/unified-assets/* | Data Asset Dashboard (dashboard / list / :id / relation-graph) — This is what workbuddy proxies |
Note: Some routes have been migrated to app/router.js (boss/dispatch/feishu/workbuddy/coze), with comments left in server.js marking them as MIGRATED.
VI. Frontend Routes (src/router/index.js, 60+ pages)
Digital Staff related pages:
| Path | Component | Description |
|---|---|---|
| /digital-staff | DigitalStaff.vue (3261 lines) | Digital Staff Management Console |
| /ai-workbench | AiWorkbench.vue (3259 lines) | AI Workbench (Conversation-triggered Staff) |
| /staff-capabilities | StaffCapabilities.vue | Staff Capability Profile |
| /staff-customizer | — | Staff Customization |
| /content-center | ContentCenter.vue | Content Center |
| /document-intelligence | DocumentIntelligence.vue | Document Intelligence |
| /llm-config | LLMConfig.vue | LLM Configuration |
Business pages: dashboard / product-list / private-library / bom-assistant / change-management / vendor-management / customer-management / order-management / project-management / document-center / file-business / quality-management / inventory-management / workflow-management / modeling-center / itemtype-management / system-objects / data-collection / rules-templates / feishu-config / system-log / inspection-history / etc.
Featured Pages: ChipWiseEngine (Chip Design) / PlmDocBrain (PLM Document Brain) / ProcessOptimization / ProcessSpecStudio / PpsTechFileBrowser / PpsExtractPanel / CrossIndustryValidation / DataMarketplace / DataRelationGraph / IndustrialAssetOverview / CustomizationCenter / CustomObjectBuilder / RuleCustomizer / PromptCustomizer
7. Key Configuration
7.1 Environment Variables (.env.example)
Server: PORT=3006 JWT_SECRET AUTH_SECRET
Database: DB_BACKEND=sqlite|mysql DATABASE_PATH DB_MYSQLDB_*
SCSAI PLM: SCSAI_SERVER SCSAI_DATABASE SCSAI_USERNAME SCSAI_PASSWORD SCSAI_AUTH_TYPE
LLM:
- Main Chain: LLM_API_KEY LLM_ENDPOINT LLM_MODEL LLM_PROVIDER
- DeepSeek: DEEPSEEK_*
- Ollama Local: OLLAMA_ENDPOINT=http://localhost:11434 OLLAMA_MODEL=gemma3:4b
- Worker (Small Model): LLM_WORKER_ENDPOINT/MODEL/API_KEY
- Solver (Large Model): LLM_SOLVER_ENDPOINT/MODEL/API_KEY
Email: SMTP_HOST/PORT/SECURE/USER/PASS/FROM
7.2 YAML Features Configuration (End of local.yaml)
MTClaw Acceleration:
- base_url: http://127.0.0.1:18790/v1
- completion_mode: permissive
- 40+ high-frequency actions (db_query/identify/inspect/compare/repair/validate/procurement_assistant/...)
- disabled_actions: parse_email/understand_intent/generate_text/complex_reasoning
LLM Router:
- Worker: gemma3:4b (Ollama, 5s timeout)
- Solver: deepseek-chat (30s timeout, temp 0.7, max_tokens 2000)
- default_to_solver: true (conservative strategy)
- task_rules: simple_types (db_query/calc/validate/render/send/notify/check/list/get/find) vs complex_types (analyze/plan/create/generate/reason/understand)
- simple_patterns / complex_patterns: regex matching
- chain: mtclaw(disabled) / ollama(enabled) / deepseek(enabled)
- circuit_breaker: 5 failures → open, 60s recovery
- retry: 3 attempts, exponential backoff, jitter
- cache: 1000 size, 60s TTL
VIII. Integration Relationship with workbuddy-claw-wechat-publisher
workbuddy (8088) bossagents (3006)
┌─────────────────────────┐ ┌─────────────────────────────────┐
│ handleBossagentsProxy │ ──fetch──→ │ /api/unified-assets/* │
│ /api/bossagents-proxy │ │ /api/aml/unified/schema/:type │
│ ?type=Part │ │ (BossAgents 真活端点) │
│ ?endpoint=/api/... │ │ │
└─────────────────────────┘ │ 挂了 → workbuddy 降级 mock 真数据 │
│ │
│ handleDemoCapabilityApi │ │ CapabilityRuntime 六大能力 │
│ /api/demo/capability │ ←─内嵌AI演示─ │ (不调 bossagents,直接调 AI) │
│ (identify/create/...) │ │ │
└─────────────────────────┘ │ │
│ │
│ handleDemoMarketingApi │ │ │
│ /api/demo/marketing │ ←─内嵌AI演示─ │ │
│ (4平台营销内容) │ │ │
└─────────────────────────┘ └─────────────────────────────────┘
对接点只有 1 个:/api/bossagents-proxy → ylxt.chat,10 秒超时。
Live Endpoints of BossAgents (called by workbuddy demo page):
- /api/aml/unified/schema/Part — Recognition capability (Schema API, the only live endpoint)
- /api/unified-assets/value/total — Asset value
- /api/unified-assets/dashboard — Relationship network/Process traceability
- /api/unified-assets/quality/issues — Quality inspection
- /api/unified-assets/ai-insight — AI insights
- /api/unified-assets/external-stats — Digital employee collaboration
Inactive endpoints (workbuddy fallback display): When the bossagents backend is not running or returns 500, the workbuddy frontend displays mock real data with a "⚠ BOSSAGENTS API inactive, fallback to real data display" prompt.
9. Recent Changes to Main Branch (Last 20 Commits)
583bda87 最新提交同步
bb663674 feat(软著): 7份各生成三件套(登记申请表+ManualPDF+源码PDF)
6662cdec feat(软著): sc3/sc5 源码补足至60页,7份统一60页
df522fee feat: gst-health Node直连云诊平台,移除Java代理层
5f8b9171 fix(软著): 源码超60页裁切为前30+后30共60页
ccf93004 docs(软著): 7份说明书全面扩充至>=30页
56e3ee2f feat(软著): 主文件夹补入 bossagents 主平台软著(sc1),共7份
f516d130 feat(aml): 构建AML工业数据资产管理体系,101万+数据资产落地
2fe84d69 feat(软著): 新增软著材料生成脚本
d0b633b1 fix(postbuild): 扩展内联覆盖 store/composables/config
e517c43f fix(miniapp): 修复云开发初始化报错和生命周期钩子导入错误
953686ce docs: HICOOL MTClaw策划方案优化 + 测试框架完善
b89cf8fe feat: MTClaw Ollama本地模型调度 + 测试框架优化
17b1e53a feat: MTClaw API Key空值处理 + 商汤SenseNova配置优化
6457fb32 fix: 修复数字员工配置问题
f33f3680 docs: 数字员工全面测试报告 - 34个员工100%通过
0b2808ea 小程序优化
7628fed8 Optimize
主轴:软著材料准备(7份)+ MTClaw 加速 + 数字员工测试报告(34个员工100%通过)+ AML 资产管理。最近一周重心在 软著申请材料 和 小程序优化。
10. Potential Pitfalls and Notes
- server.js is a single file with 5269 lines, containing a massive 3637-line handleRequest function with 71+ routing branches all crammed together — even more extreme than workbuddy's cms-server.cjs, making extension extremely painful.
- digital-staff/index.js (2712 lines) and boss-scheduler/lite-scheduler.js (2323 lines) are dual schedulers. loader.js already points uniformly to lite-scheduler, but the old index.js still retains "compatibility references" — technical debt.
- Duplicate YAML keyword libraries: STAFF_KEYWORDS in staff-router.js and the keywords field for each employee in local.yaml create two sets of keywords. Changing one without updating the other causes mismatches.
- Dual local models: MTClaw on port 18790 and Ollama on port 11434. Configuration exists in both YAML and env files, with env taking precedence but YAML able to override — prone to confusion.
- _evaluateCondition uses eval to execute condition strings from YAML — a security risk; tampering with the YAML could lead to RCE.
- Database password hard-coded: docs-to-cms-pipeline.js (on the workbuddy side) hard-codes 'alibaba', pointing to the DB on the same machine as bossagents, causing secret leakage.
- 7 software copyright materials (recently submitted) — If publishing or making the repository public, note that the source code in the copyright materials may contain sensitive configurations.
- Test report for 34 employees with 100% pass rate (f33f3680) — but local.yaml only defines 30+ employees. The discrepancy between 34 and 30+ needs verification (may include Loop employees).
- SSE /api/digital-staff/logs/stream must use registerSSEClient from server/digital-staff/index.js (same module as staffLog). Cross-module usage will cause log loss.
- _runCapabilityPath calls CapabilityRuntime, but among the 10 capability methods in CapabilityRuntime, import/valuate/collect/inspect are not part of the "Six Core Capabilities" narrative — synchronize narrative changes with code modifications.
Appendix: Key Run Commands
# 后端(3006)
node server.js
npm run dev # 等价
# 前端开发(5173)
npm run dev:vite
# 构建
npm run build # vite build
npm run preview
# 测试
npm test # jest --coverage
npm run test:watch
npm run test:integration
npm run test:frontend # vitest run
# Lint
npm run lint
npm run lint:fix
# 数据资产看板验证
curl https://ylxt.chat/api/unified-assets/dashboard
curl https://ylxt.chat/api/unified-assets/list?asset_type=process_spec
curl "https://ylxt.chat/api/unified-assets/spec_pps0005290Bs2pbsl/relation-graph?depth=2"
# 数字员工手动触发
curl https://ylxt.chat/api/digital-staff/run?staffId=DS-BOSS-002
# 切换 Profile
BOSS_SCHEDULER_PROFILE=./server/boss-scheduler/profiles/valuation.yaml node server.js
附:与 workbuddy 的能力对照
| 维度 | workbuddy-claw-wechat-publisher | bossagents |
|---|---|---|
| Positioning | Content Digital Employee (Mouth + Face) | Full-Stack Digital Employee Platform (Brain + Spine) |
| Port | 8088 | 3006 |
| Main Language | Node.js (cjs) | Node.js + Vue3 |
| Employees | 11 (narrative) / 3 (actual run) | 34 (test passed) / 30+ (YAML defined) |
| Employee Definition | Inline handler in cms-server.cjs | YAML Profile + Worker Module |
| Scheduling | Simple timing via node-cron | LiteScheduler (cron + mutex + queue + Loop/Goal/Pipeline) |
| Capability | Direct AI calls (callAI multi‑path fallback) | CapabilityRuntime (rule engine first → LLM fallback) |
| LLM | Multi‑provider JSON config (real‑time read) | LLMBrain + LLMRouter (Worker/Solver division) |
| Database | MySQL (lvbo_type/lvbo_article) | SQLite/MySQL (digital_staff/staff_tasks/...) |
| SCSAI | None | Deep integration (SOAP proxy + AML) |
| Frontend | public/ static HTML | Vue3 60+ pages |
| Mini‑Program | None | bossagents-miniapp/ |
| Software Copyright | None | 7 applications in progress |
BossAgents