SuperAPI AI 工具集

blueprint-builder

智能体与模型

查看项目

更新于 10-16 06:15

技能介绍

用途:创建与维护 Sorcha 蓝图 JSON 模板及工作流定义。蓝图以 JSON 文档描述多参与方工作流,由参与方、动作(含数据模式)和决定动作流向的路由组成;模板在蓝图外再包一层,支持参数化复用。

主要能力:定义参与方(至少 2 个,动作的 sender 需引用有效参与方 id);定义动作(id 从 0 顺序编号,需有一个 isStartingAction: true);定义路由(nextActionIds 为空表示流程结束,支持默认路由、JSON Logic 条件路由、并行分支与 branchDeadline);用 JSON Schema 描述动作载荷;用 JSON Logic 做条件路由与计算值;检测循环并给出警告而非错误,循环蓝图发布时设 metadata.hasCycles = "true"。模板分固定模板(parameterSchema 为 null,template 直接放原始蓝图 JSON)与参数化模板(使用 JSON-e 的 $eval、$if、$flattenDeep,需 parameterSchema、defaultParameters 和 examples)。

使用方式:蓝图发布流程为 POST /api/blueprints/ 创建草稿,POST /api/blueprints/{id}/publish 发布(校验并返回循环警告),POST /api/instances/ 创建实例并映射参与方钱包。动作执行调用 POST /api/instances/{id}/actions/{actionId}/execute,需 Authorization: Bearer <token> 与 X-Delegation-Token 头,请求体含 blueprintId、actionId、instanceId、senderWallet、registerAddress、payloadData。引擎流水线为 validate(模式校验)→ calculate(JSON Logic)→ route(确定下一步)→ disclose(可见性规则)。新蓝图应使用基于路由的路由,其优先于旧的基于条件的路由。

适用场景:审批链、Ping-Pong 循环、条件分支等流程;相关文件位于 examples/templates/*.json、src/Common/Sorcha.Blueprint.Models/、src/Core/Sorcha.Blueprint.Engine/、src/Core/Sorcha.Blueprint.Fluent/、src/Services/Sorcha.Blueprint.Service/ 等。

限制:校验要求至少 1 个动作、至少 2 个参与方、描述至少 5 字符、标题至少 3 字符;循环会产生警告而非错误。其余收费、平台与效果信息暂未提供。