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
@@ -1,6 +1,7 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
3
3
  import { reportPlatformError } from '../../core/error-codes.js';
4
+ import { MANIFEST_LIST_COMPACT_PATHS, manifestView, schemaOptionsOf } from '../../core/manifest-view.js';
4
5
  import { createEsbContinuationSigner } from './continuation.js';
5
6
  import { createEsbHost } from './host.js';
6
7
  import { esbManifest } from './manifest.js';
@@ -99,8 +100,16 @@ export const esbShortcut = {
99
100
  const esb = program.command('esb').description('泛微E10 ESB 中心自定义触发动作流(取入参模板 / 确认后触发)');
100
101
  esb.command('schema')
101
102
  .description('Print esb operation manifest for agents')
102
- .action(action((ctx) => {
103
- ctx.output.write(esbManifest, { json: true });
103
+ .option('--list', '只列操作清单(name/summary/risk),全量不截断;判断"有没有某操作"用这个')
104
+ .option('--full', '打印完整 manifest(超 stdout 预算会落本地 ref,用 refs get 分页取)')
105
+ .option('--operation <name>', '只输出单个操作的完整契约(含 inputSchema,体积远低于预算)')
106
+ .action(action((ctx, options) => {
107
+ const schema = schemaOptionsOf(options);
108
+ ctx.output.write(manifestView(esbManifest, schema), {
109
+ json: true,
110
+ // 只有 --list 单行化:条目多、缩进空白能吃掉近一半体积,且对读模型无收益。
111
+ ...(schema.list === true ? { compactPaths: MANIFEST_LIST_COMPACT_PATHS } : {}),
112
+ });
104
113
  }));
105
114
  esb.command('run')
106
115
  .description('Run an esb operation with JSON input')
@@ -43,6 +43,7 @@ export const esbOperations = [
43
43
  name: 'esb.trigger.prepare',
44
44
  summary: '触发前的只读回查与请求体组装,签发 apply 所需的 continuation(不产生业务副作用)',
45
45
  risk: 'read-before-write',
46
+ requiresConfirmation: true,
46
47
  inputSchema: {
47
48
  type: 'object',
48
49
  additionalProperties: false,
@@ -55,6 +56,7 @@ export const esbOperations = [
55
56
  name: 'esb.trigger.apply',
56
57
  summary: '按 continuation 执行动作流触发(高风险写操作,可能产生业务副作用)',
57
58
  risk: 'high-risk-write',
59
+ requiresConfirmation: true,
58
60
  inputSchema: {
59
61
  type: 'object',
60
62
  additionalProperties: false,
@@ -1,6 +1,7 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
3
3
  import { reportPlatformError } from '../../core/error-codes.js';
4
+ import { MANIFEST_LIST_COMPACT_PATHS, manifestView, schemaOptionsOf } from '../../core/manifest-view.js';
4
5
  import { createFnaContinuationSigner } from './continuation.js';
5
6
  import { createFnaHost } from './host.js';
6
7
  import { fnaManifest } from './manifest.js';
@@ -98,8 +99,16 @@ export const fnaShortcut = {
98
99
  const fna = program.command('fna').description('泛微E10齐业成费控中心(预算查询/费用中心/借款管理/发票核销)');
99
100
  fna.command('schema')
100
101
  .description('Print fna operation manifest for agents')
101
- .action(action((ctx) => {
102
- ctx.output.write(fnaManifest, { json: true });
102
+ .option('--list', '只列操作清单(name/summary/risk),全量不截断;判断"有没有某操作"用这个')
103
+ .option('--full', '打印完整 manifest(超 stdout 预算会落本地 ref,用 refs get 分页取)')
104
+ .option('--operation <name>', '只输出单个操作的完整契约(含 inputSchema,体积远低于预算)')
105
+ .action(action((ctx, options) => {
106
+ const schema = schemaOptionsOf(options);
107
+ ctx.output.write(manifestView(fnaManifest, schema), {
108
+ json: true,
109
+ // 只有 --list 单行化:条目多、缩进空白能吃掉近一半体积,且对读模型无收益。
110
+ ...(schema.list === true ? { compactPaths: MANIFEST_LIST_COMPACT_PATHS } : {}),
111
+ });
103
112
  }));
104
113
  fna.command('run')
105
114
  .description('Run an fna operation with JSON input')
@@ -1,6 +1,7 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
3
3
  import { reportPlatformError } from '../../core/error-codes.js';
4
+ import { manifestView } from '../../core/manifest-view.js';
4
5
  import { createHrmHost } from './host.js';
5
6
  import { hrmManifest } from './manifest.js';
6
7
  import { executeHrmOperation } from './operations.js';
@@ -143,9 +144,18 @@ export const hrmShortcut = {
143
144
  const hrm = program.command('hrm').description('泛微E10组织管理(员工查询/组织架构/岗位查询)');
144
145
  hrm.command('schema')
145
146
  .description('Print hrm operation manifest for agents')
147
+ // `--list` 是本模块的默认行为(默认就输出精简索引),保留声明只为跨域统一。
148
+ .option('--list', '只列操作索引(name/summary/参数名/必填项),与默认输出一致,全量不截断')
149
+ .option('--operation <name>', '只输出单个操作的完整契约(含 inputSchema,体积远低于预算)')
146
150
  .option('--full', 'print full manifest with complete inputSchema')
147
151
  .action(action((ctx, options) => {
148
- if (asOptions(options).full === true) {
152
+ const opts = asOptions(options);
153
+ const requested = String(opts.operation ?? '').trim();
154
+ if (requested) {
155
+ ctx.output.write(manifestView(hrmManifest, { operation: requested }), { json: true });
156
+ return;
157
+ }
158
+ if (opts.full === true) {
149
159
  ctx.output.write(hrmManifest, { json: true });
150
160
  return;
151
161
  }
@@ -1,5 +1,6 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
3
+ import { MANIFEST_LIST_COMPACT_PATHS, manifestView, schemaOptionsOf } from '../../core/manifest-view.js';
3
4
  import { createImContinuationSigner } from './continuation.js';
4
5
  import { printImFailure, registerImTrace } from './diagnostics.js';
5
6
  import { imValidationError } from './errors.js';
@@ -238,8 +239,16 @@ export const imShortcut = {
238
239
  .option('--trace', '每个 E10 请求在 stderr 打一行 [trace](method/path/op/status/耗时,不含凭证)');
239
240
  im.command('schema')
240
241
  .description('Print im operation manifest for agents')
241
- .action(action((ctx) => {
242
- ctx.output.write(imManifest, { json: true });
242
+ .option('--list', '只列操作清单(name/summary/risk),全量不截断;判断"有没有某操作"用这个')
243
+ .option('--full', '打印完整 manifest(超 stdout 预算会落本地 ref,用 refs get 分页取)')
244
+ .option('--operation <name>', '只输出单个操作的完整契约(含 inputSchema,体积远低于预算)')
245
+ .action(action((ctx, options) => {
246
+ const schema = schemaOptionsOf(options);
247
+ ctx.output.write(manifestView(imManifest, schema), {
248
+ json: true,
249
+ // 只有 --list 单行化:条目多、缩进空白能吃掉近一半体积,且对读模型无收益。
250
+ ...(schema.list === true ? { compactPaths: MANIFEST_LIST_COMPACT_PATHS } : {}),
251
+ });
243
252
  }));
244
253
  withJsonInputOptions(im.command('run')
245
254
  .description('Run an im operation with JSON input')
@@ -2,6 +2,7 @@ import { readFile } from 'node:fs/promises';
2
2
  import { Option } from 'commander';
3
3
  import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
4
4
  import { reportPlatformError } from '../../core/error-codes.js';
5
+ import { MANIFEST_LIST_COMPACT_PATHS, manifestView, schemaOptionsOf } from '../../core/manifest-view.js';
5
6
  import { createInvoiceContinuationSigner } from './continuation.js';
6
7
  import { createInvoiceHost } from './host.js';
7
8
  import { invoiceManifest } from './manifest.js';
@@ -145,8 +146,16 @@ export const invoiceShortcut = {
145
146
  const invoice = program.command('invoice').description('E10 业票通发票管理');
146
147
  invoice.command('schema')
147
148
  .description('Print invoice operation manifest for agents')
148
- .action(action((ctx) => {
149
- ctx.output.write(invoiceManifest, { json: true });
149
+ .option('--list', '只列操作清单(name/summary/risk),全量不截断;判断"有没有某操作"用这个')
150
+ .option('--full', '打印完整 manifest(超 stdout 预算会落本地 ref,用 refs get 分页取)')
151
+ .option('--operation <name>', '只输出单个操作的完整契约(含 inputSchema,体积远低于预算)')
152
+ .action(action((ctx, options) => {
153
+ const schema = schemaOptionsOf(options);
154
+ ctx.output.write(manifestView(invoiceManifest, schema), {
155
+ json: true,
156
+ // 只有 --list 单行化:条目多、缩进空白能吃掉近一半体积,且对读模型无收益。
157
+ ...(schema.list === true ? { compactPaths: MANIFEST_LIST_COMPACT_PATHS } : {}),
158
+ });
150
159
  }));
151
160
  withInvoiceOptions(invoice.command('run')
152
161
  .description('Run an invoice operation with JSON input')
@@ -687,6 +687,7 @@ export const invoiceOperations = [
687
687
  {
688
688
  name: 'invoice.import.prepare',
689
689
  risk: 'read-before-write',
690
+ requiresConfirmation: true,
690
691
  inputSchema: {
691
692
  type: 'object',
692
693
  additionalProperties: false,
@@ -713,6 +714,7 @@ export const invoiceOperations = [
713
714
  {
714
715
  name: 'invoice.import.apply',
715
716
  risk: 'high-risk-write',
717
+ requiresConfirmation: true,
716
718
  inputSchema: {
717
719
  type: 'object',
718
720
  additionalProperties: false,
@@ -735,6 +737,7 @@ export const invoiceOperations = [
735
737
  {
736
738
  name: 'invoice.add.prepare',
737
739
  risk: 'read-before-write',
740
+ requiresConfirmation: true,
738
741
  inputSchema: {
739
742
  type: 'object',
740
743
  additionalProperties: false,
@@ -749,6 +752,7 @@ export const invoiceOperations = [
749
752
  {
750
753
  name: 'invoice.add.apply',
751
754
  risk: 'high-risk-write',
755
+ requiresConfirmation: true,
752
756
  inputSchema: {
753
757
  type: 'object',
754
758
  additionalProperties: false,
@@ -764,6 +768,7 @@ export const invoiceOperations = [
764
768
  {
765
769
  name: 'invoice.update.prepare',
766
770
  risk: 'read-before-write',
771
+ requiresConfirmation: true,
767
772
  inputSchema: {
768
773
  type: 'object',
769
774
  additionalProperties: false,
@@ -798,6 +803,7 @@ export const invoiceOperations = [
798
803
  {
799
804
  name: 'invoice.update.apply',
800
805
  risk: 'high-risk-write',
806
+ requiresConfirmation: true,
801
807
  inputSchema: {
802
808
  type: 'object',
803
809
  additionalProperties: false,
@@ -827,6 +833,7 @@ export const invoiceOperations = [
827
833
  {
828
834
  name: 'invoice.delete.prepare',
829
835
  risk: 'read-before-write',
836
+ requiresConfirmation: true,
830
837
  inputSchema: {
831
838
  type: 'object',
832
839
  additionalProperties: false,
@@ -841,6 +848,7 @@ export const invoiceOperations = [
841
848
  {
842
849
  name: 'invoice.delete.apply',
843
850
  risk: 'high-risk-write',
851
+ requiresConfirmation: true,
844
852
  inputSchema: {
845
853
  type: 'object',
846
854
  additionalProperties: false,
@@ -13,10 +13,15 @@
13
13
  */
14
14
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
15
15
  import { homedir } from 'node:os';
16
- import { join } from 'node:path';
16
+ import { dirname, join } from 'node:path';
17
17
  import { jiuchuanhuiValidationError } from './errors.js';
18
18
  const APP_TAG = 'jch-crm-project';
19
19
  const MIN_VERSION = '1.5.11';
20
+ const REGION_CONCURRENCY = 4;
21
+ export function jiuchuanhuiCacheFile(tenantKey, userId) {
22
+ const root = process.env.WEAVER_E10_JIUCHUANHUI_HOME || join(homedir(), '.weaver-e10-jiuchuanhui');
23
+ return join(root, tenantKey, userId, 'weaver-e10-jiuchuanhui.json');
24
+ }
20
25
  const MODULE_TAGS = [
21
26
  'uf_jch_customer', 'uf_jch_sale', 'uf_jch_clue', 'uf_jch_contact',
22
27
  'uf_jch_customer_open_sea', 'uf_jch_remind', 'uf_jch_rival',
@@ -79,6 +84,17 @@ function semverGte(a, b) {
79
84
  }
80
85
  return true;
81
86
  }
87
+ function searchConditionRows(value) {
88
+ if (typeof value === 'string') {
89
+ try {
90
+ value = JSON.parse(value);
91
+ }
92
+ catch {
93
+ return undefined;
94
+ }
95
+ }
96
+ return Array.isArray(value?.datas) ? value.datas : undefined;
97
+ }
82
98
  function successCheck(value) {
83
99
  if (!value || typeof value !== 'object')
84
100
  return false;
@@ -107,8 +123,8 @@ export class CacheInitOperation {
107
123
  if (!tenantKey || !userId) {
108
124
  throw jiuchuanhuiValidationError('session_context_missing', '无法获取缓存隔离上下文:session 缺少 tenantKey/userId,请确认 E10 登录态');
109
125
  }
110
- const baseDir = join(process.env.WEAVER_E10_JIUCHUANHUI_HOME || join(homedir(), '.weaver-e10-jiuchuanhui'), tenantKey, String(userId));
111
- const mainFile = join(baseDir, 'weaver-e10-jiuchuanhui.json');
126
+ const mainFile = jiuchuanhuiCacheFile(tenantKey, String(userId));
127
+ const baseDir = dirname(mainFile);
112
128
  const cfgDir = join(baseDir, 'config');
113
129
  // 保留旧 region / options / spVersion
114
130
  let old = {};
@@ -180,6 +196,7 @@ export class CacheInitOperation {
180
196
  }
181
197
  // ── 步骤 3:创建/更新接口配置 + 字段 data_key 映射 ───────────────────
182
198
  const perPk = {};
199
+ const searchConditions = new Map();
183
200
  for (const pk of Object.keys(cfgMap)) {
184
201
  const cfgId = cfgMap[pk];
185
202
  const resp = await host.request({
@@ -189,6 +206,11 @@ export class CacheInitOperation {
189
206
  operation: this.name,
190
207
  });
191
208
  const detail = resp?.data ?? {};
209
+ if (SEARCH_PKS.includes(pk)) {
210
+ const rows = searchConditionRows(detail.conditions);
211
+ if (rows)
212
+ searchConditions.set(pk, rows);
213
+ }
192
214
  if (!detail?.id && !detail?.mainFields)
193
215
  continue;
194
216
  const allFields = [
@@ -328,24 +350,18 @@ export class CacheInitOperation {
328
350
  if (!cfgId)
329
351
  continue;
330
352
  try {
331
- const resp = await host.request({
332
- method: 'GET',
333
- path: '/api/bs/ebuilder/form/formdata/getRestCfgById',
334
- query: { apid: appId, id: cfgId },
335
- operation: this.name,
336
- });
337
- const cfgObj = resp?.data ?? {};
338
- let conditions = cfgObj.conditions;
339
- if (typeof conditions === 'string') {
340
- try {
341
- conditions = JSON.parse(conditions);
342
- }
343
- catch {
344
- conditions = null;
345
- }
353
+ let rows = searchConditions.get(pk);
354
+ if (!rows) {
355
+ const resp = await host.request({
356
+ method: 'GET',
357
+ path: '/api/bs/ebuilder/form/formdata/getRestCfgById',
358
+ query: { apid: appId, id: cfgId },
359
+ operation: this.name,
360
+ });
361
+ rows = searchConditionRows(resp?.data?.conditions);
346
362
  }
347
363
  const params = [];
348
- for (const d of conditions?.datas ?? []) {
364
+ for (const d of rows ?? []) {
349
365
  const value = d?.conditions?.value;
350
366
  if (typeof value === 'string') {
351
367
  const m = value.match(/\{([^}]+)\}/);
@@ -375,24 +391,22 @@ export class CacheInitOperation {
375
391
  }
376
392
  // ── 步骤 7:行政区划(按需预取 22 城;失败跳过,保留旧缓存 region)───
377
393
  const region = {};
378
- for (const city of REGION_CITIES) {
379
- try {
380
- const resp = await host.request({
381
- path: '/api/esb/server/event/triggerActionFlow',
382
- body: {
383
- customParams: { mainTable: { moduleType: 'administrativeDivision', name: city, fromType: 'agentSkill' } },
384
- uniqueIndent: '7EC1639D5AC24B4DBCEE8D2CB85D4025',
385
- employeeId: userId,
386
- },
387
- operation: this.name,
388
- });
389
- if (Number(resp?.resultCode ?? 0) === 200) {
390
- region[`administrativeDivision:${city}`] = resp;
394
+ for (let offset = 0; offset < REGION_CITIES.length; offset += REGION_CONCURRENCY) {
395
+ const cities = REGION_CITIES.slice(offset, offset + REGION_CONCURRENCY);
396
+ const results = await Promise.allSettled(cities.map(async (city) => host.request({
397
+ path: '/api/esb/server/event/triggerActionFlow',
398
+ body: {
399
+ customParams: { mainTable: { moduleType: 'administrativeDivision', name: city, fromType: 'agentSkill' } },
400
+ uniqueIndent: '7EC1639D5AC24B4DBCEE8D2CB85D4025',
401
+ employeeId: userId,
402
+ },
403
+ operation: this.name,
404
+ })));
405
+ for (const [index, result] of results.entries()) {
406
+ if (result.status === 'fulfilled' && Number(result.value?.resultCode) === 200) {
407
+ region[`administrativeDivision:${cities[index]}`] = result.value;
391
408
  }
392
409
  }
393
- catch {
394
- // 单城市失败跳过
395
- }
396
410
  }
397
411
  // ── 落盘 ───────────────────────────────────────────────────────────
398
412
  const cache = { discovery, ebuilder, options, region };
@@ -1,4 +1,5 @@
1
1
  import { charsOf, compactForStdout } from '../../core/output.js';
2
+ import { ExitCode } from '../../core/errors.js';
2
3
  import { E10_SESSION_EXPIRED_MESSAGE } from '../../internal/e10/auth/messages.js';
3
4
  import { requireE10Session } from '../../internal/e10/context.js';
4
5
  import { getActiveProfile } from '../../internal/e10/auth/session.js';
@@ -126,6 +127,14 @@ function failureDetails(value, code, message) {
126
127
  response: boundedResponse(value),
127
128
  };
128
129
  }
130
+ function claimPermissionMessage(value) {
131
+ const messages = [
132
+ value?.actionData?.responseData?.customData?.mainTable?.msg,
133
+ value?.responseData?.customData?.mainTable?.msg,
134
+ ];
135
+ return messages.find((message) => typeof message === 'string'
136
+ && /^您对当前客户无领取权限[,,]\s*无法领取[。.]?$/u.test(message.trim()))?.trim();
137
+ }
129
138
  export function assertJiuchuanhuiPath(requestPath) {
130
139
  if (typeof requestPath !== 'string' || !requestPath.startsWith('/') || requestPath.startsWith('//')) {
131
140
  throw jiuchuanhuiValidationError('path_invalid', '请求路径必须是相对绝对路径');
@@ -179,7 +188,7 @@ export function createJiuchuanhuiHost(ctx, dependencies = {}) {
179
188
  fetch: dependencies.fetch,
180
189
  });
181
190
  }
182
- async function request(request) {
191
+ async function send(request) {
183
192
  const { method, path, query, body, operation, timeoutMs = 30_000, } = request;
184
193
  assertJiuchuanhuiPath(path);
185
194
  const resolvedMethod = method || 'POST';
@@ -201,20 +210,44 @@ export function createJiuchuanhuiHost(ctx, dependencies = {}) {
201
210
  if (isE10SessionExpiredResponse(response)) {
202
211
  throw jiuchuanhuiAuthError('session_expired', E10_SESSION_EXPIRED_MESSAGE, { httpStatus: response.status });
203
212
  }
213
+ return response;
214
+ }
215
+ async function query(request) {
216
+ const response = await send(request);
217
+ const value = response.parseError ? response.text : response.text ? response.value : null;
218
+ return {
219
+ httpStatus: response.status,
220
+ // Keep the JSON text for stdout so exact types and long numeric IDs survive serialization.
221
+ json: response.parseError ? JSON.stringify(response.text) : response.text || 'null',
222
+ value,
223
+ };
224
+ }
225
+ async function request(request) {
226
+ const response = await send(request);
227
+ if (request.operation === 'jiuchuanhui.customer.open-sea.claim.apply') {
228
+ const message = claimPermissionMessage(response.value);
229
+ if (message) {
230
+ throw new JiuchuanhuiCliError('permission', 'claim_forbidden', message, {
231
+ exitCode: ExitCode.PolicyError,
232
+ stage: 'esb-response',
233
+ });
234
+ }
235
+ }
204
236
  if (response.parseError) {
205
237
  if (response.status < 200 || response.status >= 300) {
206
238
  throw new JiuchuanhuiCliError('api', 'http_error', `泛微接口 HTTP ${response.status}`, {
207
239
  code: response.status,
208
- details: { status: response.status, response: boundedResponse(response.value) },
240
+ details: { status: response.status },
209
241
  exitCode: 1,
210
242
  });
211
243
  }
212
244
  throw jiuchuanhuiNetworkError('protocol', `接口返回不是合法 JSON(HTTP ${response.status})`, { retryable: false });
213
245
  }
214
246
  if (response.status < 200 || response.status >= 300) {
247
+ const message = jiuchuanhuiBusinessMessage(response.value);
215
248
  throw new JiuchuanhuiCliError('api', 'http_error', `泛微接口 HTTP ${response.status}`, {
216
249
  code: response.status,
217
- details: { status: response.status, message: jiuchuanhuiBusinessMessage(response.value), response: boundedResponse(response.value) },
250
+ details: { status: response.status, ...failureDetails(response.value, response.status, message) },
218
251
  exitCode: 1,
219
252
  });
220
253
  }
@@ -222,12 +255,11 @@ export function createJiuchuanhuiHost(ctx, dependencies = {}) {
222
255
  const message = jiuchuanhuiBusinessMessage(response.value);
223
256
  throw new JiuchuanhuiCliError('api', 'business_error', message, {
224
257
  code: businessCode(response.value),
225
- // message 一律原样(服务端 resultMsg),细节另开字段补充,不改写既有文案。
226
258
  details: failureDetails(response.value, businessCode(response.value), message),
227
259
  exitCode: 1,
228
260
  });
229
261
  }
230
262
  return response.value;
231
263
  }
232
- return { request, getSession };
264
+ return { request, query, getSession };
233
265
  }
@@ -1,9 +1,10 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
3
- import { reportPlatformError } from '../../core/error-codes.js';
3
+ import { reportPlatformError, shouldReportPlatformError, toPlatformError } from '../../core/error-codes.js';
4
+ import { MANIFEST_LIST_COMPACT_PATHS, manifestView } from '../../core/manifest-view.js';
4
5
  import { createJiuchuanhuiContinuationSigner } from './continuation.js';
5
6
  import { createJiuchuanhuiHost } from './host.js';
6
- import { jiuchuanhuiManifest } from './manifest.js';
7
+ import { getJiuchuanhuiOperationContract, jiuchuanhuiManifest } from './manifest.js';
7
8
  import { executeJiuchuanhuiOperation } from './operations.js';
8
9
  import { jiuchuanhuiValidationError } from './errors.js';
9
10
  function asOptions(value) {
@@ -74,17 +75,44 @@ function failureEnvelope(error) {
74
75
  error: toErrorEnvelope(error),
75
76
  };
76
77
  }
78
+ export function queryEnvelope(operation, { response, countResponse }) {
79
+ const envelope = JSON.stringify({
80
+ schemaVersion: 1,
81
+ ok: true,
82
+ operation,
83
+ meta: {
84
+ status: 'COMPLETE',
85
+ httpStatus: response.httpStatus,
86
+ ...(countResponse ? { countHttpStatus: countResponse.httpStatus } : {}),
87
+ },
88
+ warnings: [],
89
+ });
90
+ const count = countResponse ? `,"countResponse":${countResponse.json}` : '';
91
+ return `${envelope.slice(0, -1)},"data":${response.json}${count}}`;
92
+ }
77
93
  async function executeAndPrint(ctx, operation, input) {
78
94
  try {
79
95
  const result = await executeJiuchuanhuiOperation(operation, input, {
80
96
  host: createJiuchuanhuiHost(ctx),
81
97
  continuation: createJiuchuanhuiContinuationSigner(ctx),
82
98
  });
83
- ctx.output.write(successEnvelope(operation, result), { json: true });
99
+ if ('response' in result) {
100
+ ctx.output.raw(queryEnvelope(operation, result));
101
+ }
102
+ else {
103
+ ctx.output.write(successEnvelope(operation, result), { json: true });
104
+ }
84
105
  }
85
106
  catch (error) {
86
- reportPlatformError(error);
87
- console.error(JSON.stringify(failureEnvelope(error), null, 2));
107
+ const envelope = failureEnvelope(error);
108
+ if (ctx.getGlobalOptions().json) {
109
+ const platformError = shouldReportPlatformError(error) ? toPlatformError(error) : {};
110
+ console.error(JSON.stringify({ ...envelope, ...platformError }));
111
+ }
112
+ else {
113
+ reportPlatformError(error);
114
+ console.error(JSON.stringify(envelope, null, 2));
115
+ }
88
116
  process.exitCode = isCliError(error) ? error.exitCode : ExitCode.GeneralError;
89
117
  }
90
118
  }
@@ -96,8 +124,30 @@ export const jiuchuanhuiShortcut = {
96
124
  const jiuchuanhui = program.command('jiuchuanhui').description('泛微E10九氚汇营销管理');
97
125
  jiuchuanhui.command('schema')
98
126
  .description('Print jiuchuanhui operation manifest for agents')
99
- .action(action((ctx) => {
100
- ctx.output.write(jiuchuanhuiManifest, { json: true });
127
+ .option('--list', '只列操作清单(name/summary/risk),全量不截断;判断"有没有某操作"用这个')
128
+ .option('--full', '打印完整 manifest(超 stdout 预算会落本地 ref,用 refs get 分页取)')
129
+ .option('--operation <name>', 'print the contract for one operation')
130
+ .action(action((ctx, options) => {
131
+ const { operation, list } = asOptions(options);
132
+ if (operation === undefined) {
133
+ if (list === true) {
134
+ // 完整 manifest 有 73,937 字符,超过预算后 operations 只剩 20/90,入参定义几乎全丢。
135
+ ctx.output.write(manifestView(jiuchuanhuiManifest, { list: true }), {
136
+ json: true,
137
+ compactPaths: MANIFEST_LIST_COMPACT_PATHS,
138
+ });
139
+ return;
140
+ }
141
+ ctx.output.write(jiuchuanhuiManifest, { json: true });
142
+ return;
143
+ }
144
+ const contract = getJiuchuanhuiOperationContract(operation);
145
+ if (!contract)
146
+ throw jiuchuanhuiValidationError('operation_unknown', `九氚汇不支持操作:${operation}`);
147
+ // 保持原契约:这里输出**裸 contract 对象**(`jiuchuanhui-operations.test.ts` 用 deepEqual 锁定),
148
+ // 与 invoice/caizhilian/meeting 的 `{operation: ...}` 包裹结构不同,属于历史不一致,
149
+ // 铺开统一时再收敛,不在此处破坏既有断言。
150
+ ctx.output.write(contract, { json: true });
101
151
  }));
102
152
  jiuchuanhui.command('run')
103
153
  .description('Run a jiuchuanhui operation with JSON input')
@@ -1,8 +1,13 @@
1
+ import { CUSTOMER_SEARCH_SCOPES } from './operations/customer-quick.js';
1
2
  const pageProps = {
2
3
  pageNo: { type: 'integer', minimum: 1, default: 1 },
3
4
  pageSize: { type: 'integer', minimum: 1, maximum: 200, default: 10 },
4
5
  count: { type: 'boolean', description: '是否并行请求总数接口' },
5
6
  };
7
+ const customerQuickSearchProps = {
8
+ ...pageProps,
9
+ customer_name: { type: 'string', minLength: 1, description: '客户名称搜索条件' },
10
+ };
6
11
  const idProp = { type: 'string', pattern: '^[1-9]\\d*$' };
7
12
  const formProp = {
8
13
  type: 'object',
@@ -27,6 +32,7 @@ function writePair(baseName, title, props, required = [], fixed = {}, withPrepar
27
32
  list.push({
28
33
  name: `${baseName}.prepare`,
29
34
  risk: 'read-before-write',
35
+ requiresConfirmation: true,
30
36
  fixed: { ...fixed, stage: 'prepare' },
31
37
  inputSchema: {
32
38
  type: 'object',
@@ -46,6 +52,7 @@ function writePair(baseName, title, props, required = [], fixed = {}, withPrepar
46
52
  list.push({
47
53
  name: `${baseName}.apply`,
48
54
  risk: 'high-risk-write',
55
+ requiresConfirmation: true,
49
56
  fixed: { ...fixed, stage: 'apply' },
50
57
  inputSchema: {
51
58
  type: 'object',
@@ -285,6 +292,29 @@ export const jiuchuanhuiOperations = [
285
292
  properties: pageProps,
286
293
  },
287
294
  },
295
+ {
296
+ name: 'jiuchuanhui.customer.mine.search',
297
+ risk: 'read',
298
+ inputSchema: { type: 'object', additionalProperties: false, description: '查询我的客户。默认取第一页 10 条。', properties: customerQuickSearchProps },
299
+ },
300
+ {
301
+ name: 'jiuchuanhui.customer.success.search',
302
+ risk: 'read',
303
+ inputSchema: {
304
+ type: 'object',
305
+ additionalProperties: false,
306
+ description: '查询客户状态为“成功”或“成功客户”的客户。按当前租户的状态字典解析状态 ID,默认在我的客户范围内查询。',
307
+ properties: {
308
+ ...customerQuickSearchProps,
309
+ scope: { type: 'string', enum: Object.keys(CUSTOMER_SEARCH_SCOPES), default: 'mine', description: '我的客户、全部可见客户或公海客户' },
310
+ },
311
+ },
312
+ },
313
+ {
314
+ name: 'jiuchuanhui.customer.open-sea.customers.search',
315
+ risk: 'read',
316
+ inputSchema: { type: 'object', additionalProperties: false, description: '查询公海范围中的客户记录。默认取第一页 10 条。', properties: customerQuickSearchProps },
317
+ },
288
318
  {
289
319
  name: 'jiuchuanhui.customer.type.search',
290
320
  risk: 'read',
@@ -568,6 +598,13 @@ export const jiuchuanhuiManifest = {
568
598
  },
569
599
  ],
570
600
  };
601
+ /**
602
+ * 单 operation 契约必须与 `jiuchuanhuiManifest.operations` 完全一致——尤其 `summary`
603
+ * (模型选工具的唯一依据)。所以查表要查**补全过 summary** 的清单,不能查原始数组。
604
+ */
605
+ export function getJiuchuanhuiOperationContract(operation) {
606
+ return jiuchuanhuiManifest.operations.find((item) => item.name === operation);
607
+ }
571
608
  export function hasJiuchuanhuiOperation(operation) {
572
- return jiuchuanhuiOperations.some((item) => item.name === operation);
609
+ return getJiuchuanhuiOperationContract(operation) !== undefined;
573
610
  }