weaver-work-cli 0.1.69 → 0.1.71

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 (232) hide show
  1. package/dist/chunks/{archive-VUTREF3P.js → archive-5P33NAUN.js} +22 -5
  2. package/dist/chunks/{archive-oa-VXXO4RTB.js → archive-oa-YTY5D7DG.js} +17 -5
  3. package/dist/chunks/{asset-45U6TY7I.js → asset-3Q5MFQBX.js} +22 -5
  4. package/dist/chunks/{asset-idle-YCRBMTIT.js → asset-idle-PQPNYIS7.js} +15 -5
  5. package/dist/chunks/{attachment-content-7BEDNQ3O.js → attachment-content-7CN7JB6B.js} +3 -3
  6. package/dist/chunks/{blog-5AML4WMG.js → blog-MFHHK6ZR.js} +25 -5
  7. package/dist/chunks/{caizhilian-3P7BUNHT.js → caizhilian-OZ435AYW.js} +22 -8
  8. package/dist/chunks/{calendar-2HUXM3CZ.js → calendar-TNJXS5UC.js} +15 -5
  9. package/dist/chunks/{chunk-H2NRTGZR.js → chunk-2DNCKZRX.js} +3 -3
  10. package/dist/chunks/{chunk-DVFA3ODS.js → chunk-35A56FJ7.js} +12 -0
  11. package/dist/chunks/{chunk-HG6INLH6.js → chunk-6MMSLE6K.js} +23 -6
  12. package/dist/chunks/{chunk-UVWW5ABZ.js → chunk-B4NINGP2.js} +3 -3
  13. package/dist/chunks/{chunk-LRKKKO5A.js → chunk-DRJYPXKC.js} +3 -4
  14. package/dist/chunks/{chunk-3TZURS7M.js → chunk-EJLP63UO.js} +1 -1
  15. package/dist/chunks/{chunk-FMAZ42HS.js → chunk-FRMDHZSN.js} +11 -11
  16. package/dist/chunks/{chunk-MLJK4KLE.js → chunk-G7ZM2VOX.js} +34 -34
  17. package/dist/chunks/{chunk-LSVA7QA6.js → chunk-GB2MCJPG.js} +3 -1
  18. package/dist/chunks/{chunk-3CBURKSY.js → chunk-ICNUOWLL.js} +4 -4
  19. package/dist/chunks/{chunk-GTAFCAVP.js → chunk-IZCQU5D5.js} +1 -1
  20. package/dist/chunks/{chunk-BEYEXCWU.js → chunk-LU2SPJYY.js} +2 -2
  21. package/dist/chunks/{chunk-E7VWE2XI.js → chunk-MD5RXRI3.js} +3 -3
  22. package/dist/chunks/{chunk-VZUH3LKI.js → chunk-MZVQKQP5.js} +167 -157
  23. package/dist/chunks/{chunk-67AN5YJT.js → chunk-OFCF23FY.js} +9 -9
  24. package/dist/chunks/{chunk-ERAE4GHX.js → chunk-OPTJ6IF7.js} +1 -1
  25. package/dist/chunks/{chunk-727VKJQK.js → chunk-OZ7CJC7W.js} +2 -2
  26. package/dist/chunks/{chunk-T24EBWAZ.js → chunk-P3AFNAJ6.js} +48 -21
  27. package/dist/chunks/{chunk-4XYRTXRR.js → chunk-Q3EXRNB4.js} +1 -1
  28. package/dist/chunks/{chunk-QYDSTYGG.js → chunk-SKWKCLJX.js} +3 -3
  29. package/dist/chunks/{chunk-DSBV4GRK.js → chunk-SSS75WXW.js} +3 -3
  30. package/dist/chunks/{chunk-I5XB4MZT.js → chunk-SUWR5QEG.js} +94 -65
  31. package/dist/chunks/{chunk-YR3K53BU.js → chunk-VJWVB55R.js} +2 -2
  32. package/dist/chunks/{chunk-JAIZY37Z.js → chunk-VMVMEIL3.js} +4 -4
  33. package/dist/chunks/chunk-WM33BSIL.js +136 -0
  34. package/dist/chunks/{chunk-6DH73Q5H.js → chunk-X2C5CGGM.js} +52 -51
  35. package/dist/chunks/{chunk-ELF5TPSG.js → chunk-XLSJC6JZ.js} +6 -6
  36. package/dist/chunks/{chunk-U3OO3IZF.js → chunk-YN5SD4TX.js} +20 -7
  37. package/dist/chunks/{conflict-VKCRXHUV.js → conflict-Y4PXZ2YQ.js} +2 -2
  38. package/dist/chunks/{contract-3PMHUASH.js → contract-C3BGUMBM.js} +48 -5
  39. package/dist/chunks/{cowork-FZBTTBYX.js → cowork-2AWG4QLA.js} +37 -8
  40. package/dist/chunks/{create-flow-WYPLBLRK.js → create-flow-LOUOK46Z.js} +6 -6
  41. package/dist/chunks/{data-2YZ6A6TL.js → data-BSFYMXVO.js} +99 -184
  42. package/dist/chunks/{ebuilder-form-AWPTMZBZ.js → ebuilder-form-LAAMTD2Y.js} +17 -7
  43. package/dist/chunks/{ehr-MNPR4TE5.js → ehr-36KEX5SH.js} +62 -13
  44. package/dist/chunks/{entry-mode-BCJ7RPFC.js → entry-mode-6N2IGCS4.js} +3 -3
  45. package/dist/chunks/{env-SCVCHBN2.js → env-QYLS3EB3.js} +2 -2
  46. package/dist/chunks/{esb-GSB5QCEX.js → esb-PTYS3E67.js} +17 -7
  47. package/dist/chunks/{factory-CBXYOEBF.js → factory-LPFPKZ4T.js} +1 -1
  48. package/dist/chunks/{fna-XBSNUS2V.js → fna-JNHCLRDE.js} +15 -5
  49. package/dist/chunks/{group-chat-RFL4U7RF.js → group-chat-QP2WX4QJ.js} +3 -3
  50. package/dist/chunks/{host-2UMNXX5H.js → host-57LSRSE7.js} +4 -4
  51. package/dist/chunks/{host-NVDG3NC6.js → host-7BVR7CQ3.js} +4 -4
  52. package/dist/chunks/{host-SYPCA63D.js → host-C2BLBIID.js} +4 -4
  53. package/dist/chunks/{host-XVWBOSEN.js → host-K2ZKNXME.js} +4 -4
  54. package/dist/chunks/{host-R7BP3CTI.js → host-NS36QFLR.js} +6 -4
  55. package/dist/chunks/{host-BD44ASOD.js → host-QXFKQXNX.js} +4 -4
  56. package/dist/chunks/{hrm-FZUDJAND.js → hrm-FSGO4NSH.js} +15 -6
  57. package/dist/chunks/{im-F5NENPD7.js → im-2BFGS2XO.js} +16 -6
  58. package/dist/chunks/{invoice-DS6FLU55.js → invoice-JKLTTHSZ.js} +27 -6
  59. package/dist/chunks/{jiuchuanhui-PY2WEBUH.js → jiuchuanhui-PTABJE7V.js} +1294 -1134
  60. package/dist/chunks/{lazy-dispatch-F6O2EPGR.js → lazy-dispatch-YN2ZP3CS.js} +6 -6
  61. package/dist/chunks/{mail-ZEOSANEJ.js → mail-YNO7ZZUK.js} +116 -97
  62. package/dist/chunks/{meeting-N2AGGLVI.js → meeting-NIDHDBCB.js} +29 -16
  63. package/dist/chunks/{minute-doc-C62EZOJH.js → minute-doc-G3QAT7DE.js} +4 -4
  64. package/dist/chunks/{okr-OZUMTMCL.js → okr-QC52G6AJ.js} +15 -5
  65. package/dist/chunks/{operations-LQY3FTPH.js → operations-2WHIF5WV.js} +1 -1
  66. package/dist/chunks/{operations-UTUWFJTX.js → operations-MQV32ITT.js} +5 -5
  67. package/dist/chunks/{performance-GBKM5G2Y.js → performance-3MQ3AHDQ.js} +97 -11
  68. package/dist/chunks/{plan-C2NENH42.js → plan-ISINIEPY.js} +15 -5
  69. package/dist/chunks/{project-FAJ2P3UR.js → project-IJ6DVKT7.js} +18 -5
  70. package/dist/chunks/{reception-NH6MJFPR.js → reception-3H5LUG2I.js} +17 -7
  71. package/dist/chunks/{recruit-stage-DPEFHLSE.js → recruit-stage-MIOJXP6W.js} +412 -85
  72. package/dist/chunks/{registry-7US3QQXV.js → registry-3GQRYP2R.js} +12 -12
  73. package/dist/chunks/{registry-Y2HWS6JS.js → registry-3S7AVMXR.js} +4 -4
  74. package/dist/chunks/{registry-FTPUUHWC.js → registry-NHHKOEU3.js} +5 -5
  75. package/dist/chunks/{room-recommend-LMNF76YS.js → room-recommend-IOKBJVYP.js} +4 -4
  76. package/dist/chunks/{schedule-4QE2THAP.js → schedule-IB6EUARH.js} +4 -4
  77. package/dist/chunks/{smart-extract-GTYKF5TJ.js → smart-extract-N2TK3CEF.js} +19 -6
  78. package/dist/chunks/{workflow-KXYTQZ2H.js → workflow-RINBAL2M.js} +22 -8
  79. package/dist/cmd/auth/index.js +23 -0
  80. package/dist/cmd/e10/index.js +2 -1
  81. package/dist/cmd/index.js +2 -0
  82. package/dist/core/manifest-view.js +207 -0
  83. package/dist/core/output.js +38 -8
  84. package/dist/index.js +35 -35
  85. package/dist/internal/e10/auth/crypto.js +18 -8
  86. package/dist/internal/e10/auth/error-log.js +1 -2
  87. package/dist/internal/e10/auth/messages.js +2 -3
  88. package/dist/internal/e10/auth/xiaoe.js +1 -1
  89. package/dist/internal/e10/tls-policy.js +61 -13
  90. package/dist/shortcuts/archive/index.js +11 -2
  91. package/dist/shortcuts/archive/operations/download.js +1 -0
  92. package/dist/shortcuts/archive/operations/flow-url.js +3 -0
  93. package/dist/shortcuts/archive/operations/prelib.js +2 -0
  94. package/dist/shortcuts/archive/operations/upload.js +1 -0
  95. package/dist/shortcuts/archive-oa/index.js +11 -2
  96. package/dist/shortcuts/archive-oa/operations/borrow-car.js +2 -0
  97. package/dist/shortcuts/asset/index.js +11 -2
  98. package/dist/shortcuts/asset/manifest.js +7 -0
  99. package/dist/shortcuts/asset-idle/index.js +11 -2
  100. package/dist/shortcuts/blog/index.js +11 -2
  101. package/dist/shortcuts/blog/manifest.js +10 -0
  102. package/dist/shortcuts/caizhilian/host.js +20 -4
  103. package/dist/shortcuts/caizhilian/index.js +12 -2
  104. package/dist/shortcuts/caizhilian/manifest.js +4 -25
  105. package/dist/shortcuts/caizhilian/operations/handlers/search.js +34 -0
  106. package/dist/shortcuts/caizhilian/operations/registry.js +25 -1
  107. package/dist/shortcuts/calendar/index.js +11 -2
  108. package/dist/shortcuts/contract/index.js +11 -2
  109. package/dist/shortcuts/contract/manifest.js +32 -0
  110. package/dist/shortcuts/contract/operations/write.js +3 -0
  111. package/dist/shortcuts/cowork/index.js +21 -5
  112. package/dist/shortcuts/cowork/manifest.js +3 -0
  113. package/dist/shortcuts/cowork/operations/discuss-write.js +2 -0
  114. package/dist/shortcuts/cowork/operations/item-write.js +3 -0
  115. package/dist/shortcuts/cowork/operations/member-write.js +2 -0
  116. package/dist/shortcuts/cowork/operations/permission-write.js +2 -0
  117. package/dist/shortcuts/cowork/operations/review-write.js +1 -0
  118. package/dist/shortcuts/data/errors.js +16 -29
  119. package/dist/shortcuts/data/host.js +16 -7
  120. package/dist/shortcuts/data/index.js +12 -41
  121. package/dist/shortcuts/data/manifest.js +5 -44
  122. package/dist/shortcuts/data/operations/attend.js +2 -2
  123. package/dist/shortcuts/data/operations/conf.js +0 -88
  124. package/dist/shortcuts/data/operations/ds.js +4 -4
  125. package/dist/shortcuts/data/operations/index.js +1 -5
  126. package/dist/shortcuts/data/operations/module.js +40 -14
  127. package/dist/shortcuts/data/operations/query.js +2 -2
  128. package/dist/shortcuts/ebuilder-form/index.js +11 -2
  129. package/dist/shortcuts/ebuilder-form/manifest.js +12 -0
  130. package/dist/shortcuts/ehr/index.js +11 -2
  131. package/dist/shortcuts/ehr/operations/attend-write.js +51 -8
  132. package/dist/shortcuts/esb/index.js +11 -2
  133. package/dist/shortcuts/esb/manifest.js +2 -0
  134. package/dist/shortcuts/fna/index.js +11 -2
  135. package/dist/shortcuts/hrm/index.js +11 -1
  136. package/dist/shortcuts/im/index.js +11 -2
  137. package/dist/shortcuts/invoice/index.js +11 -2
  138. package/dist/shortcuts/invoice/manifest.js +8 -0
  139. package/dist/shortcuts/jiuchuanhui/cache.js +49 -35
  140. package/dist/shortcuts/jiuchuanhui/host.js +37 -5
  141. package/dist/shortcuts/jiuchuanhui/index.js +57 -7
  142. package/dist/shortcuts/jiuchuanhui/manifest.js +38 -1
  143. package/dist/shortcuts/jiuchuanhui/operations/customer-quick.js +110 -0
  144. package/dist/shortcuts/jiuchuanhui/operations/datajson.js +11 -56
  145. package/dist/shortcuts/jiuchuanhui/operations/esb.js +9 -16
  146. package/dist/shortcuts/jiuchuanhui/operations/generic.js +8 -30
  147. package/dist/shortcuts/jiuchuanhui/operations/registry.js +8 -2
  148. package/dist/shortcuts/jiuchuanhui/operations/shared.js +0 -10
  149. package/dist/shortcuts/mail/errors.js +14 -0
  150. package/dist/shortcuts/mail/index.js +23 -6
  151. package/dist/shortcuts/mail/manifest.js +11 -4
  152. package/dist/shortcuts/mail/operations/mail-blacklist.js +6 -6
  153. package/dist/shortcuts/mail/operations/mail-contacts.js +10 -10
  154. package/dist/shortcuts/mail/operations/mail-manage.js +15 -14
  155. package/dist/shortcuts/mail/operations/mail-read.js +7 -25
  156. package/dist/shortcuts/mail/operations/mail-send.js +12 -12
  157. package/dist/shortcuts/mail/operations/mail-sign.js +10 -10
  158. package/dist/shortcuts/mail/operations/mail-template.js +10 -10
  159. package/dist/shortcuts/meeting/index.js +11 -2
  160. package/dist/shortcuts/meeting/operations/invitation-publish.js +1 -0
  161. package/dist/shortcuts/okr/index.js +11 -2
  162. package/dist/shortcuts/performance/index.js +62 -3
  163. package/dist/shortcuts/performance/operations/flow-detail.js +5 -4
  164. package/dist/shortcuts/performance/scheme-validate.js +7 -0
  165. package/dist/shortcuts/performance/shared.js +40 -2
  166. package/dist/shortcuts/plan/index.js +11 -2
  167. package/dist/shortcuts/project/index.js +11 -2
  168. package/dist/shortcuts/project/operations/write.js +3 -0
  169. package/dist/shortcuts/reception/index.js +11 -2
  170. package/dist/shortcuts/reception/manifest.js +2 -2
  171. package/dist/shortcuts/reception/operations/ask.js +3 -0
  172. package/dist/shortcuts/recruit-stage/index.js +22 -3
  173. package/dist/shortcuts/recruit-stage/manifest.js +2 -0
  174. package/dist/shortcuts/recruit-stage/operations/jd-create.js +33 -16
  175. package/dist/shortcuts/recruit-stage/operations/profile.js +186 -0
  176. package/dist/shortcuts/recruit-stage/operations/registry.js +2 -0
  177. package/dist/shortcuts/recruit-stage/operations/resume-import.js +76 -47
  178. package/dist/shortcuts/recruit-stage/operations/search.js +151 -16
  179. package/dist/shortcuts/recruit-stage/operations/tag.js +17 -3
  180. package/dist/shortcuts/recruit-stage/shared.js +11 -1
  181. package/dist/shortcuts/smart-extract/index.js +11 -2
  182. package/dist/shortcuts/smart-extract/manifest.js +1 -0
  183. package/dist/shortcuts/smart-extract/operations/save.js +2 -0
  184. package/dist/shortcuts/workflow/index.js +21 -1
  185. package/dist/shortcuts/workflow/operations/aiDeepRead/collect.js +5 -2
  186. package/dist/shortcuts/workflow/operations/read.js +2 -2
  187. package/dist/shortcuts/workflow/operations/write.js +1 -1
  188. package/docs/caizhilian.md +1 -1
  189. package/docs/contract.md +1 -0
  190. package/docs/data.md +22 -22
  191. package/docs/e10-auth.md +41 -33
  192. package/docs/ehr.md +2 -0
  193. package/docs/jiuchuanhui.md +17 -5
  194. package/docs/reception.md +4 -3
  195. package/package.json +1 -1
  196. package/scripts/pysite/__pycache__/sitecustomize.cpython-312.pyc +0 -0
  197. package/scripts/pysite/__pycache__/sitecustomize.cpython-313.pyc +0 -0
  198. package/scripts/pysite/sitecustomize.py +41 -0
  199. package/skill-template/domains/data.md +4 -4
  200. package/skills/weaver-e10-caizhilian/SKILL.md +1 -1
  201. package/skills/weaver-e10-caizhilian/references/org-browser.md +1 -0
  202. package/skills/weaver-e10-cowork/SKILL.md +3 -1
  203. package/skills/weaver-e10-data/SKILL.md +12 -16
  204. package/skills/weaver-e10-data/references/config-center.md +6 -7
  205. package/skills/weaver-e10-data/references/datasource.md +1 -1
  206. package/skills/weaver-e10-data/references/scene-and-misc.md +2 -2
  207. package/skills/weaver-e10-jiuchuanhui/SKILL.md +51 -90
  208. package/skills/weaver-e10-jiuchuanhui/references/cache.md +17 -13
  209. package/skills/weaver-e10-jiuchuanhui/references/clue.md +2 -2
  210. package/skills/weaver-e10-jiuchuanhui/references/customer.md +49 -11
  211. package/skills/weaver-e10-jiuchuanhui/references/discovery-config.md +3 -3
  212. package/skills/weaver-e10-jiuchuanhui/references/jiuchuanhui-entry.md +9 -7
  213. package/skills/weaver-e10-jiuchuanhui/references/sale.md +2 -2
  214. package/skills/weaver-e10-jucailin/references/attend-write.md +1 -1
  215. package/skills/weaver-e10-mail/SKILL.md +4 -1
  216. package/skills/weaver-e10-mail/references/mail-read.md +4 -2
  217. package/skills/weaver-e10-mail/references/safety-boundaries.md +1 -0
  218. package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
  219. package/skills/weaver-e10-performance/SKILL.md +9 -7
  220. package/skills/weaver-e10-performance/agents/openai.yaml +4 -2
  221. package/skills/weaver-e10-performance/references/flow-assess.md +19 -6
  222. package/skills/weaver-e10-recruit-stage/SKILL.md +125 -20
  223. package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +359 -0
  224. package/skills/weaver-e10-recruit-stage/references/env-fixed-values.md +87 -0
  225. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +9 -2
  226. package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +1 -0
  227. package/skills/weaver-e10-recruit-stage/templates/match-report.html +177 -0
  228. package/skills/weaver-e10-shared/SKILL.md +22 -1
  229. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +2 -2
  230. package/skills/weaver-e10-workflow/SKILL.md +1 -1
  231. package/skills/weaver-e10-workflow/references/workflow-deep-read.md +8 -3
  232. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
@@ -3,10 +3,16 @@ const require = __esbuildCreateRequire(import.meta.url);
3
3
  import {
4
4
  charsOf,
5
5
  compactForStdout
6
- } from "./chunk-HG6INLH6.js";
6
+ } from "./chunk-6MMSLE6K.js";
7
7
  import "./chunk-AJ62BGAW.js";
8
8
  import {
9
- reportPlatformError
9
+ MANIFEST_LIST_COMPACT_PATHS,
10
+ manifestView
11
+ } from "./chunk-WM33BSIL.js";
12
+ import {
13
+ reportPlatformError,
14
+ shouldReportPlatformError,
15
+ toPlatformError
10
16
  } from "./chunk-MD5CW4B6.js";
11
17
  import {
12
18
  CONTINUATION_TTL_MS,
@@ -17,13 +23,13 @@ import {
17
23
  createE10RequestRuntime,
18
24
  isE10SessionExpiredResponse,
19
25
  requireE10Session
20
- } from "./chunk-LRKKKO5A.js";
26
+ } from "./chunk-DRJYPXKC.js";
21
27
  import {
22
28
  E10_SESSION_EXPIRED_MESSAGE
23
- } from "./chunk-GTAFCAVP.js";
29
+ } from "./chunk-IZCQU5D5.js";
24
30
  import {
25
31
  getActiveProfile
26
- } from "./chunk-I5XB4MZT.js";
32
+ } from "./chunk-SUWR5QEG.js";
27
33
  import {
28
34
  CliError,
29
35
  isCliError,
@@ -32,7 +38,7 @@ import {
32
38
  import "./chunk-BUSC6UAE.js";
33
39
 
34
40
  // src/shortcuts/jiuchuanhui/index.ts
35
- import { readFile as readFile2 } from "node:fs/promises";
41
+ import { readFile as readFile3 } from "node:fs/promises";
36
42
 
37
43
  // src/shortcuts/jiuchuanhui/continuation.ts
38
44
  import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
@@ -244,6 +250,13 @@ function failureDetails(value, code, message) {
244
250
  response: boundedResponse(value)
245
251
  };
246
252
  }
253
+ function claimPermissionMessage(value) {
254
+ const messages = [
255
+ value?.actionData?.responseData?.customData?.mainTable?.msg,
256
+ value?.responseData?.customData?.mainTable?.msg
257
+ ];
258
+ return messages.find((message) => typeof message === "string" && /^您对当前客户无领取权限[,,]\s*无法领取[。.]?$/u.test(message.trim()))?.trim();
259
+ }
247
260
  function assertJiuchuanhuiPath(requestPath) {
248
261
  if (typeof requestPath !== "string" || !requestPath.startsWith("/") || requestPath.startsWith("//")) {
249
262
  throw jiuchuanhuiValidationError("path_invalid", "\u8BF7\u6C42\u8DEF\u5F84\u5FC5\u987B\u662F\u76F8\u5BF9\u7EDD\u5BF9\u8DEF\u5F84");
@@ -296,11 +309,11 @@ function createJiuchuanhuiHost(ctx, dependencies = {}) {
296
309
  fetch: dependencies.fetch
297
310
  });
298
311
  }
299
- async function request(request2) {
312
+ async function send(request2) {
300
313
  const {
301
314
  method,
302
315
  path,
303
- query,
316
+ query: query2,
304
317
  body,
305
318
  operation,
306
319
  timeoutMs = 3e4
@@ -314,7 +327,7 @@ function createJiuchuanhuiHost(ctx, dependencies = {}) {
314
327
  operation,
315
328
  method: resolvedMethod,
316
329
  path,
317
- query: omitEmptyQueryValues(query),
330
+ query: omitEmptyQueryValues(query2),
318
331
  body,
319
332
  timeoutMs
320
333
  });
@@ -324,20 +337,44 @@ function createJiuchuanhuiHost(ctx, dependencies = {}) {
324
337
  if (isE10SessionExpiredResponse(response)) {
325
338
  throw jiuchuanhuiAuthError("session_expired", E10_SESSION_EXPIRED_MESSAGE, { httpStatus: response.status });
326
339
  }
340
+ return response;
341
+ }
342
+ async function query(request2) {
343
+ const response = await send(request2);
344
+ const value = response.parseError ? response.text : response.text ? response.value : null;
345
+ return {
346
+ httpStatus: response.status,
347
+ // Keep the JSON text for stdout so exact types and long numeric IDs survive serialization.
348
+ json: response.parseError ? JSON.stringify(response.text) : response.text || "null",
349
+ value
350
+ };
351
+ }
352
+ async function request(request2) {
353
+ const response = await send(request2);
354
+ if (request2.operation === "jiuchuanhui.customer.open-sea.claim.apply") {
355
+ const message = claimPermissionMessage(response.value);
356
+ if (message) {
357
+ throw new JiuchuanhuiCliError("permission", "claim_forbidden", message, {
358
+ exitCode: 6 /* PolicyError */,
359
+ stage: "esb-response"
360
+ });
361
+ }
362
+ }
327
363
  if (response.parseError) {
328
364
  if (response.status < 200 || response.status >= 300) {
329
365
  throw new JiuchuanhuiCliError("api", "http_error", `\u6CDB\u5FAE\u63A5\u53E3 HTTP ${response.status}`, {
330
366
  code: response.status,
331
- details: { status: response.status, response: boundedResponse(response.value) },
367
+ details: { status: response.status },
332
368
  exitCode: 1
333
369
  });
334
370
  }
335
371
  throw jiuchuanhuiNetworkError("protocol", `\u63A5\u53E3\u8FD4\u56DE\u4E0D\u662F\u5408\u6CD5 JSON\uFF08HTTP ${response.status}\uFF09`, { retryable: false });
336
372
  }
337
373
  if (response.status < 200 || response.status >= 300) {
374
+ const message = jiuchuanhuiBusinessMessage(response.value);
338
375
  throw new JiuchuanhuiCliError("api", "http_error", `\u6CDB\u5FAE\u63A5\u53E3 HTTP ${response.status}`, {
339
376
  code: response.status,
340
- details: { status: response.status, message: jiuchuanhuiBusinessMessage(response.value), response: boundedResponse(response.value) },
377
+ details: { status: response.status, ...failureDetails(response.value, response.status, message) },
341
378
  exitCode: 1
342
379
  });
343
380
  }
@@ -345,1097 +382,1239 @@ function createJiuchuanhuiHost(ctx, dependencies = {}) {
345
382
  const message = jiuchuanhuiBusinessMessage(response.value);
346
383
  throw new JiuchuanhuiCliError("api", "business_error", message, {
347
384
  code: businessCode(response.value),
348
- // message 一律原样(服务端 resultMsg),细节另开字段补充,不改写既有文案。
349
385
  details: failureDetails(response.value, businessCode(response.value), message),
350
386
  exitCode: 1
351
387
  });
352
388
  }
353
389
  return response.value;
354
390
  }
355
- return { request, getSession };
391
+ return { request, query, getSession };
356
392
  }
357
393
 
358
- // src/shortcuts/jiuchuanhui/manifest.ts
359
- var pageProps = {
360
- pageNo: { type: "integer", minimum: 1, default: 1 },
361
- pageSize: { type: "integer", minimum: 1, maximum: 200, default: 10 },
362
- count: { type: "boolean", description: "\u662F\u5426\u5E76\u884C\u8BF7\u6C42\u603B\u6570\u63A5\u53E3" }
363
- };
364
- var idProp = { type: "string", pattern: "^[1-9]\\d*$" };
365
- var formProp = {
366
- type: "object",
367
- additionalProperties: true,
368
- description: "\u521B\u5EFA/\u66F4\u65B0\u8868\u5355\u6570\u636E\uFF1A{ mainTable, detail1?, detail2?, ... } \u6216 { datas: [...] }\u3002data_key \u4E0E\u660E\u7EC6\u8868\u540D\u4EE5\u7F13\u5B58 config/{pk}.json \u4E3A\u51C6\u3002"
369
- };
370
- var esbWriteProps = (keys) => {
371
- const props = {};
372
- for (const key of keys) props[key] = { type: "string", description: `\u52A8\u4F5C\u6D41\u4E1A\u52A1\u53C2\u6570 ${key}` };
373
- return props;
394
+ // src/shortcuts/jiuchuanhui/operations/customer-quick.ts
395
+ import { readFile as readFile2 } from "node:fs/promises";
396
+
397
+ // src/shortcuts/jiuchuanhui/cache.ts
398
+ import { existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "node:fs";
399
+ import { homedir as homedir2 } from "node:os";
400
+ import { dirname, join } from "node:path";
401
+ var APP_TAG = "jch-crm-project";
402
+ var MIN_VERSION = "1.5.11";
403
+ var REGION_CONCURRENCY = 4;
404
+ function jiuchuanhuiCacheFile(tenantKey, userId) {
405
+ const root = process.env.WEAVER_E10_JIUCHUANHUI_HOME || join(homedir2(), ".weaver-e10-jiuchuanhui");
406
+ return join(root, tenantKey, userId, "weaver-e10-jiuchuanhui.json");
407
+ }
408
+ var MODULE_TAGS = [
409
+ "uf_jch_customer",
410
+ "uf_jch_sale",
411
+ "uf_jch_clue",
412
+ "uf_jch_contact",
413
+ "uf_jch_customer_open_sea",
414
+ "uf_jch_remind",
415
+ "uf_jch_rival",
416
+ "uf_jch_sale_process",
417
+ "uf_jch_sale_stage",
418
+ "uf_jch_clue_pool",
419
+ "uf_jch_lose_reason",
420
+ "uf_jch_customer_cmt",
421
+ "uf_jch_sale_cmt"
422
+ ];
423
+ var CREATE_PKS = ["customer_create_api", "sale_create_api", "ebclue_ai_create_api", "contact_create_api", "ebcontact_plan_create_api"];
424
+ var SEARCH_PKS = ["ebcustomer_search_api", "ebsale_search_api", "ebclue_ai_search_api"];
425
+ var UPDATE_PKS = ["customer_update_api", "sale_update_api", "ebclue_ai_update_api", "contact_update_api"];
426
+ var ALL_PKS = [...CREATE_PKS, ...SEARCH_PKS, ...UPDATE_PKS];
427
+ var PK_TO_TAG = {
428
+ customer_create_api: "uf_jch_customer",
429
+ sale_create_api: "uf_jch_sale",
430
+ ebclue_ai_create_api: "uf_jch_clue",
431
+ contact_create_api: "uf_jch_contact",
432
+ ebcontact_plan_create_api: "uf_jch_remind",
433
+ ebcustomer_search_api: "uf_jch_customer",
434
+ ebsale_search_api: "uf_jch_sale",
435
+ ebclue_ai_search_api: "uf_jch_clue",
436
+ customer_update_api: "uf_jch_customer",
437
+ sale_update_api: "uf_jch_sale",
438
+ ebclue_ai_update_api: "uf_jch_clue",
439
+ contact_update_api: "uf_jch_contact"
374
440
  };
375
- var esbWriteSchema = (keys, required = keys) => ({
376
- type: "object",
377
- additionalProperties: false,
378
- properties: esbWriteProps(keys),
379
- required
380
- });
381
- function writePair(baseName, title, props, required = [], fixed = {}, withPrepare = true) {
382
- const list = [];
383
- if (withPrepare) {
384
- list.push({
385
- name: `${baseName}.prepare`,
386
- risk: "read-before-write",
387
- fixed: { ...fixed, stage: "prepare" },
388
- inputSchema: {
389
- type: "object",
390
- additionalProperties: false,
391
- properties: {
392
- mainTable: {
393
- type: "object",
394
- additionalProperties: false,
395
- properties: props,
396
- ...required.length ? { required } : {}
397
- }
398
- },
399
- required: ["mainTable"]
400
- }
401
- });
441
+ var DETAIL_KEEP_KEYS = ["id", "interfacePk", "interfaceName", "datasNumber", "datasSize", "mainFields", "detailFields", "interfaceType", "relevanceForm"];
442
+ var FIELD_KEEP_KEYS = ["fieldid", "isRequired", "isInput", "data_key", "title", "component_type"];
443
+ var OPT_COMP = ["Select", "RadioBox", "CheckBox"];
444
+ var EBUILDER_QUERIES = [
445
+ { key: "customer_open_sea", path: "/api/ebuilder/form/formdata/v2/getFormDataList/customer_open_sea_search_api", nameFields: ["open_sea_name", "name"] },
446
+ { key: "sale_stage", path: "/api/ebuilder/form/formdata/v2/getFormDataList/sale_stage_search_api", nameFields: ["stage_name", "name"] },
447
+ { key: "sale_process", path: "/api/ebuilder/form/formdata/v2/getFormDataList/sale_process_sear_api", nameFields: ["process_name", "name"] },
448
+ { key: "clue_pool", path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcluepool_ai_search_api", nameFields: ["clue_pool_name", "name"] },
449
+ { key: "sale_lose_reason", path: "/api/ebuilder/form/formdata/v2/getFormDataList/sale_lose_reason", nameFields: ["reason_name", "name"] },
450
+ { key: "customer_industry", path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_industry_search_api", nameFields: ["industry_name", "name"] },
451
+ { key: "customer_type", path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_type_search_api", nameFields: ["type_name", "name"] },
452
+ { key: "customer_status", path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_status_search_api", nameFields: ["state_name", "name"] }
453
+ ];
454
+ var REGION_CITIES = [
455
+ "\u5317\u4EAC\u5E02",
456
+ "\u4E0A\u6D77\u5E02",
457
+ "\u5929\u6D25\u5E02",
458
+ "\u91CD\u5E86\u5E02",
459
+ "\u6210\u90FD\u5E02",
460
+ "\u5E7F\u5DDE\u5E02",
461
+ "\u6DF1\u5733\u5E02",
462
+ "\u4E1C\u839E\u5E02",
463
+ "\u676D\u5DDE\u5E02",
464
+ "\u5357\u4EAC\u5E02",
465
+ "\u82CF\u5DDE\u5E02",
466
+ "\u6B66\u6C49\u5E02",
467
+ "\u957F\u6C99\u5E02",
468
+ "\u897F\u5B89\u5E02",
469
+ "\u90D1\u5DDE\u5E02",
470
+ "\u6D4E\u5357\u5E02",
471
+ "\u9752\u5C9B\u5E02",
472
+ "\u53A6\u95E8\u5E02",
473
+ "\u798F\u5DDE\u5E02",
474
+ "\u5408\u80A5\u5E02",
475
+ "\u6C88\u9633\u5E02",
476
+ "\u5927\u8FDE\u5E02"
477
+ ];
478
+ function pickKeys(obj, keys) {
479
+ const out = {};
480
+ for (const k of keys) if (obj?.[k] !== void 0) out[k] = obj[k];
481
+ return out;
482
+ }
483
+ var isInputOne = (f) => String(f?.isInput) === "1";
484
+ function semverGte(a, b) {
485
+ const pa = String(a || "").split(".").map((x) => parseInt(x, 10) || 0);
486
+ const pb = b.split(".").map((x) => parseInt(x, 10) || 0);
487
+ for (let i = 0; i < 3; i++) {
488
+ if ((pa[i] || 0) !== (pb[i] || 0)) return (pa[i] || 0) > (pb[i] || 0);
402
489
  }
403
- list.push({
404
- name: `${baseName}.apply`,
405
- risk: "high-risk-write",
406
- fixed: { ...fixed, stage: "apply" },
407
- inputSchema: {
408
- type: "object",
409
- additionalProperties: false,
410
- properties: {
411
- continuation: { type: "string", minLength: 1 },
412
- confirm: { const: true }
413
- },
414
- required: ["continuation", "confirm"]
490
+ return true;
491
+ }
492
+ function searchConditionRows(value) {
493
+ if (typeof value === "string") {
494
+ try {
495
+ value = JSON.parse(value);
496
+ } catch {
497
+ return void 0;
415
498
  }
416
- });
417
- return list;
499
+ }
500
+ return Array.isArray(value?.datas) ? value.datas : void 0;
418
501
  }
419
- var OPERATION_SUMMARIES = {
420
- "jiuchuanhui.cache.init": "\u521D\u59CB\u5316\u4E5D\u6C1A\u6C47\u672C\u5730\u7F13\u5B58\uFF08\u5199\u672C\u5730\u7F13\u5B58\u6587\u4EF6\uFF0C\u4E0D\u8C03\u4E1A\u52A1\u63A5\u53E3\uFF09\uFF1B\u5165\u53C2 dryRun/verbose",
421
- "jiuchuanhui.app.discovery": "\u6309\u6807\u7B7E\u53D6\u4E5D\u6C1A\u6C47\u76F8\u5173 eBuilder \u5E94\u7528 ID \u5217\u8868",
422
- "jiuchuanhui.form.discovery": "\u6309\u6807\u7B7E\u4E0E\u5E94\u7528\u53D6\u8868\u5355\uFF08\u5BF9\u8C61\uFF09\u5B9A\u4E49\uFF0C\u7528\u4E8E\u5B9A\u4F4D\u5BA2\u6237/\u5546\u673A\u7B49\u4E3B\u8868",
423
- "jiuchuanhui.field.options": "\u53D6\u8868\u5355\u67D0\u5B57\u6BB5\u7684\u9009\u9879\u5B57\u5178\uFF08id\u2194name\uFF09\uFF1B\u5165\u53C2 fieldName/objId/groupId",
424
- "jiuchuanhui.rest.cfg.detail": "\u6309 apid + id \u53D6 REST \u914D\u7F6E\u8BE6\u60C5\uFF08\u52A8\u4F5C\u6D41\u914D\u7F6E\u89E3\u6790\u7ED3\u679C\uFF09",
425
- "jiuchuanhui.config.id.by.pk": "\u6309\u4E3B\u8868\u4E0E\u6570\u636E\u4E3B\u952E\u53CD\u67E5\u914D\u7F6E ID\uFF08\u7ECF\u52A8\u4F5C\u6D41\uFF09",
426
- "jiuchuanhui.file.preview": "\u53D6\u9644\u4EF6\u9884\u89C8\u5730\u5740\uFF1B\u5165\u53C2 fileId/fieldId/appId",
427
- "jiuchuanhui.customer.create.prepare": "\u51C6\u5907\u65B0\u5EFA\u5BA2\u6237\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09\uFF1B\u5165\u53C2 mainTable \u4E0E\u5BA2\u6237\u5B57\u6BB5",
428
- "jiuchuanhui.customer.create.apply": "\u63D0\u4EA4\u65B0\u5EFA\u5BA2\u6237\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
429
- "jiuchuanhui.customer.get": "\u6309 id \u53D6\u5BA2\u6237\u8BE6\u60C5",
430
- "jiuchuanhui.customer.search": "\u5206\u9875\u67E5\u8BE2\u5BA2\u6237\u5217\u8868\uFF08\u652F\u6301\u6761\u4EF6\u8FC7\u6EE4\uFF09",
431
- "jiuchuanhui.customer.type.search": "\u5206\u9875\u67E5\u8BE2\u5BA2\u6237\u7C7B\u578B\u5B57\u5178",
432
- "jiuchuanhui.customer.status.search": "\u5206\u9875\u67E5\u8BE2\u5BA2\u6237\u72B6\u6001\u5B57\u5178",
433
- "jiuchuanhui.customer.industry.search": "\u5206\u9875\u67E5\u8BE2\u5BA2\u6237\u884C\u4E1A\u5B57\u5178",
434
- "jiuchuanhui.customer.open-sea.search": "\u5206\u9875\u67E5\u8BE2\u516C\u6D77\u5BA2\u6237\u5217\u8868",
435
- "jiuchuanhui.customer.update.prepare": "\u51C6\u5907\u4FEE\u6539\u5BA2\u6237\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09\uFF1B\u5165\u53C2 mainTable \u4E0E\u5F85\u6539\u5B57\u6BB5",
436
- "jiuchuanhui.customer.update.apply": "\u63D0\u4EA4\u4FEE\u6539\u5BA2\u6237\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
437
- "jiuchuanhui.customer.transfer.prepare": "\u51C6\u5907\u8F6C\u79FB\u5BA2\u6237\u8D1F\u8D23\u4EBA\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09\uFF1B\u5165\u53C2 mainTable \u4E0E\u76EE\u6807\u8D1F\u8D23\u4EBA",
438
- "jiuchuanhui.customer.transfer.apply": "\u63D0\u4EA4\u8F6C\u79FB\u5BA2\u6237\u8D1F\u8D23\u4EBA\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
439
- "jiuchuanhui.customer.open-sea.release.prepare": "\u51C6\u5907\u628A\u5BA2\u6237\u91CA\u653E\u5230\u516C\u6D77\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
440
- "jiuchuanhui.customer.open-sea.release.apply": "\u63D0\u4EA4\u628A\u5BA2\u6237\u91CA\u653E\u5230\u516C\u6D77\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
441
- "jiuchuanhui.customer.open-sea.claim.prepare": "\u51C6\u5907\u4ECE\u516C\u6D77\u9886\u53D6\u5BA2\u6237\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
442
- "jiuchuanhui.customer.open-sea.claim.apply": "\u63D0\u4EA4\u4ECE\u516C\u6D77\u9886\u53D6\u5BA2\u6237\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
443
- "jiuchuanhui.customer.duplicate.check": "\u5BA2\u6237\u67E5\u91CD\uFF1A\u6309\u540D\u79F0/\u5173\u952E\u4FE1\u606F\u627E\u51FA\u7591\u4F3C\u91CD\u590D\u5BA2\u6237\uFF08\u7ECF\u52A8\u4F5C\u6D41\uFF09",
444
- "jiuchuanhui.customer.contact-record.create.prepare": "\u51C6\u5907\u65B0\u589E\u5BA2\u6237\u8054\u7CFB\u8BB0\u5F55\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
445
- "jiuchuanhui.customer.contact-record.create.apply": "\u63D0\u4EA4\u65B0\u589E\u5BA2\u6237\u8054\u7CFB\u8BB0\u5F55\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
446
- "jiuchuanhui.customer.contact-record.batch.prepare": "\u51C6\u5907\u6279\u91CF\u65B0\u589E\u5BA2\u6237\u8054\u7CFB\u8BB0\u5F55\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
447
- "jiuchuanhui.customer.contact-record.batch.apply": "\u63D0\u4EA4\u6279\u91CF\u65B0\u589E\u5BA2\u6237\u8054\u7CFB\u8BB0\u5F55\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
448
- "jiuchuanhui.contact.create.prepare": "\u51C6\u5907\u65B0\u5EFA\u8054\u7CFB\u4EBA\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09\uFF1B\u5165\u53C2 mainTable \u4E0E\u8054\u7CFB\u4EBA\u5B57\u6BB5",
449
- "jiuchuanhui.contact.create.apply": "\u63D0\u4EA4\u65B0\u5EFA\u8054\u7CFB\u4EBA\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
450
- "jiuchuanhui.contact.get": "\u6309 id \u53D6\u8054\u7CFB\u4EBA\u8BE6\u60C5",
451
- "jiuchuanhui.contact.update.prepare": "\u51C6\u5907\u4FEE\u6539\u8054\u7CFB\u4EBA\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
452
- "jiuchuanhui.contact.update.apply": "\u63D0\u4EA4\u4FEE\u6539\u8054\u7CFB\u4EBA\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
453
- "jiuchuanhui.contact.by-entity.search": "\u6309\u5BA2\u6237\u6216\u5546\u673A\u67E5\u8BE2\u5173\u8054\u7684\u8054\u7CFB\u4EBA\u5217\u8868\uFF1B\u5165\u53C2 customerId/saleChanceId",
454
- "jiuchuanhui.sale.create.prepare": "\u51C6\u5907\u65B0\u5EFA\u5546\u673A\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09\uFF1B\u5165\u53C2 mainTable \u4E0E\u5546\u673A\u5B57\u6BB5",
455
- "jiuchuanhui.sale.create.apply": "\u63D0\u4EA4\u65B0\u5EFA\u5546\u673A\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
456
- "jiuchuanhui.sale.get": "\u6309 id \u53D6\u5546\u673A\u8BE6\u60C5",
457
- "jiuchuanhui.sale.search": "\u5206\u9875\u67E5\u8BE2\u5546\u673A\u5217\u8868\uFF08\u652F\u6301\u6761\u4EF6\u8FC7\u6EE4\uFF09",
458
- "jiuchuanhui.sale.update.prepare": "\u51C6\u5907\u4FEE\u6539\u5546\u673A\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
459
- "jiuchuanhui.sale.update.apply": "\u63D0\u4EA4\u4FEE\u6539\u5546\u673A\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
460
- "jiuchuanhui.sale.stage.search": "\u5206\u9875\u67E5\u8BE2\u9500\u552E\u9636\u6BB5\u5B57\u5178",
461
- "jiuchuanhui.sale.process.search": "\u5206\u9875\u67E5\u8BE2\u5546\u673A\u7684\u6D41\u7A0B/\u9636\u6BB5\u63A8\u8FDB\u8BB0\u5F55",
462
- "jiuchuanhui.sale.lose-reason.search": "\u5206\u9875\u67E5\u8BE2\u4E22\u5355\u539F\u56E0\u5B57\u5178",
463
- "jiuchuanhui.rival.search": "\u5206\u9875\u67E5\u8BE2\u7ADE\u4E89\u5BF9\u624B\u5217\u8868",
464
- "jiuchuanhui.sale.win.prepare": "\u51C6\u5907\u6807\u8BB0\u5546\u673A\u8D62\u5355\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
465
- "jiuchuanhui.sale.win.apply": "\u63D0\u4EA4\u6807\u8BB0\u5546\u673A\u8D62\u5355\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
466
- "jiuchuanhui.sale.lose.prepare": "\u51C6\u5907\u6807\u8BB0\u5546\u673A\u8F93\u5355\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
467
- "jiuchuanhui.sale.lose.apply": "\u63D0\u4EA4\u6807\u8BB0\u5546\u673A\u8F93\u5355\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
468
- "jiuchuanhui.sale.invalid.prepare": "\u51C6\u5907\u4F5C\u5E9F\u5546\u673A\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
469
- "jiuchuanhui.sale.invalid.apply": "\u63D0\u4EA4\u4F5C\u5E9F\u5546\u673A\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
470
- "jiuchuanhui.sale.pause.prepare": "\u51C6\u5907\u6682\u505C\u5546\u673A\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
471
- "jiuchuanhui.sale.pause.apply": "\u63D0\u4EA4\u6682\u505C\u5546\u673A\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
472
- "jiuchuanhui.sale.restart.prepare": "\u51C6\u5907\u91CD\u542F\u5546\u673A\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
473
- "jiuchuanhui.sale.restart.apply": "\u63D0\u4EA4\u91CD\u542F\u5546\u673A\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
474
- "jiuchuanhui.sale.manager-change.prepare": "\u51C6\u5907\u53D8\u66F4\u5546\u673A\u8D1F\u8D23\u4EBA\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
475
- "jiuchuanhui.sale.manager-change.apply": "\u63D0\u4EA4\u53D8\u66F4\u5546\u673A\u8D1F\u8D23\u4EBA\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
476
- "jiuchuanhui.sale.link-contacts.prepare": "\u51C6\u5907\u7ED9\u5546\u673A\u5173\u8054\u8054\u7CFB\u4EBA\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
477
- "jiuchuanhui.sale.link-contacts.apply": "\u63D0\u4EA4\u7ED9\u5546\u673A\u5173\u8054\u8054\u7CFB\u4EBA\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
478
- "jiuchuanhui.sale.contact-record.create.prepare": "\u51C6\u5907\u65B0\u589E\u5546\u673A\u8054\u7CFB\u8BB0\u5F55\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
479
- "jiuchuanhui.sale.contact-record.create.apply": "\u63D0\u4EA4\u65B0\u589E\u5546\u673A\u8054\u7CFB\u8BB0\u5F55\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
480
- "jiuchuanhui.clue.create.prepare": "\u51C6\u5907\u65B0\u5EFA\u7EBF\u7D22\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09\uFF1B\u5165\u53C2 mainTable \u4E0E\u7EBF\u7D22\u5B57\u6BB5",
481
- "jiuchuanhui.clue.create.apply": "\u63D0\u4EA4\u65B0\u5EFA\u7EBF\u7D22\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
482
- "jiuchuanhui.clue.get": "\u6309 id \u53D6\u7EBF\u7D22\u8BE6\u60C5",
483
- "jiuchuanhui.clue.search": "\u5206\u9875\u67E5\u8BE2\u7EBF\u7D22\u5217\u8868\uFF08\u652F\u6301\u6761\u4EF6\u8FC7\u6EE4\uFF09",
484
- "jiuchuanhui.clue.pool.search": "\u5206\u9875\u67E5\u8BE2\u7EBF\u7D22\u6C60\u5217\u8868",
485
- "jiuchuanhui.clue.update.prepare": "\u51C6\u5907\u4FEE\u6539\u7EBF\u7D22\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
486
- "jiuchuanhui.clue.update.apply": "\u63D0\u4EA4\u4FEE\u6539\u7EBF\u7D22\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
487
- "jiuchuanhui.clue.status-change.prepare": "\u51C6\u5907\u53D8\u66F4\u7EBF\u7D22\u72B6\u6001\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
488
- "jiuchuanhui.clue.status-change.apply": "\u63D0\u4EA4\u53D8\u66F4\u7EBF\u7D22\u72B6\u6001\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
489
- "jiuchuanhui.clue.to-customer.prepare": "\u51C6\u5907\u628A\u7EBF\u7D22\u8F6C\u4E3A\u5BA2\u6237\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
490
- "jiuchuanhui.clue.to-customer.apply": "\u63D0\u4EA4\u628A\u7EBF\u7D22\u8F6C\u4E3A\u5BA2\u6237\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
491
- "jiuchuanhui.clue.contact-record.create.prepare": "\u51C6\u5907\u65B0\u589E\u7EBF\u7D22\u8054\u7CFB\u8BB0\u5F55\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
492
- "jiuchuanhui.clue.contact-record.create.apply": "\u63D0\u4EA4\u65B0\u589E\u7EBF\u7D22\u8054\u7CFB\u8BB0\u5F55\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
493
- "jiuchuanhui.contact-plan.create.prepare": "\u51C6\u5907\u65B0\u5EFA\u8054\u7CFB\u8BA1\u5212\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
494
- "jiuchuanhui.contact-plan.create.apply": "\u63D0\u4EA4\u65B0\u5EFA\u8054\u7CFB\u8BA1\u5212\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
495
- "jiuchuanhui.contact-plan.complete.prepare": "\u51C6\u5907\u628A\u8054\u7CFB\u8BA1\u5212\u6807\u8BB0\u5B8C\u6210\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
496
- "jiuchuanhui.contact-plan.complete.apply": "\u63D0\u4EA4\u628A\u8054\u7CFB\u8BA1\u5212\u6807\u8BB0\u5B8C\u6210\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
497
- "jiuchuanhui.entity.contact-records.list": "\u67E5\u67D0\u4E2A\u5B9E\u4F53\uFF08\u5BA2\u6237/\u5546\u673A/\u7EBF\u7D22\uFF09\u540D\u4E0B\u7684\u8054\u7CFB\u8BB0\u5F55\uFF1B\u5165\u53C2 mainTable \u4E0E\u5B9E\u4F53\u4E3B\u952E",
498
- "jiuchuanhui.contact-records.by-person-time.list": "\u6309\u4EBA\u5458\u4E0E\u65F6\u95F4\u8303\u56F4\u67E5\u8054\u7CFB\u8BB0\u5F55",
499
- "jiuchuanhui.entity.id.by-name": "\u6309\u540D\u79F0\u89E3\u6790\u5B9E\u4F53 ID\uFF08\u91CD\u540D\u65F6\u4F1A\u7ED9\u51FA\u5019\u9009\uFF09",
500
- "jiuchuanhui.user.id.by-name": "\u6309\u59D3\u540D\u89E3\u6790\u7528\u6237 ID\uFF08\u91CD\u540D\u65F6\u4F1A\u7ED9\u51FA\u5019\u9009\uFF09",
501
- "jiuchuanhui.user.current-profile": "\u53D6\u5F53\u524D\u767B\u5F55\u4EBA\u7684\u753B\u50CF\u4FE1\u606F\uFF08\u90E8\u95E8/\u5C97\u4F4D/\u4E0A\u7EA7\uFF09",
502
- "jiuchuanhui.entity.permission.judge": "\u5224\u5B9A\u5F53\u524D\u7528\u6237\u5BF9\u67D0\u5B9E\u4F53\uFF08\u5BA2\u6237/\u5546\u673A/\u7EBF\u7D22\uFF09\u7684\u64CD\u4F5C\u6743\u9650",
503
- "jiuchuanhui.company.business-profile.query": "\u67E5\u5BA2\u6237\u7684\u5DE5\u5546\u753B\u50CF\u4FE1\u606F",
504
- "jiuchuanhui.field.info.by-ids": "\u6309 ID \u6279\u91CF\u53D6\u5B57\u6BB5\u4FE1\u606F\uFF08\u540D\u79F0/\u7C7B\u578B\uFF09",
505
- "jiuchuanhui.browser-option.search": "\u901A\u7528\u6D4F\u89C8\u6309\u94AE\u68C0\u7D22\uFF1A\u6309\u81EA\u5B9A\u4E49\u6D4F\u89C8\u6309\u94AE\u7C7B\u578B\u53D6\u5019\u9009\uFF08\u8DEF\u5F84\u53C2\u6570 pathParams\uFF09",
506
- "jiuchuanhui.get-rest-cfg-detail": "\u6309 apid + id \u53D6 REST \u914D\u7F6E\u8BE6\u60C5\uFF08\u4E0E rest.cfg.detail \u540C\u7C7B\uFF0C\u8DEF\u5F84\u4E0D\u540C\uFF09"
507
- };
508
- function withSummaries(operations) {
509
- return operations.map((item) => ({
510
- ...item,
511
- summary: item.summary || OPERATION_SUMMARIES[item.name] || ""
512
- }));
502
+ function successCheck(value) {
503
+ if (!value || typeof value !== "object") return false;
504
+ if (value.resultCode !== void 0 && value.resultCode !== null) return Number(value.resultCode) === 200;
505
+ if (value.datajson && typeof value.datajson === "object") {
506
+ const status = value.datajson.status;
507
+ if (status === "true" || status === true) return true;
508
+ if (status === "false" || status === false) return false;
509
+ }
510
+ const code = value.code ?? value.res_base?.ret;
511
+ if (code !== void 0 && code !== null) return Number(code) === 0 || Number(code) === 200;
512
+ return typeof value.success === "boolean" ? value.success : false;
513
513
  }
514
- var jiuchuanhuiOperations = [
515
- // ==================== 发现与配置 ====================
516
- {
517
- name: "jiuchuanhui.cache.init",
518
- risk: "local-file-write",
519
- fixed: { path: "local:cache", purpose: "\u4E5D\u6C1A\u6C47\u914D\u7F6E\u7F13\u5B58\u521D\u59CB\u5316/\u5237\u65B0" },
520
- inputSchema: {
521
- type: "object",
522
- additionalProperties: false,
523
- properties: {
524
- dryRun: { type: "boolean", description: "\u53EA\u62C9\u53D6\u4E0D\u5199\u5165\uFF08\u9884\u89C8\uFF09" },
525
- verbose: { type: "boolean", description: "\u8FD4\u56DE\u66F4\u591A\u6B65\u9AA4\u660E\u7EC6" }
526
- }
514
+ var CacheInitOperation = class {
515
+ name = "jiuchuanhui.cache.init";
516
+ async execute(input, { host }) {
517
+ const dryRun = input.dryRun === true;
518
+ const verbose = input.verbose === true;
519
+ const session = await host.getSession();
520
+ const tenantKey = session.tenantKey || "";
521
+ const userId = session.userId || "";
522
+ if (!tenantKey || !userId) {
523
+ throw jiuchuanhuiValidationError("session_context_missing", "\u65E0\u6CD5\u83B7\u53D6\u7F13\u5B58\u9694\u79BB\u4E0A\u4E0B\u6587\uFF1Asession \u7F3A\u5C11 tenantKey/userId\uFF0C\u8BF7\u786E\u8BA4 E10 \u767B\u5F55\u6001");
527
524
  }
528
- },
529
- {
530
- name: "jiuchuanhui.app.discovery",
531
- risk: "read",
532
- fixed: { path: "/api/bs/ebuilder/app/tags/getAppIds", method: "GET" },
533
- inputSchema: {
534
- type: "object",
535
- additionalProperties: false,
536
- properties: {
537
- tag: { type: "string", description: "\u5E94\u7528\u6807\u7B7E\uFF1B\u5FC5\u586B\uFF0C\u5E38\u7528 jch-crm-project\uFF08\u4E0D\u4F1A\u81EA\u52A8\u6CE8\u5165\u9ED8\u8BA4\u503C\uFF09" }
538
- },
539
- required: ["tag"]
525
+ const mainFile = jiuchuanhuiCacheFile(tenantKey, String(userId));
526
+ const baseDir = dirname(mainFile);
527
+ const cfgDir = join(baseDir, "config");
528
+ let old = {};
529
+ if (existsSync2(mainFile)) {
530
+ try {
531
+ old = JSON.parse(readFileSync(mainFile, "utf-8"));
532
+ } catch {
533
+ }
540
534
  }
541
- },
542
- {
543
- name: "jiuchuanhui.form.discovery",
544
- risk: "read",
545
- fixed: { path: "/api/ebuilder/form/obj/getObjsByTag", method: "GET" },
546
- inputSchema: {
547
- type: "object",
548
- additionalProperties: false,
549
- properties: {
550
- tag: { type: "string", description: "\u8868\u5355 tag\uFF0C\u5982 uf_jch_customer" },
551
- appId: { type: "string" }
552
- },
553
- required: ["tag", "appId"]
535
+ const discovery = {};
536
+ const appResp = await host.request({
537
+ method: "GET",
538
+ path: "/api/bs/ebuilder/app/tags/getAppIds",
539
+ query: { tag: APP_TAG },
540
+ operation: this.name
541
+ });
542
+ if (!successCheck(appResp)) throw jiuchuanhuiValidationError("init_failed", "app.discovery \u672A\u6210\u529F\uFF0C\u65E0\u6CD5\u521D\u59CB\u5316\u7F13\u5B58");
543
+ const rawApp = appResp?.data ?? appResp?.datajson?.datas;
544
+ const appId = Array.isArray(rawApp) && rawApp[0] ? String(rawApp[0]) : null;
545
+ if (!appId) throw jiuchuanhuiValidationError("init_failed", "\u6B65\u9AA4 1 \u672A\u53D6\u5F97 appId\uFF0C\u8BF7\u68C0\u67E5 E10 \u767B\u5F55\u6001");
546
+ discovery[`appId:${APP_TAG}`] = appId;
547
+ for (const tag of MODULE_TAGS) {
548
+ const resp = await host.request({
549
+ method: "GET",
550
+ path: "/api/ebuilder/form/obj/getObjsByTag",
551
+ query: { tag, appId },
552
+ operation: this.name
553
+ });
554
+ const list = Array.isArray(resp?.data) ? resp.data : resp?.datajson?.datas ?? [];
555
+ const hit = list.find((o) => o?.formId && String(o.formId) !== "0") ?? list?.[0];
556
+ if (hit?.id) discovery[`objId:${tag}`] = String(hit.id);
554
557
  }
555
- },
556
- {
557
- name: "jiuchuanhui.field.options",
558
- risk: "read",
559
- fixed: { path: "/api/ebuilder/common/ds/options", method: "GET", sourceType: "FORM", optionLevel: 1 },
560
- inputSchema: {
561
- type: "object",
562
- additionalProperties: false,
563
- properties: {
564
- fieldName: { type: "string", description: "\u5B57\u6BB5\u5143\u6570\u636EID\uFF08fieldid\uFF09\uFF0C\u4E0D\u662F data_key \u540D\u79F0" },
565
- sourceType: { type: "string", default: "FORM" },
566
- objId: { type: "string", description: "\u8868\u5355\u5BF9\u8C61ID\uFF0C\u53EF\u7701\u7565\u81EA\u52A8\u53D1\u73B0" },
567
- groupId: { type: "string", description: "\u5E94\u7528\u5206\u7EC4ID\uFF0C\u53EF\u7701\u7565\u81EA\u52A8\u53D1\u73B0\uFF08\u9ED8\u8BA4\u6309 jch-crm-project \u53D1\u73B0\uFF09" }
568
- },
569
- required: ["fieldName", "sourceType"]
558
+ try {
559
+ const spResp = await host.request({
560
+ method: "GET",
561
+ path: "/api/installer/public/querySpAppVersionInfo",
562
+ query: { appId },
563
+ operation: this.name
564
+ });
565
+ const sp = spResp?.data;
566
+ const commitVersion = typeof sp === "object" && sp !== null ? String(sp.commitVersion ?? sp.version ?? "") : "";
567
+ if (commitVersion) {
568
+ discovery[`spVersion:${APP_TAG}`] = { commitVersion, passed: semverGte(commitVersion, MIN_VERSION) };
569
+ }
570
+ } catch {
570
571
  }
571
- },
572
- {
573
- name: "jiuchuanhui.rest.cfg.detail",
574
- risk: "read",
575
- fixed: { path: "/api/bs/ebuilder/form/formdata/getRestCfgById", method: "GET" },
576
- inputSchema: {
577
- type: "object",
578
- additionalProperties: false,
579
- properties: {
580
- apid: { type: "string", description: "\u5E94\u7528 ID" },
581
- id: { type: "string", description: "\u63A5\u53E3\u914D\u7F6E ID (cfgId)" }
582
- },
583
- required: ["apid", "id"]
572
+ const cfgMap = {};
573
+ for (const pk of ALL_PKS) {
574
+ const resp = await host.request({
575
+ path: "/api/esb/server/event/triggerActionFlow",
576
+ body: { customParams: { mainTable: { interface_pk: pk } }, uniqueIndent: "4F6E1A9702864666803CCA6B77B86227", employeeId: userId },
577
+ operation: this.name
578
+ });
579
+ const cfgId = resp?.actionData?.responseData?.customData?.mainTable?.cfgId ?? resp?.customData?.mainTable?.cfgId ?? resp?.datajson?.mainTable?.cfgId ?? resp?.data?.mainTable?.cfgId ?? resp?.mainTable?.cfgId;
580
+ if (cfgId) cfgMap[pk] = String(cfgId);
584
581
  }
585
- },
586
- {
587
- name: "jiuchuanhui.config.id.by.pk",
588
- risk: "read",
589
- fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "4F6E1A9702864666803CCA6B77B86227" },
590
- inputSchema: {
591
- type: "object",
592
- additionalProperties: false,
593
- properties: {
594
- mainTable: {
595
- type: "object",
596
- additionalProperties: false,
597
- properties: { interface_pk: { type: "string" } },
598
- required: ["interface_pk"]
582
+ const perPk = {};
583
+ const searchConditions = /* @__PURE__ */ new Map();
584
+ for (const pk of Object.keys(cfgMap)) {
585
+ const cfgId = cfgMap[pk];
586
+ const resp = await host.request({
587
+ method: "GET",
588
+ path: "/api/bs/ebuilder/form/formdata/getRestCfgById",
589
+ query: { apid: appId, id: cfgId },
590
+ operation: this.name
591
+ });
592
+ const detail = resp?.data ?? {};
593
+ if (SEARCH_PKS.includes(pk)) {
594
+ const rows = searchConditionRows(detail.conditions);
595
+ if (rows) searchConditions.set(pk, rows);
596
+ }
597
+ if (!detail?.id && !detail?.mainFields) continue;
598
+ const allFields = [
599
+ ...detail.mainFields || [],
600
+ ...(detail.detailFields || []).flatMap((df) => df.fields || [])
601
+ ];
602
+ const fieldIds = [...new Set(allFields.filter(isInputOne).map((f) => String(f.fieldid)).filter(Boolean))];
603
+ const infoMap = /* @__PURE__ */ new Map();
604
+ if (fieldIds.length > 0) {
605
+ try {
606
+ const infoResp = await host.request({
607
+ path: "/api/esb/server/event/triggerActionFlow",
608
+ body: { customParams: { mainTable: { fieldids: fieldIds.join(",") } }, uniqueIndent: "10351A4DC8D4454A9F1957FBE647CD9F", employeeId: userId },
609
+ operation: this.name
610
+ });
611
+ const list = infoResp?.actionData?.responseData?.customData?.mainTable?.fieldInfoList ?? infoResp?.customData?.mainTable?.fieldInfoList ?? infoResp?.datajson?.mainTable?.fieldInfoList ?? infoResp?.fieldInfoList ?? [];
612
+ for (const it of list) infoMap.set(String(it.id), it);
613
+ } catch {
599
614
  }
600
- },
601
- required: ["mainTable"]
615
+ }
616
+ const merge = (f) => {
617
+ const info = infoMap.get(String(f?.fieldid));
618
+ if (info) {
619
+ f.data_key = info.data_key ?? f.data_key;
620
+ f.title = info.title ?? f.title;
621
+ f.component_type = info.component_type ?? f.component_type;
622
+ }
623
+ };
624
+ detail.mainFields = (detail.mainFields || []).filter(isInputOne);
625
+ detail.detailFields = (detail.detailFields || []).map((df) => ({ ...df, fields: (df.fields || []).filter(isInputOne) })).filter((df) => Array.isArray(df.fields) && df.fields.length > 0);
626
+ for (const f of detail.mainFields) merge(f);
627
+ for (const df of detail.detailFields) for (const f of df.fields) merge(f);
628
+ const kept = pickKeys(detail, DETAIL_KEEP_KEYS);
629
+ if (Array.isArray(kept.mainFields)) kept.mainFields = kept.mainFields.map((f) => pickKeys(f, FIELD_KEEP_KEYS));
630
+ if (Array.isArray(kept.detailFields)) {
631
+ kept.detailFields = kept.detailFields.map((df) => ({
632
+ ...pickKeys(df, ["id", "fieldName", "title", "fields"]),
633
+ fields: Array.isArray(df.fields) ? df.fields.map((f) => pickKeys(f, FIELD_KEEP_KEYS)) : []
634
+ }));
635
+ }
636
+ perPk[pk] = { cfgId, detail: kept };
602
637
  }
603
- },
604
- {
605
- name: "jiuchuanhui.file.preview",
606
- risk: "read",
607
- fixed: { path: "/api/file/preview", method: "GET", module: "ebuilderform", authModule: "ebuilderform", source: "form" },
608
- inputSchema: {
609
- type: "object",
610
- additionalProperties: false,
611
- properties: {
612
- fileId: { type: "string" },
613
- fieldId: { type: "string" },
614
- appId: { type: "string" },
615
- customParam: { type: ["string", "object"] }
616
- },
617
- required: ["fileId"]
638
+ const ebuilder = {};
639
+ for (const { key, path, nameFields } of EBUILDER_QUERIES) {
640
+ const list = [];
641
+ let pageNo = 1;
642
+ for (; ; ) {
643
+ const resp = await host.request({
644
+ path,
645
+ body: { datajson: { mainTable: {}, pageInfo: { pageNo, pageSize: 100 }, header: { operator: userId } } },
646
+ operation: this.name
647
+ });
648
+ const items = resp?.datajson?.datas ?? resp?.data ?? [];
649
+ list.push(...Array.isArray(items) ? items : []);
650
+ const hasMore = resp?.hasMore ?? (Array.isArray(items) && items.length === 100);
651
+ if (!hasMore || list.length >= 500 || pageNo >= 5) break;
652
+ pageNo += 1;
653
+ }
654
+ ebuilder[key] = list.map((it) => {
655
+ const mt = it?.mainTable ?? it ?? {};
656
+ let name = "";
657
+ for (const nf of nameFields) {
658
+ if (mt[nf] !== void 0 && mt[nf] !== null && String(mt[nf]) !== "") {
659
+ name = String(mt[nf]);
660
+ break;
661
+ }
662
+ }
663
+ const item = { id: String(mt.id ?? ""), name };
664
+ if (key === "sale_stage" && mt.sale_process !== void 0) {
665
+ const sp = Array.isArray(mt.sale_process) ? mt.sale_process[0] : mt.sale_process;
666
+ if (sp && typeof sp === "object") item.sale_process = { id: String(sp.id ?? ""), name: String(sp.name ?? "") };
667
+ }
668
+ return item;
669
+ }).filter((x) => x.id);
618
670
  }
619
- },
620
- // ==================== 客户 ====================
621
- ...writePair("jiuchuanhui.customer.create", "\u5BA2\u6237\u521B\u5EFA", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/saveFormData/customer_create_api" }),
622
- {
623
- name: "jiuchuanhui.customer.get",
624
- risk: "read",
625
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataByPk/customer_get_api" },
626
- inputSchema: { type: "object", additionalProperties: false, properties: { id: idProp }, required: ["id"] }
627
- },
628
- {
629
- name: "jiuchuanhui.customer.search",
630
- risk: "read",
631
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_search_api", countPath: "/api/ebuilder/form/formdata/v2/getFormDataCount/ebcustomer_search_count_api" },
632
- inputSchema: {
633
- type: "object",
634
- additionalProperties: true,
635
- description: "\u641C\u7D22\u6761\u4EF6\u8D70 query\uFF1A\u652F\u6301 searchParams \u4E2D\u7684\u5B57\u6BB5\uFF08customer_name/status/type/managerid/...\uFF09\uFF0C\u4EE5\u53CA\u4E8B\u9879\u8303\u56F4 mine/all/customerSea\uFF08\u5FC5\u987B\u4E09\u9009\u4E00\u7F6E\u7A7A\u5176\u4F59\u4E3A -1\uFF09\u4E0E\u5206\u9875\u3002",
636
- properties: pageProps
637
- }
638
- },
639
- {
640
- name: "jiuchuanhui.customer.type.search",
641
- risk: "read",
642
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_type_search_api" },
643
- inputSchema: { type: "object", additionalProperties: false, properties: pageProps }
644
- },
645
- {
646
- name: "jiuchuanhui.customer.status.search",
647
- risk: "read",
648
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_status_search_api" },
649
- inputSchema: { type: "object", additionalProperties: false, properties: pageProps }
650
- },
651
- {
652
- name: "jiuchuanhui.customer.industry.search",
653
- risk: "read",
654
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_industry_search_api" },
655
- inputSchema: { type: "object", additionalProperties: false, properties: pageProps }
656
- },
657
- {
658
- name: "jiuchuanhui.customer.open-sea.search",
659
- risk: "read",
660
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/customer_open_sea_search_api" },
661
- inputSchema: { type: "object", additionalProperties: true, properties: pageProps }
662
- },
663
- ...writePair("jiuchuanhui.customer.update", "\u5BA2\u6237\u4FEE\u6539", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/updateFormData/customer_update_api" }),
664
- ...writePair("jiuchuanhui.customer.transfer", "\u5BA2\u6237\u8F6C\u79FB", esbWriteProps(["customerId", "employee_MappingId", "employeeName"]), ["customerId"], { uniqueIndent: "1E44ED7DA9EB46329818E682C2914928" }),
665
- ...writePair("jiuchuanhui.customer.open-sea.release", "\u5BA2\u6237\u91CA\u653E\u516C\u6D77", esbWriteProps(["customerId", "openSeaId"]), ["customerId", "openSeaId"], { uniqueIndent: "0E29AD0E708D4964B071D293288B92D7" }),
666
- ...writePair("jiuchuanhui.customer.open-sea.claim", "\u9886\u53D6\u516C\u6D77\u5BA2\u6237", esbWriteProps(["customer_id"]), ["customer_id"], { uniqueIndent: "D587CDC892FE41118DD073475C01A2CE" }),
667
- {
668
- name: "jiuchuanhui.customer.duplicate.check",
669
- risk: "read",
670
- fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "D5D0A1C30E7B404B842987C0AD3B749D" },
671
- inputSchema: {
672
- type: "object",
673
- additionalProperties: false,
674
- properties: { mainTable: esbWriteSchema(["name", "simpleName"], ["name", "simpleName"]) },
675
- required: ["mainTable"]
676
- }
677
- },
678
- ...writePair("jiuchuanhui.customer.contact-record.create", "\u65B0\u5EFA\u5BA2\u6237\u8054\u7CFB\u8BB0\u5F55", esbWriteProps(["customerId", "comment_content", "type", "rating", "contact_information", "contacts", "next_time", "next_content", "next_contact_information", "next_contacts", "sync_salechance", "rel_remind"]), ["customerId", "comment_content"], { uniqueIndent: "C7A226EEE1324FF3B6E5BD18AF923DE7" }),
679
- ...writePair("jiuchuanhui.customer.contact-record.batch", "\u6279\u91CF\u6DFB\u52A0\u5BA2\u6237\u8054\u7CFB\u8BB0\u5F55", esbWriteProps(["entityList", "content"]), ["entityList", "content"], { uniqueIndent: "D0F315619FE34C669AE738ED68329FAB" }),
680
- // ==================== 联系人 ====================
681
- ...writePair("jiuchuanhui.contact.create", "\u8054\u7CFB\u4EBA\u521B\u5EFA", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/saveFormData/contact_create_api" }),
682
- {
683
- name: "jiuchuanhui.contact.get",
684
- risk: "read",
685
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataByPk/contact_get_api" },
686
- inputSchema: { type: "object", additionalProperties: false, properties: { id: idProp }, required: ["id"] }
687
- },
688
- ...writePair("jiuchuanhui.contact.update", "\u8054\u7CFB\u4EBA\u4FEE\u6539", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/updateFormData/contact_update_api" }),
689
- {
690
- name: "jiuchuanhui.contact.by-entity.search",
691
- risk: "read",
692
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcontact_search_by_entity_api" },
693
- inputSchema: {
694
- type: "object",
695
- additionalProperties: true,
696
- properties: { ...pageProps, customerId: { type: "string" }, saleChanceId: { type: "string" } }
697
- }
698
- },
699
- // ==================== 商机 ====================
700
- ...writePair("jiuchuanhui.sale.create", "\u5546\u673A\u521B\u5EFA", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/saveFormData/sale_create_api" }),
701
- {
702
- name: "jiuchuanhui.sale.get",
703
- risk: "read",
704
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataByPk/sale_get_api" },
705
- inputSchema: { type: "object", additionalProperties: false, properties: { id: idProp }, required: ["id"] }
706
- },
707
- {
708
- name: "jiuchuanhui.sale.search",
709
- risk: "read",
710
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebsale_search_api", countPath: "/api/ebuilder/form/formdata/v2/getFormDataCount/ebsale_search_count_api" },
711
- inputSchema: { type: "object", additionalProperties: true, properties: pageProps }
712
- },
713
- ...writePair("jiuchuanhui.sale.update", "\u5546\u673A\u4FEE\u6539", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/updateFormData/sale_update_api" }),
714
- {
715
- name: "jiuchuanhui.sale.stage.search",
716
- risk: "read",
717
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/sale_stage_search_api" },
718
- inputSchema: { type: "object", additionalProperties: false, properties: pageProps }
719
- },
720
- {
721
- name: "jiuchuanhui.sale.process.search",
722
- risk: "read",
723
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/sale_process_sear_api" },
724
- inputSchema: { type: "object", additionalProperties: false, properties: pageProps }
725
- },
726
- {
727
- name: "jiuchuanhui.sale.lose-reason.search",
728
- risk: "read",
729
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/sale_lose_reason" },
730
- inputSchema: { type: "object", additionalProperties: false, properties: pageProps }
731
- },
732
- {
733
- name: "jiuchuanhui.rival.search",
734
- risk: "read",
735
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebrival_search_api" },
736
- inputSchema: { type: "object", additionalProperties: false, properties: pageProps }
737
- },
738
- ...writePair("jiuchuanhui.sale.win", "\u5546\u673A\u8D62\u5355", esbWriteProps(["saleId"]), ["saleId"], { uniqueIndent: "3B23E782E5084F18A904E895BBD61A96" }),
739
- ...writePair("jiuchuanhui.sale.lose", "\u5546\u673A\u8F93\u5355", esbWriteProps(["saleid", "money", "reasonids", "rivals", "desc"]), ["saleid"], { uniqueIndent: "DE35D926F82F49FDBA26B48B0CA1CB53" }),
740
- ...writePair("jiuchuanhui.sale.invalid", "\u5546\u673A\u65E0\u6548", esbWriteProps(["saleId"]), ["saleId"], { uniqueIndent: "4D88AB8677D84BAC90B63137E7FA1FF9" }),
741
- ...writePair("jiuchuanhui.sale.pause", "\u5546\u673A\u6682\u505C", esbWriteProps(["saleId", "pauseReason", "restartDate"]), ["saleId", "pauseReason"], { uniqueIndent: "859C73403DCC4F01B02329571BDBD9F3" }),
742
- ...writePair("jiuchuanhui.sale.restart", "\u5546\u673A\u91CD\u542F", esbWriteProps(["saleChanceId"]), ["saleChanceId"], { uniqueIndent: "F3004CDCA8A548B5A0DACD3CDE62387A" }),
743
- ...writePair("jiuchuanhui.sale.manager-change", "\u5546\u673A\u8F6C\u79FB/\u8D1F\u8D23\u4EBA\u53D8\u66F4", esbWriteProps(["saleChanceId", "managerId"]), ["saleChanceId", "managerId"], { uniqueIndent: "595F9C6F1C4248929B83086F71363BA7" }),
744
- ...writePair("jiuchuanhui.sale.link-contacts", "\u5546\u673A\u5173\u8054\u8054\u7CFB\u4EBA", esbWriteProps(["salechanceId", "contactIds"]), ["salechanceId", "contactIds"], { uniqueIndent: "1114A713A62F4CA9899CC24ED5902D93" }),
745
- ...writePair("jiuchuanhui.sale.contact-record.create", "\u65B0\u5EFA\u5546\u673A\u8054\u7CFB\u8BB0\u5F55", esbWriteProps(["saleId", "comment_content", "type", "rating", "contact_information", "contacts", "next_time", "next_content", "next_contact_information", "next_contacts", "rel_remind"]), ["saleId", "comment_content"], { uniqueIndent: "7BB3A1918186445F9E770862EFA7EDA9" }),
746
- // ==================== 线索 ====================
747
- ...writePair("jiuchuanhui.clue.create", "\u7EBF\u7D22\u521B\u5EFA", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/saveFormData/ebclue_ai_create_api" }),
748
- {
749
- name: "jiuchuanhui.clue.get",
750
- risk: "read",
751
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataByPk/ebcluepool_ai_get_api" },
752
- inputSchema: { type: "object", additionalProperties: false, properties: { id: idProp }, required: ["id"] }
753
- },
754
- {
755
- name: "jiuchuanhui.clue.search",
756
- risk: "read",
757
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebclue_ai_search_api", countPath: "/api/ebuilder/form/formdata/v2/getFormDataCount/ebclue_ai_search_count_api" },
758
- inputSchema: { type: "object", additionalProperties: true, properties: pageProps }
759
- },
760
- {
761
- name: "jiuchuanhui.clue.pool.search",
762
- risk: "read",
763
- fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcluepool_ai_search_api" },
764
- inputSchema: { type: "object", additionalProperties: true, properties: pageProps }
765
- },
766
- ...writePair("jiuchuanhui.clue.update", "\u7EBF\u7D22\u4FEE\u6539", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/updateFormData/ebclue_ai_update_api" }),
767
- ...writePair("jiuchuanhui.clue.status-change", "\u7EBF\u7D22\u72B6\u6001\u53D8\u66F4", esbWriteProps(["clueid", "type", "newmanager", "desc"]), ["clueid", "type"], { uniqueIndent: "257CC8DE42234F9191439B229839B8A7" }),
768
- ...writePair("jiuchuanhui.clue.to-customer", "\u7EBF\u7D22\u8F6C\u5DF2\u6709\u5BA2\u6237", esbWriteProps(["clueId", "customerId"]), ["clueId", "customerId"], { uniqueIndent: "00914C6415EB455DB7FCCC32DBE6E0C3" }),
769
- ...writePair("jiuchuanhui.clue.contact-record.create", "\u65B0\u5EFA\u7EBF\u7D22\u8DDF\u8FDB\u8BB0\u5F55", esbWriteProps(["clueId", "content", "clueStatus_MappingId"]), ["clueId", "content"], { uniqueIndent: "B3DD120601344320A2B50A042B450681" }),
770
- // ==================== 联系计划 ====================
771
- ...writePair("jiuchuanhui.contact-plan.create", "\u521B\u5EFA\u8054\u7CFB\u8BA1\u5212", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/saveFormData/ebcontact_plan_create_api" }),
772
- ...writePair("jiuchuanhui.contact-plan.complete", "\u5B8C\u6210\u8054\u7CFB\u8BA1\u5212", esbWriteProps(["planId"]), ["planId"], { uniqueIndent: "2595D3556CFC414F85B1A4A8D806EFE5" }),
773
- // ==================== 联系记录 ====================
774
- {
775
- name: "jiuchuanhui.entity.contact-records.list",
776
- risk: "read",
777
- fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "364A9713D10C4997AF6EDCAA5296968E" },
778
- inputSchema: {
779
- type: "object",
780
- additionalProperties: false,
781
- properties: {
782
- mainTable: {
783
- type: "object",
784
- additionalProperties: false,
785
- properties: {
786
- moduleType: { type: "string", description: "\u4E8B\u9879\u6A21\u5757\u6807\u8BC6\uFF1Acustomer=\u5BA2\u6237\u3001clue=\u7EBF\u7D22\u3001saleChance=\u5546\u673A" },
787
- entityId: { type: "string" }
788
- },
789
- required: ["moduleType", "entityId"]
671
+ const options = {};
672
+ for (const pk of Object.keys(perPk)) {
673
+ const tag = PK_TO_TAG[pk];
674
+ const objId = discovery[`objId:${tag}`];
675
+ if (!objId) continue;
676
+ const detail = perPk[pk].detail ?? {};
677
+ const fields = [
678
+ ...detail.mainFields || [],
679
+ ...(detail.detailFields || []).flatMap((d) => d.fields || [])
680
+ ];
681
+ for (const f of fields) {
682
+ if (!f?.fieldid) continue;
683
+ if (!OPT_COMP.includes(f.component_type)) continue;
684
+ const key = `options:${f.fieldid}:*:1`;
685
+ if (options[key]) continue;
686
+ try {
687
+ const resp = await host.request({
688
+ method: "GET",
689
+ path: "/api/ebuilder/common/ds/options",
690
+ query: { fieldName: String(f.fieldid), objId, groupId: appId, optionLevel: 1 },
691
+ operation: this.name
692
+ });
693
+ const values = resp?.data ?? resp?.datajson?.datas ?? [];
694
+ options[key] = {
695
+ lable: `${pk}.${f.data_key ?? f.fieldid}`,
696
+ lableTitle: `${pk}.${f.title ?? f.data_key ?? f.fieldid}`,
697
+ value: (Array.isArray(values) ? values : []).map((v) => ({
698
+ label: String(v?.lable ?? v?.label ?? v?.text ?? v?.name ?? ""),
699
+ value: String(v?.value ?? v?.val ?? v?.id ?? "")
700
+ }))
701
+ };
702
+ } catch {
790
703
  }
791
- },
792
- required: ["mainTable"]
793
- }
794
- },
795
- {
796
- name: "jiuchuanhui.contact-records.by-person-time.list",
797
- risk: "read",
798
- fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "D01DD00978524525AD8728BE1BF9FE79" },
799
- inputSchema: {
800
- type: "object",
801
- additionalProperties: false,
802
- properties: { mainTable: esbWriteSchema(["employeeId", "startData", "endData"]) },
803
- required: ["mainTable"]
804
- }
805
- },
806
- // ==================== 通用辅助 ====================
807
- {
808
- name: "jiuchuanhui.entity.id.by-name",
809
- risk: "read",
810
- fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "7EC1639D5AC24B4DBCEE8D2CB85D4025" },
811
- inputSchema: {
812
- type: "object",
813
- additionalProperties: false,
814
- properties: { mainTable: esbWriteSchema(["moduleType", "name"]) },
815
- required: ["mainTable"]
816
- }
817
- },
818
- {
819
- name: "jiuchuanhui.user.id.by-name",
820
- risk: "read",
821
- fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "911C17207E2C4BD29379B5A4001B246E" },
822
- inputSchema: {
823
- type: "object",
824
- additionalProperties: false,
825
- properties: { mainTable: esbWriteSchema(["employeeName"]) },
826
- required: ["mainTable"]
827
- }
828
- },
829
- {
830
- name: "jiuchuanhui.user.current-profile",
831
- risk: "read",
832
- fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "B8F7597190FF419FB9127D6C8272C4FE" },
833
- inputSchema: { type: "object", additionalProperties: false, properties: {} }
834
- },
835
- {
836
- name: "jiuchuanhui.entity.permission.judge",
837
- risk: "read",
838
- fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "6D369F0A84764051A5D7B5AA1245F49A" },
839
- inputSchema: {
840
- type: "object",
841
- additionalProperties: false,
842
- properties: { mainTable: esbWriteSchema(["moduleType", "entityId", "opType"]) },
843
- required: ["mainTable"]
844
- }
845
- },
846
- {
847
- name: "jiuchuanhui.company.business-profile.query",
848
- risk: "read",
849
- fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "BAB4DBE204214BB395BA161620A4A1CD" },
850
- inputSchema: {
851
- type: "object",
852
- additionalProperties: false,
853
- properties: { mainTable: esbWriteSchema(["companyName"]) },
854
- required: ["mainTable"]
704
+ }
855
705
  }
856
- },
857
- {
858
- name: "jiuchuanhui.field.info.by-ids",
859
- risk: "read",
860
- fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "10351A4DC8D4454A9F1957FBE647CD9F" },
861
- inputSchema: {
862
- type: "object",
863
- additionalProperties: false,
864
- properties: { mainTable: esbWriteSchema(["fieldids"]) },
865
- required: ["mainTable"]
706
+ const searchPerPk = {};
707
+ for (const pk of SEARCH_PKS) {
708
+ const cfgId = cfgMap[pk];
709
+ if (!cfgId) continue;
710
+ try {
711
+ let rows = searchConditions.get(pk);
712
+ if (!rows) {
713
+ const resp = await host.request({
714
+ method: "GET",
715
+ path: "/api/bs/ebuilder/form/formdata/getRestCfgById",
716
+ query: { apid: appId, id: cfgId },
717
+ operation: this.name
718
+ });
719
+ rows = searchConditionRows(resp?.data?.conditions);
720
+ }
721
+ const params = [];
722
+ for (const d of rows ?? []) {
723
+ const value = d?.conditions?.value;
724
+ if (typeof value === "string") {
725
+ const m = value.match(/\{([^}]+)\}/);
726
+ if (m) {
727
+ params.push({
728
+ key: m[1],
729
+ text: d?.text ?? "",
730
+ fieldType: d?.fieldType ?? "",
731
+ compType: d?.compType ?? "",
732
+ func: d?.conditions?.func ?? "",
733
+ fieldid: d?.fieldName ?? ""
734
+ });
735
+ }
736
+ }
737
+ }
738
+ searchPerPk[pk] = { cfgId, searchParams: params };
739
+ } catch {
740
+ }
866
741
  }
867
- },
868
- {
869
- name: "jiuchuanhui.browser-option.search",
870
- risk: "read",
871
- fixed: { path: "/api/bcw/common/browser/complete/{customBrowserType}", method: "POST" },
872
- inputSchema: {
873
- type: "object",
874
- additionalProperties: false,
875
- properties: {
876
- pathParams: {
877
- type: "object",
878
- additionalProperties: false,
879
- properties: { customBrowserType: { type: "string" } },
880
- required: ["customBrowserType"]
742
+ for (const [pk, entry] of Object.entries(searchPerPk)) {
743
+ if (perPk[pk]) perPk[pk] = { ...perPk[pk], ...entry };
744
+ else perPk[pk] = entry;
745
+ }
746
+ const region = {};
747
+ for (let offset = 0; offset < REGION_CITIES.length; offset += REGION_CONCURRENCY) {
748
+ const cities = REGION_CITIES.slice(offset, offset + REGION_CONCURRENCY);
749
+ const results = await Promise.allSettled(cities.map(async (city) => host.request({
750
+ path: "/api/esb/server/event/triggerActionFlow",
751
+ body: {
752
+ customParams: { mainTable: { moduleType: "administrativeDivision", name: city, fromType: "agentSkill" } },
753
+ uniqueIndent: "7EC1639D5AC24B4DBCEE8D2CB85D4025",
754
+ employeeId: userId
881
755
  },
882
- params: {
883
- type: "object",
884
- additionalProperties: true,
885
- properties: { searchValue: { type: "string" } }
756
+ operation: this.name
757
+ })));
758
+ for (const [index, result] of results.entries()) {
759
+ if (result.status === "fulfilled" && Number(result.value?.resultCode) === 200) {
760
+ region[`administrativeDivision:${cities[index]}`] = result.value;
886
761
  }
887
- },
888
- required: ["pathParams"]
762
+ }
889
763
  }
890
- },
891
- {
892
- name: "jiuchuanhui.get-rest-cfg-detail",
893
- risk: "read",
894
- fixed: { path: "/api/bs/ebuilder/form/formdata/getRestCfgById", method: "GET" },
895
- inputSchema: {
896
- type: "object",
897
- additionalProperties: false,
898
- properties: {
899
- apid: { type: "string" },
900
- id: { type: "string" }
764
+ const cache = { discovery, ebuilder, options, region };
765
+ cache.region = { ...old.region || {}, ...cache.region || {} };
766
+ cache.options = { ...old.options || {}, ...cache.options || {} };
767
+ if (!cache.discovery[`spVersion:${APP_TAG}`] && old.discovery?.[`spVersion:${APP_TAG}`]) {
768
+ cache.discovery[`spVersion:${APP_TAG}`] = old.discovery[`spVersion:${APP_TAG}`];
769
+ }
770
+ const summary = {
771
+ dryRun,
772
+ cacheDir: baseDir,
773
+ mainFile,
774
+ namespaces: {
775
+ discovery: Object.keys(cache.discovery).length,
776
+ ebuilder: Object.keys(cache.ebuilder).length,
777
+ options: Object.keys(cache.options).length,
778
+ region: Object.keys(cache.region).length
901
779
  },
902
- required: ["apid", "id"]
780
+ configFiles: Object.keys(perPk).length,
781
+ objIdCount: Object.keys(discovery).filter((k) => k.startsWith("objId:")).length,
782
+ cfgIdCount: Object.keys(cfgMap).length,
783
+ version: cache.discovery[`spVersion:${APP_TAG}`] ?? null,
784
+ warnings: []
785
+ };
786
+ if (cache.discovery[`spVersion:${APP_TAG}`] && cache.discovery[`spVersion:${APP_TAG}`].passed === false) {
787
+ summary.warnings.push(`\u4E5D\u6C1A\u6C47\u8425\u9500\u7BA1\u7406\u5305\u7248\u672C\uFF08${cache.discovery[`spVersion:${APP_TAG}`].commitVersion}\uFF09\u4F4E\u4E8E ${MIN_VERSION}\uFF0C\u4E1A\u52A1\u8C03\u7528\u5E94\u505C\u6B62`);
903
788
  }
904
- }
905
- ];
906
- var jiuchuanhuiManifest = {
907
- schemaVersion: 1,
908
- name: "jiuchuanhui",
909
- title: "\u6CDB\u5FAEE10\u4E5D\u6C1A\u6C47\u8425\u9500\u7BA1\u7406\uFF08\u5BA2\u6237/\u8054\u7CFB\u4EBA/\u5546\u673A/\u7EBF\u7D22/\u8054\u7CFB\u8BA1\u5212/\u516C\u6D77\uFF09",
910
- version: "0.1.0",
911
- host: "e10-jiuchuanhui",
912
- status: "builtin",
913
- sourceSkill: "weaver-e10-jiuchuanhui",
914
- operations: withSummaries(jiuchuanhuiOperations),
915
- withheldOperations: [
916
- {
917
- name: "jiuchuanhui.sale.stage-advance",
918
- reason: "\u5546\u673A\u63A8\u8FDB\u9500\u552E\u9636\u6BB5\u4F9D\u8D56\u7F13\u5B58\u4E2D\u7684 sale_stage \u914D\u7F6E\u505A\u9636\u6BB5 ID \u6620\u5C04\u4E0E\u524D\u7F6E\u6821\u9A8C\uFF0C\u5C5E\u4E8E Skill \u7F16\u6392\u5C42\u804C\u8D23\uFF1BCLI \u66B4\u9732\u7684 sale.update \u4E0E sale.stage.search \u5DF2\u8986\u76D6\u57FA\u7840\u80FD\u529B\uFF0C\u9636\u6BB5\u63A8\u8FDB\u7684\u7EC4\u5408\u903B\u8F91\u4E0D\u5728 CLI \u786C\u7F16\u7801\u3002"
789
+ if (dryRun) return { status: "COMPLETE", data: { ...summary, written: false, note: "dry-run\uFF1A\u53EA\u62C9\u53D6\u672A\u5199\u5165" } };
790
+ mkdirSync(cfgDir, { recursive: true });
791
+ writeFileSync(mainFile, JSON.stringify(cache, null, 2), "utf-8");
792
+ for (const [pk, entry] of Object.entries(perPk)) {
793
+ const tag = PK_TO_TAG[pk];
794
+ const objId = cache.discovery[`objId:${tag}`];
795
+ writeFileSync(join(cfgDir, `${pk}.json`), JSON.stringify({ ...entry, objId: objId ?? "" }, null, 2), "utf-8");
919
796
  }
920
- ]
797
+ if (verbose) {
798
+ summary.warnings.push(`${JSON.stringify({ step1: "discovery", step2: "cfgId", step3: "cfg.detail", step4: "ebuilder", step5: "options", step6: "searchParams", step7: "region" })}`);
799
+ }
800
+ return {
801
+ status: "COMPLETE",
802
+ data: { ...summary, written: true }
803
+ };
804
+ }
921
805
  };
922
806
 
923
- // src/shortcuts/jiuchuanhui/cache.ts
924
- import { existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "node:fs";
925
- import { homedir as homedir2 } from "node:os";
926
- import { join } from "node:path";
927
- var APP_TAG = "jch-crm-project";
928
- var MIN_VERSION = "1.5.11";
929
- var MODULE_TAGS = [
930
- "uf_jch_customer",
931
- "uf_jch_sale",
932
- "uf_jch_clue",
933
- "uf_jch_contact",
934
- "uf_jch_customer_open_sea",
935
- "uf_jch_remind",
936
- "uf_jch_rival",
937
- "uf_jch_sale_process",
938
- "uf_jch_sale_stage",
939
- "uf_jch_clue_pool",
940
- "uf_jch_lose_reason",
941
- "uf_jch_customer_cmt",
942
- "uf_jch_sale_cmt"
943
- ];
944
- var CREATE_PKS = ["customer_create_api", "sale_create_api", "ebclue_ai_create_api", "contact_create_api", "ebcontact_plan_create_api"];
945
- var SEARCH_PKS = ["ebcustomer_search_api", "ebsale_search_api", "ebclue_ai_search_api"];
946
- var UPDATE_PKS = ["customer_update_api", "sale_update_api", "ebclue_ai_update_api", "contact_update_api"];
947
- var ALL_PKS = [...CREATE_PKS, ...SEARCH_PKS, ...UPDATE_PKS];
948
- var PK_TO_TAG = {
949
- customer_create_api: "uf_jch_customer",
950
- sale_create_api: "uf_jch_sale",
951
- ebclue_ai_create_api: "uf_jch_clue",
952
- contact_create_api: "uf_jch_contact",
953
- ebcontact_plan_create_api: "uf_jch_remind",
954
- ebcustomer_search_api: "uf_jch_customer",
955
- ebsale_search_api: "uf_jch_sale",
956
- ebclue_ai_search_api: "uf_jch_clue",
957
- customer_update_api: "uf_jch_customer",
958
- sale_update_api: "uf_jch_sale",
959
- ebclue_ai_update_api: "uf_jch_clue",
960
- contact_update_api: "uf_jch_contact"
961
- };
962
- var DETAIL_KEEP_KEYS = ["id", "interfacePk", "interfaceName", "datasNumber", "datasSize", "mainFields", "detailFields", "interfaceType", "relevanceForm"];
963
- var FIELD_KEEP_KEYS = ["fieldid", "isRequired", "isInput", "data_key", "title", "component_type"];
964
- var OPT_COMP = ["Select", "RadioBox", "CheckBox"];
965
- var EBUILDER_QUERIES = [
966
- { key: "customer_open_sea", path: "/api/ebuilder/form/formdata/v2/getFormDataList/customer_open_sea_search_api", nameFields: ["open_sea_name", "name"] },
967
- { key: "sale_stage", path: "/api/ebuilder/form/formdata/v2/getFormDataList/sale_stage_search_api", nameFields: ["stage_name", "name"] },
968
- { key: "sale_process", path: "/api/ebuilder/form/formdata/v2/getFormDataList/sale_process_sear_api", nameFields: ["process_name", "name"] },
969
- { key: "clue_pool", path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcluepool_ai_search_api", nameFields: ["clue_pool_name", "name"] },
970
- { key: "sale_lose_reason", path: "/api/ebuilder/form/formdata/v2/getFormDataList/sale_lose_reason", nameFields: ["reason_name", "name"] },
971
- { key: "customer_industry", path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_industry_search_api", nameFields: ["industry_name", "name"] },
972
- { key: "customer_type", path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_type_search_api", nameFields: ["type_name", "name"] },
973
- { key: "customer_status", path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_status_search_api", nameFields: ["state_name", "name"] }
974
- ];
975
- var REGION_CITIES = [
976
- "\u5317\u4EAC\u5E02",
977
- "\u4E0A\u6D77\u5E02",
978
- "\u5929\u6D25\u5E02",
979
- "\u91CD\u5E86\u5E02",
980
- "\u6210\u90FD\u5E02",
981
- "\u5E7F\u5DDE\u5E02",
982
- "\u6DF1\u5733\u5E02",
983
- "\u4E1C\u839E\u5E02",
984
- "\u676D\u5DDE\u5E02",
985
- "\u5357\u4EAC\u5E02",
986
- "\u82CF\u5DDE\u5E02",
987
- "\u6B66\u6C49\u5E02",
988
- "\u957F\u6C99\u5E02",
989
- "\u897F\u5B89\u5E02",
990
- "\u90D1\u5DDE\u5E02",
991
- "\u6D4E\u5357\u5E02",
992
- "\u9752\u5C9B\u5E02",
993
- "\u53A6\u95E8\u5E02",
994
- "\u798F\u5DDE\u5E02",
995
- "\u5408\u80A5\u5E02",
996
- "\u6C88\u9633\u5E02",
997
- "\u5927\u8FDE\u5E02"
998
- ];
999
- function pickKeys(obj, keys) {
1000
- const out = {};
1001
- for (const k of keys) if (obj?.[k] !== void 0) out[k] = obj[k];
1002
- return out;
807
+ // src/shortcuts/jiuchuanhui/operations/shared.ts
808
+ var FORBIDDEN_INPUT_KEYS = /* @__PURE__ */ new Set([
809
+ "access_token",
810
+ "app_key",
811
+ "app_secret",
812
+ "cookie",
813
+ "eteamsid",
814
+ "token",
815
+ "sessionid"
816
+ ]);
817
+ var FORBIDDEN_NORMALIZED_KEYS = new Set([...FORBIDDEN_INPUT_KEYS].map((key) => key.toLowerCase()));
818
+ function asObject(value, name = "\u4E1A\u52A1\u8F93\u5165") {
819
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
820
+ throw jiuchuanhuiValidationError("input_invalid", `${name}\u5FC5\u987B\u662F JSON \u5BF9\u8C61`);
821
+ }
822
+ return value;
823
+ }
824
+ function asNonEmptyString(value, name) {
825
+ if (typeof value !== "string" || !value.trim()) {
826
+ throw jiuchuanhuiValidationError("input_invalid", `${name} \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32`);
827
+ }
828
+ return value.trim();
829
+ }
830
+ function asPositiveString(value, name) {
831
+ if (typeof value !== "string" || !/^\d+$/u.test(value) || value === "0") {
832
+ throw jiuchuanhuiValidationError("input_invalid", `${name} \u5FC5\u987B\u662F\u6B63\u6574\u6570\u6587\u672C`);
833
+ }
834
+ return value;
835
+ }
836
+ function assertNoForbiddenKeys(value, location = "input") {
837
+ if (!value || typeof value !== "object") return;
838
+ if (Array.isArray(value)) {
839
+ value.forEach((item, index) => assertNoForbiddenKeys(item, `${location}[${index}]`));
840
+ return;
841
+ }
842
+ for (const [key, child] of Object.entries(value)) {
843
+ if (FORBIDDEN_INPUT_KEYS.has(key) || FORBIDDEN_NORMALIZED_KEYS.has(key.toLowerCase())) {
844
+ throw jiuchuanhuiValidationError("field_forbidden", `\u7981\u6B62\u4E1A\u52A1\u8F93\u5165\u5B57\u6BB5\uFF1A${location}.${key}`);
845
+ }
846
+ assertNoForbiddenKeys(child, `${location}.${key}`);
847
+ }
848
+ }
849
+ function sessionMatches(lease, session) {
850
+ return lease.baseUrl === session.baseUrl && lease.profile === session.profile && lease.userId === session.userId;
851
+ }
852
+ function workflow(name, state) {
853
+ return { workflow: name, version: 1, state };
854
+ }
855
+ function esbBody(mainTable, uniqueIndent, userId) {
856
+ return {
857
+ customParams: { mainTable },
858
+ uniqueIndent,
859
+ employeeId: userId
860
+ };
861
+ }
862
+ function datasBody(form, userId) {
863
+ const datas = Array.isArray(form.datas) ? form.datas : [form];
864
+ const cleansed = datas.map((item) => stripForbidden(item));
865
+ return {
866
+ datajson: {
867
+ datas: cleansed,
868
+ header: { operator: userId }
869
+ }
870
+ };
871
+ }
872
+ function byIdBody(id, userId) {
873
+ return {
874
+ datajson: {
875
+ mainTable: { id },
876
+ header: { operator: userId }
877
+ }
878
+ };
879
+ }
880
+ function listBody(userId, pageNo, pageSize, mainTable) {
881
+ const mt = mainTable && Object.keys(mainTable).length ? { ...mainTable } : {};
882
+ return {
883
+ datajson: {
884
+ mainTable: mt,
885
+ pageInfo: { pageNo, pageSize },
886
+ header: { operator: userId }
887
+ }
888
+ };
889
+ }
890
+ function stripForbidden(value) {
891
+ if (Array.isArray(value)) return value.map(stripForbidden);
892
+ if (!value || typeof value !== "object") return value;
893
+ const result = {};
894
+ for (const [key, child] of Object.entries(value)) {
895
+ if (FORBIDDEN_INPUT_KEYS.has(key) || FORBIDDEN_NORMALIZED_KEYS.has(key.toLowerCase())) continue;
896
+ result[key] = stripForbidden(child);
897
+ }
898
+ return result;
899
+ }
900
+ function stripForbiddenKeys(value) {
901
+ return stripForbidden(value);
902
+ }
903
+ function resultDataIds(value) {
904
+ if (!value || typeof value !== "object") return [];
905
+ const ids = value.datajson?.dataIds;
906
+ if (Array.isArray(ids)) return ids.map((item) => String(item));
907
+ return [];
1003
908
  }
1004
- var isInputOne = (f) => String(f?.isInput) === "1";
1005
- function semverGte(a, b) {
1006
- const pa = String(a || "").split(".").map((x) => parseInt(x, 10) || 0);
1007
- const pb = b.split(".").map((x) => parseInt(x, 10) || 0);
1008
- for (let i = 0; i < 3; i++) {
1009
- if ((pa[i] || 0) !== (pb[i] || 0)) return (pa[i] || 0) > (pb[i] || 0);
909
+ function esbOutcome(value) {
910
+ if (!value || typeof value !== "object") return { resultCode: 0, resultMsg: "" };
911
+ const root = value;
912
+ return {
913
+ resultCode: Number(root.resultCode ?? 0),
914
+ resultMsg: typeof root.resultMsg === "string" ? root.resultMsg : ""
915
+ };
916
+ }
917
+ function pagingFrom(input) {
918
+ const pageNo = Number.isInteger(input.pageNo) && input.pageNo >= 1 ? input.pageNo : 1;
919
+ const pageSize = Number.isInteger(input.pageSize) && input.pageSize >= 1 ? input.pageSize : 10;
920
+ return { pageNo, pageSize };
921
+ }
922
+
923
+ // src/shortcuts/jiuchuanhui/operations/customer-quick.ts
924
+ var CUSTOMER_SEARCH_SCOPES = {
925
+ mine: { mine: "", all: "-1", customerSea: "-1" },
926
+ all: { mine: "-1", all: "", customerSea: "-1" },
927
+ "open-sea": { mine: "-1", all: "-1", customerSea: "" }
928
+ };
929
+ var STATUS_PAGE_SIZE = 100;
930
+ var STATUS_MAX_PAGES = 5;
931
+ function addSuccessStatusIds(ids, rows) {
932
+ for (const row of rows) {
933
+ const status = row?.mainTable ?? row;
934
+ const fields = status;
935
+ const label = String(fields?.state_name ?? "").trim() || String(fields?.name ?? "").trim();
936
+ if (label !== "\u6210\u529F\u5BA2\u6237" && label !== "\u6210\u529F") continue;
937
+ const id = String(fields?.id ?? "").trim();
938
+ if (/^[1-9]\d*$/u.test(id)) ids.add(id);
1010
939
  }
1011
- return true;
1012
940
  }
1013
- function successCheck(value) {
1014
- if (!value || typeof value !== "object") return false;
1015
- if (value.resultCode !== void 0 && value.resultCode !== null) return Number(value.resultCode) === 200;
1016
- if (value.datajson && typeof value.datajson === "object") {
1017
- const status = value.datajson.status;
1018
- if (status === "true" || status === true) return true;
1019
- if (status === "false" || status === false) return false;
941
+ async function cachedCustomerStatuses(context) {
942
+ const { tenantKey, userId } = await context.host.getSession();
943
+ if (!tenantKey || !userId) return [];
944
+ try {
945
+ const raw = await readFile2(jiuchuanhuiCacheFile(tenantKey, userId), "utf8");
946
+ const rows = JSON.parse(raw.replace(/^\uFEFF/u, ""))?.ebuilder?.customer_status;
947
+ return Array.isArray(rows) && rows.length < STATUS_PAGE_SIZE * STATUS_MAX_PAGES ? rows : [];
948
+ } catch {
949
+ return [];
1020
950
  }
1021
- const code = value.code ?? value.res_base?.ret;
1022
- if (code !== void 0 && code !== null) return Number(code) === 0 || Number(code) === 200;
1023
- return typeof value.success === "boolean" ? value.success : false;
1024
951
  }
1025
- var CacheInitOperation = class {
1026
- name = "jiuchuanhui.cache.init";
1027
- async execute(input, { host }) {
1028
- const dryRun = input.dryRun === true;
1029
- const verbose = input.verbose === true;
1030
- const session = await host.getSession();
1031
- const tenantKey = session.tenantKey || "";
1032
- const userId = session.userId || "";
1033
- if (!tenantKey || !userId) {
1034
- throw jiuchuanhuiValidationError("session_context_missing", "\u65E0\u6CD5\u83B7\u53D6\u7F13\u5B58\u9694\u79BB\u4E0A\u4E0B\u6587\uFF1Asession \u7F3A\u5C11 tenantKey/userId\uFF0C\u8BF7\u786E\u8BA4 E10 \u767B\u5F55\u6001");
952
+ function uniqueSuccessStatusId(ids) {
953
+ if (ids.size > 1) {
954
+ throw jiuchuanhuiValidationError("customer_success_status_ambiguous", "\u627E\u5230\u591A\u4E2A\u6210\u529F\u5BA2\u6237\u72B6\u6001\uFF0C\u8BF7\u786E\u8BA4\u8981\u4F7F\u7528\u7684\u5BA2\u6237\u72B6\u6001", {
955
+ statusIds: [...ids]
956
+ });
957
+ }
958
+ return ids.values().next().value;
959
+ }
960
+ async function resolveSuccessStatus(search, context) {
961
+ const ids = /* @__PURE__ */ new Set();
962
+ addSuccessStatusIds(ids, await cachedCustomerStatuses(context));
963
+ const cachedId = uniqueSuccessStatusId(ids);
964
+ if (cachedId) return cachedId;
965
+ for (let pageNo = 1; pageNo <= STATUS_MAX_PAGES; pageNo += 1) {
966
+ const { response } = await search.execute({ pageNo, pageSize: STATUS_PAGE_SIZE }, context);
967
+ const rows = response.value?.datajson?.datas;
968
+ if (response.httpStatus < 200 || response.httpStatus >= 300 || !Array.isArray(rows)) {
969
+ throw jiuchuanhuiValidationError("customer_success_status_lookup_failed", "\u65E0\u6CD5\u8BFB\u53D6\u5BA2\u6237\u72B6\u6001\u5B57\u5178\uFF0C\u8BF7\u786E\u8BA4\u9700\u8981\u4F7F\u7528\u7684\u5BA2\u6237\u72B6\u6001", { httpStatus: response.httpStatus });
970
+ }
971
+ addSuccessStatusIds(ids, rows);
972
+ const statusId = uniqueSuccessStatusId(ids);
973
+ if (rows.length < STATUS_PAGE_SIZE) {
974
+ if (statusId) return statusId;
975
+ throw jiuchuanhuiValidationError("customer_success_status_not_found", "\u5F53\u524D\u79DF\u6237\u672A\u627E\u5230\u201C\u6210\u529F\u201D\u6216\u201C\u6210\u529F\u5BA2\u6237\u201D\u72B6\u6001\uFF0C\u8BF7\u786E\u8BA4\u5BA2\u6237\u72B6\u6001\u540D\u79F0");
1035
976
  }
1036
- const baseDir = join(process.env.WEAVER_E10_JIUCHUANHUI_HOME || join(homedir2(), ".weaver-e10-jiuchuanhui"), tenantKey, String(userId));
1037
- const mainFile = join(baseDir, "weaver-e10-jiuchuanhui.json");
1038
- const cfgDir = join(baseDir, "config");
1039
- let old = {};
1040
- if (existsSync2(mainFile)) {
1041
- try {
1042
- old = JSON.parse(readFileSync(mainFile, "utf-8"));
1043
- } catch {
977
+ }
978
+ throw jiuchuanhuiValidationError("customer_success_status_lookup_incomplete", "\u5BA2\u6237\u72B6\u6001\u5B57\u5178\u672A\u67E5\u5B8C\uFF0C\u8BF7\u786E\u8BA4\u9700\u8981\u4F7F\u7528\u7684\u5BA2\u6237\u72B6\u6001");
979
+ }
980
+ var CustomerQuickSearchOperation = class {
981
+ constructor(name, customerSearch, defaultScope, customerStatusSearch) {
982
+ this.name = name;
983
+ this.customerSearch = customerSearch;
984
+ this.defaultScope = defaultScope;
985
+ this.customerStatusSearch = customerStatusSearch;
986
+ }
987
+ name;
988
+ customerSearch;
989
+ defaultScope;
990
+ customerStatusSearch;
991
+ async execute(input, context) {
992
+ const { customer_name, pageNo, pageSize, count, scope = this.defaultScope, ...unsupported } = input;
993
+ const unexpected = Object.keys(unsupported);
994
+ if (!this.customerStatusSearch && Object.hasOwn(input, "scope")) unexpected.push("scope");
995
+ if (unexpected.length) {
996
+ throw jiuchuanhuiValidationError("field_unsupported", `\u5FEB\u6377\u67E5\u8BE2\u4E0D\u652F\u6301\u4EE5\u4E0B\u53C2\u6570\uFF1A${unexpected.join("\u3001")}`, { fields: unexpected });
997
+ }
998
+ if (typeof scope !== "string" || !Object.hasOwn(CUSTOMER_SEARCH_SCOPES, scope)) {
999
+ throw jiuchuanhuiValidationError("input_invalid", "scope \u5FC5\u987B\u662F mine\u3001all \u6216 open-sea");
1000
+ }
1001
+ if (pageNo !== void 0 && (!Number.isSafeInteger(pageNo) || pageNo < 1)) {
1002
+ throw jiuchuanhuiValidationError("input_invalid", "pageNo \u5FC5\u987B\u662F\u6B63\u6574\u6570");
1003
+ }
1004
+ if (pageSize !== void 0 && (!Number.isSafeInteger(pageSize) || pageSize < 1 || pageSize > 200)) {
1005
+ throw jiuchuanhuiValidationError("input_invalid", "pageSize \u5FC5\u987B\u662F 1 \u5230 200 \u4E4B\u95F4\u7684\u6574\u6570");
1006
+ }
1007
+ if (count !== void 0 && typeof count !== "boolean") {
1008
+ throw jiuchuanhuiValidationError("input_invalid", "count \u5FC5\u987B\u662F\u5E03\u5C14\u503C");
1009
+ }
1010
+ const customerName = customer_name === void 0 ? void 0 : asNonEmptyString(customer_name, "customer_name");
1011
+ const status = this.customerStatusSearch ? await resolveSuccessStatus(this.customerStatusSearch, context) : void 0;
1012
+ return this.customerSearch.execute({
1013
+ ...CUSTOMER_SEARCH_SCOPES[scope],
1014
+ customer_name: customerName,
1015
+ pageNo,
1016
+ pageSize,
1017
+ count,
1018
+ status
1019
+ }, context);
1020
+ }
1021
+ };
1022
+
1023
+ // src/shortcuts/jiuchuanhui/manifest.ts
1024
+ var pageProps = {
1025
+ pageNo: { type: "integer", minimum: 1, default: 1 },
1026
+ pageSize: { type: "integer", minimum: 1, maximum: 200, default: 10 },
1027
+ count: { type: "boolean", description: "\u662F\u5426\u5E76\u884C\u8BF7\u6C42\u603B\u6570\u63A5\u53E3" }
1028
+ };
1029
+ var customerQuickSearchProps = {
1030
+ ...pageProps,
1031
+ customer_name: { type: "string", minLength: 1, description: "\u5BA2\u6237\u540D\u79F0\u641C\u7D22\u6761\u4EF6" }
1032
+ };
1033
+ var idProp = { type: "string", pattern: "^[1-9]\\d*$" };
1034
+ var formProp = {
1035
+ type: "object",
1036
+ additionalProperties: true,
1037
+ description: "\u521B\u5EFA/\u66F4\u65B0\u8868\u5355\u6570\u636E\uFF1A{ mainTable, detail1?, detail2?, ... } \u6216 { datas: [...] }\u3002data_key \u4E0E\u660E\u7EC6\u8868\u540D\u4EE5\u7F13\u5B58 config/{pk}.json \u4E3A\u51C6\u3002"
1038
+ };
1039
+ var esbWriteProps = (keys) => {
1040
+ const props = {};
1041
+ for (const key of keys) props[key] = { type: "string", description: `\u52A8\u4F5C\u6D41\u4E1A\u52A1\u53C2\u6570 ${key}` };
1042
+ return props;
1043
+ };
1044
+ var esbWriteSchema = (keys, required = keys) => ({
1045
+ type: "object",
1046
+ additionalProperties: false,
1047
+ properties: esbWriteProps(keys),
1048
+ required
1049
+ });
1050
+ function writePair(baseName, title, props, required = [], fixed = {}, withPrepare = true) {
1051
+ const list = [];
1052
+ if (withPrepare) {
1053
+ list.push({
1054
+ name: `${baseName}.prepare`,
1055
+ risk: "read-before-write",
1056
+ requiresConfirmation: true,
1057
+ fixed: { ...fixed, stage: "prepare" },
1058
+ inputSchema: {
1059
+ type: "object",
1060
+ additionalProperties: false,
1061
+ properties: {
1062
+ mainTable: {
1063
+ type: "object",
1064
+ additionalProperties: false,
1065
+ properties: props,
1066
+ ...required.length ? { required } : {}
1067
+ }
1068
+ },
1069
+ required: ["mainTable"]
1044
1070
  }
1045
- }
1046
- const discovery = {};
1047
- const appResp = await host.request({
1048
- method: "GET",
1049
- path: "/api/bs/ebuilder/app/tags/getAppIds",
1050
- query: { tag: APP_TAG },
1051
- operation: this.name
1052
1071
  });
1053
- if (!successCheck(appResp)) throw jiuchuanhuiValidationError("init_failed", "app.discovery \u672A\u6210\u529F\uFF0C\u65E0\u6CD5\u521D\u59CB\u5316\u7F13\u5B58");
1054
- const rawApp = appResp?.data ?? appResp?.datajson?.datas;
1055
- const appId = Array.isArray(rawApp) && rawApp[0] ? String(rawApp[0]) : null;
1056
- if (!appId) throw jiuchuanhuiValidationError("init_failed", "\u6B65\u9AA4 1 \u672A\u53D6\u5F97 appId\uFF0C\u8BF7\u68C0\u67E5 E10 \u767B\u5F55\u6001");
1057
- discovery[`appId:${APP_TAG}`] = appId;
1058
- for (const tag of MODULE_TAGS) {
1059
- const resp = await host.request({
1060
- method: "GET",
1061
- path: "/api/ebuilder/form/obj/getObjsByTag",
1062
- query: { tag, appId },
1063
- operation: this.name
1064
- });
1065
- const list = Array.isArray(resp?.data) ? resp.data : resp?.datajson?.datas ?? [];
1066
- const hit = list.find((o) => o?.formId && String(o.formId) !== "0") ?? list?.[0];
1067
- if (hit?.id) discovery[`objId:${tag}`] = String(hit.id);
1072
+ }
1073
+ list.push({
1074
+ name: `${baseName}.apply`,
1075
+ risk: "high-risk-write",
1076
+ requiresConfirmation: true,
1077
+ fixed: { ...fixed, stage: "apply" },
1078
+ inputSchema: {
1079
+ type: "object",
1080
+ additionalProperties: false,
1081
+ properties: {
1082
+ continuation: { type: "string", minLength: 1 },
1083
+ confirm: { const: true }
1084
+ },
1085
+ required: ["continuation", "confirm"]
1068
1086
  }
1069
- try {
1070
- const spResp = await host.request({
1071
- method: "GET",
1072
- path: "/api/installer/public/querySpAppVersionInfo",
1073
- query: { appId },
1074
- operation: this.name
1075
- });
1076
- const sp = spResp?.data;
1077
- const commitVersion = typeof sp === "object" && sp !== null ? String(sp.commitVersion ?? sp.version ?? "") : "";
1078
- if (commitVersion) {
1079
- discovery[`spVersion:${APP_TAG}`] = { commitVersion, passed: semverGte(commitVersion, MIN_VERSION) };
1087
+ });
1088
+ return list;
1089
+ }
1090
+ var OPERATION_SUMMARIES = {
1091
+ "jiuchuanhui.cache.init": "\u521D\u59CB\u5316\u4E5D\u6C1A\u6C47\u672C\u5730\u7F13\u5B58\uFF08\u5199\u672C\u5730\u7F13\u5B58\u6587\u4EF6\uFF0C\u4E0D\u8C03\u4E1A\u52A1\u63A5\u53E3\uFF09\uFF1B\u5165\u53C2 dryRun/verbose",
1092
+ "jiuchuanhui.app.discovery": "\u6309\u6807\u7B7E\u53D6\u4E5D\u6C1A\u6C47\u76F8\u5173 eBuilder \u5E94\u7528 ID \u5217\u8868",
1093
+ "jiuchuanhui.form.discovery": "\u6309\u6807\u7B7E\u4E0E\u5E94\u7528\u53D6\u8868\u5355\uFF08\u5BF9\u8C61\uFF09\u5B9A\u4E49\uFF0C\u7528\u4E8E\u5B9A\u4F4D\u5BA2\u6237/\u5546\u673A\u7B49\u4E3B\u8868",
1094
+ "jiuchuanhui.field.options": "\u53D6\u8868\u5355\u67D0\u5B57\u6BB5\u7684\u9009\u9879\u5B57\u5178\uFF08id\u2194name\uFF09\uFF1B\u5165\u53C2 fieldName/objId/groupId",
1095
+ "jiuchuanhui.rest.cfg.detail": "\u6309 apid + id \u53D6 REST \u914D\u7F6E\u8BE6\u60C5\uFF08\u52A8\u4F5C\u6D41\u914D\u7F6E\u89E3\u6790\u7ED3\u679C\uFF09",
1096
+ "jiuchuanhui.config.id.by.pk": "\u6309\u4E3B\u8868\u4E0E\u6570\u636E\u4E3B\u952E\u53CD\u67E5\u914D\u7F6E ID\uFF08\u7ECF\u52A8\u4F5C\u6D41\uFF09",
1097
+ "jiuchuanhui.file.preview": "\u53D6\u9644\u4EF6\u9884\u89C8\u5730\u5740\uFF1B\u5165\u53C2 fileId/fieldId/appId",
1098
+ "jiuchuanhui.customer.create.prepare": "\u51C6\u5907\u65B0\u5EFA\u5BA2\u6237\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09\uFF1B\u5165\u53C2 mainTable \u4E0E\u5BA2\u6237\u5B57\u6BB5",
1099
+ "jiuchuanhui.customer.create.apply": "\u63D0\u4EA4\u65B0\u5EFA\u5BA2\u6237\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1100
+ "jiuchuanhui.customer.get": "\u6309 id \u53D6\u5BA2\u6237\u8BE6\u60C5",
1101
+ "jiuchuanhui.customer.search": "\u5206\u9875\u67E5\u8BE2\u5BA2\u6237\u5217\u8868\uFF08\u652F\u6301\u6761\u4EF6\u8FC7\u6EE4\uFF09",
1102
+ "jiuchuanhui.customer.type.search": "\u5206\u9875\u67E5\u8BE2\u5BA2\u6237\u7C7B\u578B\u5B57\u5178",
1103
+ "jiuchuanhui.customer.status.search": "\u5206\u9875\u67E5\u8BE2\u5BA2\u6237\u72B6\u6001\u5B57\u5178",
1104
+ "jiuchuanhui.customer.industry.search": "\u5206\u9875\u67E5\u8BE2\u5BA2\u6237\u884C\u4E1A\u5B57\u5178",
1105
+ "jiuchuanhui.customer.open-sea.search": "\u5206\u9875\u67E5\u8BE2\u516C\u6D77\u5BA2\u6237\u5217\u8868",
1106
+ "jiuchuanhui.customer.update.prepare": "\u51C6\u5907\u4FEE\u6539\u5BA2\u6237\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09\uFF1B\u5165\u53C2 mainTable \u4E0E\u5F85\u6539\u5B57\u6BB5",
1107
+ "jiuchuanhui.customer.update.apply": "\u63D0\u4EA4\u4FEE\u6539\u5BA2\u6237\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1108
+ "jiuchuanhui.customer.transfer.prepare": "\u51C6\u5907\u8F6C\u79FB\u5BA2\u6237\u8D1F\u8D23\u4EBA\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09\uFF1B\u5165\u53C2 mainTable \u4E0E\u76EE\u6807\u8D1F\u8D23\u4EBA",
1109
+ "jiuchuanhui.customer.transfer.apply": "\u63D0\u4EA4\u8F6C\u79FB\u5BA2\u6237\u8D1F\u8D23\u4EBA\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1110
+ "jiuchuanhui.customer.open-sea.release.prepare": "\u51C6\u5907\u628A\u5BA2\u6237\u91CA\u653E\u5230\u516C\u6D77\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1111
+ "jiuchuanhui.customer.open-sea.release.apply": "\u63D0\u4EA4\u628A\u5BA2\u6237\u91CA\u653E\u5230\u516C\u6D77\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1112
+ "jiuchuanhui.customer.open-sea.claim.prepare": "\u51C6\u5907\u4ECE\u516C\u6D77\u9886\u53D6\u5BA2\u6237\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1113
+ "jiuchuanhui.customer.open-sea.claim.apply": "\u63D0\u4EA4\u4ECE\u516C\u6D77\u9886\u53D6\u5BA2\u6237\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1114
+ "jiuchuanhui.customer.duplicate.check": "\u5BA2\u6237\u67E5\u91CD\uFF1A\u6309\u540D\u79F0/\u5173\u952E\u4FE1\u606F\u627E\u51FA\u7591\u4F3C\u91CD\u590D\u5BA2\u6237\uFF08\u7ECF\u52A8\u4F5C\u6D41\uFF09",
1115
+ "jiuchuanhui.customer.contact-record.create.prepare": "\u51C6\u5907\u65B0\u589E\u5BA2\u6237\u8054\u7CFB\u8BB0\u5F55\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1116
+ "jiuchuanhui.customer.contact-record.create.apply": "\u63D0\u4EA4\u65B0\u589E\u5BA2\u6237\u8054\u7CFB\u8BB0\u5F55\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1117
+ "jiuchuanhui.customer.contact-record.batch.prepare": "\u51C6\u5907\u6279\u91CF\u65B0\u589E\u5BA2\u6237\u8054\u7CFB\u8BB0\u5F55\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1118
+ "jiuchuanhui.customer.contact-record.batch.apply": "\u63D0\u4EA4\u6279\u91CF\u65B0\u589E\u5BA2\u6237\u8054\u7CFB\u8BB0\u5F55\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1119
+ "jiuchuanhui.contact.create.prepare": "\u51C6\u5907\u65B0\u5EFA\u8054\u7CFB\u4EBA\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09\uFF1B\u5165\u53C2 mainTable \u4E0E\u8054\u7CFB\u4EBA\u5B57\u6BB5",
1120
+ "jiuchuanhui.contact.create.apply": "\u63D0\u4EA4\u65B0\u5EFA\u8054\u7CFB\u4EBA\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1121
+ "jiuchuanhui.contact.get": "\u6309 id \u53D6\u8054\u7CFB\u4EBA\u8BE6\u60C5",
1122
+ "jiuchuanhui.contact.update.prepare": "\u51C6\u5907\u4FEE\u6539\u8054\u7CFB\u4EBA\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1123
+ "jiuchuanhui.contact.update.apply": "\u63D0\u4EA4\u4FEE\u6539\u8054\u7CFB\u4EBA\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1124
+ "jiuchuanhui.contact.by-entity.search": "\u6309\u5BA2\u6237\u6216\u5546\u673A\u67E5\u8BE2\u5173\u8054\u7684\u8054\u7CFB\u4EBA\u5217\u8868\uFF1B\u5165\u53C2 customerId/saleChanceId",
1125
+ "jiuchuanhui.sale.create.prepare": "\u51C6\u5907\u65B0\u5EFA\u5546\u673A\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09\uFF1B\u5165\u53C2 mainTable \u4E0E\u5546\u673A\u5B57\u6BB5",
1126
+ "jiuchuanhui.sale.create.apply": "\u63D0\u4EA4\u65B0\u5EFA\u5546\u673A\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1127
+ "jiuchuanhui.sale.get": "\u6309 id \u53D6\u5546\u673A\u8BE6\u60C5",
1128
+ "jiuchuanhui.sale.search": "\u5206\u9875\u67E5\u8BE2\u5546\u673A\u5217\u8868\uFF08\u652F\u6301\u6761\u4EF6\u8FC7\u6EE4\uFF09",
1129
+ "jiuchuanhui.sale.update.prepare": "\u51C6\u5907\u4FEE\u6539\u5546\u673A\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1130
+ "jiuchuanhui.sale.update.apply": "\u63D0\u4EA4\u4FEE\u6539\u5546\u673A\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1131
+ "jiuchuanhui.sale.stage.search": "\u5206\u9875\u67E5\u8BE2\u9500\u552E\u9636\u6BB5\u5B57\u5178",
1132
+ "jiuchuanhui.sale.process.search": "\u5206\u9875\u67E5\u8BE2\u5546\u673A\u7684\u6D41\u7A0B/\u9636\u6BB5\u63A8\u8FDB\u8BB0\u5F55",
1133
+ "jiuchuanhui.sale.lose-reason.search": "\u5206\u9875\u67E5\u8BE2\u4E22\u5355\u539F\u56E0\u5B57\u5178",
1134
+ "jiuchuanhui.rival.search": "\u5206\u9875\u67E5\u8BE2\u7ADE\u4E89\u5BF9\u624B\u5217\u8868",
1135
+ "jiuchuanhui.sale.win.prepare": "\u51C6\u5907\u6807\u8BB0\u5546\u673A\u8D62\u5355\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1136
+ "jiuchuanhui.sale.win.apply": "\u63D0\u4EA4\u6807\u8BB0\u5546\u673A\u8D62\u5355\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1137
+ "jiuchuanhui.sale.lose.prepare": "\u51C6\u5907\u6807\u8BB0\u5546\u673A\u8F93\u5355\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1138
+ "jiuchuanhui.sale.lose.apply": "\u63D0\u4EA4\u6807\u8BB0\u5546\u673A\u8F93\u5355\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1139
+ "jiuchuanhui.sale.invalid.prepare": "\u51C6\u5907\u4F5C\u5E9F\u5546\u673A\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1140
+ "jiuchuanhui.sale.invalid.apply": "\u63D0\u4EA4\u4F5C\u5E9F\u5546\u673A\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1141
+ "jiuchuanhui.sale.pause.prepare": "\u51C6\u5907\u6682\u505C\u5546\u673A\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1142
+ "jiuchuanhui.sale.pause.apply": "\u63D0\u4EA4\u6682\u505C\u5546\u673A\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1143
+ "jiuchuanhui.sale.restart.prepare": "\u51C6\u5907\u91CD\u542F\u5546\u673A\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1144
+ "jiuchuanhui.sale.restart.apply": "\u63D0\u4EA4\u91CD\u542F\u5546\u673A\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1145
+ "jiuchuanhui.sale.manager-change.prepare": "\u51C6\u5907\u53D8\u66F4\u5546\u673A\u8D1F\u8D23\u4EBA\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1146
+ "jiuchuanhui.sale.manager-change.apply": "\u63D0\u4EA4\u53D8\u66F4\u5546\u673A\u8D1F\u8D23\u4EBA\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1147
+ "jiuchuanhui.sale.link-contacts.prepare": "\u51C6\u5907\u7ED9\u5546\u673A\u5173\u8054\u8054\u7CFB\u4EBA\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1148
+ "jiuchuanhui.sale.link-contacts.apply": "\u63D0\u4EA4\u7ED9\u5546\u673A\u5173\u8054\u8054\u7CFB\u4EBA\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1149
+ "jiuchuanhui.sale.contact-record.create.prepare": "\u51C6\u5907\u65B0\u589E\u5546\u673A\u8054\u7CFB\u8BB0\u5F55\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1150
+ "jiuchuanhui.sale.contact-record.create.apply": "\u63D0\u4EA4\u65B0\u589E\u5546\u673A\u8054\u7CFB\u8BB0\u5F55\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1151
+ "jiuchuanhui.clue.create.prepare": "\u51C6\u5907\u65B0\u5EFA\u7EBF\u7D22\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09\uFF1B\u5165\u53C2 mainTable \u4E0E\u7EBF\u7D22\u5B57\u6BB5",
1152
+ "jiuchuanhui.clue.create.apply": "\u63D0\u4EA4\u65B0\u5EFA\u7EBF\u7D22\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1153
+ "jiuchuanhui.clue.get": "\u6309 id \u53D6\u7EBF\u7D22\u8BE6\u60C5",
1154
+ "jiuchuanhui.clue.search": "\u5206\u9875\u67E5\u8BE2\u7EBF\u7D22\u5217\u8868\uFF08\u652F\u6301\u6761\u4EF6\u8FC7\u6EE4\uFF09",
1155
+ "jiuchuanhui.clue.pool.search": "\u5206\u9875\u67E5\u8BE2\u7EBF\u7D22\u6C60\u5217\u8868",
1156
+ "jiuchuanhui.clue.update.prepare": "\u51C6\u5907\u4FEE\u6539\u7EBF\u7D22\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1157
+ "jiuchuanhui.clue.update.apply": "\u63D0\u4EA4\u4FEE\u6539\u7EBF\u7D22\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1158
+ "jiuchuanhui.clue.status-change.prepare": "\u51C6\u5907\u53D8\u66F4\u7EBF\u7D22\u72B6\u6001\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1159
+ "jiuchuanhui.clue.status-change.apply": "\u63D0\u4EA4\u53D8\u66F4\u7EBF\u7D22\u72B6\u6001\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1160
+ "jiuchuanhui.clue.to-customer.prepare": "\u51C6\u5907\u628A\u7EBF\u7D22\u8F6C\u4E3A\u5BA2\u6237\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1161
+ "jiuchuanhui.clue.to-customer.apply": "\u63D0\u4EA4\u628A\u7EBF\u7D22\u8F6C\u4E3A\u5BA2\u6237\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1162
+ "jiuchuanhui.clue.contact-record.create.prepare": "\u51C6\u5907\u65B0\u589E\u7EBF\u7D22\u8054\u7CFB\u8BB0\u5F55\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1163
+ "jiuchuanhui.clue.contact-record.create.apply": "\u63D0\u4EA4\u65B0\u589E\u7EBF\u7D22\u8054\u7CFB\u8BB0\u5F55\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1164
+ "jiuchuanhui.contact-plan.create.prepare": "\u51C6\u5907\u65B0\u5EFA\u8054\u7CFB\u8BA1\u5212\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1165
+ "jiuchuanhui.contact-plan.create.apply": "\u63D0\u4EA4\u65B0\u5EFA\u8054\u7CFB\u8BA1\u5212\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1166
+ "jiuchuanhui.contact-plan.complete.prepare": "\u51C6\u5907\u628A\u8054\u7CFB\u8BA1\u5212\u6807\u8BB0\u5B8C\u6210\uFF08\u53EA\u51FA\u9884\u89C8\uFF0C\u4E0D\u5199\u5165\uFF09",
1167
+ "jiuchuanhui.contact-plan.complete.apply": "\u63D0\u4EA4\u628A\u8054\u7CFB\u8BA1\u5212\u6807\u8BB0\u5B8C\u6210\uFF08\u843D\u5E93\u524D\u9700\u786E\u8BA4\uFF09\uFF1B\u9700 continuation + confirm",
1168
+ "jiuchuanhui.entity.contact-records.list": "\u67E5\u67D0\u4E2A\u5B9E\u4F53\uFF08\u5BA2\u6237/\u5546\u673A/\u7EBF\u7D22\uFF09\u540D\u4E0B\u7684\u8054\u7CFB\u8BB0\u5F55\uFF1B\u5165\u53C2 mainTable \u4E0E\u5B9E\u4F53\u4E3B\u952E",
1169
+ "jiuchuanhui.contact-records.by-person-time.list": "\u6309\u4EBA\u5458\u4E0E\u65F6\u95F4\u8303\u56F4\u67E5\u8054\u7CFB\u8BB0\u5F55",
1170
+ "jiuchuanhui.entity.id.by-name": "\u6309\u540D\u79F0\u89E3\u6790\u5B9E\u4F53 ID\uFF08\u91CD\u540D\u65F6\u4F1A\u7ED9\u51FA\u5019\u9009\uFF09",
1171
+ "jiuchuanhui.user.id.by-name": "\u6309\u59D3\u540D\u89E3\u6790\u7528\u6237 ID\uFF08\u91CD\u540D\u65F6\u4F1A\u7ED9\u51FA\u5019\u9009\uFF09",
1172
+ "jiuchuanhui.user.current-profile": "\u53D6\u5F53\u524D\u767B\u5F55\u4EBA\u7684\u753B\u50CF\u4FE1\u606F\uFF08\u90E8\u95E8/\u5C97\u4F4D/\u4E0A\u7EA7\uFF09",
1173
+ "jiuchuanhui.entity.permission.judge": "\u5224\u5B9A\u5F53\u524D\u7528\u6237\u5BF9\u67D0\u5B9E\u4F53\uFF08\u5BA2\u6237/\u5546\u673A/\u7EBF\u7D22\uFF09\u7684\u64CD\u4F5C\u6743\u9650",
1174
+ "jiuchuanhui.company.business-profile.query": "\u67E5\u5BA2\u6237\u7684\u5DE5\u5546\u753B\u50CF\u4FE1\u606F",
1175
+ "jiuchuanhui.field.info.by-ids": "\u6309 ID \u6279\u91CF\u53D6\u5B57\u6BB5\u4FE1\u606F\uFF08\u540D\u79F0/\u7C7B\u578B\uFF09",
1176
+ "jiuchuanhui.browser-option.search": "\u901A\u7528\u6D4F\u89C8\u6309\u94AE\u68C0\u7D22\uFF1A\u6309\u81EA\u5B9A\u4E49\u6D4F\u89C8\u6309\u94AE\u7C7B\u578B\u53D6\u5019\u9009\uFF08\u8DEF\u5F84\u53C2\u6570 pathParams\uFF09",
1177
+ "jiuchuanhui.get-rest-cfg-detail": "\u6309 apid + id \u53D6 REST \u914D\u7F6E\u8BE6\u60C5\uFF08\u4E0E rest.cfg.detail \u540C\u7C7B\uFF0C\u8DEF\u5F84\u4E0D\u540C\uFF09"
1178
+ };
1179
+ function withSummaries(operations) {
1180
+ return operations.map((item) => ({
1181
+ ...item,
1182
+ summary: item.summary || OPERATION_SUMMARIES[item.name] || ""
1183
+ }));
1184
+ }
1185
+ var jiuchuanhuiOperations = [
1186
+ // ==================== 发现与配置 ====================
1187
+ {
1188
+ name: "jiuchuanhui.cache.init",
1189
+ risk: "local-file-write",
1190
+ fixed: { path: "local:cache", purpose: "\u4E5D\u6C1A\u6C47\u914D\u7F6E\u7F13\u5B58\u521D\u59CB\u5316/\u5237\u65B0" },
1191
+ inputSchema: {
1192
+ type: "object",
1193
+ additionalProperties: false,
1194
+ properties: {
1195
+ dryRun: { type: "boolean", description: "\u53EA\u62C9\u53D6\u4E0D\u5199\u5165\uFF08\u9884\u89C8\uFF09" },
1196
+ verbose: { type: "boolean", description: "\u8FD4\u56DE\u66F4\u591A\u6B65\u9AA4\u660E\u7EC6" }
1080
1197
  }
1081
- } catch {
1082
1198
  }
1083
- const cfgMap = {};
1084
- for (const pk of ALL_PKS) {
1085
- const resp = await host.request({
1086
- path: "/api/esb/server/event/triggerActionFlow",
1087
- body: { customParams: { mainTable: { interface_pk: pk } }, uniqueIndent: "4F6E1A9702864666803CCA6B77B86227", employeeId: userId },
1088
- operation: this.name
1089
- });
1090
- const cfgId = resp?.actionData?.responseData?.customData?.mainTable?.cfgId ?? resp?.customData?.mainTable?.cfgId ?? resp?.datajson?.mainTable?.cfgId ?? resp?.data?.mainTable?.cfgId ?? resp?.mainTable?.cfgId;
1091
- if (cfgId) cfgMap[pk] = String(cfgId);
1199
+ },
1200
+ {
1201
+ name: "jiuchuanhui.app.discovery",
1202
+ risk: "read",
1203
+ fixed: { path: "/api/bs/ebuilder/app/tags/getAppIds", method: "GET" },
1204
+ inputSchema: {
1205
+ type: "object",
1206
+ additionalProperties: false,
1207
+ properties: {
1208
+ tag: { type: "string", description: "\u5E94\u7528\u6807\u7B7E\uFF1B\u5FC5\u586B\uFF0C\u5E38\u7528 jch-crm-project\uFF08\u4E0D\u4F1A\u81EA\u52A8\u6CE8\u5165\u9ED8\u8BA4\u503C\uFF09" }
1209
+ },
1210
+ required: ["tag"]
1092
1211
  }
1093
- const perPk = {};
1094
- for (const pk of Object.keys(cfgMap)) {
1095
- const cfgId = cfgMap[pk];
1096
- const resp = await host.request({
1097
- method: "GET",
1098
- path: "/api/bs/ebuilder/form/formdata/getRestCfgById",
1099
- query: { apid: appId, id: cfgId },
1100
- operation: this.name
1101
- });
1102
- const detail = resp?.data ?? {};
1103
- if (!detail?.id && !detail?.mainFields) continue;
1104
- const allFields = [
1105
- ...detail.mainFields || [],
1106
- ...(detail.detailFields || []).flatMap((df) => df.fields || [])
1107
- ];
1108
- const fieldIds = [...new Set(allFields.filter(isInputOne).map((f) => String(f.fieldid)).filter(Boolean))];
1109
- const infoMap = /* @__PURE__ */ new Map();
1110
- if (fieldIds.length > 0) {
1111
- try {
1112
- const infoResp = await host.request({
1113
- path: "/api/esb/server/event/triggerActionFlow",
1114
- body: { customParams: { mainTable: { fieldids: fieldIds.join(",") } }, uniqueIndent: "10351A4DC8D4454A9F1957FBE647CD9F", employeeId: userId },
1115
- operation: this.name
1116
- });
1117
- const list = infoResp?.actionData?.responseData?.customData?.mainTable?.fieldInfoList ?? infoResp?.customData?.mainTable?.fieldInfoList ?? infoResp?.datajson?.mainTable?.fieldInfoList ?? infoResp?.fieldInfoList ?? [];
1118
- for (const it of list) infoMap.set(String(it.id), it);
1119
- } catch {
1120
- }
1121
- }
1122
- const merge = (f) => {
1123
- const info = infoMap.get(String(f?.fieldid));
1124
- if (info) {
1125
- f.data_key = info.data_key ?? f.data_key;
1126
- f.title = info.title ?? f.title;
1127
- f.component_type = info.component_type ?? f.component_type;
1128
- }
1129
- };
1130
- detail.mainFields = (detail.mainFields || []).filter(isInputOne);
1131
- detail.detailFields = (detail.detailFields || []).map((df) => ({ ...df, fields: (df.fields || []).filter(isInputOne) })).filter((df) => Array.isArray(df.fields) && df.fields.length > 0);
1132
- for (const f of detail.mainFields) merge(f);
1133
- for (const df of detail.detailFields) for (const f of df.fields) merge(f);
1134
- const kept = pickKeys(detail, DETAIL_KEEP_KEYS);
1135
- if (Array.isArray(kept.mainFields)) kept.mainFields = kept.mainFields.map((f) => pickKeys(f, FIELD_KEEP_KEYS));
1136
- if (Array.isArray(kept.detailFields)) {
1137
- kept.detailFields = kept.detailFields.map((df) => ({
1138
- ...pickKeys(df, ["id", "fieldName", "title", "fields"]),
1139
- fields: Array.isArray(df.fields) ? df.fields.map((f) => pickKeys(f, FIELD_KEEP_KEYS)) : []
1140
- }));
1141
- }
1142
- perPk[pk] = { cfgId, detail: kept };
1212
+ },
1213
+ {
1214
+ name: "jiuchuanhui.form.discovery",
1215
+ risk: "read",
1216
+ fixed: { path: "/api/ebuilder/form/obj/getObjsByTag", method: "GET" },
1217
+ inputSchema: {
1218
+ type: "object",
1219
+ additionalProperties: false,
1220
+ properties: {
1221
+ tag: { type: "string", description: "\u8868\u5355 tag\uFF0C\u5982 uf_jch_customer" },
1222
+ appId: { type: "string" }
1223
+ },
1224
+ required: ["tag", "appId"]
1143
1225
  }
1144
- const ebuilder = {};
1145
- for (const { key, path, nameFields } of EBUILDER_QUERIES) {
1146
- const list = [];
1147
- let pageNo = 1;
1148
- for (; ; ) {
1149
- const resp = await host.request({
1150
- path,
1151
- body: { datajson: { mainTable: {}, pageInfo: { pageNo, pageSize: 100 }, header: { operator: userId } } },
1152
- operation: this.name
1153
- });
1154
- const items = resp?.datajson?.datas ?? resp?.data ?? [];
1155
- list.push(...Array.isArray(items) ? items : []);
1156
- const hasMore = resp?.hasMore ?? (Array.isArray(items) && items.length === 100);
1157
- if (!hasMore || list.length >= 500 || pageNo >= 5) break;
1158
- pageNo += 1;
1159
- }
1160
- ebuilder[key] = list.map((it) => {
1161
- const mt = it?.mainTable ?? it ?? {};
1162
- let name = "";
1163
- for (const nf of nameFields) {
1164
- if (mt[nf] !== void 0 && mt[nf] !== null && String(mt[nf]) !== "") {
1165
- name = String(mt[nf]);
1166
- break;
1167
- }
1168
- }
1169
- const item = { id: String(mt.id ?? ""), name };
1170
- if (key === "sale_stage" && mt.sale_process !== void 0) {
1171
- const sp = Array.isArray(mt.sale_process) ? mt.sale_process[0] : mt.sale_process;
1172
- if (sp && typeof sp === "object") item.sale_process = { id: String(sp.id ?? ""), name: String(sp.name ?? "") };
1173
- }
1174
- return item;
1175
- }).filter((x) => x.id);
1226
+ },
1227
+ {
1228
+ name: "jiuchuanhui.field.options",
1229
+ risk: "read",
1230
+ fixed: { path: "/api/ebuilder/common/ds/options", method: "GET", sourceType: "FORM", optionLevel: 1 },
1231
+ inputSchema: {
1232
+ type: "object",
1233
+ additionalProperties: false,
1234
+ properties: {
1235
+ fieldName: { type: "string", description: "\u5B57\u6BB5\u5143\u6570\u636EID\uFF08fieldid\uFF09\uFF0C\u4E0D\u662F data_key \u540D\u79F0" },
1236
+ sourceType: { type: "string", default: "FORM" },
1237
+ objId: { type: "string", description: "\u8868\u5355\u5BF9\u8C61ID\uFF0C\u53EF\u7701\u7565\u81EA\u52A8\u53D1\u73B0" },
1238
+ groupId: { type: "string", description: "\u5E94\u7528\u5206\u7EC4ID\uFF0C\u53EF\u7701\u7565\u81EA\u52A8\u53D1\u73B0\uFF08\u9ED8\u8BA4\u6309 jch-crm-project \u53D1\u73B0\uFF09" }
1239
+ },
1240
+ required: ["fieldName", "sourceType"]
1176
1241
  }
1177
- const options = {};
1178
- for (const pk of Object.keys(perPk)) {
1179
- const tag = PK_TO_TAG[pk];
1180
- const objId = discovery[`objId:${tag}`];
1181
- if (!objId) continue;
1182
- const detail = perPk[pk].detail ?? {};
1183
- const fields = [
1184
- ...detail.mainFields || [],
1185
- ...(detail.detailFields || []).flatMap((d) => d.fields || [])
1186
- ];
1187
- for (const f of fields) {
1188
- if (!f?.fieldid) continue;
1189
- if (!OPT_COMP.includes(f.component_type)) continue;
1190
- const key = `options:${f.fieldid}:*:1`;
1191
- if (options[key]) continue;
1192
- try {
1193
- const resp = await host.request({
1194
- method: "GET",
1195
- path: "/api/ebuilder/common/ds/options",
1196
- query: { fieldName: String(f.fieldid), objId, groupId: appId, optionLevel: 1 },
1197
- operation: this.name
1198
- });
1199
- const values = resp?.data ?? resp?.datajson?.datas ?? [];
1200
- options[key] = {
1201
- lable: `${pk}.${f.data_key ?? f.fieldid}`,
1202
- lableTitle: `${pk}.${f.title ?? f.data_key ?? f.fieldid}`,
1203
- value: (Array.isArray(values) ? values : []).map((v) => ({
1204
- label: String(v?.lable ?? v?.label ?? v?.text ?? v?.name ?? ""),
1205
- value: String(v?.value ?? v?.val ?? v?.id ?? "")
1206
- }))
1207
- };
1208
- } catch {
1209
- }
1210
- }
1242
+ },
1243
+ {
1244
+ name: "jiuchuanhui.rest.cfg.detail",
1245
+ risk: "read",
1246
+ fixed: { path: "/api/bs/ebuilder/form/formdata/getRestCfgById", method: "GET" },
1247
+ inputSchema: {
1248
+ type: "object",
1249
+ additionalProperties: false,
1250
+ properties: {
1251
+ apid: { type: "string", description: "\u5E94\u7528 ID" },
1252
+ id: { type: "string", description: "\u63A5\u53E3\u914D\u7F6E ID (cfgId)" }
1253
+ },
1254
+ required: ["apid", "id"]
1211
1255
  }
1212
- const searchPerPk = {};
1213
- for (const pk of SEARCH_PKS) {
1214
- const cfgId = cfgMap[pk];
1215
- if (!cfgId) continue;
1216
- try {
1217
- const resp = await host.request({
1218
- method: "GET",
1219
- path: "/api/bs/ebuilder/form/formdata/getRestCfgById",
1220
- query: { apid: appId, id: cfgId },
1221
- operation: this.name
1222
- });
1223
- const cfgObj = resp?.data ?? {};
1224
- let conditions = cfgObj.conditions;
1225
- if (typeof conditions === "string") {
1226
- try {
1227
- conditions = JSON.parse(conditions);
1228
- } catch {
1229
- conditions = null;
1230
- }
1231
- }
1232
- const params = [];
1233
- for (const d of conditions?.datas ?? []) {
1234
- const value = d?.conditions?.value;
1235
- if (typeof value === "string") {
1236
- const m = value.match(/\{([^}]+)\}/);
1237
- if (m) {
1238
- params.push({
1239
- key: m[1],
1240
- text: d?.text ?? "",
1241
- fieldType: d?.fieldType ?? "",
1242
- compType: d?.compType ?? "",
1243
- func: d?.conditions?.func ?? "",
1244
- fieldid: d?.fieldName ?? ""
1245
- });
1246
- }
1247
- }
1256
+ },
1257
+ {
1258
+ name: "jiuchuanhui.config.id.by.pk",
1259
+ risk: "read",
1260
+ fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "4F6E1A9702864666803CCA6B77B86227" },
1261
+ inputSchema: {
1262
+ type: "object",
1263
+ additionalProperties: false,
1264
+ properties: {
1265
+ mainTable: {
1266
+ type: "object",
1267
+ additionalProperties: false,
1268
+ properties: { interface_pk: { type: "string" } },
1269
+ required: ["interface_pk"]
1248
1270
  }
1249
- searchPerPk[pk] = { cfgId, searchParams: params };
1250
- } catch {
1271
+ },
1272
+ required: ["mainTable"]
1273
+ }
1274
+ },
1275
+ {
1276
+ name: "jiuchuanhui.file.preview",
1277
+ risk: "read",
1278
+ fixed: { path: "/api/file/preview", method: "GET", module: "ebuilderform", authModule: "ebuilderform", source: "form" },
1279
+ inputSchema: {
1280
+ type: "object",
1281
+ additionalProperties: false,
1282
+ properties: {
1283
+ fileId: { type: "string" },
1284
+ fieldId: { type: "string" },
1285
+ appId: { type: "string" },
1286
+ customParam: { type: ["string", "object"] }
1287
+ },
1288
+ required: ["fileId"]
1289
+ }
1290
+ },
1291
+ // ==================== 客户 ====================
1292
+ ...writePair("jiuchuanhui.customer.create", "\u5BA2\u6237\u521B\u5EFA", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/saveFormData/customer_create_api" }),
1293
+ {
1294
+ name: "jiuchuanhui.customer.get",
1295
+ risk: "read",
1296
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataByPk/customer_get_api" },
1297
+ inputSchema: { type: "object", additionalProperties: false, properties: { id: idProp }, required: ["id"] }
1298
+ },
1299
+ {
1300
+ name: "jiuchuanhui.customer.search",
1301
+ risk: "read",
1302
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_search_api", countPath: "/api/ebuilder/form/formdata/v2/getFormDataCount/ebcustomer_search_count_api" },
1303
+ inputSchema: {
1304
+ type: "object",
1305
+ additionalProperties: true,
1306
+ description: "\u641C\u7D22\u6761\u4EF6\u8D70 query\uFF1A\u652F\u6301 searchParams \u4E2D\u7684\u5B57\u6BB5\uFF08customer_name/status/type/managerid/...\uFF09\uFF0C\u4EE5\u53CA\u4E8B\u9879\u8303\u56F4 mine/all/customerSea\uFF08\u5FC5\u987B\u4E09\u9009\u4E00\u7F6E\u7A7A\u5176\u4F59\u4E3A -1\uFF09\u4E0E\u5206\u9875\u3002",
1307
+ properties: pageProps
1308
+ }
1309
+ },
1310
+ {
1311
+ name: "jiuchuanhui.customer.mine.search",
1312
+ risk: "read",
1313
+ inputSchema: { type: "object", additionalProperties: false, description: "\u67E5\u8BE2\u6211\u7684\u5BA2\u6237\u3002\u9ED8\u8BA4\u53D6\u7B2C\u4E00\u9875 10 \u6761\u3002", properties: customerQuickSearchProps }
1314
+ },
1315
+ {
1316
+ name: "jiuchuanhui.customer.success.search",
1317
+ risk: "read",
1318
+ inputSchema: {
1319
+ type: "object",
1320
+ additionalProperties: false,
1321
+ description: "\u67E5\u8BE2\u5BA2\u6237\u72B6\u6001\u4E3A\u201C\u6210\u529F\u201D\u6216\u201C\u6210\u529F\u5BA2\u6237\u201D\u7684\u5BA2\u6237\u3002\u6309\u5F53\u524D\u79DF\u6237\u7684\u72B6\u6001\u5B57\u5178\u89E3\u6790\u72B6\u6001 ID\uFF0C\u9ED8\u8BA4\u5728\u6211\u7684\u5BA2\u6237\u8303\u56F4\u5185\u67E5\u8BE2\u3002",
1322
+ properties: {
1323
+ ...customerQuickSearchProps,
1324
+ scope: { type: "string", enum: Object.keys(CUSTOMER_SEARCH_SCOPES), default: "mine", description: "\u6211\u7684\u5BA2\u6237\u3001\u5168\u90E8\u53EF\u89C1\u5BA2\u6237\u6216\u516C\u6D77\u5BA2\u6237" }
1251
1325
  }
1252
1326
  }
1253
- for (const [pk, entry] of Object.entries(searchPerPk)) {
1254
- if (perPk[pk]) perPk[pk] = { ...perPk[pk], ...entry };
1255
- else perPk[pk] = entry;
1327
+ },
1328
+ {
1329
+ name: "jiuchuanhui.customer.open-sea.customers.search",
1330
+ risk: "read",
1331
+ inputSchema: { type: "object", additionalProperties: false, description: "\u67E5\u8BE2\u516C\u6D77\u8303\u56F4\u4E2D\u7684\u5BA2\u6237\u8BB0\u5F55\u3002\u9ED8\u8BA4\u53D6\u7B2C\u4E00\u9875 10 \u6761\u3002", properties: customerQuickSearchProps }
1332
+ },
1333
+ {
1334
+ name: "jiuchuanhui.customer.type.search",
1335
+ risk: "read",
1336
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_type_search_api" },
1337
+ inputSchema: { type: "object", additionalProperties: false, properties: pageProps }
1338
+ },
1339
+ {
1340
+ name: "jiuchuanhui.customer.status.search",
1341
+ risk: "read",
1342
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_status_search_api" },
1343
+ inputSchema: { type: "object", additionalProperties: false, properties: pageProps }
1344
+ },
1345
+ {
1346
+ name: "jiuchuanhui.customer.industry.search",
1347
+ risk: "read",
1348
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_industry_search_api" },
1349
+ inputSchema: { type: "object", additionalProperties: false, properties: pageProps }
1350
+ },
1351
+ {
1352
+ name: "jiuchuanhui.customer.open-sea.search",
1353
+ risk: "read",
1354
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/customer_open_sea_search_api" },
1355
+ inputSchema: { type: "object", additionalProperties: true, properties: pageProps }
1356
+ },
1357
+ ...writePair("jiuchuanhui.customer.update", "\u5BA2\u6237\u4FEE\u6539", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/updateFormData/customer_update_api" }),
1358
+ ...writePair("jiuchuanhui.customer.transfer", "\u5BA2\u6237\u8F6C\u79FB", esbWriteProps(["customerId", "employee_MappingId", "employeeName"]), ["customerId"], { uniqueIndent: "1E44ED7DA9EB46329818E682C2914928" }),
1359
+ ...writePair("jiuchuanhui.customer.open-sea.release", "\u5BA2\u6237\u91CA\u653E\u516C\u6D77", esbWriteProps(["customerId", "openSeaId"]), ["customerId", "openSeaId"], { uniqueIndent: "0E29AD0E708D4964B071D293288B92D7" }),
1360
+ ...writePair("jiuchuanhui.customer.open-sea.claim", "\u9886\u53D6\u516C\u6D77\u5BA2\u6237", esbWriteProps(["customer_id"]), ["customer_id"], { uniqueIndent: "D587CDC892FE41118DD073475C01A2CE" }),
1361
+ {
1362
+ name: "jiuchuanhui.customer.duplicate.check",
1363
+ risk: "read",
1364
+ fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "D5D0A1C30E7B404B842987C0AD3B749D" },
1365
+ inputSchema: {
1366
+ type: "object",
1367
+ additionalProperties: false,
1368
+ properties: { mainTable: esbWriteSchema(["name", "simpleName"], ["name", "simpleName"]) },
1369
+ required: ["mainTable"]
1256
1370
  }
1257
- const region = {};
1258
- for (const city of REGION_CITIES) {
1259
- try {
1260
- const resp = await host.request({
1261
- path: "/api/esb/server/event/triggerActionFlow",
1262
- body: {
1263
- customParams: { mainTable: { moduleType: "administrativeDivision", name: city, fromType: "agentSkill" } },
1264
- uniqueIndent: "7EC1639D5AC24B4DBCEE8D2CB85D4025",
1265
- employeeId: userId
1371
+ },
1372
+ ...writePair("jiuchuanhui.customer.contact-record.create", "\u65B0\u5EFA\u5BA2\u6237\u8054\u7CFB\u8BB0\u5F55", esbWriteProps(["customerId", "comment_content", "type", "rating", "contact_information", "contacts", "next_time", "next_content", "next_contact_information", "next_contacts", "sync_salechance", "rel_remind"]), ["customerId", "comment_content"], { uniqueIndent: "C7A226EEE1324FF3B6E5BD18AF923DE7" }),
1373
+ ...writePair("jiuchuanhui.customer.contact-record.batch", "\u6279\u91CF\u6DFB\u52A0\u5BA2\u6237\u8054\u7CFB\u8BB0\u5F55", esbWriteProps(["entityList", "content"]), ["entityList", "content"], { uniqueIndent: "D0F315619FE34C669AE738ED68329FAB" }),
1374
+ // ==================== 联系人 ====================
1375
+ ...writePair("jiuchuanhui.contact.create", "\u8054\u7CFB\u4EBA\u521B\u5EFA", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/saveFormData/contact_create_api" }),
1376
+ {
1377
+ name: "jiuchuanhui.contact.get",
1378
+ risk: "read",
1379
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataByPk/contact_get_api" },
1380
+ inputSchema: { type: "object", additionalProperties: false, properties: { id: idProp }, required: ["id"] }
1381
+ },
1382
+ ...writePair("jiuchuanhui.contact.update", "\u8054\u7CFB\u4EBA\u4FEE\u6539", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/updateFormData/contact_update_api" }),
1383
+ {
1384
+ name: "jiuchuanhui.contact.by-entity.search",
1385
+ risk: "read",
1386
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcontact_search_by_entity_api" },
1387
+ inputSchema: {
1388
+ type: "object",
1389
+ additionalProperties: true,
1390
+ properties: { ...pageProps, customerId: { type: "string" }, saleChanceId: { type: "string" } }
1391
+ }
1392
+ },
1393
+ // ==================== 商机 ====================
1394
+ ...writePair("jiuchuanhui.sale.create", "\u5546\u673A\u521B\u5EFA", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/saveFormData/sale_create_api" }),
1395
+ {
1396
+ name: "jiuchuanhui.sale.get",
1397
+ risk: "read",
1398
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataByPk/sale_get_api" },
1399
+ inputSchema: { type: "object", additionalProperties: false, properties: { id: idProp }, required: ["id"] }
1400
+ },
1401
+ {
1402
+ name: "jiuchuanhui.sale.search",
1403
+ risk: "read",
1404
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebsale_search_api", countPath: "/api/ebuilder/form/formdata/v2/getFormDataCount/ebsale_search_count_api" },
1405
+ inputSchema: { type: "object", additionalProperties: true, properties: pageProps }
1406
+ },
1407
+ ...writePair("jiuchuanhui.sale.update", "\u5546\u673A\u4FEE\u6539", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/updateFormData/sale_update_api" }),
1408
+ {
1409
+ name: "jiuchuanhui.sale.stage.search",
1410
+ risk: "read",
1411
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/sale_stage_search_api" },
1412
+ inputSchema: { type: "object", additionalProperties: false, properties: pageProps }
1413
+ },
1414
+ {
1415
+ name: "jiuchuanhui.sale.process.search",
1416
+ risk: "read",
1417
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/sale_process_sear_api" },
1418
+ inputSchema: { type: "object", additionalProperties: false, properties: pageProps }
1419
+ },
1420
+ {
1421
+ name: "jiuchuanhui.sale.lose-reason.search",
1422
+ risk: "read",
1423
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/sale_lose_reason" },
1424
+ inputSchema: { type: "object", additionalProperties: false, properties: pageProps }
1425
+ },
1426
+ {
1427
+ name: "jiuchuanhui.rival.search",
1428
+ risk: "read",
1429
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebrival_search_api" },
1430
+ inputSchema: { type: "object", additionalProperties: false, properties: pageProps }
1431
+ },
1432
+ ...writePair("jiuchuanhui.sale.win", "\u5546\u673A\u8D62\u5355", esbWriteProps(["saleId"]), ["saleId"], { uniqueIndent: "3B23E782E5084F18A904E895BBD61A96" }),
1433
+ ...writePair("jiuchuanhui.sale.lose", "\u5546\u673A\u8F93\u5355", esbWriteProps(["saleid", "money", "reasonids", "rivals", "desc"]), ["saleid"], { uniqueIndent: "DE35D926F82F49FDBA26B48B0CA1CB53" }),
1434
+ ...writePair("jiuchuanhui.sale.invalid", "\u5546\u673A\u65E0\u6548", esbWriteProps(["saleId"]), ["saleId"], { uniqueIndent: "4D88AB8677D84BAC90B63137E7FA1FF9" }),
1435
+ ...writePair("jiuchuanhui.sale.pause", "\u5546\u673A\u6682\u505C", esbWriteProps(["saleId", "pauseReason", "restartDate"]), ["saleId", "pauseReason"], { uniqueIndent: "859C73403DCC4F01B02329571BDBD9F3" }),
1436
+ ...writePair("jiuchuanhui.sale.restart", "\u5546\u673A\u91CD\u542F", esbWriteProps(["saleChanceId"]), ["saleChanceId"], { uniqueIndent: "F3004CDCA8A548B5A0DACD3CDE62387A" }),
1437
+ ...writePair("jiuchuanhui.sale.manager-change", "\u5546\u673A\u8F6C\u79FB/\u8D1F\u8D23\u4EBA\u53D8\u66F4", esbWriteProps(["saleChanceId", "managerId"]), ["saleChanceId", "managerId"], { uniqueIndent: "595F9C6F1C4248929B83086F71363BA7" }),
1438
+ ...writePair("jiuchuanhui.sale.link-contacts", "\u5546\u673A\u5173\u8054\u8054\u7CFB\u4EBA", esbWriteProps(["salechanceId", "contactIds"]), ["salechanceId", "contactIds"], { uniqueIndent: "1114A713A62F4CA9899CC24ED5902D93" }),
1439
+ ...writePair("jiuchuanhui.sale.contact-record.create", "\u65B0\u5EFA\u5546\u673A\u8054\u7CFB\u8BB0\u5F55", esbWriteProps(["saleId", "comment_content", "type", "rating", "contact_information", "contacts", "next_time", "next_content", "next_contact_information", "next_contacts", "rel_remind"]), ["saleId", "comment_content"], { uniqueIndent: "7BB3A1918186445F9E770862EFA7EDA9" }),
1440
+ // ==================== 线索 ====================
1441
+ ...writePair("jiuchuanhui.clue.create", "\u7EBF\u7D22\u521B\u5EFA", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/saveFormData/ebclue_ai_create_api" }),
1442
+ {
1443
+ name: "jiuchuanhui.clue.get",
1444
+ risk: "read",
1445
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataByPk/ebcluepool_ai_get_api" },
1446
+ inputSchema: { type: "object", additionalProperties: false, properties: { id: idProp }, required: ["id"] }
1447
+ },
1448
+ {
1449
+ name: "jiuchuanhui.clue.search",
1450
+ risk: "read",
1451
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebclue_ai_search_api", countPath: "/api/ebuilder/form/formdata/v2/getFormDataCount/ebclue_ai_search_count_api" },
1452
+ inputSchema: { type: "object", additionalProperties: true, properties: pageProps }
1453
+ },
1454
+ {
1455
+ name: "jiuchuanhui.clue.pool.search",
1456
+ risk: "read",
1457
+ fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/ebcluepool_ai_search_api" },
1458
+ inputSchema: { type: "object", additionalProperties: true, properties: pageProps }
1459
+ },
1460
+ ...writePair("jiuchuanhui.clue.update", "\u7EBF\u7D22\u4FEE\u6539", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/updateFormData/ebclue_ai_update_api" }),
1461
+ ...writePair("jiuchuanhui.clue.status-change", "\u7EBF\u7D22\u72B6\u6001\u53D8\u66F4", esbWriteProps(["clueid", "type", "newmanager", "desc"]), ["clueid", "type"], { uniqueIndent: "257CC8DE42234F9191439B229839B8A7" }),
1462
+ ...writePair("jiuchuanhui.clue.to-customer", "\u7EBF\u7D22\u8F6C\u5DF2\u6709\u5BA2\u6237", esbWriteProps(["clueId", "customerId"]), ["clueId", "customerId"], { uniqueIndent: "00914C6415EB455DB7FCCC32DBE6E0C3" }),
1463
+ ...writePair("jiuchuanhui.clue.contact-record.create", "\u65B0\u5EFA\u7EBF\u7D22\u8DDF\u8FDB\u8BB0\u5F55", esbWriteProps(["clueId", "content", "clueStatus_MappingId"]), ["clueId", "content"], { uniqueIndent: "B3DD120601344320A2B50A042B450681" }),
1464
+ // ==================== 联系计划 ====================
1465
+ ...writePair("jiuchuanhui.contact-plan.create", "\u521B\u5EFA\u8054\u7CFB\u8BA1\u5212", { form: formProp }, ["form"], { path: "/api/ebuilder/form/formdata/v2/saveFormData/ebcontact_plan_create_api" }),
1466
+ ...writePair("jiuchuanhui.contact-plan.complete", "\u5B8C\u6210\u8054\u7CFB\u8BA1\u5212", esbWriteProps(["planId"]), ["planId"], { uniqueIndent: "2595D3556CFC414F85B1A4A8D806EFE5" }),
1467
+ // ==================== 联系记录 ====================
1468
+ {
1469
+ name: "jiuchuanhui.entity.contact-records.list",
1470
+ risk: "read",
1471
+ fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "364A9713D10C4997AF6EDCAA5296968E" },
1472
+ inputSchema: {
1473
+ type: "object",
1474
+ additionalProperties: false,
1475
+ properties: {
1476
+ mainTable: {
1477
+ type: "object",
1478
+ additionalProperties: false,
1479
+ properties: {
1480
+ moduleType: { type: "string", description: "\u4E8B\u9879\u6A21\u5757\u6807\u8BC6\uFF1Acustomer=\u5BA2\u6237\u3001clue=\u7EBF\u7D22\u3001saleChance=\u5546\u673A" },
1481
+ entityId: { type: "string" }
1266
1482
  },
1267
- operation: this.name
1268
- });
1269
- if (Number(resp?.resultCode ?? 0) === 200) {
1270
- region[`administrativeDivision:${city}`] = resp;
1483
+ required: ["moduleType", "entityId"]
1271
1484
  }
1272
- } catch {
1273
- }
1485
+ },
1486
+ required: ["mainTable"]
1274
1487
  }
1275
- const cache = { discovery, ebuilder, options, region };
1276
- cache.region = { ...old.region || {}, ...cache.region || {} };
1277
- cache.options = { ...old.options || {}, ...cache.options || {} };
1278
- if (!cache.discovery[`spVersion:${APP_TAG}`] && old.discovery?.[`spVersion:${APP_TAG}`]) {
1279
- cache.discovery[`spVersion:${APP_TAG}`] = old.discovery[`spVersion:${APP_TAG}`];
1488
+ },
1489
+ {
1490
+ name: "jiuchuanhui.contact-records.by-person-time.list",
1491
+ risk: "read",
1492
+ fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "D01DD00978524525AD8728BE1BF9FE79" },
1493
+ inputSchema: {
1494
+ type: "object",
1495
+ additionalProperties: false,
1496
+ properties: { mainTable: esbWriteSchema(["employeeId", "startData", "endData"]) },
1497
+ required: ["mainTable"]
1280
1498
  }
1281
- const summary = {
1282
- dryRun,
1283
- cacheDir: baseDir,
1284
- mainFile,
1285
- namespaces: {
1286
- discovery: Object.keys(cache.discovery).length,
1287
- ebuilder: Object.keys(cache.ebuilder).length,
1288
- options: Object.keys(cache.options).length,
1289
- region: Object.keys(cache.region).length
1290
- },
1291
- configFiles: Object.keys(perPk).length,
1292
- objIdCount: Object.keys(discovery).filter((k) => k.startsWith("objId:")).length,
1293
- cfgIdCount: Object.keys(cfgMap).length,
1294
- version: cache.discovery[`spVersion:${APP_TAG}`] ?? null,
1295
- warnings: []
1296
- };
1297
- if (cache.discovery[`spVersion:${APP_TAG}`] && cache.discovery[`spVersion:${APP_TAG}`].passed === false) {
1298
- summary.warnings.push(`\u4E5D\u6C1A\u6C47\u8425\u9500\u7BA1\u7406\u5305\u7248\u672C\uFF08${cache.discovery[`spVersion:${APP_TAG}`].commitVersion}\uFF09\u4F4E\u4E8E ${MIN_VERSION}\uFF0C\u4E1A\u52A1\u8C03\u7528\u5E94\u505C\u6B62`);
1499
+ },
1500
+ // ==================== 通用辅助 ====================
1501
+ {
1502
+ name: "jiuchuanhui.entity.id.by-name",
1503
+ risk: "read",
1504
+ fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "7EC1639D5AC24B4DBCEE8D2CB85D4025" },
1505
+ inputSchema: {
1506
+ type: "object",
1507
+ additionalProperties: false,
1508
+ properties: { mainTable: esbWriteSchema(["moduleType", "name"]) },
1509
+ required: ["mainTable"]
1299
1510
  }
1300
- if (dryRun) return { status: "COMPLETE", data: { ...summary, written: false, note: "dry-run\uFF1A\u53EA\u62C9\u53D6\u672A\u5199\u5165" } };
1301
- mkdirSync(cfgDir, { recursive: true });
1302
- writeFileSync(mainFile, JSON.stringify(cache, null, 2), "utf-8");
1303
- for (const [pk, entry] of Object.entries(perPk)) {
1304
- const tag = PK_TO_TAG[pk];
1305
- const objId = cache.discovery[`objId:${tag}`];
1306
- writeFileSync(join(cfgDir, `${pk}.json`), JSON.stringify({ ...entry, objId: objId ?? "" }, null, 2), "utf-8");
1511
+ },
1512
+ {
1513
+ name: "jiuchuanhui.user.id.by-name",
1514
+ risk: "read",
1515
+ fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "911C17207E2C4BD29379B5A4001B246E" },
1516
+ inputSchema: {
1517
+ type: "object",
1518
+ additionalProperties: false,
1519
+ properties: { mainTable: esbWriteSchema(["employeeName"]) },
1520
+ required: ["mainTable"]
1307
1521
  }
1308
- if (verbose) {
1309
- summary.warnings.push(`${JSON.stringify({ step1: "discovery", step2: "cfgId", step3: "cfg.detail", step4: "ebuilder", step5: "options", step6: "searchParams", step7: "region" })}`);
1522
+ },
1523
+ {
1524
+ name: "jiuchuanhui.user.current-profile",
1525
+ risk: "read",
1526
+ fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "B8F7597190FF419FB9127D6C8272C4FE" },
1527
+ inputSchema: { type: "object", additionalProperties: false, properties: {} }
1528
+ },
1529
+ {
1530
+ name: "jiuchuanhui.entity.permission.judge",
1531
+ risk: "read",
1532
+ fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "6D369F0A84764051A5D7B5AA1245F49A" },
1533
+ inputSchema: {
1534
+ type: "object",
1535
+ additionalProperties: false,
1536
+ properties: { mainTable: esbWriteSchema(["moduleType", "entityId", "opType"]) },
1537
+ required: ["mainTable"]
1310
1538
  }
1311
- return {
1312
- status: "COMPLETE",
1313
- data: { ...summary, written: true }
1314
- };
1315
- }
1316
- };
1317
-
1318
- // src/shortcuts/jiuchuanhui/operations/shared.ts
1319
- var FORBIDDEN_INPUT_KEYS = /* @__PURE__ */ new Set([
1320
- "access_token",
1321
- "app_key",
1322
- "app_secret",
1323
- "cookie",
1324
- "eteamsid",
1325
- "token",
1326
- "sessionid"
1327
- ]);
1328
- var FORBIDDEN_NORMALIZED_KEYS = new Set([...FORBIDDEN_INPUT_KEYS].map((key) => key.toLowerCase()));
1329
- function asObject(value, name = "\u4E1A\u52A1\u8F93\u5165") {
1330
- if (!value || typeof value !== "object" || Array.isArray(value)) {
1331
- throw jiuchuanhuiValidationError("input_invalid", `${name}\u5FC5\u987B\u662F JSON \u5BF9\u8C61`);
1332
- }
1333
- return value;
1334
- }
1335
- function asNonEmptyString(value, name) {
1336
- if (typeof value !== "string" || !value.trim()) {
1337
- throw jiuchuanhuiValidationError("input_invalid", `${name} \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32`);
1338
- }
1339
- return value.trim();
1340
- }
1341
- function asPositiveString(value, name) {
1342
- if (typeof value !== "string" || !/^\d+$/u.test(value) || value === "0") {
1343
- throw jiuchuanhuiValidationError("input_invalid", `${name} \u5FC5\u987B\u662F\u6B63\u6574\u6570\u6587\u672C`);
1344
- }
1345
- return value;
1346
- }
1347
- function assertNoForbiddenKeys(value, location = "input") {
1348
- if (!value || typeof value !== "object") return;
1349
- if (Array.isArray(value)) {
1350
- value.forEach((item, index) => assertNoForbiddenKeys(item, `${location}[${index}]`));
1351
- return;
1352
- }
1353
- for (const [key, child] of Object.entries(value)) {
1354
- if (FORBIDDEN_INPUT_KEYS.has(key) || FORBIDDEN_NORMALIZED_KEYS.has(key.toLowerCase())) {
1355
- throw jiuchuanhuiValidationError("field_forbidden", `\u7981\u6B62\u4E1A\u52A1\u8F93\u5165\u5B57\u6BB5\uFF1A${location}.${key}`);
1539
+ },
1540
+ {
1541
+ name: "jiuchuanhui.company.business-profile.query",
1542
+ risk: "read",
1543
+ fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "BAB4DBE204214BB395BA161620A4A1CD" },
1544
+ inputSchema: {
1545
+ type: "object",
1546
+ additionalProperties: false,
1547
+ properties: { mainTable: esbWriteSchema(["companyName"]) },
1548
+ required: ["mainTable"]
1356
1549
  }
1357
- assertNoForbiddenKeys(child, `${location}.${key}`);
1358
- }
1359
- }
1360
- function sessionMatches(lease, session) {
1361
- return lease.baseUrl === session.baseUrl && lease.profile === session.profile && lease.userId === session.userId;
1362
- }
1363
- function workflow(name, state) {
1364
- return { workflow: name, version: 1, state };
1365
- }
1366
- function esbBody(mainTable, uniqueIndent, userId) {
1367
- return {
1368
- customParams: { mainTable },
1369
- uniqueIndent,
1370
- employeeId: userId
1371
- };
1372
- }
1373
- function datasBody(form, userId) {
1374
- const datas = Array.isArray(form.datas) ? form.datas : [form];
1375
- const cleansed = datas.map((item) => stripForbidden(item));
1376
- return {
1377
- datajson: {
1378
- datas: cleansed,
1379
- header: { operator: userId }
1550
+ },
1551
+ {
1552
+ name: "jiuchuanhui.field.info.by-ids",
1553
+ risk: "read",
1554
+ fixed: { path: "/api/esb/server/event/triggerActionFlow", uniqueIndent: "10351A4DC8D4454A9F1957FBE647CD9F" },
1555
+ inputSchema: {
1556
+ type: "object",
1557
+ additionalProperties: false,
1558
+ properties: { mainTable: esbWriteSchema(["fieldids"]) },
1559
+ required: ["mainTable"]
1380
1560
  }
1381
- };
1382
- }
1383
- function byIdBody(id, userId) {
1384
- return {
1385
- datajson: {
1386
- mainTable: { id },
1387
- header: { operator: userId }
1561
+ },
1562
+ {
1563
+ name: "jiuchuanhui.browser-option.search",
1564
+ risk: "read",
1565
+ fixed: { path: "/api/bcw/common/browser/complete/{customBrowserType}", method: "POST" },
1566
+ inputSchema: {
1567
+ type: "object",
1568
+ additionalProperties: false,
1569
+ properties: {
1570
+ pathParams: {
1571
+ type: "object",
1572
+ additionalProperties: false,
1573
+ properties: { customBrowserType: { type: "string" } },
1574
+ required: ["customBrowserType"]
1575
+ },
1576
+ params: {
1577
+ type: "object",
1578
+ additionalProperties: true,
1579
+ properties: { searchValue: { type: "string" } }
1580
+ }
1581
+ },
1582
+ required: ["pathParams"]
1388
1583
  }
1389
- };
1390
- }
1391
- function listBody(userId, pageNo, pageSize, mainTable) {
1392
- const mt = mainTable && Object.keys(mainTable).length ? { ...mainTable } : {};
1393
- return {
1394
- datajson: {
1395
- mainTable: mt,
1396
- pageInfo: { pageNo, pageSize },
1397
- header: { operator: userId }
1584
+ },
1585
+ {
1586
+ name: "jiuchuanhui.get-rest-cfg-detail",
1587
+ risk: "read",
1588
+ fixed: { path: "/api/bs/ebuilder/form/formdata/getRestCfgById", method: "GET" },
1589
+ inputSchema: {
1590
+ type: "object",
1591
+ additionalProperties: false,
1592
+ properties: {
1593
+ apid: { type: "string" },
1594
+ id: { type: "string" }
1595
+ },
1596
+ required: ["apid", "id"]
1398
1597
  }
1399
- };
1400
- }
1401
- function stripForbidden(value) {
1402
- if (Array.isArray(value)) return value.map(stripForbidden);
1403
- if (!value || typeof value !== "object") return value;
1404
- const result = {};
1405
- for (const [key, child] of Object.entries(value)) {
1406
- if (FORBIDDEN_INPUT_KEYS.has(key) || FORBIDDEN_NORMALIZED_KEYS.has(key.toLowerCase())) continue;
1407
- result[key] = stripForbidden(child);
1408
1598
  }
1409
- return result;
1410
- }
1411
- function stripForbiddenKeys(value) {
1412
- return stripForbidden(value);
1413
- }
1414
- function listRecords(value) {
1415
- if (!value || typeof value !== "object") return [];
1416
- const root = value;
1417
- const datas = root.datajson?.datas;
1418
- if (Array.isArray(datas)) return datas;
1419
- return [];
1420
- }
1421
- function resultDataIds(value) {
1422
- if (!value || typeof value !== "object") return [];
1423
- const ids = value.datajson?.dataIds;
1424
- if (Array.isArray(ids)) return ids.map((item) => String(item));
1425
- return [];
1426
- }
1427
- function esbOutcome(value) {
1428
- if (!value || typeof value !== "object") return { resultCode: 0, resultMsg: "" };
1429
- const root = value;
1430
- return {
1431
- resultCode: Number(root.resultCode ?? 0),
1432
- resultMsg: typeof root.resultMsg === "string" ? root.resultMsg : ""
1433
- };
1434
- }
1435
- function pagingFrom(input) {
1436
- const pageNo = Number.isInteger(input.pageNo) && input.pageNo >= 1 ? input.pageNo : 1;
1437
- const pageSize = Number.isInteger(input.pageSize) && input.pageSize >= 1 ? input.pageSize : 10;
1438
- return { pageNo, pageSize };
1599
+ ];
1600
+ var jiuchuanhuiManifest = {
1601
+ schemaVersion: 1,
1602
+ name: "jiuchuanhui",
1603
+ title: "\u6CDB\u5FAEE10\u4E5D\u6C1A\u6C47\u8425\u9500\u7BA1\u7406\uFF08\u5BA2\u6237/\u8054\u7CFB\u4EBA/\u5546\u673A/\u7EBF\u7D22/\u8054\u7CFB\u8BA1\u5212/\u516C\u6D77\uFF09",
1604
+ version: "0.1.0",
1605
+ host: "e10-jiuchuanhui",
1606
+ status: "builtin",
1607
+ sourceSkill: "weaver-e10-jiuchuanhui",
1608
+ operations: withSummaries(jiuchuanhuiOperations),
1609
+ withheldOperations: [
1610
+ {
1611
+ name: "jiuchuanhui.sale.stage-advance",
1612
+ reason: "\u5546\u673A\u63A8\u8FDB\u9500\u552E\u9636\u6BB5\u4F9D\u8D56\u7F13\u5B58\u4E2D\u7684 sale_stage \u914D\u7F6E\u505A\u9636\u6BB5 ID \u6620\u5C04\u4E0E\u524D\u7F6E\u6821\u9A8C\uFF0C\u5C5E\u4E8E Skill \u7F16\u6392\u5C42\u804C\u8D23\uFF1BCLI \u66B4\u9732\u7684 sale.update \u4E0E sale.stage.search \u5DF2\u8986\u76D6\u57FA\u7840\u80FD\u529B\uFF0C\u9636\u6BB5\u63A8\u8FDB\u7684\u7EC4\u5408\u903B\u8F91\u4E0D\u5728 CLI \u786C\u7F16\u7801\u3002"
1613
+ }
1614
+ ]
1615
+ };
1616
+ function getJiuchuanhuiOperationContract(operation) {
1617
+ return jiuchuanhuiManifest.operations.find((item) => item.name === operation);
1439
1618
  }
1440
1619
 
1441
1620
  // src/shortcuts/jiuchuanhui/operations/datajson.ts
@@ -1536,20 +1715,12 @@ var DatajsonDetailOperation = class {
1536
1715
  async execute(input, { host }) {
1537
1716
  const id = asPositiveString(String(input.id ?? input.dataId), "id");
1538
1717
  const session = await host.getSession();
1539
- const result = await host.request({
1718
+ const response = await host.query({
1540
1719
  path: this.path,
1541
1720
  body: byIdBody(id, session.userId),
1542
1721
  operation: this.name
1543
1722
  });
1544
- return {
1545
- status: "COMPLETE",
1546
- data: {
1547
- id,
1548
- ...result && typeof result === "object" ? { raw: result } : {},
1549
- mainTable: extractMainTable(result),
1550
- detail: result
1551
- }
1552
- };
1723
+ return { response };
1553
1724
  }
1554
1725
  };
1555
1726
  var DatajsonSearchOperation = class {
@@ -1566,22 +1737,13 @@ var DatajsonSearchOperation = class {
1566
1737
  const session = await host.getSession();
1567
1738
  const query = buildSearchQuery(input, pageNo, pageSize);
1568
1739
  const main = listBody(session.userId, pageNo, pageSize, {});
1569
- const listPromise = host.request({ path: this.path, query, body: main, operation: this.name });
1570
- const countPromise = input.count === true && this.countPath ? host.request({ path: this.countPath, query: withoutPaging(query), body: listBody(session.userId, 1, 1, {}), operation: `${this.name}.count` }) : void 0;
1571
- const [listResult, countResult] = countPromise ? await Promise.all([listPromise, countPromise]) : [await listPromise, void 0];
1572
- const records = listRecords(listResult);
1573
- const total = extractCount(countResult);
1574
- return {
1575
- status: "COMPLETE",
1576
- data: {
1577
- items: records,
1578
- total,
1579
- pageNo,
1580
- pageSize,
1581
- hasMore: total === void 0 ? records.length >= pageSize : pageNo * pageSize < total,
1582
- query
1583
- }
1584
- };
1740
+ const listPromise = host.query({ path: this.path, query, body: main, operation: this.name });
1741
+ if (input.count !== true || !this.countPath) return { response: await listPromise };
1742
+ const [response, countResponse] = await Promise.all([
1743
+ listPromise,
1744
+ host.query({ path: this.countPath, query: withoutPaging(query), body: listBody(session.userId, 1, 1, {}), operation: `${this.name}.count` })
1745
+ ]);
1746
+ return { response, countResponse };
1585
1747
  }
1586
1748
  };
1587
1749
  function buildSearchQuery(input, pageNo, pageSize) {
@@ -1606,27 +1768,6 @@ function withoutPaging(query) {
1606
1768
  delete next.pageSize;
1607
1769
  return next;
1608
1770
  }
1609
- function extractCount(value) {
1610
- if (!value || typeof value !== "object") return void 0;
1611
- const root = value;
1612
- const datas = root.datajson?.datas;
1613
- const raw = Array.isArray(datas) ? datas[0] : datas;
1614
- const num = Number(raw ?? root.total ?? root.count);
1615
- return Number.isFinite(num) ? num : void 0;
1616
- }
1617
- function extractMainTable(value) {
1618
- if (!value || typeof value !== "object") return void 0;
1619
- const root = value;
1620
- const mt = root.datajson?.mainTable;
1621
- if (mt && typeof mt === "object" && !Array.isArray(mt)) return mt;
1622
- const datas = root.datajson?.datas;
1623
- if (Array.isArray(datas) && datas[0] && typeof datas[0] === "object") {
1624
- const first = datas[0];
1625
- if (first.mainTable && typeof first.mainTable === "object") return first.mainTable;
1626
- return first;
1627
- }
1628
- return void 0;
1629
- }
1630
1771
 
1631
1772
  // src/shortcuts/jiuchuanhui/operations/esb.ts
1632
1773
  var EsbWritePrepareOperation = class {
@@ -1642,6 +1783,11 @@ var EsbWritePrepareOperation = class {
1642
1783
  mainTableKeys;
1643
1784
  async execute(input, { host, continuation }) {
1644
1785
  const mainTable = normalizeMainTable(input.mainTable, this.mainTableKeys);
1786
+ const properties = getJiuchuanhuiOperationContract(this.name)?.inputSchema.properties;
1787
+ const missing = properties?.mainTable?.required?.filter((key) => !Object.hasOwn(mainTable, key) || mainTable[key] === void 0 || mainTable[key] === null || mainTable[key] === "");
1788
+ if (missing?.length) {
1789
+ throw jiuchuanhuiValidationError("field_required", `\u7F3A\u5C11\u5FC5\u586B\u53C2\u6570\uFF1A${missing.join("\u3001")}`, { fields: missing });
1790
+ }
1645
1791
  const preview = summaryOf(mainTable);
1646
1792
  const session = await host.getSession();
1647
1793
  const continuationToken = await continuation.issue({
@@ -1732,26 +1878,12 @@ var EsbReadOperation = class {
1732
1878
  async execute(input, { host }) {
1733
1879
  const mainTable = normalizeMainTable(input.mainTable ?? input, this.mainTableKeys);
1734
1880
  const session = await host.getSession();
1735
- const result = await host.request({
1881
+ const response = await host.query({
1736
1882
  path: "/api/esb/server/event/triggerActionFlow",
1737
1883
  body: esbBody(mainTable, this.uniqueIndent, session.userId),
1738
1884
  operation: this.name
1739
1885
  });
1740
- const { resultCode, resultMsg } = esbOutcome(result);
1741
- if (resultCode !== 200) {
1742
- throw jiuchuanhuiValidationError("esb_read_failed", `\u52A8\u4F5C\u6D41\u67E5\u8BE2\u5931\u8D25\uFF08resultCode=${resultCode}\uFF09\uFF1A${resultMsg}`);
1743
- }
1744
- const customData = result?.actionData?.responseData?.customData;
1745
- return {
1746
- status: "COMPLETE",
1747
- data: {
1748
- resultCode,
1749
- resultMsg,
1750
- ...customData && typeof customData === "object" ? { customData } : {},
1751
- mainTable: customData?.mainTable,
1752
- raw: result
1753
- }
1754
- };
1886
+ return { response };
1755
1887
  }
1756
1888
  };
1757
1889
  function normalizeMainTable(raw, allowedKeys) {
@@ -1794,19 +1926,13 @@ var GetQueryOperation = class {
1794
1926
  if (value === void 0 || value === null || key === "save") continue;
1795
1927
  query[key] = Array.isArray(value) ? value.join(",") : value;
1796
1928
  }
1797
- const result = await host.request({
1929
+ const response = await host.query({
1798
1930
  method: "GET",
1799
1931
  path: this.path,
1800
1932
  query,
1801
1933
  operation: this.name
1802
1934
  });
1803
- return {
1804
- status: "COMPLETE",
1805
- data: {
1806
- ...result && typeof result === "object" ? { raw: result } : { raw: result },
1807
- query
1808
- }
1809
- };
1935
+ return { response };
1810
1936
  }
1811
1937
  };
1812
1938
  var PathParamsPostOperation = class {
@@ -1828,17 +1954,12 @@ var PathParamsPostOperation = class {
1828
1954
  path = path.replace(`{${name}}`, encodeURIComponent(String(value)));
1829
1955
  }
1830
1956
  const body = input.params && typeof input.params === "object" ? input.params : {};
1831
- const result = await host.request({
1957
+ const response = await host.query({
1832
1958
  path,
1833
1959
  body,
1834
1960
  operation: this.name
1835
1961
  });
1836
- return {
1837
- status: "COMPLETE",
1838
- data: {
1839
- ...result && typeof result === "object" ? { raw: result } : { raw: result }
1840
- }
1841
- };
1962
+ return { response };
1842
1963
  }
1843
1964
  };
1844
1965
  var FilePreviewOperation = class {
@@ -1857,25 +1978,21 @@ var FilePreviewOperation = class {
1857
1978
  if (input.fieldId !== void 0) query.fieldId = input.fieldId;
1858
1979
  if (input.appId !== void 0) query.appId = input.appId;
1859
1980
  if (input.customParam !== void 0) query.customParam = typeof input.customParam === "string" ? input.customParam : JSON.stringify(input.customParam);
1860
- const result = await host.request({
1981
+ const response = await host.query({
1861
1982
  method: "GET",
1862
1983
  path: "/api/file/preview",
1863
1984
  query,
1864
1985
  operation: this.name
1865
1986
  });
1866
- return {
1867
- status: "COMPLETE",
1868
- data: {
1869
- ...result && typeof result === "object" ? { raw: result } : { raw: result },
1870
- fileId
1871
- }
1872
- };
1987
+ return { response };
1873
1988
  }
1874
1989
  };
1875
1990
 
1876
1991
  // src/shortcuts/jiuchuanhui/operations/registry.ts
1877
1992
  function buildRegistry() {
1878
1993
  const registry = /* @__PURE__ */ new Map();
1994
+ const customerSearch = new DatajsonSearchOperation("jiuchuanhui.customer.search", "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_search_api", "/api/ebuilder/form/formdata/v2/getFormDataCount/ebcustomer_search_count_api");
1995
+ const customerStatusSearch = new DatajsonSearchOperation("jiuchuanhui.customer.status.search", "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_status_search_api");
1879
1996
  const handlers = [
1880
1997
  // ===== 发现与缓存 =====
1881
1998
  new CacheInitOperation(),
@@ -1889,9 +2006,12 @@ function buildRegistry() {
1889
2006
  new DatajsonWritePrepareOperation("jiuchuanhui.customer.create.prepare", "jiuchuanhui.customer.create.apply"),
1890
2007
  new DatajsonWriteApplyOperation("jiuchuanhui.customer.create.apply", "/api/ebuilder/form/formdata/v2/saveFormData/customer_create_api"),
1891
2008
  new DatajsonDetailOperation("jiuchuanhui.customer.get", "/api/ebuilder/form/formdata/v2/getFormDataByPk/customer_get_api"),
1892
- new DatajsonSearchOperation("jiuchuanhui.customer.search", "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_search_api", "/api/ebuilder/form/formdata/v2/getFormDataCount/ebcustomer_search_count_api"),
2009
+ customerSearch,
2010
+ new CustomerQuickSearchOperation("jiuchuanhui.customer.mine.search", customerSearch, "mine"),
2011
+ new CustomerQuickSearchOperation("jiuchuanhui.customer.success.search", customerSearch, "mine", customerStatusSearch),
2012
+ new CustomerQuickSearchOperation("jiuchuanhui.customer.open-sea.customers.search", customerSearch, "open-sea"),
1893
2013
  new DatajsonSearchOperation("jiuchuanhui.customer.type.search", "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_type_search_api"),
1894
- new DatajsonSearchOperation("jiuchuanhui.customer.status.search", "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_status_search_api"),
2014
+ customerStatusSearch,
1895
2015
  new DatajsonSearchOperation("jiuchuanhui.customer.industry.search", "/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_industry_search_api"),
1896
2016
  new DatajsonSearchOperation("jiuchuanhui.customer.open-sea.search", "/api/ebuilder/form/formdata/v2/getFormDataList/customer_open_sea_search_api"),
1897
2017
  new DatajsonWritePrepareOperation("jiuchuanhui.customer.update.prepare", "jiuchuanhui.customer.update.apply"),
@@ -2028,7 +2148,7 @@ async function inputFrom(options, extra = {}) {
2028
2148
  if (opts.input) {
2029
2149
  let raw;
2030
2150
  try {
2031
- raw = stripBom(opts.input === "-" ? await readStdin() : await readFile2(String(opts.input), "utf8"));
2151
+ raw = stripBom(opts.input === "-" ? await readStdin() : await readFile3(String(opts.input), "utf8"));
2032
2152
  } catch {
2033
2153
  throw jiuchuanhuiValidationError("input_unreadable", `\u65E0\u6CD5\u8BFB\u53D6 --input\uFF1A${String(opts.input)}`);
2034
2154
  }
@@ -2069,16 +2189,41 @@ function failureEnvelope(error) {
2069
2189
  error: toErrorEnvelope(error)
2070
2190
  };
2071
2191
  }
2192
+ function queryEnvelope(operation, { response, countResponse }) {
2193
+ const envelope = JSON.stringify({
2194
+ schemaVersion: 1,
2195
+ ok: true,
2196
+ operation,
2197
+ meta: {
2198
+ status: "COMPLETE",
2199
+ httpStatus: response.httpStatus,
2200
+ ...countResponse ? { countHttpStatus: countResponse.httpStatus } : {}
2201
+ },
2202
+ warnings: []
2203
+ });
2204
+ const count = countResponse ? `,"countResponse":${countResponse.json}` : "";
2205
+ return `${envelope.slice(0, -1)},"data":${response.json}${count}}`;
2206
+ }
2072
2207
  async function executeAndPrint(ctx, operation, input) {
2073
2208
  try {
2074
2209
  const result = await executeJiuchuanhuiOperation(operation, input, {
2075
2210
  host: createJiuchuanhuiHost(ctx),
2076
2211
  continuation: createJiuchuanhuiContinuationSigner(ctx)
2077
2212
  });
2078
- ctx.output.write(successEnvelope(operation, result), { json: true });
2213
+ if ("response" in result) {
2214
+ ctx.output.raw(queryEnvelope(operation, result));
2215
+ } else {
2216
+ ctx.output.write(successEnvelope(operation, result), { json: true });
2217
+ }
2079
2218
  } catch (error) {
2080
- reportPlatformError(error);
2081
- console.error(JSON.stringify(failureEnvelope(error), null, 2));
2219
+ const envelope = failureEnvelope(error);
2220
+ if (ctx.getGlobalOptions().json) {
2221
+ const platformError = shouldReportPlatformError(error) ? toPlatformError(error) : {};
2222
+ console.error(JSON.stringify({ ...envelope, ...platformError }));
2223
+ } else {
2224
+ reportPlatformError(error);
2225
+ console.error(JSON.stringify(envelope, null, 2));
2226
+ }
2082
2227
  process.exitCode = isCliError(error) ? error.exitCode : 1 /* GeneralError */;
2083
2228
  }
2084
2229
  }
@@ -2088,8 +2233,22 @@ var jiuchuanhuiShortcut = {
2088
2233
  category: "shortcut",
2089
2234
  register({ program, action }) {
2090
2235
  const jiuchuanhui = program.command("jiuchuanhui").description("\u6CDB\u5FAEE10\u4E5D\u6C1A\u6C47\u8425\u9500\u7BA1\u7406");
2091
- jiuchuanhui.command("schema").description("Print jiuchuanhui operation manifest for agents").action(action((ctx) => {
2092
- ctx.output.write(jiuchuanhuiManifest, { json: true });
2236
+ jiuchuanhui.command("schema").description("Print jiuchuanhui operation manifest for agents").option("--list", '\u53EA\u5217\u64CD\u4F5C\u6E05\u5355\uFF08name/summary/risk\uFF09\uFF0C\u5168\u91CF\u4E0D\u622A\u65AD\uFF1B\u5224\u65AD"\u6709\u6CA1\u6709\u67D0\u64CD\u4F5C"\u7528\u8FD9\u4E2A').option("--full", "\u6253\u5370\u5B8C\u6574 manifest\uFF08\u8D85 stdout \u9884\u7B97\u4F1A\u843D\u672C\u5730 ref\uFF0C\u7528 refs get \u5206\u9875\u53D6\uFF09").option("--operation <name>", "print the contract for one operation").action(action((ctx, options) => {
2237
+ const { operation, list } = asOptions(options);
2238
+ if (operation === void 0) {
2239
+ if (list === true) {
2240
+ ctx.output.write(manifestView(jiuchuanhuiManifest, { list: true }), {
2241
+ json: true,
2242
+ compactPaths: MANIFEST_LIST_COMPACT_PATHS
2243
+ });
2244
+ return;
2245
+ }
2246
+ ctx.output.write(jiuchuanhuiManifest, { json: true });
2247
+ return;
2248
+ }
2249
+ const contract = getJiuchuanhuiOperationContract(operation);
2250
+ if (!contract) throw jiuchuanhuiValidationError("operation_unknown", `\u4E5D\u6C1A\u6C47\u4E0D\u652F\u6301\u64CD\u4F5C\uFF1A${operation}`);
2251
+ ctx.output.write(contract, { json: true });
2093
2252
  }));
2094
2253
  jiuchuanhui.command("run").description("Run a jiuchuanhui operation with JSON input").argument("<operation>", "operation name, e.g. jiuchuanhui.customer.search").option("--input <path>", "JSON input file, or - for stdin").option("--input-json <json>", "inline JSON input object").action(action(async (ctx, operation, options) => {
2095
2254
  await executeAndPrint(ctx, String(operation), await inputFrom(options));
@@ -2098,5 +2257,6 @@ var jiuchuanhuiShortcut = {
2098
2257
  };
2099
2258
  export {
2100
2259
  inputFrom,
2101
- jiuchuanhuiShortcut
2260
+ jiuchuanhuiShortcut,
2261
+ queryEnvelope
2102
2262
  };