diff --git a/skills/hose-use/SKILL.md b/skills/hose-use/SKILL.md index 30b6b5b..74fb98c 100644 --- a/skills/hose-use/SKILL.md +++ b/skills/hose-use/SKILL.md @@ -1,9 +1,9 @@ --- name: hose-use -description: "v0.8.6: 合思/易快报 (ekuaibao) 企业级 SaaS CLI 与底层 SDK:多账号 API 登录、租户切换、单据检索与审批动作、工作流跨域扫描、内置 HTTP 交互文档与常驻守护进程。" +description: "合思/易快报(Ekuaibao)企业级 SaaS 一站式能力:hose-use CLI/SDK 多账号登录、租户切换、单据检索与审批动作、自建应用与工作流扫描、密钥与应用中心、常驻守护进程与 HTTP 文档/OpenAPI,以及工作流 MVEL 代码节点脚本生成调试、节点批量开通。用于一切合思/易快报相关请求。" metadata: version: 0.8.6 - short-description: 合思/易快报企业级 CLI 工具与底层 SDK (v0.8.6) + short-description: 合思/易快报 企业级 CLI 与工作流 skill 套件(含 MVEL 代码节点) --- # hose-use (v0.8.6) @@ -13,6 +13,18 @@ metadata: --- +## 本套件结构(先看这里) + +本 skill 是**合思/易快报系列的唯一入口**,下级技能不在模型目录中,按需读取: + +| 需要做什么 | 去哪里 | +|---|---| +| 登录/租户/单据/审批/通讯录/档案/费用类型/角色/待办/应用商店/守护进程 | 本文件下方路由表;细节读 `references/*.md` | +| 写或排错**工作流 MVEL 代码节点**脚本 | `multi/ekuaibao-mvel/SKILL.md` | +| **批量开通工作流节点**(从浏览器 curl 提取 token/corpId/baseUrl) | `multi/ekuaibao-nodes/SKILL.md` | + +--- + ## Agent 执行原则 (First Rules) 0. **一键构建上下文(Zero Source-Reading)**:在开始执行任务前,优先执行 `hose-use context --json` 或 `hose-aipro status --json` 一键获取当前账号、企业租户、登录凭证、运行模式与 AI PRO 网关状态。**严禁翻阅源码目录探查配置与企业列表**。 diff --git a/skills/hose-use/multi/ekuaibao-mvel/SKILL.md b/skills/hose-use/multi/ekuaibao-mvel/SKILL.md new file mode 100644 index 0000000..a36ed54 --- /dev/null +++ b/skills/hose-use/multi/ekuaibao-mvel/SKILL.md @@ -0,0 +1,147 @@ +--- +name: ekuaibao-mvel +description: Generate and debug MVEL code-node scripts for 合思/易快报/Ekuaibao workflows. +--- +> 本文件是 **hose-use(合思/易快报套件)** 的下级技能;CLI 命令与其余能力见 `../../SKILL.md`。 + +# 合思 MVEL 代码节点 + +## Core Rule + +Generate code for Ekuaibao's modified MVEL 2.x runtime, not JavaScript, Groovy, or standard Java. First match the syntax style the user has already proven in their tenant or node. + +- If the user provides a working snippet, preserve that dialect. For example, if `a = action_xxx; ... result;` works, use bare assignments and final-expression return. +- If the user has not provided a working snippet, prefer conservative MVEL and be ready to simplify to a probe script. +- Do not use `def` for variables. +- Use `return`, `import`, or `var` only when they match the user's known working environment; otherwise avoid them in favor of final-expression return and fully qualified JDK classes. +- Use Java collection methods: `.get()`, `.put()`, `.add()`, `.size()`. +- For Chinese or dynamic field names, prefer `map.get("字段名")` instead of dot access. +- Every `if`, `&&`, and `||` operand must be a strict boolean expression. Never write `if (data)`. + +## Code Node Template + +Use this style when the user has shown bare assignments and final-expression return work: + +```groovy +a = action_xxxxxx; + +result = new java.util.HashMap(); +result.put("ok", true); +result; +``` + +When the user's environment supports `var/import/return`, it is acceptable to use that style, but do not mix styles unnecessarily within one answer. + +## Tenant-Proven Short Syntax + +This tenant has verified that these short forms work: + +- Map literal: `["key": value]` +- List literal: `[item1, item2]` +- Final-expression return +- Upstream node references use node ID variables such as `action_xxxxxx` + +When the user asks to hard-return a config object, prefer Map/List literals first: + +```groovy +[ + "config": [ + "key": "value", + "list": ["a", "b"] + ] +] +``` + +If Map/List literals fail in a different tenant or node, fall back to `new java.util.HashMap()` and `new java.util.ArrayList()`. + +## Upstream Node Reference + +When the user says the upstream node is referenced by ID, assign the node ID variable to a semantic local name first: + +```groovy +inputData = action_xxxxxx; +``` + +Do not assume the platform provides a built-in variable named `inputData` unless the user explicitly says so. Replace `action_xxxxxx` with the real upstream node ID the user provides. + +## Defensive Patterns + +### Read First Item Only + +When the user says to read only the first upstream record, do not loop. + +```groovy +a = action_xxxxxx; +firstItem = null; + +if (a != null && a.size() > 0) { + firstItem = a.get(0); +} +``` + +### Read Nested Form Field + +```groovy +value = ""; + +if (firstItem != null && firstItem.get("form") != null) { + form = firstItem.get("form"); + rawValue = form.get("E_xxx_字段名"); + + if (rawValue != null && String.valueOf(rawValue).trim() != "") { + value = String.valueOf(rawValue).trim(); + } +} +``` + +### Generate Next 6-Digit Number + +Use this for JS logic like `parseInt(num, 10) || 0` and `.padStart(6, "0")`: + +```groovy +num = ""; +nextStr = "000001"; + +if (rawNum != null && String.valueOf(rawNum).trim() != "") { + num = String.valueOf(rawNum).trim(); +} + +if (num != null && num.trim() != "" && num.trim().matches("[0-9]+")) { + cleanNum = num.trim(); + nextNumber = java.lang.Integer.parseInt(cleanNum) + 1; + rawNextStr = String.valueOf(nextNumber); + + if (rawNextStr.length() < 6) { + padded = "000000" + rawNextStr; + nextStr = padded.substring(padded.length() - 6); + } else { + nextStr = rawNextStr; + } +} +``` + +## Avoid + +- Do not use JavaScript methods: `.push()`, `.length` as a property, `parseInt`, `padStart`. +- Do not use Groovy sugar: `?.`, `?:`. +- Do not use `try/catch` unless the user has already verified it works in their tenant. +- Do not use third-party imports such as Fastjson. +- Do not use `String.valueOf(map)` when downstream needs valid JSON; manually concatenate JSON strings. +- In enhanced loops, write `for (item : list)`, never `for (var item : list)`. + +## Debugging Silent Failures + +If the platform gives no detailed error, simplify toward a probe script: + +```groovy +a = action_xxxxxx; + +result = new java.util.HashMap(); +result.put("isNull", a == null); +result.put("total", a != null ? a.size() : 0); +result; +``` + +Then add one field access at a time. For code nodes nested inside a condition branch, still return a normal object from the code node; only condition expressions themselves must return boolean. + +Treat tenant-specific behavior as evidence, not a universal rule. Say what assumption the code is using when syntax compatibility is uncertain. diff --git a/skills/hose-use/multi/ekuaibao-mvel/agents/openai.yaml b/skills/hose-use/multi/ekuaibao-mvel/agents/openai.yaml new file mode 100644 index 0000000..18c4bf0 --- /dev/null +++ b/skills/hose-use/multi/ekuaibao-mvel/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "合思 MVEL" + short_description: "生成、改写和排查合思 MVEL 代码节点运行兼容问题" + default_prompt: "Use $ekuaibao-mvel to write a 合思 MVEL code-node script." diff --git a/skills/hose-use/multi/ekuaibao-nodes/SKILL.md b/skills/hose-use/multi/ekuaibao-nodes/SKILL.md new file mode 100644 index 0000000..439c487 --- /dev/null +++ b/skills/hose-use/multi/ekuaibao-nodes/SKILL.md @@ -0,0 +1,51 @@ +--- +name: ekuaibao-nodes +description: | + 合思(易快报)工作流节点批量开通工具。 + 当用户提到"合思"、"易快报"、"ekuaibao"、"工作流节点"、"开通节点"时使用。 +--- +> 本文件是 **hose-use(合思/易快报套件)** 的下级技能;CLI 命令与其余能力见 `../../SKILL.md`。 + +# 合思工作流节点开通 + +批量开通合思工作流节点。 + +节点名称与 type 对照见 [灰度节点清单](references/gray-nodes.md)。 **`nodes` 参数填清单中的 `type` 列值(如 `code`、`risk`),不是中文名。** 遇到同名节点或用户只提供模糊名称时,先根据 type 核对并向用户确认。 + +## 参数提取 + +用户通常会贴浏览器请求(curl),从请求中自动提取参数: + +| 参数 | 提取位置 | 说明 | +|------|----------|------| +| token | Header `accesstoken` 或 Cookie `ekb-access-token` | accessToken | +| corpId | Header `corpid` 或 URL query `corpId` | 企业 ID | +| baseUrl | URL 协议+域名部分(非 `app.ekuaibao.com` 时) | 自定义合思地址 | +| nodes | 向用户确认 | 节点名,逗号分隔 | + +**域名判断**:URL 的域名不是 `app.ekuaibao.com` / `*.hosecloud.com` 时即为自定义部署域名,必须提取为 `baseUrl`。 + +## 执行 + +通过 `HOSE_WORKFLOW_NODE_URL` 指定开通服务地址(末尾不要带 `/`): + +```bash +curl -s -X POST "${HOSE_WORKFLOW_NODE_URL:?请先设置 HOSE_WORKFLOW_NODE_URL}/hose-workflow-node" \ + -H 'Content-Type: application/json' \ + -d '{"token":"TOKEN","corpId":"CORPID","nodes":"NODES"}' +``` + +可选参数: +- `baseUrl: "https://..."` — **重要:用户使用了自定义域名时,必须加上此参数。** 不传则默认走正式环境认证地址(`app.ekuaibao.com` 一类)。 +- `isTest: true` — 仅用于切换内部标记,不能替代 `baseUrl` + +> 未设置 `HOSE_WORKFLOW_NODE_URL` 时先向用户确认自建开通服务的地址,不要猜测或回退到他人环境。 + +## 结果处理 + +**成功**:`{"success":true,"data":{"msg":"新开通的节点:xxx"}}` + +**失败排查**: +- `认证失败` + `缺少或传错了 baseUrl` — 检查用户请求是否走自定义域名,加上 `baseUrl` +- `认证失败` + 其他 — token 过期,让用户重新获取 +- 节点名错误 — 核对名称拼写 diff --git a/skills/hose-use/multi/ekuaibao-nodes/references/gray-nodes.md b/skills/hose-use/multi/ekuaibao-nodes/references/gray-nodes.md new file mode 100644 index 0000000..d52dda1 --- /dev/null +++ b/skills/hose-use/multi/ekuaibao-nodes/references/gray-nodes.md @@ -0,0 +1,119 @@ +# 灰度节点清单 + +来源:`合思工作流开通节点_节点开通-节点列表_灰度节点.csv`。共 109 条非空记录,去重后 108 条。 + +开通请求的 `nodes` 使用本表的 **`type` 列值**(第三列),如 `code`、`risk`。第二列"节点名称"仅用于展示和核对。 + +> 注意:`数据映射`有两个可用类型(`mapping`、`dmn`);同名节点需先与用户确认具体类型。`单据查询详情(跨租户)`在源文件中有重复记录,以下仅保留一条。 + +| 显示名称 | 节点名称(nodes) | type | +| --- | --- | --- | +| JS节点(新) | JS节点(新) | `code-js2` | +| 重算审批流 | 重算审批流 | `recalculate-the-approval-flow` | +| 提示框 | 提示框 | `ui-notification` | +| 定时任务节点 | 定时任务节点 | `start` | +| 推送飞书消息 | 推送飞书消息 | `feishu-sendMsg` | +| 飞书消息 | 飞书消息 | `message-feishu` | +| if节点 | if节点 | `if` | +| http节点 | http节点 | `http` | +| 遍历数组 | 遍历数组 | `loop` | +| 循环节点 | 循环节点 | `while` | +| 企业微信开放平台获取子部门ID列表 | 企业微信开放平台获取子部门ID列表 | `wecom-department` | +| 易桥参数转化 | 易桥参数转化 | `eBridge-mapData` | +| 代码节点 | 代码节点 | `code` | +| 数据映射 | 数据映射 | `mapping` | +| 纷享销客鉴权 | 纷享销客鉴权 | `fxiaoke-auth` | +| 纷享销客数据列表 | 纷享销客数据列表 | `fxiaoke-list` | +| NetSuite数据列表 | NetSuite数据列表 | `netsuite-sync` | +| NetSuite数据创建 | NetSuite数据创建 | `netsuite-create` | +| 易桥鉴权 | 易桥鉴权 | `ebridge-auth` | +| 新增业务对象数据 | 新增业务对象数据 | `ekuaibao-datalink-create` | +| 定时触发 | 定时触发 | `clock` | +| 纷享销客触发器 | 纷享销客触发器 | `fxiaoke-trigger` | +| 到达业务对象数据中的日期时触发 | 到达业务对象数据中的日期时触发 | `ekuaibao-datalink-time-trigger` | +| 发送邮件 | 发送邮件 | `email` | +| 查找业务对象数据 | 查找业务对象数据 | `ekuaibao-datalink-filter` | +| 修改业务对象数据 | 修改业务对象数据 | `ekuaibao-datalink-edit` | +| NetSuite数据删除 | NetSuite数据删除 | `netsuite-delete` | +| 薪人薪事触发器 | 薪人薪事触发器 | `xrxs-trigger` | +| 新增业务对象数据时触发 | 新增业务对象数据时触发 | `ekuaibao-datalink-create-trigger` | +| 变更业务对象数据时触发 | 变更业务对象数据时触发 | `ekuaibao-datalink-change-trigger` | +| 单据审批事件触发器 | 单据审批事件触发器 | `ekuaibao-flowform-trigger` | +| 发送短信 | 发送短信 | `message` | +| webhook触发器 | webhook触发器 | `webhook` | +| 对话框 | 对话框 | `ui-dialog` | +| 流程日志 | 流程日志 | `task-log` | +| 动态节点测试 | 动态节点测试 | `task-dynamic-test` | +| 条件节点 | 条件节点 | `condition` | +| OpenAPI | OpenAPI | `task-openapi` | +| 终止节点 | 终止节点 | `stop` | +| 收集节点 | 收集节点 | `context` | +| 到达单据日期时触发 | 到达单据日期时触发 | `flow-change-trigger` | +| 获取钉钉考勤 | 获取钉钉考勤 | `task-dynamic-ding-attendance` | +| 摊销节点 | 摊销节点 | `apportion` | +| 创建单据 | 创建单据 | `flow-create-task` | +| 站内信 | 站内信 | `message-internet` | +| 钉钉消息 | 钉钉消息 | `message-dingtalk` | +| 修改角色 | 修改角色 | `role-update` | +| 依次执行 | 依次执行 | `every` | +| 查询申请事项详情 | 查询申请事项详情 | `ekuaibao-requision-detail` | +| 查询单据详情 | 查询单据详情 | `flow-detail` | +| 查询单据历史详情 | 查询单据历史详情 | `flow-detail-versioned` | +| 业务对象数据按钮触发 | 业务对象数据按钮触发 | `datalink-button-trigger` | +| 查找行程数据 | 查找行程数据 | `ekuaibao-tmc-datalink-filter` | +| 新增行程数据时触发 | 新增行程数据时触发 | `ekuaibao-tmc-datalink-create-trigger` | +| 变更行程数据时触发 | 变更行程数据时触发 | `ekuaibao-tmc-datalink-change-trigger` | +| 到达行程日期时触发 | 到达行程日期时触发 | `ekuaibao-tmc-datalink-time-trigger` | +| 查询发票 | 查询发票 | `ekuaibao-invoice-datalink-filter` | +| 结果输出 | 结果输出 | `output` | +| EBOT触发 | EBOT触发 | `ekuaibao-ebot-trigger` | +| 补充发票触发 | 补充发票触发 | `other-event-trigger` | +| 发票验真 | 发票验真 | `invoice-verification` | +| JS节点 | JS节点 | `code-js` | +| 数据转化 | 数据转化 | `data-convert` | +| 新摊销 | 新摊销 | `amortization` | +| 数据映射 | 数据映射 | `dmn` | +| 查询人员 | 查询人员 | `ekuaibao-staff-filter` | +| 查询单据列表 | 查询单据列表 | `flow-list` | +| HAB触发器 | HAB触发器 | `hab-trigger-task` | +| 申请事项触发器 | 申请事项触发器 | `ekuaibao-requisition-trigger` | +| 创建部门 | 创建部门 | `department-create` | +| 部门查询 | 部门查询 | `department-filter` | +| 新增人员 | 新增人员 | `staff-create` | +| 查询随手记列表 | 查询随手记列表 | `ekuaibao-ecard-fee-filter` | +| 查询人员详情 | 查询人员详情 | `ekuaibao-staff-detail` | +| 查询部门详情 | 查询部门详情 | `ekuaibao-department-detail` | +| 查询易商卡申请事项列表 | 查询易商卡申请事项列表 | `ekuaibao-ecard-requisition-filter` | +| 查询飞书部门 | 查询飞书部门 | `feishu-department-filter` | +| 修改部门 | 修改部门 | `ekuaibao-department-update` | +| 站外信 | 站外信 | `message-outnet` | +| AI节点 | AI节点 | `ekb-ai` | +| 修改单据 | 修改单据 | `flow-update-task` | +| 提取文本(word,PDF) | 提取文本(word,PDF) | `ekb-ai-pdf` | +| 单据风险写入 | 单据风险写入 | `risk` | +| 天润工单查询 | 天润工单查询 | `tr-select` | +| 天润工单评论 | 天润工单评论 | `tr-comment` | +| 天润工单查询详情 | 天润工单查询详情 | `tr-detail` | +| Dify接入 | Dify接入 | `dify` | +| 图片URL识别 | 图片URL识别 | `ekb-ai-url` | +| AI文本理解 | AI文本理解 | `ekb-minimax-text` | +| AI图像理解 | AI图像理解 | `ekb-minimax-photo` | +| 查询角色下的人员 | 查询角色下的人员 | `search-staff-by-role` | +| 发票巡检 | 发票巡检 | `ekuaibao-invoice-inspector` | +| 招商银行商务卡查询 | 招商银行商务卡查询 | `task-zs` | +| 单据查询详情(跨租户) | 单据查询详情(跨租户) | `escape` | +| 海亮单据查询详情 | 海亮单据查询详情 | `hl-detail` | +| 单据查询详情AI审批专用 | 单据查询详情AI审批专用 | `mapping-detail` | +| 海亮数据集列表 | 海亮数据集列表 | `hl` | +| 查询易商卡流水的费用信息 | 查询易商卡流水的费用信息 | `ekuaibao-ecard-fee-detail-filter` | +| Ebot审批 | Ebot审批 | `ebot-approval-flow` | +| 给OA账号发送提醒 | 给OA账号发送提醒 | `oa` | +| 查询历史单据测试集 | 查询历史单据测试集 | `flow-sample-list` | +| 分类汇总 | 分类汇总 | `aggregation` | +| 单据转译节点 | 单据转译节点 | `flow-format` | +| 导出表格 | 导出表格 | `excel` | +| AI附件理解 | AI附件理解 | `ai-attachment` | +| AI智能匹配 | AI智能匹配 | `ai-classification` | +| AI智能提取 | AI智能提取 | `ai-extraction` | +| 延迟执行节点 | 延迟执行节点 | `task-dynamic-delay` | + diff --git a/src/core/embedded-skill.test.ts b/src/core/embedded-skill.test.ts index 008aef5..4193dec 100644 --- a/src/core/embedded-skill.test.ts +++ b/src/core/embedded-skill.test.ts @@ -40,6 +40,13 @@ describe("embedded-skill - 多文件内嵌 Skill 体系", () => { expect(EMBEDDED_SKILL_FILES["references/store.md"]).toContain("hose-use keys"); expect(EMBEDDED_SKILL_FILES["SKILL.md"]).toContain("--reveal -o "); expect(EMBEDDED_SKILL_FILES["SKILL.md"]).toContain("references/store.md"); + + // 套件结构:根入口路由到 multi/ 下的子技能 + expect(EMBEDDED_SKILL_FILES["SKILL.md"]).toContain("multi/ekuaibao-mvel/SKILL.md"); + expect(EMBEDDED_SKILL_FILES["multi/ekuaibao-mvel/SKILL.md"]).toContain("name: ekuaibao-mvel"); + expect(EMBEDDED_SKILL_FILES["multi/ekuaibao-mvel/agents/openai.yaml"]).toContain("ekuaibao-mvel"); + expect(EMBEDDED_SKILL_FILES["multi/ekuaibao-nodes/SKILL.md"]).toContain("name: ekuaibao-nodes"); + expect(EMBEDDED_SKILL_FILES["multi/ekuaibao-nodes/references/gray-nodes.md"]).toContain("灰度节点清单"); }); test("installSkillFiles 递归保留层级结构并落盘到目标目录", () => { @@ -47,7 +54,7 @@ describe("embedded-skill - 多文件内嵌 Skill 体系", () => { try { const res = installSkillFiles(tmp); expect(res.targetDir).toBe(tmp); - expect(res.files.length).toBe(14); + expect(res.files.length).toBe(18); expect(existsSync(join(tmp, "SKILL.md"))).toBe(true); expect(existsSync(join(tmp, "agents", "openai.yaml"))).toBe(true); expect(existsSync(join(tmp, "references", "auth.md"))).toBe(true); @@ -59,6 +66,8 @@ describe("embedded-skill - 多文件内嵌 Skill 体系", () => { expect(existsSync(join(tmp, "references", "workflow.md"))).toBe(true); expect(existsSync(join(tmp, "references", "service.md"))).toBe(true); expect(existsSync(join(tmp, "references", "store.md"))).toBe(true); + expect(existsSync(join(tmp, "multi", "ekuaibao-mvel", "SKILL.md"))).toBe(true); + expect(existsSync(join(tmp, "multi", "ekuaibao-nodes", "references", "gray-nodes.md"))).toBe(true); } finally { rmSync(tmp, { recursive: true, force: true }); } diff --git a/src/core/embedded-skill.ts b/src/core/embedded-skill.ts index 86cd95e..a60cf5e 100644 --- a/src/core/embedded-skill.ts +++ b/src/core/embedded-skill.ts @@ -16,6 +16,10 @@ import refRole from "../../skills/hose-use/references/role.md" with { type: "tex import refApproval from "../../skills/hose-use/references/approval.md" with { type: "text" }; import refFeeType from "../../skills/hose-use/references/feetype.md" with { type: "text" }; import refStore from "../../skills/hose-use/references/store.md" with { type: "text" }; +import multiMvel from "../../skills/hose-use/multi/ekuaibao-mvel/SKILL.md" with { type: "text" }; +import multiMvelAgent from "../../skills/hose-use/multi/ekuaibao-mvel/agents/openai.yaml" with { type: "text" }; +import multiNodes from "../../skills/hose-use/multi/ekuaibao-nodes/SKILL.md" with { type: "text" }; +import multiNodesGray from "../../skills/hose-use/multi/ekuaibao-nodes/references/gray-nodes.md" with { type: "text" }; export const EMBEDDED_SKILL_FILES: Record = { "SKILL.md": skillMain, @@ -32,6 +36,10 @@ export const EMBEDDED_SKILL_FILES: Record = { "references/workflow.md": refWorkflow, "references/service.md": refService, "references/store.md": refStore, + "multi/ekuaibao-mvel/SKILL.md": multiMvel, + "multi/ekuaibao-mvel/agents/openai.yaml": multiMvelAgent, + "multi/ekuaibao-nodes/SKILL.md": multiNodes, + "multi/ekuaibao-nodes/references/gray-nodes.md": multiNodesGray, }; export function getSkillContent(): string {