weaver-work-cli 0.1.8 → 0.1.20

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 (263) hide show
  1. package/README.md +11 -11
  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 +432 -0
  14. package/dist/core/state.js +26 -0
  15. package/dist/internal/e10/auth/commands.js +2 -2
  16. package/dist/internal/e10/auth/session.js +14 -0
  17. package/dist/internal/e10/auth/xiaoe.js +116 -51
  18. package/dist/internal/e10/request-runtime.js +5 -0
  19. package/dist/internal/skills/install.js +148 -28
  20. package/dist/internal/skills/reader.js +12 -9
  21. package/dist/shortcuts/blog/continuation.js +74 -0
  22. package/dist/shortcuts/blog/errors.js +60 -0
  23. package/dist/shortcuts/blog/host.js +175 -0
  24. package/dist/shortcuts/blog/index.js +324 -0
  25. package/dist/shortcuts/blog/manifest.js +415 -0
  26. package/dist/shortcuts/blog/operations/comment.js +125 -0
  27. package/dist/shortcuts/blog/operations/comments.js +31 -0
  28. package/dist/shortcuts/blog/operations/edit.js +131 -0
  29. package/dist/shortcuts/blog/operations/export.js +46 -0
  30. package/dist/shortcuts/blog/operations/like.js +80 -0
  31. package/dist/shortcuts/blog/operations/publish.js +157 -0
  32. package/dist/shortcuts/blog/operations/query-user.js +58 -0
  33. package/dist/shortcuts/blog/operations/query.js +96 -0
  34. package/dist/shortcuts/blog/operations/registry.js +54 -0
  35. package/dist/shortcuts/blog/operations/remind.js +176 -0
  36. package/dist/shortcuts/blog/operations/shared.js +330 -0
  37. package/dist/shortcuts/blog/operations/types.js +16 -0
  38. package/dist/shortcuts/blog/operations.js +9 -0
  39. package/dist/shortcuts/caizhilian/continuation.js +70 -0
  40. package/dist/shortcuts/caizhilian/errors.js +53 -0
  41. package/dist/shortcuts/caizhilian/host.js +190 -0
  42. package/dist/shortcuts/caizhilian/index.js +186 -0
  43. package/dist/shortcuts/caizhilian/manifest.js +42 -0
  44. package/dist/shortcuts/caizhilian/operations/api.js +801 -0
  45. package/dist/shortcuts/caizhilian/operations/confirm.js +75 -0
  46. package/dist/shortcuts/caizhilian/operations/files.js +306 -0
  47. package/dist/shortcuts/caizhilian/operations/form.js +170 -0
  48. package/dist/shortcuts/caizhilian/operations/handlers/collab.js +611 -0
  49. package/dist/shortcuts/caizhilian/operations/handlers/document.js +890 -0
  50. package/dist/shortcuts/caizhilian/operations/handlers/file-collection.js +346 -0
  51. package/dist/shortcuts/caizhilian/operations/handlers/file-upload.js +192 -0
  52. package/dist/shortcuts/caizhilian/operations/handlers/fileops.js +570 -0
  53. package/dist/shortcuts/caizhilian/operations/handlers/folder.js +969 -0
  54. package/dist/shortcuts/caizhilian/operations/handlers/search.js +318 -0
  55. package/dist/shortcuts/caizhilian/operations/handlers/setting-attach.js +294 -0
  56. package/dist/shortcuts/caizhilian/operations/handlers/setting-backup.js +423 -0
  57. package/dist/shortcuts/caizhilian/operations/handlers/setting-encrypt.js +238 -0
  58. package/dist/shortcuts/caizhilian/operations/handlers/setting-storage.js +364 -0
  59. package/dist/shortcuts/caizhilian/operations/handlers/system.js +106 -0
  60. package/dist/shortcuts/caizhilian/operations/registry.js +151 -0
  61. package/dist/shortcuts/caizhilian/operations/shared.js +408 -0
  62. package/dist/shortcuts/caizhilian/operations/specs.js +623 -0
  63. package/dist/shortcuts/caizhilian/operations/types.js +57 -0
  64. package/dist/shortcuts/caizhilian/operations.js +21 -0
  65. package/dist/shortcuts/contract/continuation.js +70 -0
  66. package/dist/shortcuts/contract/errors.js +62 -0
  67. package/dist/shortcuts/contract/host.js +205 -0
  68. package/dist/shortcuts/contract/index.js +318 -0
  69. package/dist/shortcuts/contract/manifest.js +596 -0
  70. package/dist/shortcuts/contract/operations/clause-reference.js +78 -0
  71. package/dist/shortcuts/contract/operations/form-info.js +371 -0
  72. package/dist/shortcuts/contract/operations/read.js +118 -0
  73. package/dist/shortcuts/contract/operations/registry.js +43 -0
  74. package/dist/shortcuts/contract/operations/request.js +300 -0
  75. package/dist/shortcuts/contract/operations/shared.js +133 -0
  76. package/dist/shortcuts/contract/operations/subject.js +157 -0
  77. package/dist/shortcuts/contract/operations/template.js +81 -0
  78. package/dist/shortcuts/contract/operations/types.js +7 -0
  79. package/dist/shortcuts/contract/operations/workflow.js +52 -0
  80. package/dist/shortcuts/contract/operations/write.js +131 -0
  81. package/dist/shortcuts/contract/operations.js +8 -0
  82. package/dist/shortcuts/hrm/index.js +83 -2
  83. package/dist/shortcuts/hrm/operations/employee.js +160 -30
  84. package/dist/shortcuts/hrm/operations/org.js +17 -3
  85. package/dist/shortcuts/hrm/operations/position.js +18 -2
  86. package/dist/shortcuts/index.js +5 -1
  87. package/dist/shortcuts/invoice/index.js +74 -36
  88. package/dist/shortcuts/invoice/manifest.js +674 -4
  89. package/dist/shortcuts/invoice/markdown.js +172 -0
  90. package/dist/shortcuts/invoice/operations/add.js +3 -3
  91. package/dist/shortcuts/invoice/operations/delete.js +2 -2
  92. package/dist/shortcuts/invoice/operations/get.js +10 -2
  93. package/dist/shortcuts/invoice/operations/import.js +2 -2
  94. package/dist/shortcuts/invoice/operations/registry.js +8 -1
  95. package/dist/shortcuts/invoice/operations/reim-auto.js +719 -0
  96. package/dist/shortcuts/invoice/operations/reim.js +85 -2
  97. package/dist/shortcuts/invoice/operations/shared.js +75 -8
  98. package/dist/shortcuts/invoice/operations/update.js +2 -2
  99. package/dist/shortcuts/invoice/operations/upload-and-validate.js +93 -0
  100. package/dist/shortcuts/invoice/operations/validate-preview.js +2 -1
  101. package/dist/shortcuts/invoice/projection.js +328 -0
  102. package/dist/shortcuts/meeting/host.js +18 -1
  103. package/dist/shortcuts/meeting/manifest.js +30 -18
  104. package/dist/shortcuts/meeting/operations/eb/catalog.js +390 -0
  105. package/dist/shortcuts/meeting/operations/eb/conflict.js +389 -0
  106. package/dist/shortcuts/meeting/operations/eb/factory.js +389 -0
  107. package/dist/shortcuts/meeting/operations/eb/index.js +22 -0
  108. package/dist/shortcuts/meeting/operations/env.js +8 -1
  109. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  110. package/dist/shortcuts/meeting/operations/signs.js +216 -2
  111. package/dist/shortcuts/workflow/endpoints.js +2 -1
  112. package/dist/shortcuts/workflow/errors.js +8 -2
  113. package/dist/shortcuts/workflow/host.js +6 -3
  114. package/dist/shortcuts/workflow/operations/form.js +931 -589
  115. package/dist/shortcuts/workflow/operations/read.js +128 -205
  116. package/dist/shortcuts/workflow/operations/shared.js +21 -0
  117. package/dist/shortcuts/workflow/operations/write.js +750 -52
  118. package/dist/shortcuts/workflow/operations.js +36 -10
  119. package/docs/_catalog.md +6 -0
  120. package/docs/agent-invoice.md +5 -1
  121. package/docs/agent-io-channel-design.md +468 -0
  122. package/docs/agent-skill-install.md +9 -4
  123. package/docs/blog.md +123 -0
  124. package/docs/caizhilian.md +304 -0
  125. package/docs/contract.md +91 -0
  126. package/docs/e10-auth.md +2 -2
  127. package/docs/hrm.md +19 -9
  128. package/docs/invoice.md +5 -1
  129. package/docs/meeting.md +1 -1
  130. package/docs/operation-manual.md +15 -3
  131. package/docs/skill-review-2026-09-19.md +2 -2
  132. package/package.json +2 -2
  133. package/scripts/package-skill.mjs +32 -20
  134. package/skill-template/business-info.json +113 -14
  135. package/skill-template/domains/blog.md +24 -0
  136. package/skill-template/domains/caizhilian.md +22 -0
  137. package/skill-template/domains/jinchengda.md +23 -0
  138. package/skill-template/domains/meeting.md +1 -1
  139. package/skill-template/domains/workflow.md +1 -1
  140. package/skill-template/skill-template.md +1 -1
  141. package/skills/weaver-e10-blog/SKILL.md +111 -0
  142. package/skills/weaver-e10-blog/references/blog-comment.md +51 -0
  143. package/skills/weaver-e10-blog/references/blog-comments.md +39 -0
  144. package/skills/weaver-e10-blog/references/blog-default-permission.md +38 -0
  145. package/skills/weaver-e10-blog/references/blog-disabled-capabilities.md +11 -0
  146. package/skills/weaver-e10-blog/references/blog-edit.md +51 -0
  147. package/skills/weaver-e10-blog/references/blog-export.md +42 -0
  148. package/skills/weaver-e10-blog/references/blog-like.md +50 -0
  149. package/skills/weaver-e10-blog/references/blog-publish.md +52 -0
  150. package/skills/weaver-e10-blog/references/blog-query-user.md +45 -0
  151. package/skills/weaver-e10-blog/references/blog-query.md +49 -0
  152. package/skills/weaver-e10-blog/references/blog-remind.md +51 -0
  153. package/skills/weaver-e10-blog/references/blog-resolve-users.md +38 -0
  154. package/skills/weaver-e10-blog/references/source-manifest.json +1540 -0
  155. package/skills/weaver-e10-caizhilian/SKILL.md +216 -0
  156. package/skills/weaver-e10-caizhilian/references/agent-entry.md +106 -0
  157. package/skills/weaver-e10-caizhilian/references/collaboration.md +112 -0
  158. package/skills/weaver-e10-caizhilian/references/document.md +111 -0
  159. package/skills/weaver-e10-caizhilian/references/file-collection.md +136 -0
  160. package/skills/weaver-e10-caizhilian/references/file-upload.md +309 -0
  161. package/skills/weaver-e10-caizhilian/references/files.md +120 -0
  162. package/skills/weaver-e10-caizhilian/references/folder.md +118 -0
  163. package/skills/weaver-e10-caizhilian/references/org-browser.md +104 -0
  164. package/skills/weaver-e10-caizhilian/references/setting-attach.md +410 -0
  165. package/skills/weaver-e10-caizhilian/references/setting-backup.md +372 -0
  166. package/skills/weaver-e10-caizhilian/references/setting-encrypt.md +399 -0
  167. package/skills/weaver-e10-caizhilian/references/setting-storage.md +603 -0
  168. package/skills/weaver-e10-caizhilian/references/source-manifest.json +5079 -0
  169. package/skills/weaver-e10-caizhilian/references/withheld.md +93 -0
  170. package/skills/weaver-e10-caizhilian/references/write-protocol.md +120 -0
  171. package/skills/weaver-e10-calendar/SKILL.md +4 -3
  172. package/skills/weaver-e10-ebuilder-form/SKILL.md +4 -9
  173. package/skills/weaver-e10-ebuilder-form/references/context-routing.md +0 -9
  174. package/skills/weaver-e10-ebuilder-form/references/custom-api.md +1 -5
  175. package/skills/weaver-e10-ebuilder-form/references/fields-browser.md +1 -5
  176. package/skills/weaver-e10-ebuilder-form/references/list-nlist.md +1 -5
  177. package/skills/weaver-e10-ebuilder-form/references/openapi-read.md +1 -5
  178. package/skills/weaver-e10-ebuilder-form/references/openapi-write.md +1 -5
  179. package/skills/weaver-e10-esb/SKILL.md +2 -2
  180. package/skills/weaver-e10-esb/references/source-manifest.json +9 -9
  181. package/skills/weaver-e10-hrm/SKILL.md +54 -6
  182. package/skills/weaver-e10-hrm/references/employee.md +89 -15
  183. package/skills/weaver-e10-hrm/references/org.md +7 -4
  184. package/skills/weaver-e10-hrm/references/position.md +14 -7
  185. package/skills/weaver-e10-hrm/references/source-manifest.json +1 -1
  186. package/skills/weaver-e10-jinchengda/SKILL.md +166 -0
  187. package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +82 -0
  188. package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +69 -0
  189. package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +78 -0
  190. package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +27 -0
  191. package/skills/weaver-e10-jinchengda/references/contract-request-status.md +71 -0
  192. package/skills/weaver-e10-jinchengda/references/contract-request-write.md +94 -0
  193. package/skills/weaver-e10-jinchengda/references/contract-signing-subjects.md +89 -0
  194. package/skills/weaver-e10-jinchengda/references/contract-subject-create.md +77 -0
  195. package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +66 -0
  196. package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +94 -0
  197. package/skills/weaver-e10-jinchengda/references/source-manifest.json +259 -0
  198. package/skills/weaver-e10-jiuchuanhui/SKILL.md +5 -11
  199. package/skills/weaver-e10-jucailin/SKILL.md +4 -3
  200. package/skills/weaver-e10-mail/SKILL.md +4 -11
  201. package/skills/weaver-e10-meeting/SKILL.md +66 -32
  202. package/skills/weaver-e10-meeting/references/meeting-change.md +5 -2
  203. package/skills/weaver-e10-meeting/references/meeting-create.md +2 -1
  204. package/skills/weaver-e10-meeting/references/meeting-eb.md +114 -0
  205. package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +9 -8
  206. package/skills/weaver-e10-meeting/references/meeting-receipts-signs.md +35 -7
  207. package/skills/weaver-e10-meeting/references/meeting-update.md +1 -1
  208. package/skills/weaver-e10-okr/SKILL.md +6 -11
  209. package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
  210. package/skills/weaver-e10-plan/SKILL.md +3 -3
  211. package/skills/weaver-e10-plan/references/plan-collect-and-compose.md +1 -1
  212. package/skills/weaver-e10-plan/references/plan-overview-and-routing.md +1 -1
  213. package/skills/weaver-e10-plan/references/source-manifest.json +13 -13
  214. package/skills/weaver-e10-qiyecheng/SKILL.md +4 -10
  215. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +9 -9
  216. package/skills/weaver-e10-shared/SKILL.md +36 -25
  217. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +10 -31
  218. package/skills/weaver-e10-shared/references/json-output-contract.md +20 -11
  219. package/skills/weaver-e10-shijingran/SKILL.md +2 -1
  220. package/skills/weaver-e10-shijingran/references/source-manifest.json +9 -9
  221. package/skills/weaver-e10-skill-maker/SKILL.md +4 -10
  222. package/skills/weaver-e10-skill-maker/references/business-skill-generation.md +5 -3
  223. package/skills/weaver-e10-skill-maker/references/module-cli-generation.md +12 -27
  224. package/skills/weaver-e10-skill-maker/references/module-gap-audit-and-repair.md +17 -5
  225. package/skills/weaver-e10-skill-maker/references/source-update-detection.md +4 -27
  226. package/skills/weaver-e10-wenshuding/SKILL.md +5 -16
  227. package/skills/weaver-e10-wenshuding/references/source-manifest.json +7 -7
  228. package/skills/weaver-e10-workflow/SKILL.md +32 -37
  229. package/skills/weaver-e10-workflow/references/source-manifest.json +39 -75
  230. package/skills/weaver-e10-workflow/references/workflow-batch.md +90 -29
  231. package/skills/weaver-e10-workflow/references/workflow-create.md +79 -109
  232. package/skills/weaver-e10-workflow/references/workflow-memory.md +19 -9
  233. package/skills/weaver-e10-workflow/references/workflow-operate.md +2 -2
  234. package/skills/weaver-e10-workflow/references/workflow-query.md +38 -20
  235. package/skills/weaver-e10-workflow/references/workflow-share.md +18 -2
  236. package/skills/weaver-e10-workflow/references/workflow-view.md +3 -4
  237. package/skills/weaver-e10-yepiaotong/SKILL.md +75 -39
  238. package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +22 -1
  239. package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +3 -1
  240. package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +135 -0
  241. package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +15 -3
  242. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +1 -1
  243. package/skills/weaver-e10-yepiaotong/references/invoice-summarize.py +217 -0
  244. package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +88 -0
  245. package/skills/weaver-e10-yepiaotong/references/invoice-validation-preview.md +7 -2
  246. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +89 -9
  247. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +1 -0
  248. package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +70 -49
  249. package/skills/weaver-e10-yepiaotong/references/reim-fast-path.md +119 -0
  250. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +55 -36
  251. package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +4 -0
  252. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +149 -0
  253. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +125 -5
  254. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +430 -63
  255. package/skills/weaver-e10-yimiaoban/SKILL.md +4 -12
  256. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
  257. package/skills/weaver-e10-ziguanjia/SKILL.md +2 -1
  258. package/skills/weaver-e10-ziguanjia/references/ziguanjia-agent-entry.md +3 -3
  259. package/tools/weaver-skill-detector-1.0.13/SKILL.md +9 -9
  260. package/tools/weaver-skill-detector-1.0.13/references/checklist.md +3 -3
  261. package/tools/weaver-skill-detector-1.0.13/scripts/__pycache__/validate_skill.cpython-313.pyc +0 -0
  262. package/tools/weaver-skill-detector-1.0.13/scripts/validate_skill.py +98 -91
  263. package/scripts/sync-connector-skills.mjs +0 -172
@@ -0,0 +1,423 @@
1
+ /**
2
+ * caizhilian.setting-backup — 备份设置(文件设置 → 备份设置)
3
+ *
4
+ * 覆盖「文件设置 → 备份设置」页面:
5
+ * - 开关本地备份(sysLocalFileBackup)
6
+ * - 备份规则 CRUD(list/get/update/delete/enable)
7
+ *
8
+ * 接口:
9
+ * - 拉 settings:POST /api/file/tenant/setting
10
+ * - 改开关:POST /api/file/tenant/setting/save
11
+ * - 列规则:POST /api/file/get/backup/rule/list
12
+ * - 单个规则详情:GET /api/file/get/backup/rule?id=N
13
+ * - 更新规则:POST /api/file/update/backup/rule
14
+ * - 删除规则:POST /api/file/delete/backup/rule
15
+ * - 启停规则:POST /api/file/enable/backup/rule
16
+ */
17
+ import { CaizhilianCliError, caizhilianValidationError } from '../../errors.js';
18
+ import { caizhilianSuccess } from '../types.js';
19
+ import { requireId } from '../shared.js';
20
+ const ACTION = 'caizhilian.setting-backup';
21
+ // ── 接口路径 ──────────────────────────────────────────────
22
+ const GET_SETTING_PATH = '/api/file/tenant/setting';
23
+ const SAVE_SETTING_PATH = '/api/file/tenant/setting/save';
24
+ const LIST_RULES_PATH = '/api/file/get/backup/rule/list';
25
+ const GET_RULE_PATH = '/api/file/get/backup/rule';
26
+ const UPDATE_RULE_PATH = '/api/file/update/backup/rule';
27
+ const DELETE_RULE_PATH = '/api/file/delete/backup/rule';
28
+ const ENABLE_RULE_PATH = '/api/file/enable/backup/rule';
29
+ // ── 辅助函数 ──────────────────────────────────────────────
30
+ function asRecord(value) {
31
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
32
+ }
33
+ function asList(value) {
34
+ return Array.isArray(value) ? value : [];
35
+ }
36
+ function isPlainObject(value) {
37
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
38
+ }
39
+ function parseBoolean(value) {
40
+ if (typeof value === 'boolean')
41
+ return value;
42
+ const s = String(value).toLowerCase();
43
+ return ['true', '1', '开', '启用'].includes(s);
44
+ }
45
+ // ── 读取备份开关状态 ──────────────────────────────────────
46
+ async function getBackupSetting(args, env) {
47
+ const response = await env.host.request({
48
+ method: 'POST',
49
+ path: GET_SETTING_PATH,
50
+ body: {},
51
+ operation: ACTION,
52
+ });
53
+ const data = asRecord(response);
54
+ if (!data.status && !data.success) {
55
+ throw new CaizhilianCliError('api', 'business_error', String(data.msg || data.message || '读取备份设置失败'), {
56
+ code: data.code ?? data.status,
57
+ details: { action: ACTION, message: String(data.msg || data.message || '读取备份设置失败') },
58
+ exitCode: 1,
59
+ });
60
+ }
61
+ const settings = asRecord(data.data);
62
+ return caizhilianSuccess(ACTION, {
63
+ enabled: settings.sysLocalFileBackup ?? false,
64
+ });
65
+ }
66
+ // ── 设置备份开关(prepare/apply)──────────────────────────────────────
67
+ async function setBackupSettingPrepare(args, env) {
68
+ const enabled = parseBoolean(args.enabled);
69
+ // 读取当前设置
70
+ const currentResponse = await env.host.request({
71
+ method: 'POST',
72
+ path: GET_SETTING_PATH,
73
+ body: {},
74
+ operation: ACTION,
75
+ });
76
+ const currentData = asRecord(currentResponse);
77
+ if (!currentData.status && !currentData.success) {
78
+ throw new CaizhilianCliError('api', 'business_error', String(currentData.msg || currentData.message || '读取备份设置失败'), {
79
+ code: currentData.code ?? currentData.status,
80
+ details: { action: ACTION, message: String(currentData.msg || currentData.message || '读取备份设置失败') },
81
+ exitCode: 1,
82
+ });
83
+ }
84
+ const current = asRecord(currentData.data);
85
+ const currentEnabled = current.sysLocalFileBackup ?? false;
86
+ // 签发 continuation
87
+ const continuation = await env.continuation.issue({
88
+ operation: 'caizhilian.setting-backup.set.apply',
89
+ enabled,
90
+ currentEnabled,
91
+ });
92
+ return caizhilianSuccess('caizhilian.setting-backup.set.prepare', {
93
+ enabled,
94
+ current_enabled: currentEnabled,
95
+ continuation,
96
+ });
97
+ }
98
+ async function setBackupSettingApply(args, env, lease) {
99
+ const enabled = lease.payload?.enabled;
100
+ // 保存
101
+ const saveResponse = await env.host.request({
102
+ method: 'POST',
103
+ path: SAVE_SETTING_PATH,
104
+ body: { sysLocalFileBackup: enabled },
105
+ operation: 'caizhilian.setting-backup.set.apply',
106
+ });
107
+ const saveData = asRecord(saveResponse);
108
+ if (!saveData.status && !saveData.success) {
109
+ throw new CaizhilianCliError('api', 'business_error', String(saveData.msg || saveData.message || '保存备份设置失败'), {
110
+ code: saveData.code ?? saveData.status,
111
+ details: { action: 'caizhilian.setting-backup.set.apply', message: String(saveData.msg || saveData.message || '保存备份设置失败') },
112
+ exitCode: 1,
113
+ });
114
+ }
115
+ // 回读复核
116
+ const verifyResponse = await env.host.request({
117
+ method: 'POST',
118
+ path: GET_SETTING_PATH,
119
+ body: {},
120
+ operation: 'caizhilian.setting-backup.set.apply',
121
+ });
122
+ const verifyData = asRecord(verifyResponse);
123
+ const verified = asRecord(verifyData.data);
124
+ return caizhilianSuccess('caizhilian.setting-backup.set.apply', {
125
+ enabled: verified.sysLocalFileBackup ?? false,
126
+ });
127
+ }
128
+ // ── 列出备份规则 ──────────────────────────────────────────
129
+ async function listBackupRules(args, env) {
130
+ const response = await env.host.request({
131
+ method: 'POST',
132
+ path: LIST_RULES_PATH,
133
+ body: { pageNo: args.page_no || 1, pageSize: args.page_size || 20 },
134
+ operation: ACTION,
135
+ });
136
+ const data = asRecord(response);
137
+ if (!data.status && !data.success) {
138
+ throw new CaizhilianCliError('api', 'business_error', String(data.msg || data.message || '查询备份规则失败'), {
139
+ code: data.code ?? data.status,
140
+ details: { action: ACTION, message: String(data.msg || data.message || '查询备份规则失败') },
141
+ exitCode: 1,
142
+ });
143
+ }
144
+ const result = asRecord(data.data);
145
+ const rules = asList(result.list || result.data).map((item) => ({
146
+ id: item.id,
147
+ name: item.backupName || '',
148
+ path: item.backupPath || '',
149
+ period: item.period || 0,
150
+ enabled: item.enableStatus ?? false,
151
+ create_time: item.createTime || '',
152
+ }));
153
+ return caizhilianSuccess(ACTION, {
154
+ total: result.total || 0,
155
+ page_no: args.page_no || 1,
156
+ page_size: args.page_size || 20,
157
+ rules,
158
+ });
159
+ }
160
+ // ── 获取单个备份规则详情 ──────────────────────────────────
161
+ async function getBackupRule(args, env) {
162
+ const ruleId = requireId(args.id, 'id');
163
+ const response = await env.host.request({
164
+ method: 'GET',
165
+ path: `${GET_RULE_PATH}?id=${ruleId}`,
166
+ operation: ACTION,
167
+ });
168
+ const data = asRecord(response);
169
+ if (!data.status && !data.success) {
170
+ throw new CaizhilianCliError('api', 'business_error', String(data.msg || data.message || '查询备份规则失败'), {
171
+ code: data.code ?? data.status,
172
+ details: { action: ACTION, message: String(data.msg || data.message || '查询备份规则失败') },
173
+ exitCode: 1,
174
+ });
175
+ }
176
+ const rule = asRecord(data.data);
177
+ return caizhilianSuccess(ACTION, {
178
+ id: rule.id,
179
+ name: rule.backupName || '',
180
+ path: rule.backupPath || '',
181
+ period: rule.period || 0,
182
+ enabled: rule.enableStatus ?? false,
183
+ create_time: rule.createTime || '',
184
+ });
185
+ }
186
+ // ── 更新备份规则(prepare/apply)──────────────────────────────────────
187
+ async function updateBackupRulePrepare(args, env) {
188
+ const ruleId = requireId(args.id, 'id');
189
+ // 读取当前规则
190
+ const currentResponse = await env.host.request({
191
+ method: 'GET',
192
+ path: `${GET_RULE_PATH}?id=${ruleId}`,
193
+ operation: ACTION,
194
+ });
195
+ const currentData = asRecord(currentResponse);
196
+ if (!currentData.status && !currentData.success) {
197
+ throw new CaizhilianCliError('api', 'business_error', String(currentData.msg || currentData.message || '查询备份规则失败'), {
198
+ code: currentData.code ?? currentData.status,
199
+ details: { action: ACTION, message: String(currentData.msg || currentData.message || '查询备份规则失败') },
200
+ exitCode: 1,
201
+ });
202
+ }
203
+ const current = asRecord(currentData.data);
204
+ // 构建改动
205
+ const changed = { id: ruleId };
206
+ if (args.name !== undefined)
207
+ changed.backupName = String(args.name);
208
+ if (args.path !== undefined)
209
+ changed.backupPath = String(args.path);
210
+ if (args.period !== undefined) {
211
+ const period = parseInt(String(args.period), 10);
212
+ if (isNaN(period) || period < 60 || period > 1440) {
213
+ throw caizhilianValidationError('range_invalid', '备份周期必须在 60-1440 分钟之间');
214
+ }
215
+ changed.period = period;
216
+ }
217
+ // 签发 continuation
218
+ const continuation = await env.continuation.issue({
219
+ operation: 'caizhilian.setting-backup.rule.update.apply',
220
+ changed,
221
+ current: {
222
+ id: current.id,
223
+ name: current.backupName || '',
224
+ path: current.backupPath || '',
225
+ period: current.period || 0,
226
+ enabled: current.enableStatus ?? false,
227
+ },
228
+ });
229
+ return caizhilianSuccess('caizhilian.setting-backup.rule.update.prepare', {
230
+ rule_id: ruleId,
231
+ changed,
232
+ current: {
233
+ id: current.id,
234
+ name: current.backupName || '',
235
+ path: current.backupPath || '',
236
+ period: current.period || 0,
237
+ enabled: current.enableStatus ?? false,
238
+ },
239
+ continuation,
240
+ });
241
+ }
242
+ async function updateBackupRuleApply(args, env, lease) {
243
+ const changed = lease.payload?.changed;
244
+ const saveResponse = await env.host.request({
245
+ method: 'POST',
246
+ path: UPDATE_RULE_PATH,
247
+ body: changed,
248
+ operation: 'caizhilian.setting-backup.rule.update.apply',
249
+ });
250
+ const saveData = asRecord(saveResponse);
251
+ if (!saveData.status && !saveData.success) {
252
+ throw new CaizhilianCliError('api', 'business_error', String(saveData.msg || saveData.message || '更新备份规则失败'), {
253
+ code: saveData.code ?? saveData.status,
254
+ details: { action: 'caizhilian.setting-backup.rule.update.apply', message: String(saveData.msg || saveData.message || '更新备份规则失败') },
255
+ exitCode: 1,
256
+ });
257
+ }
258
+ // 回读复核
259
+ const verifyResponse = await env.host.request({
260
+ method: 'GET',
261
+ path: `${GET_RULE_PATH}?id=${changed.id}`,
262
+ operation: 'caizhilian.setting-backup.rule.update.apply',
263
+ });
264
+ const verifyData = asRecord(verifyResponse);
265
+ const verified = asRecord(verifyData.data);
266
+ return caizhilianSuccess('caizhilian.setting-backup.rule.update.apply', {
267
+ rule: {
268
+ id: verified.id,
269
+ name: verified.backupName || '',
270
+ path: verified.backupPath || '',
271
+ period: verified.period || 0,
272
+ enabled: verified.enableStatus ?? false,
273
+ },
274
+ });
275
+ }
276
+ // ── 删除备份规则(prepare/apply)──────────────────────────────────────
277
+ async function deleteBackupRulePrepare(args, env) {
278
+ const ruleId = requireId(args.id, 'id');
279
+ // 读取当前规则
280
+ const currentResponse = await env.host.request({
281
+ method: 'GET',
282
+ path: `${GET_RULE_PATH}?id=${ruleId}`,
283
+ operation: ACTION,
284
+ });
285
+ const currentData = asRecord(currentResponse);
286
+ if (!currentData.status && !currentData.success) {
287
+ throw new CaizhilianCliError('api', 'business_error', String(currentData.msg || currentData.message || '查询备份规则失败'), {
288
+ code: currentData.code ?? currentData.status,
289
+ details: { action: ACTION, message: String(currentData.msg || currentData.message || '查询备份规则失败') },
290
+ exitCode: 1,
291
+ });
292
+ }
293
+ const current = asRecord(currentData.data);
294
+ // 签发 continuation
295
+ const continuation = await env.continuation.issue({
296
+ operation: 'caizhilian.setting-backup.rule.delete.apply',
297
+ ruleId,
298
+ current: {
299
+ id: current.id,
300
+ name: current.backupName || '',
301
+ path: current.backupPath || '',
302
+ },
303
+ });
304
+ return caizhilianSuccess('caizhilian.setting-backup.rule.delete.prepare', {
305
+ rule_id: ruleId,
306
+ current: {
307
+ id: current.id,
308
+ name: current.backupName || '',
309
+ path: current.backupPath || '',
310
+ },
311
+ continuation,
312
+ });
313
+ }
314
+ async function deleteBackupRuleApply(args, env, lease) {
315
+ const ruleId = lease.payload?.ruleId;
316
+ const deleteResponse = await env.host.request({
317
+ method: 'POST',
318
+ path: DELETE_RULE_PATH,
319
+ body: { ids: [ruleId] },
320
+ operation: 'caizhilian.setting-backup.rule.delete.apply',
321
+ });
322
+ const deleteData = asRecord(deleteResponse);
323
+ if (!deleteData.status && !deleteData.success) {
324
+ throw new CaizhilianCliError('api', 'business_error', String(deleteData.msg || deleteData.message || '删除备份规则失败'), {
325
+ code: deleteData.code ?? deleteData.status,
326
+ details: { action: 'caizhilian.setting-backup.rule.delete.apply', message: String(deleteData.msg || deleteData.message || '删除备份规则失败') },
327
+ exitCode: 1,
328
+ });
329
+ }
330
+ return caizhilianSuccess('caizhilian.setting-backup.rule.delete.apply', {
331
+ deleted: true,
332
+ rule_id: ruleId,
333
+ });
334
+ }
335
+ // ── 启停备份规则(prepare/apply)──────────────────────────────────────
336
+ async function enableBackupRulePrepare(args, env) {
337
+ const ruleId = requireId(args.id, 'id');
338
+ const enabled = parseBoolean(args.enabled);
339
+ // 读取当前规则
340
+ const currentResponse = await env.host.request({
341
+ method: 'GET',
342
+ path: `${GET_RULE_PATH}?id=${ruleId}`,
343
+ operation: ACTION,
344
+ });
345
+ const currentData = asRecord(currentResponse);
346
+ if (!currentData.status && !currentData.success) {
347
+ throw new CaizhilianCliError('api', 'business_error', String(currentData.msg || currentData.message || '查询备份规则失败'), {
348
+ code: currentData.code ?? currentData.status,
349
+ details: { action: ACTION, message: String(currentData.msg || currentData.message || '查询备份规则失败') },
350
+ exitCode: 1,
351
+ });
352
+ }
353
+ const current = asRecord(currentData.data);
354
+ // 签发 continuation
355
+ const continuation = await env.continuation.issue({
356
+ operation: 'caizhilian.setting-backup.rule.enable.apply',
357
+ ruleId,
358
+ enabled,
359
+ currentEnabled: current.enableStatus ?? false,
360
+ });
361
+ return caizhilianSuccess('caizhilian.setting-backup.rule.enable.prepare', {
362
+ rule_id: ruleId,
363
+ enabled,
364
+ current_enabled: current.enableStatus ?? false,
365
+ continuation,
366
+ });
367
+ }
368
+ async function enableBackupRuleApply(args, env, lease) {
369
+ const ruleId = lease.payload?.ruleId;
370
+ const enabled = lease.payload?.enabled;
371
+ const enableResponse = await env.host.request({
372
+ method: 'POST',
373
+ path: ENABLE_RULE_PATH,
374
+ body: { id: ruleId, enableStatus: enabled },
375
+ operation: 'caizhilian.setting-backup.rule.enable.apply',
376
+ });
377
+ const enableData = asRecord(enableResponse);
378
+ if (!enableData.status && !enableData.success) {
379
+ throw new CaizhilianCliError('api', 'business_error', String(enableData.msg || enableData.message || '启停备份规则失败'), {
380
+ code: enableData.code ?? enableData.status,
381
+ details: { action: 'caizhilian.setting-backup.rule.enable.apply', message: String(enableData.msg || enableData.message || '启停备份规则失败') },
382
+ exitCode: 1,
383
+ });
384
+ }
385
+ // 回读复核
386
+ const verifyResponse = await env.host.request({
387
+ method: 'GET',
388
+ path: `${GET_RULE_PATH}?id=${ruleId}`,
389
+ operation: 'caizhilian.setting-backup.rule.enable.apply',
390
+ });
391
+ const verifyData = asRecord(verifyResponse);
392
+ const verified = asRecord(verifyData.data);
393
+ return caizhilianSuccess('caizhilian.setting-backup.rule.enable.apply', {
394
+ rule_id: ruleId,
395
+ enabled: verified.enableStatus ?? false,
396
+ });
397
+ }
398
+ // ── 处理器汇总 ────────────────────────────────────────────
399
+ export const caizhilianSettingBackupHandlers = {
400
+ 'caizhilian.setting-backup.get': { execute: getBackupSetting },
401
+ 'caizhilian.setting-backup.set': {
402
+ prepare: setBackupSettingPrepare,
403
+ apply: setBackupSettingApply,
404
+ targetKeys: ['enabled'],
405
+ },
406
+ 'caizhilian.setting-backup.rule.list': { execute: listBackupRules },
407
+ 'caizhilian.setting-backup.rule.get': { execute: getBackupRule },
408
+ 'caizhilian.setting-backup.rule.update': {
409
+ prepare: updateBackupRulePrepare,
410
+ apply: updateBackupRuleApply,
411
+ targetKeys: ['id'],
412
+ },
413
+ 'caizhilian.setting-backup.rule.delete': {
414
+ prepare: deleteBackupRulePrepare,
415
+ apply: deleteBackupRuleApply,
416
+ targetKeys: ['id'],
417
+ },
418
+ 'caizhilian.setting-backup.rule.enable': {
419
+ prepare: enableBackupRulePrepare,
420
+ apply: enableBackupRuleApply,
421
+ targetKeys: ['id'],
422
+ },
423
+ };
@@ -0,0 +1,238 @@
1
+ /**
2
+ * caizhilian.setting-encrypt — 加解密设置(文件设置 → 加解密设置)
3
+ *
4
+ * 覆盖「文件设置 → 加解密设置」页面的 8 项配置:
5
+ * - openEncryptFunction: 是否启用加解密功能
6
+ * - encryptPlugs: 加解密插件类型
7
+ * - encryptUrl: 加解密服务地址
8
+ * - encryptScene: 加解密场景
9
+ * - encryptFileUpload: 加密文件上传规则
10
+ * - encryptFileDownload: 加密文件下载规则
11
+ * - unencryptedFileUpload: 未加密文件上传规则
12
+ * - unencryptedFileDownload: 未加密文件下载规则
13
+ *
14
+ * 接口:
15
+ * - 拉配置(新版本):GET /api/file/thirdPlugEncDec/config
16
+ * - 拉配置(旧版本兼容):POST /api/file/tenant/setting
17
+ * - 保存:POST /api/file/tenant/setting/save(整对象 POST)
18
+ */
19
+ import { CaizhilianCliError, caizhilianValidationError } from '../../errors.js';
20
+ import { caizhilianSuccess } from '../types.js';
21
+ const ACTION = 'caizhilian.setting-encrypt';
22
+ // ── 接口路径 ──────────────────────────────────────────────
23
+ const GET_CONFIG_V2_PATH = '/api/file/thirdPlugEncDec/config';
24
+ const GET_SETTING_PATH = '/api/file/tenant/setting';
25
+ const SAVE_SETTING_PATH = '/api/file/tenant/setting/save';
26
+ // ── 字段映射 ──────────────────────────────────────────────
27
+ const FIELD_MAP = {
28
+ 'enabled': 'openEncryptFunction',
29
+ 'plugs': 'encryptPlugs',
30
+ 'url': 'encryptUrl',
31
+ 'scene': 'encryptScene',
32
+ 'upload-encrypted': 'encryptFileUpload',
33
+ 'download-encrypted': 'encryptFileDownload',
34
+ 'upload-unencrypted': 'unencryptedFileUpload',
35
+ 'download-unencrypted': 'unencryptedFileDownload',
36
+ };
37
+ const VALID_SCENES = ['uploadAndDownloadEncrypt', 'uploadEncrypt', 'downloadEncrypt', 'custom'];
38
+ // ── 辅助函数 ──────────────────────────────────────────────
39
+ function asRecord(value) {
40
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
41
+ }
42
+ function isPlainObject(value) {
43
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
44
+ }
45
+ function parseBoolean(value) {
46
+ if (typeof value === 'boolean')
47
+ return value;
48
+ const s = String(value).toLowerCase();
49
+ return ['true', '1', '开', '启用'].includes(s);
50
+ }
51
+ // ── 读取加解密配置 ──────────────────────────────────────
52
+ async function getEncryptSetting(args, env) {
53
+ let settings = {};
54
+ // 优先走新版本接口
55
+ try {
56
+ const response = await env.host.request({
57
+ method: 'GET',
58
+ path: GET_CONFIG_V2_PATH,
59
+ operation: ACTION,
60
+ });
61
+ const data = asRecord(response);
62
+ if (data.code === 200 || data.status === 0 || data.success) {
63
+ settings = asRecord(data.data);
64
+ }
65
+ }
66
+ catch (error) {
67
+ // 新版本接口失败,走旧版本兼容接口
68
+ const response = await env.host.request({
69
+ method: 'POST',
70
+ path: GET_SETTING_PATH,
71
+ body: {},
72
+ operation: ACTION,
73
+ });
74
+ const data = asRecord(response);
75
+ if (!data.status && !data.success) {
76
+ throw new CaizhilianCliError('api', 'business_error', String(data.msg || data.message || '读取加解密设置失败'), {
77
+ code: data.code ?? data.status,
78
+ details: { action: ACTION, message: String(data.msg || data.message || '读取加解密设置失败') },
79
+ exitCode: 1,
80
+ });
81
+ }
82
+ const settingData = asRecord(data.data);
83
+ settings = asRecord(settingData.encryptionSettings);
84
+ }
85
+ return caizhilianSuccess(ACTION, {
86
+ settings: {
87
+ enabled: settings.openEncryptFunction ?? false,
88
+ plugs: settings.encryptPlugs || '',
89
+ url: settings.encryptUrl || '',
90
+ scene: settings.encryptScene || 'uploadAndDownloadEncrypt',
91
+ upload_encrypted: settings.encryptFileUpload || '',
92
+ download_encrypted: settings.encryptFileDownload || '',
93
+ upload_unencrypted: settings.unencryptedFileUpload || '',
94
+ download_unencrypted: settings.unencryptedFileDownload || '',
95
+ },
96
+ });
97
+ }
98
+ // ── 保存加解密配置(prepare/apply)──────────────────────────────────────
99
+ async function setEncryptSettingPrepare(args, env) {
100
+ const items = args.items;
101
+ if (!isPlainObject(items)) {
102
+ throw caizhilianValidationError('input_not_object', 'items 必须是对象');
103
+ }
104
+ // 读取当前配置
105
+ let current = {};
106
+ try {
107
+ const response = await env.host.request({
108
+ method: 'GET',
109
+ path: GET_CONFIG_V2_PATH,
110
+ operation: ACTION,
111
+ });
112
+ const data = asRecord(response);
113
+ if (data.code === 200 || data.status === 0 || data.success) {
114
+ current = asRecord(data.data);
115
+ }
116
+ }
117
+ catch (error) {
118
+ const response = await env.host.request({
119
+ method: 'POST',
120
+ path: GET_SETTING_PATH,
121
+ body: {},
122
+ operation: ACTION,
123
+ });
124
+ const data = asRecord(response);
125
+ if (!data.status && !data.success) {
126
+ throw new CaizhilianCliError('api', 'business_error', String(data.msg || data.message || '读取加解密设置失败'), {
127
+ code: data.code ?? data.status,
128
+ details: { action: ACTION, message: String(data.msg || data.message || '读取加解密设置失败') },
129
+ exitCode: 1,
130
+ });
131
+ }
132
+ const settingData = asRecord(data.data);
133
+ current = asRecord(settingData.encryptionSettings);
134
+ }
135
+ // 构建改动
136
+ const changed = {};
137
+ for (const [key, value] of Object.entries(items)) {
138
+ const dtoKey = FIELD_MAP[key];
139
+ if (!dtoKey) {
140
+ throw caizhilianValidationError('unknown_field', `未知字段: ${key}`);
141
+ }
142
+ if (key === 'enabled') {
143
+ changed[dtoKey] = parseBoolean(value);
144
+ }
145
+ else if (key === 'scene') {
146
+ const scene = String(value);
147
+ if (!VALID_SCENES.includes(scene)) {
148
+ throw caizhilianValidationError('enum_invalid', `encryptScene 不支持: ${scene},可选值: ${VALID_SCENES.join(', ')}`);
149
+ }
150
+ changed[dtoKey] = scene;
151
+ }
152
+ else {
153
+ changed[dtoKey] = String(value);
154
+ }
155
+ }
156
+ // 签发 continuation
157
+ const continuation = await env.continuation.issue({
158
+ operation: 'caizhilian.setting-encrypt.set.apply',
159
+ changed,
160
+ current,
161
+ });
162
+ return caizhilianSuccess('caizhilian.setting-encrypt.set.prepare', {
163
+ changed,
164
+ current: {
165
+ enabled: current.openEncryptFunction ?? false,
166
+ plugs: current.encryptPlugs || '',
167
+ url: current.encryptUrl || '',
168
+ scene: current.encryptScene || 'uploadAndDownloadEncrypt',
169
+ },
170
+ continuation,
171
+ });
172
+ }
173
+ async function setEncryptSettingApply(args, env, lease) {
174
+ const changed = lease.payload?.changed;
175
+ const current = lease.payload?.current;
176
+ // 合并当前配置与改动
177
+ const merged = { ...current, ...changed };
178
+ // 保存(整对象 POST)
179
+ const saveResponse = await env.host.request({
180
+ method: 'POST',
181
+ path: SAVE_SETTING_PATH,
182
+ body: { encryptionSettings: merged },
183
+ operation: 'caizhilian.setting-encrypt.set.apply',
184
+ });
185
+ const saveData = asRecord(saveResponse);
186
+ if (!saveData.status && !saveData.success) {
187
+ throw new CaizhilianCliError('api', 'business_error', String(saveData.msg || saveData.message || '保存加解密设置失败'), {
188
+ code: saveData.code ?? saveData.status,
189
+ details: { action: 'caizhilian.setting-encrypt.set.apply', message: String(saveData.msg || saveData.message || '保存加解密设置失败') },
190
+ exitCode: 1,
191
+ });
192
+ }
193
+ // 回读复核
194
+ let verified = {};
195
+ try {
196
+ const response = await env.host.request({
197
+ method: 'GET',
198
+ path: GET_CONFIG_V2_PATH,
199
+ operation: 'caizhilian.setting-encrypt.set.apply',
200
+ });
201
+ const data = asRecord(response);
202
+ if (data.code === 200 || data.status === 0 || data.success) {
203
+ verified = asRecord(data.data);
204
+ }
205
+ }
206
+ catch (error) {
207
+ const response = await env.host.request({
208
+ method: 'POST',
209
+ path: GET_SETTING_PATH,
210
+ body: {},
211
+ operation: 'caizhilian.setting-encrypt.set.apply',
212
+ });
213
+ const data = asRecord(response);
214
+ const settingData = asRecord(data.data);
215
+ verified = asRecord(settingData.encryptionSettings);
216
+ }
217
+ return caizhilianSuccess('caizhilian.setting-encrypt.set.apply', {
218
+ settings: {
219
+ enabled: verified.openEncryptFunction ?? false,
220
+ plugs: verified.encryptPlugs || '',
221
+ url: verified.encryptUrl || '',
222
+ scene: verified.encryptScene || 'uploadAndDownloadEncrypt',
223
+ upload_encrypted: verified.encryptFileUpload || '',
224
+ download_encrypted: verified.encryptFileDownload || '',
225
+ upload_unencrypted: verified.unencryptedFileUpload || '',
226
+ download_unencrypted: verified.unencryptedFileDownload || '',
227
+ },
228
+ });
229
+ }
230
+ // ── 处理器汇总 ────────────────────────────────────────────
231
+ export const caizhilianSettingEncryptHandlers = {
232
+ 'caizhilian.setting-encrypt.get': { execute: getEncryptSetting },
233
+ 'caizhilian.setting-encrypt.set': {
234
+ prepare: setEncryptSettingPrepare,
235
+ apply: setEncryptSettingApply,
236
+ targetKeys: ['items'],
237
+ },
238
+ };