weaver-work-cli 0.1.8 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/README.md +25 -17
  2. package/dist/cmd/action.js +76 -0
  3. package/dist/cmd/index.js +2 -0
  4. package/dist/cmd/refs/index.js +103 -0
  5. package/dist/cmd/register.js +31 -0
  6. package/dist/cmd/root.js +1 -0
  7. package/dist/cmd/setup/index.js +25 -5
  8. package/dist/cmd/skills/index.js +37 -5
  9. package/dist/core/connector.js +54 -0
  10. package/dist/core/context.js +2 -1
  11. package/dist/core/input.js +48 -0
  12. package/dist/core/output.js +298 -3
  13. package/dist/core/refs.js +435 -0
  14. package/dist/core/state.js +26 -0
  15. package/dist/internal/e10/auth/commands.js +34 -19
  16. package/dist/internal/e10/auth/session.js +74 -2
  17. package/dist/internal/e10/auth/xiaoe.js +359 -94
  18. package/dist/internal/e10/context.js +18 -6
  19. package/dist/internal/e10/request-runtime.js +8 -1
  20. package/dist/internal/skills/install.js +148 -28
  21. package/dist/internal/skills/reader.js +12 -9
  22. package/dist/shortcuts/blog/continuation.js +74 -0
  23. package/dist/shortcuts/blog/errors.js +60 -0
  24. package/dist/shortcuts/blog/host.js +175 -0
  25. package/dist/shortcuts/blog/index.js +324 -0
  26. package/dist/shortcuts/blog/manifest.js +415 -0
  27. package/dist/shortcuts/blog/operations/comment.js +125 -0
  28. package/dist/shortcuts/blog/operations/comments.js +31 -0
  29. package/dist/shortcuts/blog/operations/edit.js +131 -0
  30. package/dist/shortcuts/blog/operations/export.js +46 -0
  31. package/dist/shortcuts/blog/operations/like.js +80 -0
  32. package/dist/shortcuts/blog/operations/publish.js +157 -0
  33. package/dist/shortcuts/blog/operations/query-user.js +58 -0
  34. package/dist/shortcuts/blog/operations/query.js +96 -0
  35. package/dist/shortcuts/blog/operations/registry.js +54 -0
  36. package/dist/shortcuts/blog/operations/remind.js +176 -0
  37. package/dist/shortcuts/blog/operations/shared.js +330 -0
  38. package/dist/shortcuts/blog/operations/types.js +16 -0
  39. package/dist/shortcuts/blog/operations.js +9 -0
  40. package/dist/shortcuts/caizhilian/continuation.js +70 -0
  41. package/dist/shortcuts/caizhilian/errors.js +53 -0
  42. package/dist/shortcuts/caizhilian/host.js +190 -0
  43. package/dist/shortcuts/caizhilian/index.js +186 -0
  44. package/dist/shortcuts/caizhilian/manifest.js +42 -0
  45. package/dist/shortcuts/caizhilian/operations/api.js +801 -0
  46. package/dist/shortcuts/caizhilian/operations/confirm.js +75 -0
  47. package/dist/shortcuts/caizhilian/operations/files.js +306 -0
  48. package/dist/shortcuts/caizhilian/operations/form.js +170 -0
  49. package/dist/shortcuts/caizhilian/operations/handlers/collab.js +611 -0
  50. package/dist/shortcuts/caizhilian/operations/handlers/document.js +890 -0
  51. package/dist/shortcuts/caizhilian/operations/handlers/file-collection.js +1227 -0
  52. package/dist/shortcuts/caizhilian/operations/handlers/file-upload.js +192 -0
  53. package/dist/shortcuts/caizhilian/operations/handlers/fileops.js +570 -0
  54. package/dist/shortcuts/caizhilian/operations/handlers/folder.js +1024 -0
  55. package/dist/shortcuts/caizhilian/operations/handlers/search.js +318 -0
  56. package/dist/shortcuts/caizhilian/operations/handlers/setting-attach.js +294 -0
  57. package/dist/shortcuts/caizhilian/operations/handlers/setting-backup.js +423 -0
  58. package/dist/shortcuts/caizhilian/operations/handlers/setting-encrypt.js +238 -0
  59. package/dist/shortcuts/caizhilian/operations/handlers/setting-storage.js +364 -0
  60. package/dist/shortcuts/caizhilian/operations/handlers/system.js +106 -0
  61. package/dist/shortcuts/caizhilian/operations/registry.js +151 -0
  62. package/dist/shortcuts/caizhilian/operations/shared.js +408 -0
  63. package/dist/shortcuts/caizhilian/operations/specs.js +698 -0
  64. package/dist/shortcuts/caizhilian/operations/types.js +57 -0
  65. package/dist/shortcuts/caizhilian/operations.js +21 -0
  66. package/dist/shortcuts/contract/continuation.js +70 -0
  67. package/dist/shortcuts/contract/errors.js +62 -0
  68. package/dist/shortcuts/contract/host.js +205 -0
  69. package/dist/shortcuts/contract/index.js +318 -0
  70. package/dist/shortcuts/contract/manifest.js +596 -0
  71. package/dist/shortcuts/contract/operations/clause-reference.js +78 -0
  72. package/dist/shortcuts/contract/operations/form-info.js +371 -0
  73. package/dist/shortcuts/contract/operations/read.js +118 -0
  74. package/dist/shortcuts/contract/operations/registry.js +43 -0
  75. package/dist/shortcuts/contract/operations/request.js +300 -0
  76. package/dist/shortcuts/contract/operations/shared.js +133 -0
  77. package/dist/shortcuts/contract/operations/subject.js +157 -0
  78. package/dist/shortcuts/contract/operations/template.js +81 -0
  79. package/dist/shortcuts/contract/operations/types.js +7 -0
  80. package/dist/shortcuts/contract/operations/workflow.js +52 -0
  81. package/dist/shortcuts/contract/operations/write.js +131 -0
  82. package/dist/shortcuts/contract/operations.js +8 -0
  83. package/dist/shortcuts/hrm/index.js +83 -2
  84. package/dist/shortcuts/hrm/manifest.js +16 -9
  85. package/dist/shortcuts/hrm/operations/employee.js +160 -30
  86. package/dist/shortcuts/hrm/operations/org.js +17 -3
  87. package/dist/shortcuts/hrm/operations/position.js +18 -2
  88. package/dist/shortcuts/hrm/operations/registry.js +2 -0
  89. package/dist/shortcuts/hrm/operations/resolve.js +449 -0
  90. package/dist/shortcuts/index.js +5 -1
  91. package/dist/shortcuts/invoice/index.js +74 -36
  92. package/dist/shortcuts/invoice/manifest.js +674 -4
  93. package/dist/shortcuts/invoice/markdown.js +172 -0
  94. package/dist/shortcuts/invoice/operations/add.js +3 -3
  95. package/dist/shortcuts/invoice/operations/delete.js +2 -2
  96. package/dist/shortcuts/invoice/operations/get.js +10 -2
  97. package/dist/shortcuts/invoice/operations/import.js +2 -2
  98. package/dist/shortcuts/invoice/operations/registry.js +8 -1
  99. package/dist/shortcuts/invoice/operations/reim-auto.js +719 -0
  100. package/dist/shortcuts/invoice/operations/reim.js +85 -2
  101. package/dist/shortcuts/invoice/operations/shared.js +75 -8
  102. package/dist/shortcuts/invoice/operations/update.js +2 -2
  103. package/dist/shortcuts/invoice/operations/upload-and-validate.js +93 -0
  104. package/dist/shortcuts/invoice/operations/validate-preview.js +2 -1
  105. package/dist/shortcuts/invoice/projection.js +328 -0
  106. package/dist/shortcuts/meeting/host.js +18 -1
  107. package/dist/shortcuts/meeting/manifest.js +30 -18
  108. package/dist/shortcuts/meeting/operations/eb/catalog.js +390 -0
  109. package/dist/shortcuts/meeting/operations/eb/conflict.js +389 -0
  110. package/dist/shortcuts/meeting/operations/eb/factory.js +389 -0
  111. package/dist/shortcuts/meeting/operations/eb/index.js +22 -0
  112. package/dist/shortcuts/meeting/operations/env.js +8 -1
  113. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  114. package/dist/shortcuts/meeting/operations/signs.js +216 -2
  115. package/dist/shortcuts/workflow/endpoints.js +2 -1
  116. package/dist/shortcuts/workflow/errors.js +8 -2
  117. package/dist/shortcuts/workflow/host.js +11 -4
  118. package/dist/shortcuts/workflow/operations/form.js +1016 -590
  119. package/dist/shortcuts/workflow/operations/read.js +913 -231
  120. package/dist/shortcuts/workflow/operations/shared.js +21 -0
  121. package/dist/shortcuts/workflow/operations/write.js +750 -52
  122. package/dist/shortcuts/workflow/operations.js +36 -10
  123. package/docs/_catalog.md +6 -0
  124. package/docs/agent-invoice.md +5 -1
  125. package/docs/agent-io-channel-design.md +468 -0
  126. package/docs/agent-skill-install.md +9 -4
  127. package/docs/blog.md +123 -0
  128. package/docs/caizhilian.md +304 -0
  129. package/docs/contract.md +91 -0
  130. package/docs/e10-auth.md +4 -2
  131. package/docs/hrm.md +53 -11
  132. package/docs/invoice.md +5 -1
  133. package/docs/meeting.md +1 -1
  134. package/docs/operation-manual.md +15 -3
  135. package/docs/skill-review-2026-09-19.md +2 -2
  136. package/package.json +1 -1
  137. package/scripts/package-skill.mjs +32 -20
  138. package/scripts/xiaoe_env.py +118 -0
  139. package/skill-template/business-info.json +113 -14
  140. package/skill-template/domains/blog.md +24 -0
  141. package/skill-template/domains/caizhilian.md +22 -0
  142. package/skill-template/domains/hrm.md +2 -1
  143. package/skill-template/domains/jinchengda.md +23 -0
  144. package/skill-template/domains/meeting.md +1 -1
  145. package/skill-template/domains/workflow.md +1 -1
  146. package/skill-template/skill-template.md +1 -1
  147. package/skills/weaver-e10-blog/SKILL.md +111 -0
  148. package/skills/weaver-e10-blog/references/blog-comment.md +51 -0
  149. package/skills/weaver-e10-blog/references/blog-comments.md +39 -0
  150. package/skills/weaver-e10-blog/references/blog-default-permission.md +38 -0
  151. package/skills/weaver-e10-blog/references/blog-disabled-capabilities.md +11 -0
  152. package/skills/weaver-e10-blog/references/blog-edit.md +51 -0
  153. package/skills/weaver-e10-blog/references/blog-export.md +42 -0
  154. package/skills/weaver-e10-blog/references/blog-like.md +50 -0
  155. package/skills/weaver-e10-blog/references/blog-publish.md +52 -0
  156. package/skills/weaver-e10-blog/references/blog-query-user.md +45 -0
  157. package/skills/weaver-e10-blog/references/blog-query.md +49 -0
  158. package/skills/weaver-e10-blog/references/blog-remind.md +51 -0
  159. package/skills/weaver-e10-blog/references/blog-resolve-users.md +38 -0
  160. package/skills/weaver-e10-blog/references/source-manifest.json +1540 -0
  161. package/skills/weaver-e10-caizhilian/SKILL.md +217 -0
  162. package/skills/weaver-e10-caizhilian/references/agent-entry.md +106 -0
  163. package/skills/weaver-e10-caizhilian/references/collaboration.md +112 -0
  164. package/skills/weaver-e10-caizhilian/references/document.md +111 -0
  165. package/skills/weaver-e10-caizhilian/references/file-collection.md +173 -0
  166. package/skills/weaver-e10-caizhilian/references/file-upload.md +309 -0
  167. package/skills/weaver-e10-caizhilian/references/files.md +120 -0
  168. package/skills/weaver-e10-caizhilian/references/folder.md +122 -0
  169. package/skills/weaver-e10-caizhilian/references/org-browser.md +104 -0
  170. package/skills/weaver-e10-caizhilian/references/setting-attach.md +440 -0
  171. package/skills/weaver-e10-caizhilian/references/setting-backup.md +372 -0
  172. package/skills/weaver-e10-caizhilian/references/setting-encrypt.md +399 -0
  173. package/skills/weaver-e10-caizhilian/references/setting-storage.md +603 -0
  174. package/skills/weaver-e10-caizhilian/references/source-manifest.json +5694 -0
  175. package/skills/weaver-e10-caizhilian/references/withheld.md +93 -0
  176. package/skills/weaver-e10-caizhilian/references/write-protocol.md +120 -0
  177. package/skills/weaver-e10-calendar/SKILL.md +4 -3
  178. package/skills/weaver-e10-ebuilder-form/SKILL.md +4 -9
  179. package/skills/weaver-e10-ebuilder-form/references/context-routing.md +0 -9
  180. package/skills/weaver-e10-ebuilder-form/references/custom-api.md +1 -5
  181. package/skills/weaver-e10-ebuilder-form/references/fields-browser.md +1 -5
  182. package/skills/weaver-e10-ebuilder-form/references/list-nlist.md +1 -5
  183. package/skills/weaver-e10-ebuilder-form/references/openapi-read.md +1 -5
  184. package/skills/weaver-e10-ebuilder-form/references/openapi-write.md +1 -5
  185. package/skills/weaver-e10-esb/SKILL.md +2 -2
  186. package/skills/weaver-e10-esb/references/source-manifest.json +9 -9
  187. package/skills/weaver-e10-hrm/SKILL.md +104 -9
  188. package/skills/weaver-e10-hrm/references/employee.md +89 -15
  189. package/skills/weaver-e10-hrm/references/org.md +114 -5
  190. package/skills/weaver-e10-hrm/references/position.md +14 -7
  191. package/skills/weaver-e10-hrm/references/source-manifest.json +1 -1
  192. package/skills/weaver-e10-jinchengda/SKILL.md +167 -0
  193. package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +82 -0
  194. package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +69 -0
  195. package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +78 -0
  196. package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +27 -0
  197. package/skills/weaver-e10-jinchengda/references/contract-request-status.md +71 -0
  198. package/skills/weaver-e10-jinchengda/references/contract-request-write.md +94 -0
  199. package/skills/weaver-e10-jinchengda/references/contract-signing-subjects.md +89 -0
  200. package/skills/weaver-e10-jinchengda/references/contract-subject-create.md +77 -0
  201. package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +66 -0
  202. package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +94 -0
  203. package/skills/weaver-e10-jinchengda/references/source-manifest.json +259 -0
  204. package/skills/weaver-e10-jiuchuanhui/SKILL.md +5 -11
  205. package/skills/weaver-e10-jucailin/SKILL.md +4 -3
  206. package/skills/weaver-e10-mail/SKILL.md +4 -11
  207. package/skills/weaver-e10-meeting/SKILL.md +66 -32
  208. package/skills/weaver-e10-meeting/references/meeting-change.md +5 -2
  209. package/skills/weaver-e10-meeting/references/meeting-create.md +2 -1
  210. package/skills/weaver-e10-meeting/references/meeting-eb.md +114 -0
  211. package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +9 -8
  212. package/skills/weaver-e10-meeting/references/meeting-receipts-signs.md +35 -7
  213. package/skills/weaver-e10-meeting/references/meeting-update.md +1 -1
  214. package/skills/weaver-e10-okr/SKILL.md +6 -11
  215. package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
  216. package/skills/weaver-e10-plan/SKILL.md +3 -3
  217. package/skills/weaver-e10-plan/references/plan-collect-and-compose.md +1 -1
  218. package/skills/weaver-e10-plan/references/plan-overview-and-routing.md +1 -1
  219. package/skills/weaver-e10-plan/references/source-manifest.json +13 -13
  220. package/skills/weaver-e10-qiyecheng/SKILL.md +4 -10
  221. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +9 -9
  222. package/skills/weaver-e10-shared/SKILL.md +42 -34
  223. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +16 -43
  224. package/skills/weaver-e10-shared/references/json-output-contract.md +20 -11
  225. package/skills/weaver-e10-shared/references/non-interactive-environment.md +21 -14
  226. package/skills/weaver-e10-shijingran/SKILL.md +2 -1
  227. package/skills/weaver-e10-shijingran/references/source-manifest.json +9 -9
  228. package/skills/weaver-e10-skill-maker/SKILL.md +4 -10
  229. package/skills/weaver-e10-skill-maker/references/business-skill-generation.md +5 -3
  230. package/skills/weaver-e10-skill-maker/references/module-cli-generation.md +12 -27
  231. package/skills/weaver-e10-skill-maker/references/module-gap-audit-and-repair.md +17 -5
  232. package/skills/weaver-e10-skill-maker/references/source-update-detection.md +4 -27
  233. package/skills/weaver-e10-skill-maker/references/weaver-skill-style.md +1 -1
  234. package/skills/weaver-e10-wenshuding/SKILL.md +5 -16
  235. package/skills/weaver-e10-wenshuding/references/source-manifest.json +7 -7
  236. package/skills/weaver-e10-workflow/SKILL.md +41 -46
  237. package/skills/weaver-e10-workflow/references/source-manifest.json +39 -75
  238. package/skills/weaver-e10-workflow/references/workflow-batch.md +90 -29
  239. package/skills/weaver-e10-workflow/references/workflow-create.md +83 -109
  240. package/skills/weaver-e10-workflow/references/workflow-memory.md +19 -9
  241. package/skills/weaver-e10-workflow/references/workflow-operate.md +2 -2
  242. package/skills/weaver-e10-workflow/references/workflow-query.md +40 -27
  243. package/skills/weaver-e10-workflow/references/workflow-share.md +18 -2
  244. package/skills/weaver-e10-workflow/references/workflow-view.md +3 -4
  245. package/skills/weaver-e10-yepiaotong/SKILL.md +74 -39
  246. package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +22 -1
  247. package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +3 -1
  248. package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +135 -0
  249. package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +15 -3
  250. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +1 -1
  251. package/skills/weaver-e10-yepiaotong/references/invoice-summarize.py +217 -0
  252. package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +88 -0
  253. package/skills/weaver-e10-yepiaotong/references/invoice-validation-preview.md +7 -2
  254. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +89 -9
  255. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +1 -0
  256. package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +70 -49
  257. package/skills/weaver-e10-yepiaotong/references/reim-fast-path.md +119 -0
  258. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +55 -36
  259. package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +4 -0
  260. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +149 -0
  261. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +125 -5
  262. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +430 -63
  263. package/skills/weaver-e10-yimiaoban/SKILL.md +4 -12
  264. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
  265. package/skills/weaver-e10-ziguanjia/SKILL.md +2 -1
  266. package/skills/weaver-e10-ziguanjia/references/ziguanjia-agent-entry.md +3 -3
  267. package/tools/weaver-skill-detector-1.0.13/SKILL.md +9 -9
  268. package/tools/weaver-skill-detector-1.0.13/references/checklist.md +3 -3
  269. package/tools/weaver-skill-detector-1.0.13/scripts/__pycache__/validate_skill.cpython-313.pyc +0 -0
  270. package/tools/weaver-skill-detector-1.0.13/scripts/validate_skill.py +98 -91
  271. package/scripts/sync-connector-skills.mjs +0 -172
package/docs/hrm.md CHANGED
@@ -17,7 +17,8 @@ weaver-work-cli --json hrm run <operation> --input -
17
17
  | `src/shortcuts/hrm/index.ts` | 命令注册与 JSON envelope |
18
18
  | `src/shortcuts/hrm/manifest.ts` | `schema` 契约与禁用边界声明 |
19
19
  | `src/shortcuts/hrm/host.ts` | E10 会话桥接、HRM 页面上下文 Referer、JSON 请求、响应归一化 |
20
- | `src/shortcuts/hrm/operations/` | 按业务域拆分的 operation 实现(employee / org / position) |
20
+ | `src/shortcuts/hrm/operations/` | 按业务域拆分的 operation 实现(employee / org / position / resolve) |
21
+ | `src/shortcuts/hrm/operations/resolve.ts` | 多维(虚拟组织维度)解析:取全量多维 → 名称精确/模糊匹配 → 带 `companyId` 查部门/分部 → 回候选 |
21
22
  | `src/shortcuts/hrm/operations/registry.ts` | operation 注册表与去重校验 |
22
23
 
23
24
  ## 认证
@@ -34,22 +35,62 @@ HRM 接口必须携带页面上下文 `Referer`(默认 `<baseUrl>/hrm/main`)
34
35
 
35
36
  **响应成功判定**:统一 `code=200`。`403`(接口开关未开启)抛 `api/permission_denied`,其余业务失败抛 `api/business_error`。
36
37
 
37
- **数据行位置**:
38
+ **数据行位置(下表描述的是上游原始响应,不是 CLI 输出)**:
38
39
 
39
- | 接口类型 | 行字段 | 总数 |
40
+ | 接口类型 | 行字段 | CLI `data.total` 的来源 |
40
41
  | --- | --- | --- |
41
- | 员工浏览 `employee.query` | `data.data` | `count/resource` 的 `data.total`(`data/resource` 的 `data.count` 恒为 0) |
42
- | 下属查询 `subordinate.mine` | `data.data` | `count/resource` 的 `data.total` |
43
- | 组织浏览 `org.query` | `data.data` | `data.total` |
44
- | 岗位浏览 `position.query` | `data.data` | `data.total` |
45
- | 岗位批量 `position.list` | `data.data` | `data.total` |
42
+ | 员工浏览 `employee.query` | `data.data` | 本页行数(**不调 count 接口**,上游 `data.count` 恒为 0) |
43
+ | 下属查询 `subordinate.mine` | `data.data` | 本页行数 |
44
+ | 组织浏览 `org.query` | `data.data` | 上游 `data.total` |
45
+ | 岗位浏览 `position.query` | `data.data` | 上游 `data.total` |
46
+ | 岗位批量 `position.list` | `data.data` | 上游 `data.total`(自动翻页累加) |
46
47
  | 批量人员 `employee.batch` | `data.userList` | 行数 |
47
- | 下属按 id `subordinate.by-id` | `data.page.result` | `data.page.totalCount` |
48
+ | 下属按 id `subordinate.by-id` | `data.page.result` | 上游 `data.page.totalCount`(**真实总数**,另附 `data.page.hasNext/totalPages`) |
48
49
 
49
- **详情接口**(`employee.detail`/`org.detail`/`position.detail`)返回单对象,CLI 附 `link`。
50
+ CLI 已把上表差异归一化:**列表类统一输出 envelope 的 `data.rows` + `data.total`,分页参数在 `meta`(current/pageSize)**;不要把上游的 `data.data` / `data.page.result` 当作 CLI 输出路径。⚠️ 注意 `employee.query`/`subordinate.mine`/`dept.members` 的 `data.total` 是**本页行数**(想要真实总数只能按 `current` 翻页到 `rows.length < pageSize`),而 `org.query`/`position.*`/`subordinate.by-id` 的 total 才是上游真值。
51
+
52
+ **详情接口**(`employee.detail`/`org.detail`/`position.detail`)返回单对象:上游 `WeaForm` 的业务字段位于其 `data.data`,CLI 会**展平上移一层**,因此 CLI 输出中业务字段**直接挂在 envelope 的 `data` 下,没有 `data.data` 嵌套**(`items`/`groups`/`layout` 等前端表单元数据已丢弃),并附 `link`。其中 `org.detail`/`position.detail` **只透出显式投影后的少量字段**:`org.detail` → `id/name/type/code/fullPath/status/parentName?/subcompanyName?/description?/remark?/link`(**不含 `employee_count`**);`position.detail` → `id/name/code/parentName?/jobsetName?/jobsetTypeName?/grade?/link`(**不含 `fullName`/`department`**)。这两个接口都没有 `full` 开关。
53
+
54
+ **`employee.detail` 默认投影**:完整卡片有 85 个顶层键(~5.3KB),其中大部分是登录/管理元数据(`password`/`last_android`/`hideFieldList`/`setting`/各 `*_admin`…)。默认只回 `DETAIL_CORE_FIELDS` 白名单的 26 个键(~1.2KB):实体数组字段(`department`/`subcompany`/`position`/`personnel_status`/`jobsetid`/`jobset_level`/`location`)只留 `{id, name}`,人员数组字段(`superior`/`other_superior`/`assistant`)只留 `{id, name, statusCode, avatar}`,`avatar` 只留 1 个 `url`。需要完整卡片时传 `full: true`(该开关只影响 `employee.detail`;`org.detail`/`position.detail` 没有该开关,且它们已只透出上面列出的显式投影字段)。
55
+
56
+ **「人员列表」默认投影**:`subordinate.mine` / `dept.members`(`formatMember` 行 366B)与 `subordinate.by-id`(原始行 960B,其中上游 `superior` 对象一项就占 485B)默认都走 `formatPersonBrief`——每行只回 `{id, name, link}`(~116~120B/行)。需要部门/岗位/电话/上级等列时传 `full: true`(`subordinate.mine`/`dept.members` 回 `formatMember` 行,`subordinate.by-id` 回 `formatSubordinateFull` 行)。
57
+
58
+ **`employee.query` 默认投影**:默认走 `formatQueryRowBrief`——每行只回**人员信息** 6 键 `{id, name, department, position, statusCode, link}`(368B → 186B,省 49%)。裁掉的是:另两套 id(`userid` 登录信息 id / `cid` IM 联系人 id)、本接口恒为空串的 `mobile`、以及 `departmentId` + `deptLink`。传 `full: true` 回原来的 `formatMember` 完整行。
59
+
60
+ **三套 id 口径**:`id` = 人员 id(驼峰 `userId` 同值;卡片链接 / `employee.detail` / `employee.batch.ids` / `subordinate.by-id` 只认它);`userid` = 登录信息 id(登录账号场景);`cid`/`imCid` = IM 联系人 id(IM 聊天 / 在线状态)。三者禁止混用。
50
61
 
51
62
  **长整型 id 一律按字符串传递**;**手机号已脱敏**(3 位前缀 + `****` + 末 4 位)。
52
63
 
64
+ ## 多维(虚拟组织维度)解析
65
+
66
+ E10 组织树按多维切分,`department`/`subcompany` 浏览接口不传 `companyId` 时默认落到「行政组织」维度,因此「按名称找部门/分部」需要先定位多维 id。
67
+
68
+ `hrm.org.resolve` 把这段编排收在 CLI 内(多维全部取自 `/api/bs/hrm/companyVirtual/listCompanyVirtual`),**一次调用完成两级匹配**:维度名称 → `companyId` → 组织名称。名称匹配分三级,**只有前两级会自动往下走**:
69
+
70
+ | 级别 | 判定 | CLI 行为 |
71
+ | --- | --- | --- |
72
+ | ① 精确 | 忽略大小写/空白的全等(服务端 `eq`/等于) | 唯一 → 继续;多个 → `ambiguous` |
73
+ | ② 包含(模糊) | 名称是关键字子串(服务端 `in`/包含 + 客户端忽略大小写等值优先) | 唯一 → 继续;多个 → `ambiguous` |
74
+ | ③ **近似** | 编辑距离阈值内(打字级差异,如「客服维度」→「客户维度」) | **只回 `suggestions`,`status: not_found`,绝不继续** |
75
+
76
+ | operation | 关键输入 | 说明 |
77
+ | --- | --- | --- |
78
+ | `hrm.org.resolve` | `virtual` + `name`(首调);`virtualId` / `orgId`(复调);`maxCandidates`(候选上限,1~200,默认 20) | 不传 `type` 时先按部门、再按分部自动识别 |
79
+
80
+ > 多维清单(维度名 + id)**不单独暴露 operation**,由 `hrm.org.resolve` 内部获取与处理(匹配用 + `not_found` 回 `availableVirtuals` 供纠错)。「列出该租户有哪些多维」**暂不支持**,已在 `withheldOperations` 声明;`availableVirtuals` 不得被当作列维度接口(禁止构造不存在的维度名去套取)。
81
+
82
+ 🔴 **结果判定看 `data.status`(不是 `ok`)**,三种结果都 `ok: true`、退出 0:
83
+
84
+ | `data.status` | 输出 | 调用方动作 |
85
+ | --- | --- | --- |
86
+ | `resolved` | `org`(`id`/`name`/`type`/`fullPath`/`virtualId`/`link`…)、`virtual`、`matchType`;不传 `type` 且存在同名另一类型节点时另回 `alsoMatched[]` | 直接使用 `org`;有 `alsoMatched` 时必须一并告知用户 |
87
+ | `ambiguous` | `stage`(`virtual`/`org`)、`candidates[]`(默认 ≤20,可调)、`candidateTotal`、`truncated`、`message` | 列候选让用户确认,确认后把 `id` 当 `orgId`(维度歧义当 `virtualId`)复调 |
88
+ | `not_found` | `suggestions[]`(近似名称,≤5)/`suggestionTotal`、`availableVirtuals`(`stage=virtual`)、`message` | **原样转述**(含"不存在"),**禁止自行替换名称重试**;用户确认后再用 `virtualId`/`orgId` 复调 |
89
+
90
+ `data.total` 与「权威总数」的关系同 `org.query`:组织浏览接口的 `data.total` 是上游真值(非本页行数);本操作调用 `current=1`,上游浏览分页取 `max(100, maxCandidates)`,不做翻页。`fullPath`/`parentPath` 中的层级分隔符已由 CLI 统一为 `/`(部分租户上游用 `|`,如泛微网络租户的 `supDepartment`)。
91
+
92
+ 不传 `type` 时本操作**同时检索部门与分部**(多 1 次浏览请求),因此不会出现「同名部门/分部被静默二选一」:唯一命中时按部门优先返回 `org`,另一类型的同名节点回在 `alsoMatched`;多命中时统一走 `ambiguous`。
93
+
53
94
  ## 详情页卡片链接
54
95
 
55
96
  查询命中后,回答中一律用 `[名称](link)` 形式输出每个命中实体(`link` 由 CLI 在每行提供):
@@ -57,7 +98,7 @@ HRM 接口必须携带页面上下文 `Referer`(默认 `<baseUrl>/hrm/main`)
57
98
  | 卡片 | link 路径 | 来源 operation |
58
99
  | --- | --- | --- |
59
100
  | 人员卡片 | `/sp/hrm/profileInfo/{id}` | `employee.query`/`employee.batch`/`subordinate.*`/`employee.detail` |
60
- | 组织卡片 | `/sp/hrm/orgCard/{id}` | `org.query`/`org.detail` |
101
+ | 组织卡片 | `/sp/hrm/orgCard/{id}` | `org.query`/`org.detail`/`org.resolve` |
61
102
  | 岗位卡片 | `/sp/hrm/positionCard/{id}` | `position.query`/`position.detail`/`position.list` |
62
103
 
63
104
  ## 调用示例
@@ -79,6 +120,7 @@ printf '%s\n' '{"keyword":"张三"}' | weaver-work-cli --json hrm run hrm.employ
79
120
  `withheldOperations` 中声明的能力不实现,也不要绕过:
80
121
 
81
122
  - **代理商查询**(`hrm.employee.dls`):`containsDls=true` 仅泛微自用系统域名支持(自用域名白名单),客户/其他环境禁止触发。
123
+ - **列多维**(`hrm.org.virtuals`):已下线并入 `hrm.org.resolve`;「列出该租户有哪些多维」暂不支持,不得构造假查询绕取 `availableVirtuals`。
82
124
 
83
125
  ## 测试
84
126
 
package/docs/invoice.md CHANGED
@@ -32,6 +32,8 @@ Windows PowerShell:
32
32
  ```powershell
33
33
  weaver-work-cli invoice schema
34
34
  weaver-work-cli --json invoice run invoice.list --input-json '{"page_size":10,"start_pos":0}'
35
+ weaver-work-cli --json invoice list --view summary
36
+ weaver-work-cli --json invoice list --fields number,detailUrl
35
37
  ```
36
38
 
37
39
  macOS/Linux(bash/zsh):
@@ -39,11 +41,13 @@ macOS/Linux(bash/zsh):
39
41
  ```bash
40
42
  weaver-work-cli invoice schema
41
43
  weaver-work-cli --json invoice run invoice.list --input-json '{"page_size":10,"start_pos":0}'
44
+ weaver-work-cli --json invoice list --view summary
45
+ weaver-work-cli --json invoice list --fields number,detailUrl
42
46
  ```
43
47
 
44
48
  成功和失败都使用 JSON envelope。成功写 stdout;失败写 stderr,并设置非 0 退出码。
45
49
 
46
- 当前输出层是完整 JSON 直接写 stdout,不提供飞书 CLI 的 `--jq`、`--format table/ndjson` 或通用 `--page-all`。Agent 使用时应默认小页读取和摘要渲染:列表先 `page_size=10`,按 `start_pos` 继续;回复只展示关键字段和数量,超长详情/OCR/调试 JSON 落本地文件后给路径。
50
+ 当前输出层把完整 JSON 直接写 stdout。0.1.17 起可用 `--view summary`(列表语义平表,仅 `invoice.list` / `invoice.enterprise.list` 支持)与 `--fields a,b.c`(点路径投影,所有 operation 可用)裁剪输出——两者互斥,只影响输出、不改变请求参数;仍不提供飞书 CLI 的 `--jq`、`--format table/ndjson` 或通用 `--page-all`。Agent 使用时应默认小页读取和摘要渲染:列表先 `page_size=10`,按 `start_pos` 继续;回复只展示关键字段和数量,超长详情/OCR/调试 JSON 落本地文件后给路径。
47
51
 
48
52
  ## Operation 目录
49
53
 
package/docs/meeting.md CHANGED
@@ -36,7 +36,7 @@ weaver-work-cli meeting today # 今天会议(meeting.li
36
36
  ## 关键契约(源资料实测坑位)
37
37
 
38
38
  - 新建会议 `operateType=SUBMIT` + `id:""` → 正常状态;`ADD` 只生成草稿,勿用。
39
- - 冲突处理看接口返回 `cansub`:false=禁止提交(直接拒绝);true=仅提醒(建议换时间/地点);检测失败视为冲突。**绝不提供"强制新建"选项**。
39
+ - 冲突处理看接口返回 `cansub`:false=禁止提交(直接拒绝,怎么都不允许);true=仅提醒(如实告知并建议换时间/地点,**用户坚持时仍可继续提交**);检测失败视为冲突(保守拒绝)。
40
40
  - 周期会议 `finishAt` 必填(仅 1=次数 / 2=日期,禁止 0);`repeatDesc` 由 CLI 自动拼接。
41
41
  - 回执更新必须传回执记录 `id`(prepare 自动按 `memberId` 回查);`attendStatus` 0/1/2。
42
42
  - 超 2^53 的 id 一律字符串传递。
@@ -113,16 +113,16 @@ weaver-work-cli --profile PROFILE_NAME auth status
113
113
 
114
114
  ## 5. 安装已有业务模块 Skill
115
115
 
116
- ### 5.1 安装到 Codex 默认目录
116
+ ### 5.1 安装到当前 Agent
117
117
 
118
118
  ```text
119
119
  weaver-work-cli skills install yepiaotong
120
120
  weaver-work-cli skills install wenshuding
121
121
  ```
122
122
 
123
- 默认目标目录优先使用环境变量 `CODEX_HOME` 下的 `skills` 子目录;未设置 `CODEX_HOME` 时使用用户主目录下的 `.codex/skills`(Windows PowerShell 示例:`$env:USERPROFILE\.codex\skills`)。安装非 shared 业务 Skill 时,CLI 会自动带上 `weaver-e10-shared`。
123
+ CLI 优先使用 `--target-dir` 或通用环境变量 `WEAVER_SKILLS_ROOT`。未显式指定时,会根据当前进程的 Codex/WorkBuddy 环境信号选择当前用户的 skills 目录;如果宿主不明确、存在多个候选目录,或者当前为其它 Agent 且未提供路径,则停止安装并要求显式指定,避免装错位置。安装非 shared 业务 Skill 时,CLI 会自动带上 `weaver-e10-shared`。
124
124
 
125
- ### 5.2 安装到 WorkBuddy 或其它 Agent
125
+ ### 5.2 显式安装到 WorkBuddy 或其它 Agent
126
126
 
127
127
  Windows PowerShell:
128
128
 
@@ -152,6 +152,18 @@ macOS/Linux(bash/zsh):
152
152
  weaver-work-cli skills install MODULE_NAME --target-dir "/path/to/agent-skills"
153
153
  ```
154
154
 
155
+ 经常使用同一 Agent 时,也可以设置通用目录环境变量:
156
+
157
+ ```powershell
158
+ $env:WEAVER_SKILLS_ROOT = "$env:USERPROFILE\.other-agent\skills"
159
+ weaver-work-cli skills install MODULE_NAME
160
+ ```
161
+
162
+ ```bash
163
+ export WEAVER_SKILLS_ROOT="$HOME/.other-agent/skills"
164
+ weaver-work-cli skills install MODULE_NAME
165
+ ```
166
+
155
167
  `<module>` 可以传短名,例如 `yepiaotong`、`wenshuding`、`skill-maker`,也可以传完整名,例如 `weaver-e10-yepiaotong`。传 `all` 会安装包内全部 Skill。
156
168
 
157
169
  ### 5.3 验证安装结果
@@ -38,13 +38,13 @@
38
38
  | 13 | jucailin「三个子系统」与实际列出的四个业务域矛盾 | 改为「四个子系统(人事档案/出勤/薪酬/招聘)」 |
39
39
  | 14 | shared SKILL.md 存在整句重复;登录依赖表述与 CLI 现状(auth 托管)冲突 | 去重并与现状对齐 |
40
40
  | 15 | qiyecheng manifest 残留开发者个人路径 `/Users/zhufangyuan/...` | 脱敏为占位 |
41
- | 16 | connector 版依赖声明错误:`weaver-e10-login` 被错写成重复的 `weaver-e10-shared-connector` | 修正为 login + shared-connector |
41
+ | 16 | connector 版依赖声明仍保留旧 login 兼容项 | 修正为 shared-connector |
42
42
 
43
43
  ## 四、规则遵从性(硬规则 / 门禁 BLOCK)
44
44
 
45
45
  | # | 问题 | 修复 |
46
46
  |---|---|---|
47
- | 17 | **7 个接口型 skill 未声明 `weaver-e10-login` 依赖,且未写明请求头三件套**(B10a / B10c,BLOCK) | jiuchuanhui / mail / meeting / okr / qiyecheng / skill-maker / workflow 全部补齐,统一新增「认证与请求头契约」章节 |
47
+ | 17 | **7 个接口型 skill 未声明 `weaver-e10-shared` 依赖,且未写明请求头三件套**(B10a / B10c,BLOCK) | jiuchuanhui / mail / meeting / okr / qiyecheng / skill-maker / workflow 全部补齐,统一新增「认证与请求头契约」章节 |
48
48
  | 18 | plan description 246 字,超 200 字上限 | 压到 164 字,触发词保留 |
49
49
  | 19 | 改写登录红线时误触发 B10b(该规则无否定豁免,写成「禁止 Playwright/扫码…」也会被判违规) | 去掉敏感词枚举,改为不含触发词的表述 |
50
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weaver-work-cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.21",
4
4
  "description": "面向泛微工作工具链的可扩展 TypeScript CLI 基础框架(E10 业票通等能力)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -13,7 +13,6 @@ const skillTemplateRoot = path.join(repositoryRoot, 'skill-template')
13
13
  const productMetadataPath = path.join(skillTemplateRoot, 'product.json')
14
14
  const packageJsonPath = path.join(repositoryRoot, 'package.json')
15
15
  const sharedSkillName = 'weaver-e10-shared'
16
- const legacySharedSkillName = 'weaver-work-cli-shared'
17
16
  const skillPrefix = 'weaver-e10-'
18
17
  const legacySkillPrefix = 'weaver-work-cli-'
19
18
  const [requestedSkillArg, outputArg] = process.argv.slice(2)
@@ -88,6 +87,31 @@ function assertSafeRelativePath(relativePath) {
88
87
  }
89
88
  }
90
89
 
90
+ function assertSkillFrontmatter(skillName, content) {
91
+ const normalized = content.replace(/\r\n/g, '\n')
92
+ const lines = normalized.split('\n')
93
+ if (lines[0] !== '---') {
94
+ throw new Error(`${skillName}/SKILL.md 缺少 YAML frontmatter:文件必须以 --- 开头`)
95
+ }
96
+
97
+ const end = lines.indexOf('---', 1)
98
+ if (end < 0) {
99
+ throw new Error(`${skillName}/SKILL.md 缺少 YAML frontmatter 结束标记 ---`)
100
+ }
101
+
102
+ const frontmatter = lines.slice(1, end).join('\n')
103
+ const nameMatch = frontmatter.match(/^name:\s*["']?([^"'\n]+?)["']?\s*$/m)
104
+ if (!nameMatch) {
105
+ throw new Error(`${skillName}/SKILL.md 的 YAML frontmatter 缺少 name`)
106
+ }
107
+ if (nameMatch[1] !== skillName) {
108
+ throw new Error(`${skillName}/SKILL.md 的 frontmatter name 必须等于目录名 ${skillName}`)
109
+ }
110
+ if (!/^description:\s*\S/m.test(frontmatter)) {
111
+ throw new Error(`${skillName}/SKILL.md 的 YAML frontmatter 缺少 description`)
112
+ }
113
+ }
114
+
91
115
  function crc32(buffer) {
92
116
  let crc = 0xffffffff
93
117
  for (const byte of buffer) {
@@ -185,11 +209,6 @@ async function createZipArchive(root, entries) {
185
209
  return Buffer.concat([...localParts, centralDirectory, end])
186
210
  }
187
211
 
188
- function rewriteSkillContent(skillName, relativePath, content) {
189
- if (skillName !== legacySharedSkillName || relativePath !== 'SKILL.md') return content
190
- return content.replace(/^name:\s*weaver-e10-shared\s*$/mu, `name: ${legacySharedSkillName}`)
191
- }
192
-
193
212
  async function loadProductMetadata() {
194
213
  const product = JSON.parse(await readFile(productMetadataPath, 'utf8'))
195
214
  const packageInfo = JSON.parse(await readFile(packageJsonPath, 'utf8'))
@@ -219,10 +238,11 @@ async function writeProductMetadata(packageRoot, packagedEntries, packageName, p
219
238
  packagedEntries.push(`${packageName}/product.json`)
220
239
  }
221
240
 
222
- async function copySkill(skillName, stagingRoot, packagedEntries, productMetadata, packageName = skillName) {
241
+ async function copySkill(skillName, stagingRoot, packagedEntries, productMetadata) {
223
242
  const sourceRoot = path.join(skillsRoot, skillName)
224
- const packageRoot = path.join(stagingRoot, packageName)
225
- await stat(path.join(sourceRoot, 'SKILL.md'))
243
+ const packageRoot = path.join(stagingRoot, skillName)
244
+ const skillMarkdown = await readFile(path.join(sourceRoot, 'SKILL.md'), 'utf8')
245
+ assertSkillFrontmatter(skillName, skillMarkdown)
226
246
 
227
247
  async function copyDir(relativeDir = '') {
228
248
  const sourceDir = path.join(sourceRoot, relativeDir)
@@ -241,19 +261,14 @@ async function copySkill(skillName, stagingRoot, packagedEntries, productMetadat
241
261
  await copyDir(relativePath)
242
262
  } else if (entry.isFile()) {
243
263
  await mkdir(path.dirname(target), { recursive: true, mode: 0o700 })
244
- if (packageName === skillName) {
245
- await copyFile(source, target)
246
- } else {
247
- const content = await readFile(source, 'utf8')
248
- await writeFile(target, rewriteSkillContent(packageName, relativePath, content))
249
- }
250
- packagedEntries.push(`${packageName}/${relativePath}`)
264
+ await copyFile(source, target)
265
+ packagedEntries.push(`${skillName}/${relativePath}`)
251
266
  }
252
267
  }
253
268
  }
254
269
 
255
270
  await copyDir()
256
- await writeProductMetadata(packageRoot, packagedEntries, packageName, productMetadata)
271
+ await writeProductMetadata(packageRoot, packagedEntries, skillName, productMetadata)
257
272
  }
258
273
 
259
274
  const skillNames = await resolveSkillNames()
@@ -268,9 +283,6 @@ try {
268
283
  await mkdir(path.dirname(output), { recursive: true, mode: 0o700 })
269
284
  for (const skillName of skillNames) {
270
285
  await copySkill(skillName, stagingRoot, packagedEntries, productMetadata)
271
- if (skillName === sharedSkillName) {
272
- await copySkill(skillName, stagingRoot, packagedEntries, productMetadata, legacySharedSkillName)
273
- }
274
286
  }
275
287
 
276
288
  await rm(output, { force: true })
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """Exchange XiaoE platform credentials for an E10 eteamId.
4
+
5
+ This compatibility helper is executed only by weaver-work-cli. It uses the
6
+ Python standard library, writes one JSON result to stdout, keeps TLS certificate
7
+ verification enabled, and refuses redirects that could leak Authorization to a
8
+ different origin.
9
+ """
10
+
11
+ import json
12
+ import os
13
+ import ssl
14
+ import sys
15
+ import urllib.error
16
+ import urllib.request
17
+ from urllib.parse import urljoin, urlsplit
18
+
19
+
20
+ MAX_REDIRECTS = 5
21
+ ETEAM_ID_PATH = "/spec-apps/api/app/rpachat/skill/extend/eteamId"
22
+
23
+
24
+ def _effective_port(parts):
25
+ if parts.port is not None:
26
+ return parts.port
27
+ return 443 if parts.scheme == "https" else 80
28
+
29
+
30
+ def _same_origin(left, right):
31
+ return (
32
+ left.scheme == right.scheme
33
+ and left.hostname == right.hostname
34
+ and _effective_port(left) == _effective_port(right)
35
+ )
36
+
37
+
38
+ class _SafeRedirectHandler(urllib.request.HTTPRedirectHandler):
39
+ def redirect_request(self, req, fp, code, msg, headers, newurl):
40
+ current = urlsplit(req.full_url)
41
+ target_url = urljoin(req.full_url, newurl)
42
+ target = urlsplit(target_url)
43
+ safe_upgrade = (
44
+ current.scheme == "http"
45
+ and target.scheme == "https"
46
+ and current.hostname == target.hostname
47
+ )
48
+ if target.scheme not in ("http", "https") or target.username or target.password:
49
+ raise urllib.error.HTTPError(target_url, 403, "unsafe XiaoE redirect", headers, fp)
50
+ if not _same_origin(current, target) and not safe_upgrade:
51
+ raise urllib.error.HTTPError(target_url, 403, "cross-origin XiaoE redirect", headers, fp)
52
+
53
+ redirects = getattr(req, "_xiaoe_redirects", 0) + 1
54
+ if redirects > MAX_REDIRECTS:
55
+ raise urllib.error.HTTPError(target_url, 310, "too many XiaoE redirects", headers, fp)
56
+
57
+ redirected = urllib.request.Request(
58
+ target_url,
59
+ data=req.data,
60
+ headers=dict(req.header_items()),
61
+ method=req.get_method(),
62
+ )
63
+ redirected._xiaoe_redirects = redirects
64
+ return redirected
65
+
66
+
67
+ def _post_json(url, token, domain):
68
+ body = json.dumps({"domain": domain}).encode("utf-8")
69
+ request = urllib.request.Request(
70
+ url,
71
+ data=body,
72
+ headers={
73
+ "authorization": token,
74
+ "Content-Type": "application/json",
75
+ },
76
+ method="POST",
77
+ )
78
+ opener = urllib.request.build_opener(
79
+ _SafeRedirectHandler(),
80
+ urllib.request.HTTPSHandler(context=ssl.create_default_context()),
81
+ )
82
+ try:
83
+ with opener.open(request, timeout=15) as response:
84
+ raw = response.read().decode("utf-8")
85
+ except urllib.error.HTTPError as error:
86
+ detail = error.read().decode("utf-8", "ignore")[:200]
87
+ raise RuntimeError(f"HTTP {error.code}: {detail}") from error
88
+ return json.loads(raw)
89
+
90
+
91
+ def main():
92
+ domain = sys.argv[1].strip() if len(sys.argv) > 1 else "https://www.e-cology.com.cn"
93
+ token = os.getenv("XIAOE_USER_TOKEN", "").strip()
94
+ erpa = os.getenv("XIAOE_DOMAIN", "").strip()
95
+ if not token or not erpa:
96
+ raise RuntimeError("missing XIAOE_USER_TOKEN or XIAOE_DOMAIN")
97
+
98
+ endpoint = f"{erpa.rstrip('/')}{ETEAM_ID_PATH}"
99
+ data = _post_json(endpoint, token, domain)
100
+ business_code = data.get("code")
101
+ business_data = data.get("data") or {}
102
+ eteam_id = business_data.get("eteamId") if isinstance(business_data, dict) else None
103
+ if business_code not in ("0000", 200) or not eteam_id:
104
+ raise RuntimeError(f"XiaoE exchange failed with business code {business_code}")
105
+
106
+ print(json.dumps({
107
+ "eteamId": eteam_id,
108
+ "code": business_code,
109
+ "msg": data.get("msg"),
110
+ }, ensure_ascii=False))
111
+
112
+
113
+ if __name__ == "__main__":
114
+ try:
115
+ main()
116
+ except Exception as error:
117
+ print(json.dumps({"code": "ERROR", "msg": str(error)}, ensure_ascii=False), file=sys.stderr)
118
+ sys.exit(1)
@@ -207,23 +207,26 @@
207
207
  ],
208
208
  "weaver-e10-ebuilder-form": [
209
209
  "eBuilder",
210
- "ebuilder",
211
- "EB表单",
212
- "表单",
213
- "数据列表",
214
- "表格",
215
- "列表数据",
210
+ "eBuilder表单",
211
+ "表单数据",
212
+ "表单查询",
213
+ "表单新增",
214
+ "表单修改",
215
+ "表单删除",
216
+ "eBuilder菜单",
216
217
  "菜单定位",
217
- "字段定义",
218
+ "List列表",
219
+ "NList列表",
220
+ "表单字段",
218
221
  "浏览字段",
219
- "人员字段",
220
- "部门字段",
221
- "表单数据",
222
- "自定义接口",
222
+ "选项字段",
223
+ "主明细映射",
223
224
  "OpenAPI",
224
- "新增表单数据",
225
- "修改表单数据",
226
- "删除表单数据"
225
+ "自定义接口",
226
+ "objId",
227
+ "interfacePk",
228
+ "表单分页",
229
+ "表单详情"
227
230
  ],
228
231
  "weaver-e10-shared": [
229
232
  "安装",
@@ -355,5 +358,101 @@
355
358
  "修改流程表单",
356
359
  "智能分组",
357
360
  "待办统计"
361
+ ],
362
+ "weaver-e10-blog": [
363
+ "日报",
364
+ "工作日报",
365
+ "写日报",
366
+ "查日报",
367
+ "提交日报",
368
+ "提交情况",
369
+ "补交",
370
+ "未提交",
371
+ "未交日报",
372
+ "催交",
373
+ "提醒交日报",
374
+ "日报提醒",
375
+ "下属日报",
376
+ "我关注的人",
377
+ "关注人员日报",
378
+ "日报评论",
379
+ "日报点赞",
380
+ "导出日报",
381
+ "日报报表",
382
+ "编辑日报",
383
+ "发布日报"
384
+ ],
385
+ "weaver-e10-caizhilian": [
386
+ "采知连",
387
+ "文档中心",
388
+ "知识库",
389
+ "公共知识库",
390
+ "个人知识库",
391
+ "虚拟知识库",
392
+ "在线文档",
393
+ "文档检索",
394
+ "文档搜索",
395
+ "建文档",
396
+ "新建文档",
397
+ "HTML 文档",
398
+ "Markdown 文档",
399
+ "Office 文档",
400
+ "上传建文档",
401
+ "文档详情",
402
+ "文档正文",
403
+ "替换正文",
404
+ "更新正文",
405
+ "修改文档字段",
406
+ "变更作者",
407
+ "文档作者",
408
+ "文件夹",
409
+ "虚拟文件夹",
410
+ "文件夹权限",
411
+ "文档权限",
412
+ "下载权限",
413
+ "默认共享",
414
+ "文档默认共享",
415
+ "标签",
416
+ "参与人",
417
+ "文档共享",
418
+ "共享设置",
419
+ "取消共享",
420
+ "附件",
421
+ "上传附件",
422
+ "替换附件",
423
+ "下载附件",
424
+ "附件转 PDF",
425
+ "封面",
426
+ "设置封面",
427
+ "移除封面",
428
+ "文档比对",
429
+ "比对链接",
430
+ "组织架构",
431
+ "人员检索",
432
+ "部门",
433
+ "子部门",
434
+ "岗位",
435
+ "角色",
436
+ "外部联系人",
437
+ "当前用户",
438
+ "系统健康检查",
439
+ "采知连接口连通性"
440
+ ],
441
+ "weaver-e10-jinchengda": [
442
+ "合同",
443
+ "合同管理",
444
+ "合同类型",
445
+ "合同模板",
446
+ "合同条款",
447
+ "条款引用",
448
+ "签约主体",
449
+ "合同审批",
450
+ "发起审批",
451
+ "保存审批",
452
+ "提交审批",
453
+ "催办",
454
+ "审批进度",
455
+ "审批意见",
456
+ "今承达"
358
457
  ]
359
458
  }
@@ -0,0 +1,24 @@
1
+ 本业务域用于 E10 工作日报(blog)。入口 `SKILL.md` 按 weaver 风格组织:CRITICAL 共享前置、路由优先级、高优先级语义、逐 operation 命令表、处理链、执行原则、写操作失败决策树和「不在范围」。具体用法拆到 `references/`:
2
+
3
+ - `blog-query.md`:群体日报查询(`user_type` 四档:直接/间接/全部下属、我关注的人),客户端窗口裁剪与 `not_submitted` 口径。
4
+ - `blog-query-user.md`:单人日报逐日扫描(`detailsByDate`,区间上限 62 天),`submit_status` 判定与 62 天上限报错。
5
+ - `blog-resolve-users.md`:HRM 按姓名精确解析 `user_id`(取 `id` 字段,不是 `userid`)。
6
+ - `blog-comments.md`:查某条日报的评论列表。
7
+ - `blog-default-permission.md`:查某日期的默认共享对象,供发布时回填 `permissionList`。
8
+ - `blog-export.md`:导出日报报表为 xlsx,本地文件写入与拒绝覆盖策略。
9
+ - `blog-publish.md`:发布日报的 `prepare -> apply` 写入协议(含写前查重与默认共享回填)。
10
+ - `blog-edit.md`:编辑指定日期日报的 `prepare -> apply` 写入协议(含目标指纹校验)。
11
+ - `blog-comment.md`:评论指定日报的 `prepare -> apply` 写入协议(含评论列表回查)。
12
+ - `blog-like.md`:点赞与取消点赞的 `prepare -> apply` 写入协议。
13
+ - `blog-remind.md`:提醒提交日报的 `prepare -> apply` 写入协议,默认文案与逐人发送语义。
14
+ - `blog-disabled-capabilities.md`:按 userId 批量查个人、`unRead`、EB 日报接口族、删除、撤回提醒等未暴露能力的处理边界。
15
+
16
+ Agent 调优重点:
17
+
18
+ - `weaver-work-cli blog schema` 是 operation 合约第一信息源。
19
+ - 查指定个人只能用 `blog.query_user`;`filter.userIds` 被服务端忽略,按 userId 列表查会静默返回登录人自己的日报。
20
+ - 补交状态统一由 CLI 判定为 `正常` / `补交` / `未提交`,不使用服务端 `later` 字段口径。
21
+ - 业务输入不得包含 Cookie、ETEAMSID、Token 或内部控制字段。
22
+ - 写操作只接受 CLI 生成的 continuation,不手工构造或复用;`apply` 一律要求 `confirm=true`。
23
+ - 结果为 `partial/write_uncertain` 时停止,不自动重放写请求,先用 `blog.query_user` 只读回查。
24
+ - 导出属于本地文件写入:`output` 指向已存在文件时 CLI 拒绝覆盖。
@@ -0,0 +1,22 @@
1
+ 本业务域用于 E10 采知连(文档中心 / 知识库)。入口 `SKILL.md` 按飞书 `lark-approval` 风格组织:CRITICAL 共享前置、登录与请求头凭证契约、路由优先级、高优先级语义、逐 operation 命令表、处理链、执行原则、写操作失败决策树和「不在范围」。具体用法拆到 `references/`:
2
+
3
+ - `agent-entry.md`:schema / operations 入口、统一 `caizhilian run` 调用方式、`--input-json` 与 `--input <path>` 选择、成功与失败 envelope、完整错误码表。
4
+ - `document.md`:文档检索、文档详情、当前登录人,以及 HTML / Markdown / Office / 批量上传四种建文档方式与四种编辑(基础字段、作者、保存正文、替换正文)。
5
+ - `folder.md`:文件夹创建、虚拟文件夹检索、文件夹默认设置,以及默认共享与八类文档权限(含 `Premisstion` 源拼写与按权限反查)。
6
+ - `collaboration.md`:标签(公共/个人)、参与人、文档共享的查询与增删,含 `share.add` 的「已存在」语义与 `share_entry_id` 用法。
7
+ - `org-browser.md`:人员/部门/分部/外部人员/岗位/角色/客户/客户类型八类浏览器检索与当前登录人,用于把名称解析成 ID。
8
+ - `files.md`:附件上传/替换/下载(含转 PDF)、封面上传/设置/移除、文档比对(检索、文件对象、上传、提交拿 `compare_link`)。
9
+ - `write-protocol.md`:prepare → apply 四步链路、continuation 票据约束与全部票据类错误码、写结果不确定的决策树。
10
+ - `withheld.md`:4 个不提供的系统操作(环境列表 / 配置快照 / 配置重载 / 环境切换)与源 Skill 范围外模块,以及源基础设施脚本的等价替换说明。
11
+
12
+ Agent 调优重点:
13
+
14
+ - `weaver-work-cli caizhilian schema` 是 operation、字段与风险等级的合约第一信息源;`caizhilian operations` 给出按资源分组的能力目录与 `withheldOperations`。
15
+ - 业务输入不得包含 Cookie、ETEAMSID、Token 或内部控制字段;认证只走 `weaver-work-cli auth ...`。
16
+ - ID 一律来自查询:`doc_id` 来自检索或详情,`folder_id` 来自 `folder.query-by-name`,人员与部门 ID 来自 `org.search-*`,权限与共享的合法取值来自 `*.form` / `*.list`。
17
+ - 枚举拼写 1:1 沿用源接口,权限键是 `deletePremisstion` / `downloadPremisstion` / `newCreateDocPremisstion` / `newCreateFolderPremisstion`,不要「纠正」成 `Permission`。
18
+ - 写操作只接受 CLI 生成的 continuation,不手工构造、不跨操作复用;apply 入参必须与 prepare 逐字一致,票据有效期 10 分钟。
19
+ - 分页 `has_next` 按「本页条数 >= page_size」判定,服务端 `total` 不可信;列表默认小页,回复只给摘要。
20
+ - 附件、封面图片、正文文件属于用户私有数据:上传下载前必须提醒文件可能进入大模型上下文并取得明确确认;文件内容不得读入上下文,只引用路径与元数据。
21
+ - 上传与下载是长耗时操作(120 秒超时、下载上限 100MB),一次只跑一个,不并发批量传输。
22
+ - 结果为 `partial/write_uncertain`、网络中断或回查不一致时停止,最多补一次只读回查,不自动重放写请求。
@@ -1,7 +1,7 @@
1
1
  本业务域用于泛微 E10 组织管理(员工查询 / 组织架构 / 岗位查询,全部只读)。入口 `SKILL.md` 先路由到 `weaver-e10-shared/SKILL.md`,再给出跨模块约定、Reference 路由表和安全边界。具体用法拆到 `references/`:
2
2
 
3
3
  - `employee.md`:按工号/姓名/手机/邮箱查员工、批量人员、资料名片、下属查询(当前登录人 + 按 id)、部门成员。
4
- - `org.md`:分部/部门浏览、组织详情、多级路径 drill-down 编排。
4
+ - `org.md`:分部/部门浏览、组织详情、多级路径 drill-down 编排、多维(虚拟组织维度)解析(`org.resolve`,含"维度名不存在时只给近似提示"的三级匹配)。
5
5
  - `position.md`:岗位浏览、岗位详情、岗位批量(岗位地址簿)。
6
6
  - `source-manifest.json`:源资料清单与 sha256 指纹,用于源资料更新检测。
7
7
 
@@ -12,5 +12,6 @@
12
12
  - 长整型 id 一律按字符串传递;手机号已由 CLI 脱敏。
13
13
  - **无条件禁止全量拉取**:`employee.query`/`org.query`/`position.query` 必须带收敛条件;`position.list` 无过滤需显式 `all=true`;`employee.query` 的 `status` 不能单独使用。
14
14
  - 姓名/工号/名称模糊匹配多人命中时必须列候选让用户选择,不得自动取第一条;部门重名改传组织 id。
15
+ - 组织树按**多维**切分,同名部门在不同多维下是不同节点;`org.resolve` 已把「多维名称+部门/分部名称」的两级匹配收在 CLI 内,**只调一次**,结果看 `data.status`(`resolved`/`ambiguous`/`not_found`),`ambiguous` 必须问用户后再用 `orgId`/`virtualId` 复调。
15
16
  - 批量查询禁止循环单查:批量人员走 `employee.batch`,岗位批量走 `position.list`。
16
17
  - 代理商查询(`containsDls=true`)属禁用边界,直接说明不可用,不引导用户绕过。