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
@@ -0,0 +1,698 @@
1
+ import { schemaOf } from './types.js';
2
+ /**
3
+ * 采知连(E10 文档中心)操作规格表。
4
+ *
5
+ * 由源 Skill `weaver-e10-caizhilian` 的 64 个 operation(scripts/*_plugins.py +
6
+ * doc-business-operations/*.json)1:1 派生:
7
+ * - 60 个 canonical operation 保留(4 个本地配置类 operation 落到 manifest.withheldOperations);
8
+ * - 入参名严格保持源 snake_case(doc_id / folder_id / page_no / save_path ...);
9
+ * - `sourceOperation` 记录源 operation 名,便于回溯;
10
+ * - `requiresConfirmation` 的写操作由 registry 展开为 `<name>.prepare` / `<name>.apply`。
11
+ */
12
+ const S = (description, extra = {}) => ({ type: 'string', description, ...extra });
13
+ const ID = (description) => ({ type: 'string', pattern: '^\\d+$', minLength: 1, description });
14
+ const INT = (description, extra = {}) => ({ type: 'integer', description, ...extra });
15
+ const BOOL = (description, extra = {}) => ({ type: 'boolean', description, ...extra });
16
+ const LIST = (description, items = { type: 'string' }) => ({
17
+ type: 'array',
18
+ minItems: 1,
19
+ items,
20
+ description,
21
+ });
22
+ const FILE = (description) => ({ type: 'string', minLength: 1, description });
23
+ /** 源 folder_plugins._VALID_PERMISSION_TYPES。 */
24
+ export const PERMISSION_TYPES = [
25
+ 'copyPermission',
26
+ 'deletePremisstion',
27
+ 'downloadPremisstion',
28
+ 'folderDefaultParticipants',
29
+ 'movePermission',
30
+ 'newCreateDocPremisstion',
31
+ 'newCreateFolderPremisstion',
32
+ 'settingPermission',
33
+ ];
34
+ /** 源 folder_plugins._VALID_DETAIL_TYPES。 */
35
+ export const SETTING_TYPES = [
36
+ 'copyPermission',
37
+ 'defaultShares',
38
+ 'deletePremisstion',
39
+ 'downloadPremisstion',
40
+ 'folderDefaultParticipants',
41
+ 'movePermission',
42
+ 'newCreateDocPremisstion',
43
+ 'newCreateFolderPremisstion',
44
+ 'settingPermission',
45
+ ];
46
+ /** 源 folder_plugins._QUERY_FOLDER_VALID_PERMISSION_KEYS。 */
47
+ export const FOLDER_PERMISSION_KEYS = [
48
+ 'copyPermission',
49
+ 'deletePremisstion',
50
+ 'downloadPremisstion',
51
+ 'folderDefaultParticipants',
52
+ 'folderDefaultShareNew',
53
+ 'movePermission',
54
+ 'newCreateDocPremisstion',
55
+ 'newCreateFolderPremisstion',
56
+ 'settingPermission',
57
+ ];
58
+ /** 源 document_plugins._FIELD_MAP 的键。 */
59
+ export const DOC_UPDATE_FIELDS = ['abstract', 'auto_invalid_date', 'keywords', 'name'];
60
+ const FOLDER_TYPE = S('文件夹类型:company=公共/privy=个人/sys=系统', { enum: ['company', 'privy', 'sys'] });
61
+ const KB_TYPE = S('知识库类型', { enum: ['company', 'privy', 'sys'], default: 'company' });
62
+ const PERMISSION_TYPE = S('权限类型', { enum: [...PERMISSION_TYPES] });
63
+ const SETTING_TYPE = S('设置项类型', { enum: [...SETTING_TYPES] });
64
+ function pageProps(defaultPageSize) {
65
+ return {
66
+ page_no: INT('页码(1-indexed)', { minimum: 1, default: 1 }),
67
+ page_size: INT('每页条数', { minimum: 1, default: defaultPageSize }),
68
+ };
69
+ }
70
+ /** 源 create_html_document / create_markdown_document / create_office_document 的公共可选入参。 */
71
+ const CREATE_DOC_OPTIONALS = {
72
+ participant_ids: LIST('参与人(人员 ID)列表;缺省时按文件夹默认参与人回填'),
73
+ abstract_text: S('摘要'),
74
+ keywords: S('关键词'),
75
+ auto_invalidate_date: S('自动失效日期(YYYY-MM-DD)'),
76
+ tags: LIST('标签列表(源样透传给 document.tags)', { type: 'object', additionalProperties: true }),
77
+ virtual_folder_ids: LIST('虚拟文件夹 ID 列表;缺省时按文件夹默认虚拟目录回填'),
78
+ doc_category: INT('文档类别:0=普通,1=重要', { enum: [0, 1], default: 0 }),
79
+ cover_picture_id: ID('封面图片文件 ID'),
80
+ };
81
+ /** 源 add_doc_share / add_folder_set_default_share 的共享对象 ID 字段(1:1 保留 11 个)。 */
82
+ const SHARE_ID_FIELDS = {
83
+ obj_id: LIST('共享对象 ID(人员等)'),
84
+ obj_id_department: LIST('部门 ID'),
85
+ obj_id_subcompany: LIST('分部/子公司 ID'),
86
+ obj_id_role: LIST('角色 ID'),
87
+ obj_id_group: LIST('组 ID'),
88
+ obj_id_external: LIST('外部人员 ID'),
89
+ obj_id_customer: LIST('客户 ID'),
90
+ obj_id_customer_type: LIST('客户类型 ID'),
91
+ obj_id_position: LIST('岗位 ID'),
92
+ obj_id_manager: LIST('上级 ID'),
93
+ obj_id_grade: LIST('职级 ID'),
94
+ };
95
+ /** 源共享表单的可选级联参数。 */
96
+ const SHARE_OPTION_FIELDS = {
97
+ download: LIST('下载权限(share_level != 1 且未传时默认 ["download"])'),
98
+ department_attribute: LIST('部门属性'),
99
+ role_level: S('角色层级'),
100
+ position_level: S('岗位层级'),
101
+ position_attribute: LIST('岗位属性'),
102
+ virtualCompany: S('虚拟组织'),
103
+ createrPositionLevel: S('创建人岗位层级'),
104
+ };
105
+ function spec(resource, action, sourceOperation, risk, summary, properties, required = [], options = {}) {
106
+ return {
107
+ name: `caizhilian.${resource}.${action}`,
108
+ resource,
109
+ method: options.method ?? 'plugin',
110
+ action,
111
+ summary,
112
+ risk,
113
+ ...(options.requiresConfirmation ? { requiresConfirmation: true } : {}),
114
+ sourceOperation,
115
+ ...(options.deprecatedInputAliases ? { deprecatedInputAliases: options.deprecatedInputAliases } : {}),
116
+ ...(options.permissions ? { permissions: options.permissions } : {}),
117
+ inputSchema: schemaOf(properties, { required }),
118
+ };
119
+ }
120
+ /**
121
+ * 源资料声明的权限/接口前置条件(doc-business-operations 的「权限校验:…」表述)。
122
+ * 只在源明确写出的操作上记录,不推断。
123
+ */
124
+ const PERMISSION_FOLDER_CREATE_DOCUMENT = ['folder.create-document'];
125
+ const PERMISSION_COMPARE_UPLOAD = ['compare.upload'];
126
+ export const caizhilianOperationSpecs = [
127
+ // ── document ────────────────────────────────────────────
128
+ spec('document', 'search', 'search_documents', 'read', '按关键词/文件夹/创建人/创建时间检索文档(源 search_documents)', {
129
+ keywords: S('检索关键词'),
130
+ folder_id: ID('文件夹 ID:100=系统,200=公共,300=个人'),
131
+ include_sub_folder: BOOL('是否包含子文件夹(仅在传了 folder_id 时生效)', { default: false }),
132
+ creator_user_id: ID('创建人(人员 ID)'),
133
+ create_time: S('创建时间范围,支持 today/last_7_days 等枚举或 last_<N>_days'),
134
+ ...pageProps(40),
135
+ }),
136
+ spec('document', 'get', 'fetch_doc_base_info_by_docid', 'read', '按 doc_id 获取文档详情(源模板 FetchDocBaseInfoByDocid)', {
137
+ doc_id: ID('文档 ID'),
138
+ }, ['doc_id'], { method: 'http_template' }),
139
+ spec('document', 'create-html', 'create_html_document', 'high-risk-write', '在指定文件夹创建 HTML 文档(源 create_html_document)', {
140
+ name: S('文档标题'),
141
+ folder_id: ID('目标文件夹 ID'),
142
+ folder_type: FOLDER_TYPE,
143
+ author_id: ID('作者(人员 ID)'),
144
+ summary: S('HTML 正文内容'),
145
+ ...CREATE_DOC_OPTIONALS,
146
+ }, ['name', 'folder_id', 'folder_type', 'author_id'], {
147
+ requiresConfirmation: true,
148
+ permissions: PERMISSION_FOLDER_CREATE_DOCUMENT,
149
+ }),
150
+ spec('document', 'create-markdown', 'create_markdown_document', 'high-risk-write', '在指定文件夹创建 Markdown 文档(源 create_markdown_document)', {
151
+ name: S('文档标题'),
152
+ folder_id: ID('目标文件夹 ID'),
153
+ folder_type: FOLDER_TYPE,
154
+ author_id: ID('作者(人员 ID)'),
155
+ summary: S('Markdown 正文内容;传 file_path 时其内容覆盖 summary,两者都可不传'),
156
+ file_path: FILE('本地 .md/.markdown 文件路径,读取内容覆盖 summary'),
157
+ ...CREATE_DOC_OPTIONALS,
158
+ }, ['name', 'folder_id', 'folder_type', 'author_id'], {
159
+ requiresConfirmation: true,
160
+ permissions: PERMISSION_FOLDER_CREATE_DOCUMENT,
161
+ }),
162
+ spec('document', 'create-office', 'create_office_document', 'read-with-upload', '上传 Office 文件并创建文档(源 create_office_document)', {
163
+ file_path: FILE('本地 Office 文件路径(.doc/.docx/.xls/.xlsx/.ppt/.pptx)'),
164
+ name: S('文档标题,缺省取文件名(不含扩展名)'),
165
+ folder_id: ID('目标文件夹 ID'),
166
+ folder_type: FOLDER_TYPE,
167
+ author_id: ID('作者(人员 ID)'),
168
+ ...CREATE_DOC_OPTIONALS,
169
+ }, ['file_path', 'folder_id', 'folder_type', 'author_id'], {
170
+ requiresConfirmation: true,
171
+ permissions: PERMISSION_FOLDER_CREATE_DOCUMENT,
172
+ }),
173
+ spec('document', 'create-by-upload', 'create_document_by_upload', 'read-with-upload', '批量上传文件直接建文档(源 create_document_by_upload)', {
174
+ file_paths: LIST('本地文件路径列表(最多并发 8 个)'),
175
+ folder_id: ID('目标文件夹 ID'),
176
+ folder_type: FOLDER_TYPE,
177
+ author_id: ID('作者(人员 ID),缺省取当前登录人'),
178
+ participant_ids: LIST('参与人(人员 ID)列表'),
179
+ keywords: S('关键词'),
180
+ abstract_text: S('摘要'),
181
+ auto_invalidate_date: S('自动失效日期(YYYY-MM-DD)'),
182
+ tags: LIST('标签列表', { type: 'object', additionalProperties: true }),
183
+ virtual_folder_ids: LIST('虚拟文件夹 ID 列表'),
184
+ doc_category: INT('文档类别:0=普通,1=重要', { enum: [0, 1], default: 0 }),
185
+ }, ['file_paths', 'folder_id', 'folder_type'], {
186
+ requiresConfirmation: true,
187
+ permissions: PERMISSION_FOLDER_CREATE_DOCUMENT,
188
+ }),
189
+ spec('document', 'update-field', 'update_doc_field', 'high-risk-write', '修改文档基础字段(源 update_doc_field)', {
190
+ doc_id: ID('文档 ID'),
191
+ field: S('字段名', { enum: [...DOC_UPDATE_FIELDS] }),
192
+ value: S('字段值(name 字段不允许空串)'),
193
+ }, ['doc_id', 'field', 'value'], { requiresConfirmation: true }),
194
+ spec('document', 'update-author', 'update_doc_author', 'high-risk-write', '变更文档作者(源 update_doc_author)', {
195
+ doc_id: ID('文档 ID'),
196
+ user_id: ID('新作者(人员 ID)'),
197
+ }, ['doc_id', 'user_id'], { requiresConfirmation: true }),
198
+ spec('document', 'update-html', 'update_doc_html_content', 'high-risk-write', '保存 HTML 正文并生成新版本(源 update_doc_html_content)', {
199
+ doc_id: ID('文档 ID'),
200
+ summary: S('HTML 正文内容'),
201
+ }, ['doc_id', 'summary'], { requiresConfirmation: true }),
202
+ spec('document', 'replace-content', 'replace_document_content', 'read-with-upload', '用本地文件替换文档正文(源 replace_document_content,走 reUpload)', {
203
+ file_path: FILE('本地文件路径,扩展名需与文档正文类型匹配'),
204
+ doc_id: ID('文档 ID'),
205
+ }, ['file_path', 'doc_id'], { requiresConfirmation: true }),
206
+ // ── folder ──────────────────────────────────────────────
207
+ spec('folder', 'create', 'create_folder', 'high-risk-write', '创建文件夹(源 create_folder)', {
208
+ name: S('文件夹名称'),
209
+ parent_id: ID('父文件夹 ID'),
210
+ parent_type: S('父文件夹类型', { enum: ['company', 'privy'] }),
211
+ sequence: INT('排序号,范围 -9999~99999;parent_type=privy 时强制为 0', { minimum: -9999, maximum: 99999, default: 0 }),
212
+ inherit_parent: BOOL('是否继承父文件夹设置;parent_type=privy 时强制为 false', { default: false }),
213
+ }, ['name', 'parent_id', 'parent_type'], { requiresConfirmation: true }),
214
+ spec('folder', 'search-virtual', 'search_virtual_folders', 'read', '检索虚拟文件夹(源 search_virtual_folders)', {
215
+ name: S('虚拟文件夹名称关键词'),
216
+ ...pageProps(50),
217
+ }),
218
+ spec('folder', 'query-by-name', 'query_folders_by_name', 'read', '按名称查询文件夹并展平为路径列表(源模板 FlattenSearchResultFolderTree)', {
219
+ folder_name: S('文件夹名称'),
220
+ kb_type: KB_TYPE,
221
+ }, ['folder_name'], { method: 'http_template' }),
222
+ spec('folder', 'get-settings', 'fetch_folder_default_settings', 'read', '查询文件夹默认设置(虚拟目录/默认参与人/默认共享)', {
223
+ folder_id: ID('文件夹 ID'),
224
+ }, ['folder_id'], { method: 'http_template' }),
225
+ spec('folder', 'list-default-shares', 'fetch_folder_default_shares', 'read', '查询文件夹文档默认共享人列表(源入参名为 folderId)', {
226
+ folder_id: ID('文件夹 ID'),
227
+ folderId: ID('旧名字段,等价 folder_id(已废弃,与新名同时出现且取值不一致会报 alias_conflict)'),
228
+ }, ['folder_id'], { deprecatedInputAliases: { folder_id: ['folderId'] } }),
229
+ spec('folder', 'default-share.form', 'fetch_folder_set_default_share_form', 'read', '查询“默认共享人”表单配置(对象类型 + 级联参数)', {
230
+ folder_id: ID('文件夹 ID'),
231
+ category: S('表单类别', { enum: ['creator', 'generic'] }),
232
+ }, ['folder_id', 'category']),
233
+ spec('folder', 'default-share.list', 'fetch_folder_set_default_share_list', 'read', '查询“默认共享人”设置列表', {
234
+ folder_id: ID('文件夹 ID'),
235
+ }, ['folder_id']),
236
+ spec('folder', 'default-share.add', 'add_folder_set_default_share', 'high-risk-write', '添加文件夹默认共享人', {
237
+ folder_id: ID('文件夹 ID'),
238
+ obj_type: S('共享对象类型(取自 default-share.form 的 obj_types[].id)'),
239
+ share_level: S('共享级别'),
240
+ ...SHARE_ID_FIELDS,
241
+ ...SHARE_OPTION_FIELDS,
242
+ seclevel_min: INT('密级下限,范围 -999~999', { minimum: -999, maximum: 999 }),
243
+ seclevel_max: INT('密级上限,范围 -999~999', { minimum: -999, maximum: 999 }),
244
+ }, ['folder_id', 'obj_type', 'share_level'], { requiresConfirmation: true }),
245
+ spec('folder', 'default-share.delete', 'delete_folder_set_default_share', 'high-risk-write', '删除文件夹默认共享人', {
246
+ folder_id: ID('文件夹 ID'),
247
+ ids: LIST('待删除条目 ID 列表'),
248
+ }, ['folder_id', 'ids'], { requiresConfirmation: true }),
249
+ spec('folder', 'permission.form', 'fetch_folder_permission_form', 'read', '查询文件夹文档权限设置的表单配置', {
250
+ folder_id: ID('文件夹 ID'),
251
+ permission_type: PERMISSION_TYPE,
252
+ }, ['folder_id', 'permission_type']),
253
+ spec('folder', 'permission.list', 'list_folder_permission', 'read', '查询文件夹文档权限设置列表', {
254
+ folder_id: ID('文件夹 ID'),
255
+ permission_type: PERMISSION_TYPE,
256
+ }, ['folder_id', 'permission_type']),
257
+ spec('folder', 'permission.add', 'add_folder_permission', 'high-risk-write', '添加文件夹文档权限设置', {
258
+ folder_id: ID('文件夹 ID'),
259
+ permission_type: PERMISSION_TYPE,
260
+ obj_type: S('权限对象类型'),
261
+ obj_id: LIST('对象 ID(人员等)'),
262
+ obj_id_department: LIST('部门 ID'),
263
+ obj_id_subcompany: LIST('分部 ID'),
264
+ obj_id_role: LIST('角色 ID'),
265
+ obj_id_position: LIST('岗位 ID'),
266
+ obj_id_customer: LIST('客户 ID'),
267
+ obj_id_customer_type: LIST('客户类型 ID'),
268
+ department_attribute: LIST('部门属性'),
269
+ role_level: S('角色层级'),
270
+ position_level: S('岗位层级'),
271
+ position_attribute: LIST('岗位属性'),
272
+ position_level_department: LIST('岗位层级-部门'),
273
+ position_level_subcompany: LIST('岗位层级-分部'),
274
+ }, ['folder_id', 'permission_type', 'obj_type'], { requiresConfirmation: true }),
275
+ spec('folder', 'permission.delete', 'delete_folder_permission', 'high-risk-write', '删除文件夹文档权限设置', {
276
+ folder_id: ID('文件夹 ID'),
277
+ permission_type: PERMISSION_TYPE,
278
+ ids: LIST('待删除条目 ID 列表'),
279
+ }, ['folder_id', 'permission_type', 'ids'], { requiresConfirmation: true }),
280
+ spec('folder', 'permission.get-auth', 'fetch_folder_permission_auth', 'read', '查询文件夹权限类型当前值(true/user/false)', {
281
+ folder_id: ID('文件夹 ID'),
282
+ permission_type: PERMISSION_TYPE,
283
+ }, ['folder_id', 'permission_type']),
284
+ spec('folder', 'permission.set-auth', 'update_folder_permission_auth', 'high-risk-write', '设置文件夹权限类型(true/user/false)', {
285
+ folder_id: ID('文件夹 ID'),
286
+ permission_type: PERMISSION_TYPE,
287
+ value: S('目标值', { enum: ['true', 'user', 'false'] }),
288
+ }, ['folder_id', 'permission_type', 'value'], { requiresConfirmation: true }),
289
+ spec('folder', 'permission.detail', 'fetch_folder_permission_detail', 'read', '查询文件夹单个设置项详情(含标题与人员明细)', {
290
+ folder_id: ID('文件夹 ID'),
291
+ setting_type: SETTING_TYPE,
292
+ }, ['folder_id', 'setting_type']),
293
+ spec('folder', 'permission.query', 'query_folder_permissions', 'read', '批量查询文件夹权限白名单字段(源模板 FilterFolderPermissionFields)', {
294
+ folder_ids: LIST('文件夹 ID 列表'),
295
+ }, ['folder_ids'], { method: 'http_template' }),
296
+ spec('folder', 'query-by-permission', 'query_folders_by_permission', 'read', '按权限类型 + 权限对象反查文件夹', {
297
+ permission_key: S('权限类型', { enum: [...FOLDER_PERMISSION_KEYS] }),
298
+ permissions: LIST('权限对象列表,如 [{"object_type":"all"}] 或 [{"object_type":"resource","object_ids":["123"]}]', {
299
+ type: 'object',
300
+ additionalProperties: false,
301
+ properties: {
302
+ object_type: S('对象类型'),
303
+ object_ids: LIST('对象 ID 列表(正整数)'),
304
+ },
305
+ required: ['object_type'],
306
+ }),
307
+ ...pageProps(20),
308
+ }, ['permission_key', 'permissions']),
309
+ spec('folder', 'permission.sync-setting', 'sync_folder_setting_permission', 'high-risk-write', '将当前文件夹的"管理员"权限设置同步到下级子文件夹', {
310
+ id: ID('文件夹 ID'),
311
+ keepOldSettingForAllFolders: BOOL('是否保留原有管理员设置(true=保留,false=不保留)'),
312
+ }, ['id'], { requiresConfirmation: true }),
313
+ // ── setting-attach ──────────────────────────────────────
314
+ spec('setting-attach', 'get', 'get_setting_attach', 'read', '读取附件设置(文件设置 → 附件设置)', {}, [], {
315
+ method: 'http_template',
316
+ }),
317
+ spec('setting-attach', 'list-workflows-by-folders', 'list_approval_workflows_by_folders', 'read', '通过文件夹 ID 反查哪些审批流程将这些文件夹设置为附件上传目录', {
318
+ folder_ids: LIST('文件夹 ID 列表'),
319
+ }, ['folder_ids'], {
320
+ method: 'http_template',
321
+ }),
322
+ spec('setting-attach', 'set', 'set_setting_attach', 'high-risk-write', '保存附件设置(只改指定字段,未指定字段透传原值)', {
323
+ items: {
324
+ type: 'object',
325
+ properties: {
326
+ 'upload-max': S('上传最大(如 2G、512MB)'),
327
+ 'shard-size': INT('上传分片大小(MB,1-50)'),
328
+ 'format-mode': S('格式控制方式(whitelist/blacklist)'),
329
+ 'format-list': S('格式列表(逗号分隔扩展名)'),
330
+ 'non-image-open': S('非图片打开方式(newTab/popupWindow)'),
331
+ 'image-open': S('图片打开方式(newTab/previewComponent)'),
332
+ 'show-attach-list': BOOL('预览显示附件列表'),
333
+ 'attach-expand': BOOL('附件列默认展开'),
334
+ 'custom-msg': S('附加提示(true::文本 或 false)'),
335
+ 'batch-download': BOOL('附件批量下载'),
336
+ 'mobile-block': BOOL('禁止移动端下载'),
337
+ },
338
+ additionalProperties: false,
339
+ },
340
+ }, ['items'], { requiresConfirmation: true }),
341
+ // ── setting-backup ──────────────────────────────────────
342
+ spec('setting-backup', 'get', 'get_setting_backup', 'read', '读取备份开关状态(文件设置 → 备份设置)', {}, [], {
343
+ method: 'http_template',
344
+ }),
345
+ spec('setting-backup', 'set', 'set_setting_backup', 'high-risk-write', '设置备份开关', {
346
+ enabled: BOOL('是否启用本地备份'),
347
+ }, ['enabled'], { requiresConfirmation: true }),
348
+ spec('setting-backup', 'rule.list', 'list_backup_rules', 'read', '列出备份规则', {
349
+ ...pageProps(20),
350
+ }),
351
+ spec('setting-backup', 'rule.get', 'get_backup_rule', 'read', '获取备份规则详情', {
352
+ id: ID('规则 ID'),
353
+ }, ['id']),
354
+ spec('setting-backup', 'rule.update', 'update_backup_rule', 'high-risk-write', '更新备份规则', {
355
+ id: ID('规则 ID'),
356
+ name: S('规则名称'),
357
+ path: S('备份路径'),
358
+ period: INT('备份周期(分钟,60-1440)'),
359
+ }, ['id'], { requiresConfirmation: true }),
360
+ spec('setting-backup', 'rule.delete', 'delete_backup_rule', 'high-risk-write', '删除备份规则', {
361
+ id: ID('规则 ID'),
362
+ }, ['id'], { requiresConfirmation: true }),
363
+ spec('setting-backup', 'rule.enable', 'enable_backup_rule', 'high-risk-write', '启停备份规则', {
364
+ id: ID('规则 ID'),
365
+ enabled: BOOL('是否启用'),
366
+ }, ['id', 'enabled'], { requiresConfirmation: true }),
367
+ // ── setting-encrypt ─────────────────────────────────────
368
+ spec('setting-encrypt', 'get', 'get_setting_encrypt', 'read', '读取加解密设置(文件设置 → 加解密设置)', {}, [], {
369
+ method: 'http_template',
370
+ }),
371
+ spec('setting-encrypt', 'set', 'set_setting_encrypt', 'high-risk-write', '保存加解密设置(整对象 POST)', {
372
+ items: {
373
+ type: 'object',
374
+ properties: {
375
+ 'enabled': BOOL('是否启用加解密功能'),
376
+ 'plugs': S('加解密插件类型'),
377
+ 'url': S('加解密服务地址'),
378
+ 'scene': S('加解密场景(uploadAndDownloadEncrypt/uploadEncrypt/downloadEncrypt/custom)'),
379
+ 'upload-encrypted': S('加密文件上传规则'),
380
+ 'download-encrypted': S('加密文件下载规则'),
381
+ 'upload-unencrypted': S('未加密文件上传规则'),
382
+ 'download-unencrypted': S('未加密文件下载规则'),
383
+ },
384
+ additionalProperties: false,
385
+ },
386
+ }, ['items'], { requiresConfirmation: true }),
387
+ // ── setting-storage ─────────────────────────────────────
388
+ spec('setting-storage', 'instance.list', 'list_storage_instances', 'read', '列出存储实例', {
389
+ ...pageProps(20),
390
+ }),
391
+ spec('setting-storage', 'instance.get', 'get_storage_instance', 'read', '获取存储实例详情', {
392
+ id: ID('实例 ID'),
393
+ instance_type: S('实例类型(可选)'),
394
+ }, ['id']),
395
+ spec('setting-storage', 'rule.form', 'get_rule_form', 'read', '拉规则表单', {
396
+ id: ID('规则 ID(可选,不传拉默认)'),
397
+ }),
398
+ spec('setting-storage', 'rule.table', 'get_rule_table', 'read', '拉规则表', {}, [], {
399
+ method: 'http_template',
400
+ }),
401
+ spec('setting-storage', 'rule.search', 'search_rules', 'read', '高级搜索规则', {
402
+ conditions: LIST('搜索条件数组', {
403
+ type: 'object',
404
+ properties: {
405
+ field: S('字段名'),
406
+ value: S('值'),
407
+ operate: S('操作符'),
408
+ },
409
+ required: ['field', 'value', 'operate'],
410
+ }),
411
+ rule_type: S('规则类型(可选)'),
412
+ }),
413
+ spec('setting-storage', 'rule.save', 'save_rule', 'high-risk-write', '保存存储规则', {
414
+ rule_info_list: LIST('规则信息列表', {
415
+ type: 'object',
416
+ additionalProperties: true,
417
+ }),
418
+ default_rule: BOOL('是否默认规则'),
419
+ }, ['rule_info_list'], { requiresConfirmation: true }),
420
+ spec('setting-storage', 'rule.delete', 'delete_rule', 'high-risk-write', '删除存储规则', {
421
+ rule_ids: LIST('规则 ID 列表'),
422
+ }, ['rule_ids'], { requiresConfirmation: true }),
423
+ spec('setting-storage', 'rule.enable', 'enable_rule', 'high-risk-write', '启停存储规则', {
424
+ rule_info_list: LIST('规则信息列表(含 id 和 openStatus)', {
425
+ type: 'object',
426
+ properties: {
427
+ id: ID('规则 ID'),
428
+ openStatus: BOOL('是否启用'),
429
+ },
430
+ required: ['id', 'openStatus'],
431
+ }),
432
+ }, ['rule_info_list'], { requiresConfirmation: true }),
433
+ spec('setting-storage', 'rule.order', 'save_rule_order', 'high-risk-write', '改规则顺序', {
434
+ rule_ids: LIST('规则 ID 列表(按顺序)'),
435
+ }, ['rule_ids'], { requiresConfirmation: true }),
436
+ // ── file-collection ─────────────────────────────────────
437
+ spec('file-collection', 'task.list', 'list_collection_tasks', 'read', '列出采集任务', {}, [], {
438
+ method: 'http_template',
439
+ }),
440
+ spec('file-collection', 'task.form', 'get_collection_task_form', 'read', '获取采集任务表单', {
441
+ id: ID('任务 ID(可选)'),
442
+ }),
443
+ spec('file-collection', 'task.save', 'save_collection_task', 'high-risk-write', '保存采集任务', {
444
+ source_id: ID('FTP/SFTP 资源 ID'),
445
+ workflow_id: ID('动作流 ID'),
446
+ task_name: S('任务名称(可选,不传时自动生成)'),
447
+ retain_dir_struct: BOOL('是否维持原目录结构(默认 true)'),
448
+ task_file_path: S('采集路径(默认 /)'),
449
+ }, ['source_id', 'workflow_id'], { requiresConfirmation: true }),
450
+ spec('file-collection', 'storage.check', 'check_collection_storage', 'read', '检查存储连接', {}, [], {
451
+ method: 'http_template',
452
+ }),
453
+ spec('file-collection', 'scan', 'scan_collection', 'high-risk-write', '扫描采集任务', {
454
+ task_id: ID('任务 ID'),
455
+ full_coll: BOOL('是否全量扫描(默认增量)'),
456
+ }, ['task_id'], { requiresConfirmation: true }),
457
+ spec('file-collection', 'scan.progress', 'scan_collection_progress', 'read', '查询扫描进度', {}, [], {
458
+ method: 'http_template',
459
+ }),
460
+ spec('file-collection', 'run', 'run_collection', 'high-risk-write', '运行/暂停采集任务', {
461
+ task_id: ID('任务 ID'),
462
+ action: S('操作类型(run/pause)'),
463
+ }, ['task_id', 'action'], { requiresConfirmation: true }),
464
+ spec('file-collection', 'run.progress', 'run_collection_progress', 'read', '查询运行进度', {}, [], {
465
+ method: 'http_template',
466
+ }),
467
+ spec('file-collection', 'detail', 'get_collection_detail', 'read', '查询采集详情', {}, [], {
468
+ method: 'http_template',
469
+ }),
470
+ spec('file-collection', 'cancel', 'cancel_collection', 'high-risk-write', '取消采集任务', {
471
+ task_id: ID('任务 ID'),
472
+ }, ['task_id'], { requiresConfirmation: true }),
473
+ spec('file-collection', 'delete', 'delete_collection_task', 'high-risk-write', '删除采集任务', {
474
+ task_id: ID('任务 ID'),
475
+ }, ['task_id'], { requiresConfirmation: true }),
476
+ // ── file-collection: 任务管理补充 ─────────────────────────
477
+ spec('file-collection', 'task.switch', 'switch_collection_task', 'high-risk-write', '切换采集任务启用/禁用状态', {
478
+ task_id: ID('任务 ID'),
479
+ task_status: INT('任务状态码'),
480
+ task_switch: BOOL('是否启用'),
481
+ }, ['task_id', 'task_status', 'task_switch'], { requiresConfirmation: true }),
482
+ spec('file-collection', 'task.save-as', 'save_as_collection_task', 'high-risk-write', '另存为采集任务副本', {
483
+ task_id: ID('源任务 ID'),
484
+ }, ['task_id'], { requiresConfirmation: true }),
485
+ spec('file-collection', 'task.update-fonds', 'update_collection_task_fonds', 'high-risk-write', '更新采集任务的全宗 ID(用于归档分支)', {
486
+ task_id: ID('任务 ID'),
487
+ fonds_id: ID('全宗 ID'),
488
+ }, ['task_id', 'fonds_id'], { requiresConfirmation: true }),
489
+ // ── file-collection: 连接器/资源管理 ─────────────────────
490
+ spec('file-collection', 'connector.query', 'query_collection_connectors', 'read', '查询 FTP/SFTP 连接器列表及其资源', {
491
+ name: S('连接器名称过滤(可选)'),
492
+ protocol_type: S('协议类型过滤', { default: 'nas,ftp,sftp' }),
493
+ ...pageProps(20),
494
+ max_pages: INT('最大翻页数', { minimum: 1, default: 5 }),
495
+ }),
496
+ spec('file-collection', 'connector.create', 'create_collection_connector', 'high-risk-write', '创建 FTP 连接器', {
497
+ name: S('连接器名称(可选,不传时自动生成)'),
498
+ company: S('公司名称', { default: '文件采集' }),
499
+ }, [], { requiresConfirmation: true }),
500
+ spec('file-collection', 'resource.create', 'create_collection_resource', 'high-risk-write', '创建 FTP/SFTP 资源连接', {
501
+ system_pk: ID('连接器 ID(不传时自动创建连接器)'),
502
+ name: S('资源名称', { default: '文件采集FTP连接' }),
503
+ remote_host: S('FTP 服务器地址'),
504
+ remote_port: S('FTP 端口'),
505
+ remote_username: S('FTP 用户名'),
506
+ remote_password: S('FTP 密码'),
507
+ transfer_protocol: S('传输协议', { enum: ['FTP', 'SFTP'] }),
508
+ }, ['remote_host', 'remote_port', 'remote_username', 'remote_password', 'transfer_protocol'], { requiresConfirmation: true }),
509
+ // ── file-collection: 动作流管理 ─────────────────────────
510
+ spec('file-collection', 'workflow.search', 'search_collection_workflows', 'read', '搜索动作流应用列表', {
511
+ name_contains: S('名称过滤关键词(可选)'),
512
+ ...pageProps(50),
513
+ }),
514
+ spec('file-collection', 'workflow.inspect', 'inspect_collection_workflow', 'read', '检测动作流是否兼容文件采集', {
515
+ application_id: ID('动作流应用 ID'),
516
+ archive_required: BOOL('是否需要归档兼容', { default: false }),
517
+ retain_dir_struct: BOOL('是否维持原目录结构', { default: false }),
518
+ }, ['application_id']),
519
+ spec('file-collection', 'workflow.create', 'create_collection_workflow', 'high-risk-write', '动态创建文件采集动作流', {
520
+ name: S('动作流名称(可选,不传时自动生成)'),
521
+ archive_required: BOOL('是否需要归档兼容', { default: false }),
522
+ retain_dir_struct: BOOL('是否维持原目录结构', { default: false }),
523
+ }, [], { requiresConfirmation: true }),
524
+ spec('file-collection', 'workflow.enable', 'enable_collection_workflow', 'high-risk-write', '启用动作流应用', {
525
+ application_id: ID('动作流应用 ID'),
526
+ }, ['application_id'], { requiresConfirmation: true }),
527
+ spec('file-collection', 'workflow.update-task', 'update_collection_task_workflow', 'high-risk-write', '更新采集任务关联的动作流 ID', {
528
+ task_id: ID('任务 ID'),
529
+ workflow_id: ID('新动作流 ID'),
530
+ }, ['task_id', 'workflow_id'], { requiresConfirmation: true }),
531
+ // ── file-collection: 等待与结果验证 ─────────────────────
532
+ spec('file-collection', 'scan.wait', 'wait_scan_completion', 'read', '轮询扫描进度直到完成', {
533
+ runtime_id: S('扫描运行时 ID(来自 scan.apply 返回)'),
534
+ timeout_seconds: INT('超时秒数', { minimum: 1, default: 300 }),
535
+ interval_seconds: INT('轮询间隔秒数', { minimum: 1, default: 3 }),
536
+ }, ['runtime_id']),
537
+ spec('file-collection', 'run.result', 'get_collection_run_result', 'read', '查询采集运行结果并归一化', {
538
+ task_id: ID('任务 ID'),
539
+ }, ['task_id']),
540
+ // ── file-upload ─────────────────────────────────────────
541
+ spec('file-upload', 'contract', 'get_upload_contract', 'read', '获取上传接口合约', {}, [], {
542
+ method: 'http_template',
543
+ }),
544
+ spec('file-upload', 'prepare', 'prepare_upload', 'read', '准备上传(本地文件校验与元数据)', {
545
+ file_path: FILE('本地文件绝对路径'),
546
+ module: S('业务模块(如 document、workflow 等)'),
547
+ }, ['file_path', 'module']),
548
+ spec('file-upload', 'upload', 'upload_file', 'high-risk-write', '上传文件到文件服务', {
549
+ file_path: FILE('本地文件绝对路径'),
550
+ module: S('业务模块(如 document、workflow 等)'),
551
+ user_confirmed: BOOL('用户已确认上传'),
552
+ }, ['file_path', 'module', 'user_confirmed'], { requiresConfirmation: true }),
553
+ // ── org ─────────────────────────────────────────────────
554
+ spec('org', 'search-user', 'search_user', 'read', '人员浏览器检索(源 search_user → /api/hrm/common/browser/data/resource)', {
555
+ keyword: S('检索关键词(按 username 快搜)'),
556
+ ...pageProps(50),
557
+ }),
558
+ spec('org', 'search-department', 'search_department', 'read', '部门浏览器检索(源 search_department)', {
559
+ keyword: S('检索关键词'),
560
+ ...pageProps(50),
561
+ }),
562
+ spec('org', 'search-subcompany', 'search_subcompany', 'read', '分部/子公司浏览器检索(源 search_subcompany)', {
563
+ keyword: S('检索关键词'),
564
+ ...pageProps(50),
565
+ }),
566
+ spec('org', 'search-external', 'search_external', 'read', '外部人员浏览器检索(源 search_external)', {
567
+ keyword: S('检索关键词'),
568
+ ...pageProps(50),
569
+ }),
570
+ spec('org', 'search-position', 'search_position', 'read', '岗位浏览器检索(源 search_position)', {
571
+ keyword: S('检索关键词'),
572
+ ...pageProps(50),
573
+ }),
574
+ spec('org', 'search-role', 'search_role', 'read', '角色浏览器检索(源 search_role)', {
575
+ keyword: S('检索关键词'),
576
+ ...pageProps(50),
577
+ }),
578
+ spec('org', 'search-customer', 'search_customer', 'read', 'CRM 客户浏览器检索(源 search_customer)', {
579
+ keyword: S('检索关键词'),
580
+ ...pageProps(50),
581
+ }),
582
+ spec('org', 'search-customer-type', 'search_customer_type', 'read', 'CRM 客户类型字典检索(源 search_customer_type)', {
583
+ keyword: S('检索关键词'),
584
+ ...pageProps(50),
585
+ }),
586
+ // ── user ────────────────────────────────────────────────
587
+ spec('user', 'current', 'fetch_current_user_info', 'read', '获取当前登录人信息(employeeId / employeeName)', {}, [], {
588
+ method: 'http_template',
589
+ }),
590
+ // ── tag ─────────────────────────────────────────────────
591
+ spec('tag', 'search', 'search_tags', 'read', '检索标签(type=0 公共标签限定 document 模块,type=1 个人标签)', {
592
+ name: S('标签名称关键词'),
593
+ type: INT('标签类型:0=公共,1=个人', { enum: [0, 1] }),
594
+ ...pageProps(50),
595
+ }, ['type']),
596
+ spec('tag', 'list', 'fetch_doc_tags', 'read', '查询文档已打标签(公共 + 个人合并)', {
597
+ doc_id: ID('文档 ID'),
598
+ }, ['doc_id']),
599
+ spec('tag', 'add', 'add_doc_tag', 'high-risk-write', '为文档添加标签', {
600
+ doc_id: ID('文档 ID'),
601
+ tags: LIST('标签列表,元素形如 {"id":"1","privacy":false} 或 {"name":"xx","privacy":true}', {
602
+ type: 'object',
603
+ additionalProperties: true,
604
+ }),
605
+ }, ['doc_id', 'tags'], { requiresConfirmation: true }),
606
+ spec('tag', 'remove', 'remove_doc_tag', 'high-risk-write', '移除文档标签', {
607
+ doc_id: ID('文档 ID'),
608
+ tags: LIST('标签列表,元素形如 {"id":"1","privacy":false}', { type: 'object', additionalProperties: true }),
609
+ }, ['doc_id', 'tags'], { requiresConfirmation: true }),
610
+ // ── participant ─────────────────────────────────────────
611
+ spec('participant', 'list', 'fetch_doc_participants', 'read', '查询文档参与人列表', {
612
+ doc_id: ID('文档 ID'),
613
+ }, ['doc_id']),
614
+ spec('participant', 'add', 'add_doc_participant', 'high-risk-write', '添加文档参与人', {
615
+ doc_id: ID('文档 ID'),
616
+ user_id: ID('人员 ID'),
617
+ }, ['doc_id', 'user_id'], { requiresConfirmation: true }),
618
+ spec('participant', 'remove', 'remove_doc_participant', 'high-risk-write', '移除文档参与人', {
619
+ share_entry_id: ID('共享条目 ID(来自 participant.list)'),
620
+ doc_id: ID('文档 ID'),
621
+ }, ['share_entry_id', 'doc_id'], { requiresConfirmation: true }),
622
+ // ── share ───────────────────────────────────────────────
623
+ spec('share', 'form', 'fetch_doc_share_form', 'read', '查询文档共享表单配置(对象类型 + 级联参数)', {
624
+ doc_id: ID('文档 ID'),
625
+ }, ['doc_id']),
626
+ spec('share', 'list', 'fetch_doc_share_list', 'read', '查询文档共享列表(含 download / can_delete)', {
627
+ doc_id: ID('文档 ID'),
628
+ }, ['doc_id']),
629
+ spec('share', 'add', 'add_doc_share', 'high-risk-write', '添加文档共享', {
630
+ doc_id: ID('文档 ID'),
631
+ obj_type: S('共享对象类型'),
632
+ share_level: S('共享级别'),
633
+ ...SHARE_ID_FIELDS,
634
+ ...SHARE_OPTION_FIELDS,
635
+ }, ['doc_id', 'obj_type', 'share_level'], { requiresConfirmation: true }),
636
+ spec('share', 'delete', 'delete_doc_share', 'high-risk-write', '删除文档共享', {
637
+ doc_id: ID('文档 ID'),
638
+ ids: LIST('待删除共享条目 ID 列表'),
639
+ }, ['doc_id', 'ids'], { requiresConfirmation: true }),
640
+ // ── attachment ──────────────────────────────────────────
641
+ spec('attachment', 'upload', 'upload_attachment_to_doc', 'read-with-upload', '向文档上传附件', {
642
+ file_path: FILE('本地文件路径'),
643
+ doc_id: ID('文档 ID'),
644
+ folder_id: ID('文档所属文件夹 ID'),
645
+ }, ['file_path', 'doc_id'], { requiresConfirmation: true }),
646
+ spec('attachment', 'replace', 'replace_document_attachment', 'read-with-upload', '替换文档附件(reUpload,保留附件 ID)', {
647
+ file_path: FILE('本地文件路径'),
648
+ doc_id: ID('文档 ID'),
649
+ attachment_id: ID('被替换的附件 ID'),
650
+ folder_id: ID('文档所属文件夹 ID'),
651
+ }, ['file_path', 'doc_id', 'attachment_id', 'folder_id'], { requiresConfirmation: true }),
652
+ spec('attachment', 'download', 'download_doc_attachment', 'local-file-write', '下载文档附件到本地(写本地磁盘,不改服务端)', {
653
+ attachment_id: ID('附件 ID'),
654
+ doc_id: ID('文档 ID'),
655
+ save_path: FILE('保存路径(完整文件路径或目录)'),
656
+ }, ['attachment_id', 'doc_id']),
657
+ spec('attachment', 'download-as-pdf', 'download_doc_attachment_to_pdf', 'local-file-write', '下载文档附件的 PDF 转换版本(写本地磁盘)', {
658
+ attachment_id: ID('附件 ID'),
659
+ doc_id: ID('文档 ID'),
660
+ save_path: FILE('保存路径(完整文件路径或目录)'),
661
+ }, ['attachment_id', 'doc_id']),
662
+ // ── cover ───────────────────────────────────────────────
663
+ spec('cover', 'upload', 'upload_cover_image', 'read-with-upload', '上传封面图片,仅返回 file_id(不改文档)', {
664
+ file_path: FILE('本地图片路径(.png/.jpg/.jpeg/.gif/.webp/.bmp)'),
665
+ }, ['file_path'], { requiresConfirmation: true }),
666
+ spec('cover', 'set', 'set_doc_cover', 'read-with-upload', '上传图片并设为文档封面', {
667
+ doc_id: ID('文档 ID'),
668
+ file_path: FILE('本地图片路径'),
669
+ }, ['doc_id', 'file_path'], { requiresConfirmation: true }),
670
+ spec('cover', 'remove', 'remove_doc_cover', 'high-risk-write', '移除文档封面', {
671
+ doc_id: ID('文档 ID'),
672
+ }, ['doc_id'], { requiresConfirmation: true }),
673
+ // ── compare ─────────────────────────────────────────────
674
+ spec('compare', 'search-documents', 'search_doc_compare_documents', 'read', '文档比对:检索可比对文档', {
675
+ name: S('文档名称'),
676
+ author: S('作者'),
677
+ creator: S('创建人'),
678
+ create_time: S('创建时间范围'),
679
+ folder: S('所属文件夹'),
680
+ ...pageProps(20),
681
+ }),
682
+ spec('compare', 'list-file-objects', 'doc_compare_query_file_objects', 'read', '文档比对:列出文档下可比对的文件对象', {
683
+ doc_id: ID('文档 ID'),
684
+ }, ['doc_id']),
685
+ spec('compare', 'upload-file', 'doc_compare_upload_file', 'read-with-upload', '文档比对:上传本地文件参与比对', {
686
+ file_path: FILE('本地文件路径'),
687
+ }, ['file_path'], {
688
+ requiresConfirmation: true,
689
+ permissions: PERMISSION_COMPARE_UPLOAD,
690
+ }),
691
+ spec('compare', 'submit', 'doc_compare_upload_compared', 'external-artifact', '文档比对:提交左右文件生成比对链接(外部制品)', {
692
+ left_file_id: ID('左侧文件 ID'),
693
+ right_file_id: ID('右侧文件 ID'),
694
+ }, ['left_file_id', 'right_file_id'], { requiresConfirmation: true }),
695
+ // ── system ──────────────────────────────────────────────
696
+ spec('system', 'health', 'check_system_health', 'read', '采知连接口连通性与登录态自检', {}),
697
+ ];
698
+ export const CAIZHILIAN_SPECS_BY_NAME = new Map(caizhilianOperationSpecs.map((item) => [item.name, item]));