approval-engine
审批流程引擎 + 异常处理系统 — 规则驱动的多级审批、异常检测、自动恢复策略和 Discord 通知集成
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/cjboy007/ssa-approval-engineapproval-engine Skill
Description
审批流程引擎 + 异常处理系统。提供规则驱动的多级审批、实时异常检测、自动恢复策略(重试/降级/人工介入)和 Discord 通知集成。
When to Use
- 需要对业务操作(报价、订单、权限变更)实施审批控制时
- 需要检测和告警系统/业务异常(超时、错误率升高、订单异常)时
- 需要配置自动恢复策略(API 失败重试、服务降级)时
- 需要通过 Discord 推送审批请求和告警时
Location
<approval-engine-root>/ 或 $APPROVAL_ENGINE_ROOT
Modules
| 模块 | 用途 |
|---|---|
src/approval-engine.js | 核心审批引擎(创建、提交、超时、升级) |
src/rule-evaluator.js | 规则评估(触发条件、阈值、条件匹配) |
src/approval-store.js | 审批状态 CRUD(JSON 持久化) |
src/exception-detector.js | 异常检测(超时/错误/订单异常) |
src/alert-manager.js | 告警发送(Discord、限流、历史) |
src/exception-logger.js | 异常日志(记录、查询、解决标记) |
src/recovery-engine.js | 恢复引擎(策略选择与执行) |
src/retry-handler.js | 重试处理(指数退避、Jitter、统计) |
src/escalation-handler.js | 升级处理(创建、确认、解决升级单) |
src/discord-notifier.js | Discord 通知(消息/Embed/审批/告警) |
src/notification-router.js | 通知路由(规则匹配→渠道选择) |
src/notification-templates.js | 通知模板(审批/告警/升级/恢复) |
Configuration
编辑 config/approval-rules.json 配置:
rules[]— 审批规则列表(触发条件、审批人、超时策略)thresholds— 数值阈值(报价金额上限等)auto_recovery— 自动恢复策略映射escalation_rules— 升级规则(升级时间、升级对象)notification_templates— Discord 消息模板
所需环境变量:
DISCORD_BOT_TOKEN— Discord 机器人令牌DISCORD_APPROVALS_CHANNEL— 审批通知渠道 IDDISCORD_ALERTS_CHANNEL— 告警通知渠道 IDDISCORD_EXCEPTIONS_CHANNEL— 异常通知渠道 IDDISCORD_RECOVERY_CHANNEL— 恢复通知渠道 ID
Invocation
触发审批(自动匹配规则)
const engine = require('<approval-engine-root>/src/approval-engine');
// 或使用环境变量
const engine = require(process.env.APPROVAL_ENGINE_ROOT + '/src/approval-engine');
// 提交业务数据,引擎自动评估规则
const approvals = await engine.autoCreateApprovals({
quotation: { amount: 15000 },
sales: { owner: 'alice' }
});
// 返回:所有被触发规则创建的审批列表
手动创建并提交审批
const engine = require('<approval-engine-root>/src/approval-engine');
// 或使用环境变量
const engine = require(process.env.APPROVAL_ENGINE_ROOT + '/src/approval-engine');
// 创建审批
const approval = await engine.createApproval('quotation-approval', {
quotation: { amount: 15000, no: 'QT-2026-001' }
}, { submitter: 'alice' });
// 审批人决策
await engine.submitApproval(approval.id, 'wilson', 'approved', '金额合理,已审批');
// 查询状态
const status = await engine.getApprovalStatus(approval.id);
异常检测(周期巡检)
const detector = require('<approval-engine-root>/src/exception-detector');
// 或使用环境变量
const detector = require(process.env.APPROVAL_ENGINE_ROOT + '/src/exception-detector');
// 全量检测(返回新发现的异常列表)
const exceptions = await detector.detectAll();
// 定时周期检测(含告警推送 Discord)
await detector.runPeriodicCheck();
自动恢复
const recovery = require('<approval-engine-root>/src/recovery-engine');
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-cjboy007-ssa-approval-engine": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
logistics
物流管理技能,提供提单生成、报关单据生成、物流跟踪等功能。支持 OKKI 客户数据同步和自动化文档处理。
okki-email-sync
Synchronize email activities and quotation events with OKKI CRM as follow-up trail records. Automatically matches emails to CRM customers via domain lookup and vector search, creates trail records (email type=102, quotation type=101), and deduplicates entries. Requires OKKI CRM API access and optional vector search setup. Use when you need to automatically log email communications and quotation events in your CRM.
follow-up-engine
Automated customer follow-up scheduling and execution engine for B2B sales. Generates personalized follow-up email drafts based on customer stage, last contact date, and follow-up strategy. Integrates with CRM systems (configurable) to sync follow-up records. Use when you need to automate outbound sales follow-ups, schedule reminders, or generate follow-up email content for dormant leads.
报价单工作流
自动化生成报价单(Excel/Word/HTML/PDF),集成数据验证防止示例数据,支持 OKKI CRM
auto-evolution
Multi-agent auto-evolution system — orchestrate review-execute-audit loops with 4 roles (Coordinator, Reviewer, Executor, Auditor). A single coordinator agent drives the loop by spawning sub-agents for review, execution, and audit. Break goals into subtasks, auto-iterate with dual quality gates, and auto-package results. Use when: user wants autonomous task execution with built-in quality assurance.