@besales/mcp 0.48.0 → 1.0.0-beta.2

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 (587) hide show
  1. package/README.md +109 -164
  2. package/README.onprem.ru.md +35 -0
  3. package/bin/besales-mcp-http.js +9 -0
  4. package/bin/besales-onprem.mjs +19 -0
  5. package/dist/auth/connection-store.d.ts +3 -1
  6. package/dist/auth/connection-store.js +9 -3
  7. package/dist/auth/connection-store.js.map +1 -1
  8. package/dist/auth/oauth-client.d.ts +20 -27
  9. package/dist/auth/oauth-client.js +31 -23
  10. package/dist/auth/oauth-client.js.map +1 -1
  11. package/dist/auth/session-workspace.d.ts +1 -0
  12. package/dist/auth/session-workspace.js +10 -1
  13. package/dist/auth/session-workspace.js.map +1 -1
  14. package/dist/auth/token-storage.js +4 -1
  15. package/dist/auth/token-storage.js.map +1 -1
  16. package/dist/cli.d.ts +1 -0
  17. package/dist/cli.js +80 -19
  18. package/dist/cli.js.map +1 -1
  19. package/dist/constants/crm-catalog.d.ts +2 -0
  20. package/dist/constants/crm-catalog.js +3 -0
  21. package/dist/constants/crm-catalog.js.map +1 -0
  22. package/dist/http/api-client.d.ts +52 -7
  23. package/dist/http/api-client.js +131 -66
  24. package/dist/http/api-client.js.map +1 -1
  25. package/dist/http/feedback-document-error.d.ts +26 -0
  26. package/dist/http/feedback-document-error.js +22 -0
  27. package/dist/http/feedback-document-error.js.map +1 -0
  28. package/dist/http-server.d.ts +15 -0
  29. package/dist/http-server.js +378 -0
  30. package/dist/http-server.js.map +1 -0
  31. package/dist/instructions/server-instructions.d.ts +1 -1
  32. package/dist/instructions/server-instructions.js +6 -3
  33. package/dist/instructions/server-instructions.js.map +1 -1
  34. package/dist/network/constants.d.ts +25 -0
  35. package/dist/network/constants.js +26 -0
  36. package/dist/network/constants.js.map +1 -0
  37. package/dist/network/failed-verifications.d.ts +10 -0
  38. package/dist/network/failed-verifications.js +37 -0
  39. package/dist/network/failed-verifications.js.map +1 -0
  40. package/dist/network/http-test-fixture.d.ts +3 -0
  41. package/dist/network/http-test-fixture.js +86 -0
  42. package/dist/network/http-test-fixture.js.map +1 -0
  43. package/dist/network/known-keys.d.ts +10 -0
  44. package/dist/network/known-keys.js +38 -0
  45. package/dist/network/known-keys.js.map +1 -0
  46. package/dist/network/memory-credentials.d.ts +11 -0
  47. package/dist/network/memory-credentials.js +24 -0
  48. package/dist/network/memory-credentials.js.map +1 -0
  49. package/dist/network/rate-limit.d.ts +23 -0
  50. package/dist/network/rate-limit.js +62 -0
  51. package/dist/network/rate-limit.js.map +1 -0
  52. package/dist/network/rejected-keys.d.ts +9 -0
  53. package/dist/network/rejected-keys.js +39 -0
  54. package/dist/network/rejected-keys.js.map +1 -0
  55. package/dist/network/request-work.d.ts +8 -0
  56. package/dist/network/request-work.js +20 -0
  57. package/dist/network/request-work.js.map +1 -0
  58. package/dist/network/successful-keys.d.ts +17 -0
  59. package/dist/network/successful-keys.js +47 -0
  60. package/dist/network/successful-keys.js.map +1 -0
  61. package/dist/resources/concepts/external-execution.md +3 -1
  62. package/dist/resources/concepts/feedback-sheets.md +21 -12
  63. package/dist/resources/concepts/icp.md +8 -1
  64. package/dist/resources/concepts/sandbox.md +15 -6
  65. package/dist/resources/concepts/triggers.md +8 -0
  66. package/dist/resources/concepts/workbook-classification.md +104 -50
  67. package/dist/resources/docs/agent-behavior.md +51 -382
  68. package/dist/resources/docs/campaigns.md +9 -16
  69. package/dist/resources/docs/crm-integration.md +39 -523
  70. package/dist/resources/docs/files-and-uploads.md +23 -286
  71. package/dist/resources/docs/follow-up.md +47 -12
  72. package/dist/resources/docs/knowledge-base.md +52 -521
  73. package/dist/resources/docs/pipeline-builder.md +26 -216
  74. package/dist/resources/docs/pipeline-settings-deep.md +27 -220
  75. package/dist/resources/docs/platforms.md +106 -519
  76. package/dist/resources/docs/prompt-anatomy.md +39 -285
  77. package/dist/resources/docs/routing.md +8 -16
  78. package/dist/resources/docs/trigger-actions.md +40 -24
  79. package/dist/resources/docs/variables.md +8 -12
  80. package/dist/resources/operator-edit.contract.d.ts +7 -0
  81. package/dist/resources/operator-edit.contract.js +8 -0
  82. package/dist/resources/operator-edit.contract.js.map +1 -0
  83. package/dist/resources/registry.js +20 -4
  84. package/dist/resources/registry.js.map +1 -1
  85. package/dist/resources/workflows/audit-dialogues.md +23 -12
  86. package/dist/resources/workflows/compare-models.md +6 -6
  87. package/dist/resources/workflows/connect-crm-from-scratch.md +15 -12
  88. package/dist/resources/workflows/connect-datasource-from-scratch.md +5 -4
  89. package/dist/resources/workflows/extract-from-document.md +8 -6
  90. package/dist/resources/workflows/operator-edit.md +15 -0
  91. package/dist/resources/workflows/platform-setup-from-scratch.md +59 -70
  92. package/dist/resources/workflows/production-readiness-check.md +25 -15
  93. package/dist/schemas/mcp-tools.json +9902 -4734
  94. package/dist/schemas/voice-actions-api.contract.json +248 -0
  95. package/dist/shared/constants/broadcast-reason.constants.d.ts +2 -0
  96. package/dist/shared/constants/broadcast-reason.constants.js +47 -0
  97. package/dist/shared/constants/broadcast-reason.constants.js.map +1 -0
  98. package/dist/shared/constants/crm-stage-pool.constants.d.ts +2 -0
  99. package/dist/shared/constants/crm-stage-pool.constants.js +3 -0
  100. package/dist/shared/constants/crm-stage-pool.constants.js.map +1 -0
  101. package/dist/shared/constants/followup-note.constants.d.ts +3 -0
  102. package/dist/shared/constants/followup-note.constants.js +4 -0
  103. package/dist/shared/constants/followup-note.constants.js.map +1 -0
  104. package/dist/shared/constants/followup-session.constants.d.ts +2 -0
  105. package/dist/shared/constants/followup-session.constants.js +3 -0
  106. package/dist/shared/constants/followup-session.constants.js.map +1 -0
  107. package/dist/shared/constants/funnel-analytics.constants.d.ts +2 -0
  108. package/dist/shared/constants/funnel-analytics.constants.js +3 -0
  109. package/dist/shared/constants/funnel-analytics.constants.js.map +1 -0
  110. package/dist/shared/constants/message-filter.constants.d.ts +7 -0
  111. package/dist/shared/constants/message-filter.constants.js +8 -0
  112. package/dist/shared/constants/message-filter.constants.js.map +1 -0
  113. package/dist/shared/utils/trigger-repeat-mapping.d.ts +72 -0
  114. package/dist/shared/utils/trigger-repeat-mapping.js +53 -0
  115. package/dist/shared/utils/trigger-repeat-mapping.js.map +1 -0
  116. package/dist/skills/besales-dialogue-audit/SKILL.md +31 -20
  117. package/dist/tasks/task-state-store.js +5 -0
  118. package/dist/tasks/task-state-store.js.map +1 -1
  119. package/dist/tools/annotations.js +4 -3
  120. package/dist/tools/annotations.js.map +1 -1
  121. package/dist/tools/definitions/agent-design.d.ts +78 -21
  122. package/dist/tools/definitions/agent-design.js +246 -90
  123. package/dist/tools/definitions/agent-design.js.map +1 -1
  124. package/dist/tools/definitions/agent-model-notice.d.ts +5 -0
  125. package/dist/tools/definitions/agent-model-notice.js +31 -0
  126. package/dist/tools/definitions/agent-model-notice.js.map +1 -0
  127. package/dist/tools/definitions/agent-models.d.ts +5 -0
  128. package/dist/tools/definitions/agent-models.js +26 -0
  129. package/dist/tools/definitions/agent-models.js.map +1 -0
  130. package/dist/tools/definitions/agent-settings.d.ts +85 -0
  131. package/dist/tools/definitions/agent-settings.js +187 -0
  132. package/dist/tools/definitions/agent-settings.js.map +1 -0
  133. package/dist/tools/definitions/ai-costs.d.ts +12 -0
  134. package/dist/tools/definitions/ai-costs.js +142 -0
  135. package/dist/tools/definitions/ai-costs.js.map +1 -0
  136. package/dist/tools/definitions/api-tool-request.d.ts +15 -0
  137. package/dist/tools/definitions/api-tool-request.js +2 -0
  138. package/dist/tools/definitions/api-tool-request.js.map +1 -0
  139. package/dist/tools/definitions/behavior-shipped-form.d.ts +182 -0
  140. package/dist/tools/definitions/behavior-shipped-form.js +185 -0
  141. package/dist/tools/definitions/behavior-shipped-form.js.map +1 -0
  142. package/dist/tools/definitions/broadcast-alerts.d.ts +6 -0
  143. package/dist/tools/definitions/broadcast-alerts.js +72 -0
  144. package/dist/tools/definitions/broadcast-alerts.js.map +1 -0
  145. package/dist/tools/definitions/broadcast-analytics.d.ts +102 -18
  146. package/dist/tools/definitions/broadcast-analytics.js +732 -431
  147. package/dist/tools/definitions/broadcast-analytics.js.map +1 -1
  148. package/dist/tools/definitions/broadcast-scheduler.d.ts +10 -13
  149. package/dist/tools/definitions/broadcast-scheduler.js +196 -154
  150. package/dist/tools/definitions/broadcast-scheduler.js.map +1 -1
  151. package/dist/tools/definitions/call-operator-task.schema.d.ts +11 -0
  152. package/dist/tools/definitions/call-operator-task.schema.js +30 -0
  153. package/dist/tools/definitions/call-operator-task.schema.js.map +1 -0
  154. package/dist/tools/definitions/contacts.d.ts +3 -0
  155. package/dist/tools/definitions/contacts.js +57 -31
  156. package/dist/tools/definitions/contacts.js.map +1 -1
  157. package/dist/tools/definitions/crm-platform.d.ts +28 -41
  158. package/dist/tools/definitions/crm-platform.js +235 -368
  159. package/dist/tools/definitions/crm-platform.js.map +1 -1
  160. package/dist/tools/definitions/crm-stage-pool.messages.d.ts +39 -0
  161. package/dist/tools/definitions/crm-stage-pool.messages.js +43 -0
  162. package/dist/tools/definitions/crm-stage-pool.messages.js.map +1 -0
  163. package/dist/tools/definitions/crm-stage-pool.schema.d.ts +64 -0
  164. package/dist/tools/definitions/crm-stage-pool.schema.js +109 -0
  165. package/dist/tools/definitions/crm-stage-pool.schema.js.map +1 -0
  166. package/dist/tools/definitions/custom-reports.d.ts +12 -0
  167. package/dist/tools/definitions/custom-reports.js +68 -0
  168. package/dist/tools/definitions/custom-reports.js.map +1 -0
  169. package/dist/tools/definitions/datasource.d.ts +2 -1
  170. package/dist/tools/definitions/datasource.js +28 -13
  171. package/dist/tools/definitions/datasource.js.map +1 -1
  172. package/dist/tools/definitions/dialog-review-findings-response.d.ts +14 -0
  173. package/dist/tools/definitions/dialog-review-findings-response.js +23 -0
  174. package/dist/tools/definitions/dialog-review-findings-response.js.map +1 -0
  175. package/dist/tools/definitions/dialog-review-safe-response.d.ts +5 -0
  176. package/dist/tools/definitions/dialog-review-safe-response.js +152 -0
  177. package/dist/tools/definitions/dialog-review-safe-response.js.map +1 -0
  178. package/dist/tools/definitions/dialog-review.d.ts +49 -0
  179. package/dist/tools/definitions/dialog-review.js +383 -0
  180. package/dist/tools/definitions/dialog-review.js.map +1 -0
  181. package/dist/tools/definitions/dialogue-analysis.d.ts +46 -0
  182. package/dist/tools/definitions/dialogue-analysis.js +170 -0
  183. package/dist/tools/definitions/dialogue-analysis.js.map +1 -0
  184. package/dist/tools/definitions/dialogue-audit-agent-scope.d.ts +7 -0
  185. package/dist/tools/definitions/dialogue-audit-agent-scope.js +41 -0
  186. package/dist/tools/definitions/dialogue-audit-agent-scope.js.map +1 -0
  187. package/dist/tools/definitions/dialogue-audit-alias.d.ts +67 -0
  188. package/dist/tools/definitions/dialogue-audit-alias.js +559 -0
  189. package/dist/tools/definitions/dialogue-audit-alias.js.map +1 -0
  190. package/dist/tools/definitions/dialogue-export.d.ts +7 -1
  191. package/dist/tools/definitions/dialogue-export.js +89 -32
  192. package/dist/tools/definitions/dialogue-export.js.map +1 -1
  193. package/dist/tools/definitions/dialogue-followup-state.d.ts +9 -0
  194. package/dist/tools/definitions/dialogue-followup-state.js +69 -0
  195. package/dist/tools/definitions/dialogue-followup-state.js.map +1 -0
  196. package/dist/tools/definitions/edit-version-transport.test-fixtures.d.ts +13 -0
  197. package/dist/tools/definitions/edit-version-transport.test-fixtures.js +292 -0
  198. package/dist/tools/definitions/edit-version-transport.test-fixtures.js.map +1 -0
  199. package/dist/tools/definitions/edit-version.d.ts +5 -0
  200. package/dist/tools/definitions/edit-version.js +20 -0
  201. package/dist/tools/definitions/edit-version.js.map +1 -0
  202. package/dist/tools/definitions/external-api-channels.js +17 -15
  203. package/dist/tools/definitions/external-api-channels.js.map +1 -1
  204. package/dist/tools/definitions/feedback-document-access.d.ts +16 -0
  205. package/dist/tools/definitions/feedback-document-access.js +63 -0
  206. package/dist/tools/definitions/feedback-document-access.js.map +1 -0
  207. package/dist/tools/definitions/fixtures/shipped-setup-status.d.ts +3 -0
  208. package/dist/tools/definitions/fixtures/shipped-setup-status.js +9 -0
  209. package/dist/tools/definitions/fixtures/shipped-setup-status.js.map +1 -0
  210. package/dist/tools/definitions/follow-up-config.d.ts +79 -0
  211. package/dist/tools/definitions/follow-up-config.js +258 -0
  212. package/dist/tools/definitions/follow-up-config.js.map +1 -0
  213. package/dist/tools/definitions/follow-up-funnel-test.d.ts +4 -3
  214. package/dist/tools/definitions/follow-up-funnel-test.js +65 -52
  215. package/dist/tools/definitions/follow-up-funnel-test.js.map +1 -1
  216. package/dist/tools/definitions/follow-up-promotion-instructions.d.ts +2 -0
  217. package/dist/tools/definitions/follow-up-promotion-instructions.js +7 -0
  218. package/dist/tools/definitions/follow-up-promotion-instructions.js.map +1 -0
  219. package/dist/tools/definitions/follow-up-setup.d.ts +4 -28
  220. package/dist/tools/definitions/follow-up-setup.js +20 -87
  221. package/dist/tools/definitions/follow-up-setup.js.map +1 -1
  222. package/dist/tools/definitions/follow-up.d.ts +20 -122
  223. package/dist/tools/definitions/follow-up.js +200 -357
  224. package/dist/tools/definitions/follow-up.js.map +1 -1
  225. package/dist/tools/definitions/followup-getcourse-compat.d.ts +29 -0
  226. package/dist/tools/definitions/followup-getcourse-compat.js +62 -0
  227. package/dist/tools/definitions/followup-getcourse-compat.js.map +1 -0
  228. package/dist/tools/definitions/followup-sequence-config.schema.d.ts +10 -0
  229. package/dist/tools/definitions/followup-sequence-config.schema.js +14 -0
  230. package/dist/tools/definitions/followup-sequence-config.schema.js.map +1 -0
  231. package/dist/tools/definitions/funnel-analytics.d.ts +18 -0
  232. package/dist/tools/definitions/funnel-analytics.js +150 -0
  233. package/dist/tools/definitions/funnel-analytics.js.map +1 -0
  234. package/dist/tools/definitions/getcourse-anchor-refresh.d.ts +5 -9
  235. package/dist/tools/definitions/getcourse-anchor-refresh.js +26 -31
  236. package/dist/tools/definitions/getcourse-anchor-refresh.js.map +1 -1
  237. package/dist/tools/definitions/getcourse-cold-outbound-settings.d.ts +46 -0
  238. package/dist/tools/definitions/getcourse-cold-outbound-settings.js +37 -0
  239. package/dist/tools/definitions/getcourse-cold-outbound-settings.js.map +1 -0
  240. package/dist/tools/definitions/getcourse-cold-welcome.d.ts +14 -29
  241. package/dist/tools/definitions/getcourse-cold-welcome.js +180 -254
  242. package/dist/tools/definitions/getcourse-cold-welcome.js.map +1 -1
  243. package/dist/tools/definitions/getcourse-wave-welcome.messages.d.ts +10 -0
  244. package/dist/tools/definitions/getcourse-wave-welcome.messages.js +17 -0
  245. package/dist/tools/definitions/getcourse-wave-welcome.messages.js.map +1 -0
  246. package/dist/tools/definitions/help.js.map +1 -1
  247. package/dist/tools/definitions/icp-import-source.d.ts +75 -0
  248. package/dist/tools/definitions/icp-import-source.js +88 -0
  249. package/dist/tools/definitions/icp-import-source.js.map +1 -0
  250. package/dist/tools/definitions/inbound-analytics.d.ts +13 -0
  251. package/dist/tools/definitions/inbound-analytics.js +55 -0
  252. package/dist/tools/definitions/inbound-analytics.js.map +1 -0
  253. package/dist/tools/definitions/instagram-comment.templates.d.ts +19 -0
  254. package/dist/tools/definitions/instagram-comment.templates.js +34 -0
  255. package/dist/tools/definitions/instagram-comment.templates.js.map +1 -0
  256. package/dist/tools/definitions/instagram-settings-compat.d.ts +33 -0
  257. package/dist/tools/definitions/instagram-settings-compat.js +7 -0
  258. package/dist/tools/definitions/instagram-settings-compat.js.map +1 -0
  259. package/dist/tools/definitions/knowledge-chunking.d.ts +42 -0
  260. package/dist/tools/definitions/knowledge-chunking.js +83 -0
  261. package/dist/tools/definitions/knowledge-chunking.js.map +1 -0
  262. package/dist/tools/definitions/knowledge-space-search-fields.d.ts +12 -0
  263. package/dist/tools/definitions/knowledge-space-search-fields.js +30 -0
  264. package/dist/tools/definitions/knowledge-space-search-fields.js.map +1 -0
  265. package/dist/tools/definitions/knowledge.d.ts +24 -14
  266. package/dist/tools/definitions/knowledge.js +342 -233
  267. package/dist/tools/definitions/knowledge.js.map +1 -1
  268. package/dist/tools/definitions/legacy-trigger-repeat.d.ts +17 -0
  269. package/dist/tools/definitions/legacy-trigger-repeat.js +53 -0
  270. package/dist/tools/definitions/legacy-trigger-repeat.js.map +1 -0
  271. package/dist/tools/definitions/link-tracking.d.ts +8 -0
  272. package/dist/tools/definitions/link-tracking.js +141 -38
  273. package/dist/tools/definitions/link-tracking.js.map +1 -1
  274. package/dist/tools/definitions/mailing-variant-content.d.ts +75 -0
  275. package/dist/tools/definitions/mailing-variant-content.js +73 -0
  276. package/dist/tools/definitions/mailing-variant-content.js.map +1 -0
  277. package/dist/tools/definitions/model-comparison.d.ts +1 -0
  278. package/dist/tools/definitions/model-comparison.js +4 -5
  279. package/dist/tools/definitions/model-comparison.js.map +1 -1
  280. package/dist/tools/definitions/money-currency.d.ts +5 -0
  281. package/dist/tools/definitions/money-currency.js +10 -0
  282. package/dist/tools/definitions/money-currency.js.map +1 -0
  283. package/dist/tools/definitions/operator-workflow.d.ts +5 -5
  284. package/dist/tools/definitions/operator-workflow.js +80 -27
  285. package/dist/tools/definitions/operator-workflow.js.map +1 -1
  286. package/dist/tools/definitions/platform-funnel-analytics.d.ts +42 -0
  287. package/dist/tools/definitions/platform-funnel-analytics.js +72 -0
  288. package/dist/tools/definitions/platform-funnel-analytics.js.map +1 -0
  289. package/dist/tools/definitions/platform-getcourse-wave-field-bindings.d.ts +42 -0
  290. package/dist/tools/definitions/platform-getcourse-wave-field-bindings.js +51 -0
  291. package/dist/tools/definitions/platform-getcourse-wave-field-bindings.js.map +1 -0
  292. package/dist/tools/definitions/platform-settings-limits.d.ts +5 -0
  293. package/dist/tools/definitions/platform-settings-limits.js +6 -0
  294. package/dist/tools/definitions/platform-settings-limits.js.map +1 -0
  295. package/dist/tools/definitions/platform-settings-shipped-form.d.ts +37 -0
  296. package/dist/tools/definitions/platform-settings-shipped-form.js +310 -0
  297. package/dist/tools/definitions/platform-settings-shipped-form.js.map +1 -0
  298. package/dist/tools/definitions/platform-settings-update.d.ts +300 -0
  299. package/dist/tools/definitions/platform-settings-update.js +134 -0
  300. package/dist/tools/definitions/platform-settings-update.js.map +1 -0
  301. package/dist/tools/definitions/{getcourse-wave.d.ts → platform-setup-wave.d.ts} +75 -6
  302. package/dist/tools/definitions/platform-setup-wave.js +1079 -0
  303. package/dist/tools/definitions/platform-setup-wave.js.map +1 -0
  304. package/dist/tools/definitions/platform-setup.d.ts +686 -224
  305. package/dist/tools/definitions/platform-setup.js +313 -752
  306. package/dist/tools/definitions/platform-setup.js.map +1 -1
  307. package/dist/tools/definitions/platform-widget-page-rules.schema.d.ts +10 -0
  308. package/dist/tools/definitions/platform-widget-page-rules.schema.js +7 -0
  309. package/dist/tools/definitions/platform-widget-page-rules.schema.js.map +1 -0
  310. package/dist/tools/definitions/prompt-authoring.constants.d.ts +2 -0
  311. package/dist/tools/definitions/prompt-authoring.constants.js +3 -0
  312. package/dist/tools/definitions/prompt-authoring.constants.js.map +1 -0
  313. package/dist/tools/definitions/prompt-batch-controls.d.ts +5 -0
  314. package/dist/tools/definitions/prompt-batch-controls.js +40 -0
  315. package/dist/tools/definitions/prompt-batch-controls.js.map +1 -0
  316. package/dist/tools/definitions/prompt-draft-authoring.d.ts +5 -0
  317. package/dist/tools/definitions/prompt-draft-authoring.js +24 -0
  318. package/dist/tools/definitions/prompt-draft-authoring.js.map +1 -0
  319. package/dist/tools/definitions/prompt-text-projection.d.ts +11 -0
  320. package/dist/tools/definitions/prompt-text-projection.js +62 -0
  321. package/dist/tools/definitions/prompt-text-projection.js.map +1 -0
  322. package/dist/tools/definitions/reviewer-paid.d.ts +19 -0
  323. package/dist/tools/definitions/reviewer-paid.js +115 -0
  324. package/dist/tools/definitions/reviewer-paid.js.map +1 -0
  325. package/dist/tools/definitions/routing-condition-projection.d.ts +31 -0
  326. package/dist/tools/definitions/routing-condition-projection.js +97 -0
  327. package/dist/tools/definitions/routing-condition-projection.js.map +1 -0
  328. package/dist/tools/definitions/schedule-selection-hints.d.ts +3 -0
  329. package/dist/tools/definitions/schedule-selection-hints.js +42 -0
  330. package/dist/tools/definitions/schedule-selection-hints.js.map +1 -0
  331. package/dist/tools/definitions/{scheduled-tasks.d.ts → scheduled-task-alias.d.ts} +12 -10
  332. package/dist/tools/definitions/scheduled-task-alias.js +207 -0
  333. package/dist/tools/definitions/scheduled-task-alias.js.map +1 -0
  334. package/dist/tools/definitions/session.js +3 -3
  335. package/dist/tools/definitions/session.js.map +1 -1
  336. package/dist/tools/definitions/setup-init-operation.schema.d.ts +2 -0
  337. package/dist/tools/definitions/setup-init-operation.schema.js +6 -0
  338. package/dist/tools/definitions/setup-init-operation.schema.js.map +1 -0
  339. package/dist/tools/definitions/shared-input.helpers.d.ts +51 -0
  340. package/dist/tools/definitions/shared-input.helpers.js +323 -0
  341. package/dist/tools/definitions/shared-input.helpers.js.map +1 -0
  342. package/dist/tools/definitions/shared.d.ts +396 -307
  343. package/dist/tools/definitions/shared.js +430 -652
  344. package/dist/tools/definitions/shared.js.map +1 -1
  345. package/dist/tools/definitions/shipped-output-names.d.ts +19 -0
  346. package/dist/tools/definitions/shipped-output-names.js +123 -0
  347. package/dist/tools/definitions/shipped-output-names.js.map +1 -0
  348. package/dist/tools/definitions/task-state.d.ts +5 -5
  349. package/dist/tools/definitions/task-state.js +2 -1
  350. package/dist/tools/definitions/task-state.js.map +1 -1
  351. package/dist/tools/definitions/telegram-personal-capacity.d.ts +4 -0
  352. package/dist/tools/definitions/telegram-personal-capacity.js +18 -0
  353. package/dist/tools/definitions/telegram-personal-capacity.js.map +1 -0
  354. package/dist/tools/definitions/telegram-pool-policy.d.ts +8 -0
  355. package/dist/tools/definitions/telegram-pool-policy.js +56 -0
  356. package/dist/tools/definitions/telegram-pool-policy.js.map +1 -0
  357. package/dist/tools/definitions/touch-history-alias.d.ts +4 -0
  358. package/dist/tools/definitions/touch-history-alias.js +99 -0
  359. package/dist/tools/definitions/touch-history-alias.js.map +1 -0
  360. package/dist/tools/definitions/trigger-action-item.schema.d.ts +254 -0
  361. package/dist/tools/definitions/trigger-action-item.schema.js +121 -0
  362. package/dist/tools/definitions/trigger-action-item.schema.js.map +1 -0
  363. package/dist/tools/definitions/trigger-argument.schema.d.ts +14 -0
  364. package/dist/tools/definitions/trigger-argument.schema.js +23 -0
  365. package/dist/tools/definitions/trigger-argument.schema.js.map +1 -0
  366. package/dist/tools/definitions/trigger-claim-alias.d.ts +10 -0
  367. package/dist/tools/definitions/trigger-claim-alias.js +90 -0
  368. package/dist/tools/definitions/trigger-claim-alias.js.map +1 -0
  369. package/dist/tools/definitions/trigger-echo-projection.d.ts +1 -0
  370. package/dist/tools/definitions/trigger-echo-projection.js +41 -0
  371. package/dist/tools/definitions/trigger-echo-projection.js.map +1 -0
  372. package/dist/tools/definitions/trigger-upsert.tool.d.ts +29 -0
  373. package/dist/tools/definitions/trigger-upsert.tool.js +122 -0
  374. package/dist/tools/definitions/trigger-upsert.tool.js.map +1 -0
  375. package/dist/tools/definitions/v15-port-descriptions.d.ts +11 -0
  376. package/dist/tools/definitions/v15-port-descriptions.js +30 -0
  377. package/dist/tools/definitions/v15-port-descriptions.js.map +1 -0
  378. package/dist/tools/definitions/variables.d.ts +44 -0
  379. package/dist/tools/definitions/variables.js +310 -0
  380. package/dist/tools/definitions/variables.js.map +1 -0
  381. package/dist/tools/definitions/voice-action-input.d.ts +9 -0
  382. package/dist/tools/definitions/voice-action-input.js +141 -0
  383. package/dist/tools/definitions/voice-action-input.js.map +1 -0
  384. package/dist/tools/definitions/widget-customization-compat.d.ts +51 -0
  385. package/dist/tools/definitions/widget-customization-compat.js +23 -0
  386. package/dist/tools/definitions/widget-customization-compat.js.map +1 -0
  387. package/dist/tools/definitions.d.ts +1089 -636
  388. package/dist/tools/definitions.js +57 -27
  389. package/dist/tools/definitions.js.map +1 -1
  390. package/dist/tools/description-localization.js +3 -2
  391. package/dist/tools/description-localization.js.map +1 -1
  392. package/dist/tools/follow-up-request.d.ts +19 -0
  393. package/dist/tools/follow-up-request.js +81 -0
  394. package/dist/tools/follow-up-request.js.map +1 -0
  395. package/dist/tools/followup-revision.d.ts +4 -0
  396. package/dist/tools/followup-revision.js +29 -0
  397. package/dist/tools/followup-revision.js.map +1 -0
  398. package/dist/tools/incomplete-list.js +4 -0
  399. package/dist/tools/incomplete-list.js.map +1 -1
  400. package/dist/tools/inventory.js +47 -11
  401. package/dist/tools/inventory.js.map +1 -1
  402. package/dist/tools/operation-recovery.d.ts +4 -0
  403. package/dist/tools/operation-recovery.js +33 -0
  404. package/dist/tools/operation-recovery.js.map +1 -0
  405. package/dist/tools/registry-mapping-primary.cases.d.ts +2 -0
  406. package/dist/tools/registry-mapping-primary.cases.js +753 -0
  407. package/dist/tools/registry-mapping-primary.cases.js.map +1 -0
  408. package/dist/tools/registry-mapping-secondary.cases.d.ts +2 -0
  409. package/dist/tools/registry-mapping-secondary.cases.js +626 -0
  410. package/dist/tools/registry-mapping-secondary.cases.js.map +1 -0
  411. package/dist/tools/registry-mapping.cases.d.ts +8 -0
  412. package/dist/tools/registry-mapping.cases.js +13 -0
  413. package/dist/tools/registry-mapping.cases.js.map +1 -0
  414. package/dist/tools/registry-test-fixtures.d.ts +50 -0
  415. package/dist/tools/registry-test-fixtures.js +120 -0
  416. package/dist/tools/registry-test-fixtures.js.map +1 -0
  417. package/dist/tools/registry.d.ts +2 -0
  418. package/dist/tools/registry.js +82 -52
  419. package/dist/tools/registry.js.map +1 -1
  420. package/dist/tools/result.d.ts +1 -0
  421. package/dist/tools/result.js +90 -22
  422. package/dist/tools/result.js.map +1 -1
  423. package/dist/tools/toolsets.d.ts +16 -0
  424. package/dist/tools/toolsets.js +25 -1
  425. package/dist/tools/toolsets.js.map +1 -1
  426. package/dist/types/api-contract.gen.d.ts +105875 -22205
  427. package/dist/utils/credential-signatures.d.ts +3 -0
  428. package/dist/utils/credential-signatures.js +10 -0
  429. package/dist/utils/credential-signatures.js.map +1 -0
  430. package/dist/utils/data-source-column-name.d.ts +10 -0
  431. package/dist/utils/data-source-column-name.js +36 -0
  432. package/dist/utils/data-source-column-name.js.map +1 -0
  433. package/dist/utils/logger.d.ts +1 -0
  434. package/dist/utils/logger.js +32 -8
  435. package/dist/utils/logger.js.map +1 -1
  436. package/dist/utils/secret-read-boundary.d.ts +2 -0
  437. package/dist/utils/secret-read-boundary.js +88 -0
  438. package/dist/utils/secret-read-boundary.js.map +1 -0
  439. package/dist/utils/setup-secrets.d.ts +4 -0
  440. package/dist/utils/setup-secrets.js +40 -0
  441. package/dist/utils/setup-secrets.js.map +1 -0
  442. package/docs/agent-models.md +9 -0
  443. package/docs/agent-usage-guide.full.ru.md +1 -4
  444. package/docs/analytics-contract.md +67 -0
  445. package/docs/async-operation-lifecycle.md +10 -3
  446. package/docs/connect.ru.md +144 -4
  447. package/docs/contact-company-profile.md +17 -0
  448. package/docs/contact-recommendations.md +7 -0
  449. package/docs/crm-stage-pool.md +73 -0
  450. package/docs/customer-data.md +61 -0
  451. package/docs/edit-versions.md +36 -0
  452. package/docs/failure-semantics.md +17 -9
  453. package/docs/help-navigation.md +15 -42
  454. package/docs/host-compatibility-matrix.md +72 -93
  455. package/docs/host-setup.md +33 -35
  456. package/docs/invariants/public-api-and-contracts.md +16 -0
  457. package/docs/legacy-action-settings.md +21 -0
  458. package/docs/main-transfer-dependencies.md +38 -0
  459. package/docs/mcp2-parity.md +50 -0
  460. package/docs/modules/analytics.md +79 -0
  461. package/docs/modules/besales-mcp.md +137 -0
  462. package/docs/modules/dialog-review-report.md +38 -0
  463. package/docs/modules/dialogue-followup-adapters.md +39 -0
  464. package/docs/modules/message-reactions.md +17 -0
  465. package/docs/modules/network-mode.md +284 -0
  466. package/docs/modules/prompt-batch-and-dialogue-controls.md +69 -0
  467. package/docs/pii-policy.md +21 -16
  468. package/docs/response-size-budget.md +197 -7
  469. package/docs/secret-read-boundary.md +102 -0
  470. package/docs/task-state.md +7 -2
  471. package/docs/telegram-pool-policy.md +19 -0
  472. package/docs/tool-effects.md +15 -9
  473. package/docs/tool-surface.md +205 -4
  474. package/docs/voice-actions-and-inbox.md +95 -0
  475. package/docs/wazzup-instagram-comments.md +26 -0
  476. package/package.json +17 -10
  477. package/scripts/api-source-loader.spec.mjs +40 -0
  478. package/scripts/audit-bridge-controls.mjs +129 -0
  479. package/scripts/audit-revert-mutants.mjs +107 -0
  480. package/scripts/bridge-api-input.spec.mjs +98 -0
  481. package/scripts/bridge-controls-mutants.mjs +130 -0
  482. package/scripts/brx3-shipped-refusals.spec.mjs +149 -0
  483. package/scripts/brx4-ledger-payload.spec.mjs +127 -0
  484. package/scripts/build-onprem.mjs +108 -0
  485. package/scripts/connect-clients.sh +141 -0
  486. package/scripts/connect-scopes.mjs +166 -0
  487. package/scripts/connect-scopes.spec.mjs +83 -0
  488. package/scripts/emit-personal-link-carrier.mjs +31 -0
  489. package/scripts/emit-setup-init-schemas.mjs +24 -0
  490. package/scripts/emit-tool-routes.mjs +878 -0
  491. package/scripts/emit-tool-routes.spec.mjs +300 -0
  492. package/scripts/followup-registry.spec.mjs +107 -0
  493. package/scripts/generate-crm-rotation-contract.mjs +98 -0
  494. package/scripts/generate-followup-session-contract.mjs +16 -0
  495. package/scripts/icp-import-verification/mutate.cjs +70 -0
  496. package/scripts/import-secret-read-contract.mjs +53 -0
  497. package/scripts/install-claude-desktop.js +1 -1
  498. package/scripts/lag-decisions.mjs +37 -0
  499. package/scripts/lag-decisions.spec.mjs +87 -0
  500. package/scripts/lag-open-task-owners.mjs +46 -0
  501. package/scripts/lag-open-task-owners.spec.mjs +78 -0
  502. package/scripts/lag-payload.mjs +10 -0
  503. package/scripts/legacy-action-lag.spec.mjs +22 -0
  504. package/scripts/legacy-field-refusal.shipped.spec.mjs +99 -0
  505. package/scripts/mcpcompat-handler.mjs +34 -0
  506. package/scripts/mcpcompat-loader.mjs +36 -0
  507. package/scripts/mcpcompat-typescript.mjs +3 -0
  508. package/scripts/platform-settings-shipped-parity.spec.mjs +89 -0
  509. package/scripts/prbr-round1-recheck.spec.mjs +605 -0
  510. package/scripts/prbr-shipped-compatibility.spec.mjs +276 -0
  511. package/scripts/publish-mcp-registry.mjs +98 -0
  512. package/scripts/publish-mcp-registry.spec.mjs +68 -0
  513. package/scripts/record-scheduled-task-call.mjs +26 -0
  514. package/scripts/refusal-probe.mjs +17 -0
  515. package/scripts/refusal-probe.spec.mjs +29 -0
  516. package/scripts/registry-diff.mjs +502 -0
  517. package/scripts/registry-diff.spec.mjs +787 -0
  518. package/scripts/request-query.mjs +43 -0
  519. package/scripts/request-query.spec.mjs +82 -0
  520. package/scripts/route-lag.mjs +23 -0
  521. package/scripts/route-lag.spec.mjs +30 -0
  522. package/scripts/sample-args.mjs +174 -0
  523. package/scripts/sample-args.spec.mjs +160 -0
  524. package/scripts/shipped-definitions.mjs +197 -0
  525. package/scripts/shipped-definitions.spec.mjs +57 -0
  526. package/scripts/shipped-inputs.spec.mjs +136 -0
  527. package/scripts/shipped-recordings.spec.mjs +19 -0
  528. package/scripts/shipped-ref.d.mts +5 -0
  529. package/scripts/shipped-ref.mjs +20 -0
  530. package/scripts/shipped-ref.spec.mjs +59 -0
  531. package/scripts/shipped-registry.mjs +107 -0
  532. package/scripts/shipped-sample-candidates.mjs +69 -0
  533. package/scripts/shipped-sample-candidates.spec.mjs +117 -0
  534. package/scripts/shipped-sample.mjs +868 -0
  535. package/scripts/shipped-sample.spec.mjs +451 -0
  536. package/scripts/sync-agent-model-schemas.mjs +72 -0
  537. package/scripts/sync-api-contracts.mjs +85 -0
  538. package/scripts/sync-api-contracts.spec.mjs +144 -0
  539. package/scripts/sync-contract-ledger-schemas.mjs +161 -0
  540. package/scripts/sync-crm-stage-pool-schema.mjs +85 -0
  541. package/scripts/sync-prompt-draft-schema.mjs +92 -0
  542. package/scripts/sync-route-map.mjs +94 -0
  543. package/scripts/sync-schema-descriptions.mjs +25 -0
  544. package/scripts/sync-tool-inventory.mjs +27 -0
  545. package/scripts/sync-trigger-argument-schema.mjs +121 -0
  546. package/scripts/sync-trigger-repeat-mapping.mjs +12 -0
  547. package/scripts/sync-voice-actions-contract.mjs +67 -0
  548. package/scripts/sync-voice-actions-tools.mjs +97 -0
  549. package/scripts/sync-wave-id-schemas.mjs +55 -0
  550. package/scripts/tool-input-schemas.mjs +46 -0
  551. package/scripts/tool-input-schemas.spec.mjs +50 -0
  552. package/scripts/verify-followup-adapters.mjs +235 -0
  553. package/scripts/verify-secret-read-import.mjs +84 -0
  554. package/scripts/verify-secret-read-mutants.mjs +143 -0
  555. package/dist/tools/definitions/analytics.d.ts +0 -40
  556. package/dist/tools/definitions/analytics.js +0 -233
  557. package/dist/tools/definitions/analytics.js.map +0 -1
  558. package/dist/tools/definitions/broadcast-mailing-variants.d.ts +0 -41
  559. package/dist/tools/definitions/broadcast-mailing-variants.js +0 -194
  560. package/dist/tools/definitions/broadcast-mailing-variants.js.map +0 -1
  561. package/dist/tools/definitions/dialogue-audit.d.ts +0 -38
  562. package/dist/tools/definitions/dialogue-audit.js +0 -292
  563. package/dist/tools/definitions/dialogue-audit.js.map +0 -1
  564. package/dist/tools/definitions/getcourse-wave.js +0 -519
  565. package/dist/tools/definitions/getcourse-wave.js.map +0 -1
  566. package/dist/tools/definitions/operational-overview.d.ts +0 -3
  567. package/dist/tools/definitions/operational-overview.js +0 -23
  568. package/dist/tools/definitions/operational-overview.js.map +0 -1
  569. package/dist/tools/definitions/scheduled-tasks.js +0 -173
  570. package/dist/tools/definitions/scheduled-tasks.js.map +0 -1
  571. package/dist/tools/definitions/trigger-contact-claims.d.ts +0 -7
  572. package/dist/tools/definitions/trigger-contact-claims.js +0 -60
  573. package/dist/tools/definitions/trigger-contact-claims.js.map +0 -1
  574. package/dist/tools/registry-mapping-cases-core.d.ts +0 -38
  575. package/dist/tools/registry-mapping-cases-core.js +0 -963
  576. package/dist/tools/registry-mapping-cases-core.js.map +0 -1
  577. package/dist/tools/registry-mapping-cases-platform.d.ts +0 -2
  578. package/dist/tools/registry-mapping-cases-platform.js +0 -1052
  579. package/dist/tools/registry-mapping-cases-platform.js.map +0 -1
  580. package/dist/tools/trigger-action-config.d.ts +0 -49
  581. package/dist/tools/trigger-action-config.js +0 -171
  582. package/dist/tools/trigger-action-config.js.map +0 -1
  583. package/docs/evals/model-behavior-scorecard.md +0 -80
  584. package/docs/operation-coverage.md +0 -114
  585. package/scripts/mock-credentials.js +0 -77
  586. package/scripts/model-eval-server.js +0 -213
  587. package/scripts/run-model-eval.js +0 -447
package/README.md CHANGED
@@ -4,6 +4,15 @@ Model Context Protocol server for Animaly / Besales.
4
4
 
5
5
  Status: public npm package candidate.
6
6
 
7
+ [Онлайн-MCP: подключение коллег к Claude Code и Codex CLI](docs/connect.ru.md#онлайн-mcp-подключение-коллег).
8
+
9
+ Channel responses include `desiredActive`, `isActive`, `readinessIssue`, and a localized
10
+ `readinessIssueText` on activation and settings surfaces. The client forwards `Accept-Language`
11
+ when a locale is configured. Missing permissions use a human explanation and remediation;
12
+ `requiredConnectScopes` and `deniedBy` preserve the structured recovery details. A permission
13
+ lost by the key creator names the scopes actually granted to that key. API contract types
14
+ must be regenerated from the updated API description with `BESALES_API_CONTRACTS_DIR=/path/to/besales-api/contracts yarn types:gen:api`.
15
+
7
16
  ## Install
8
17
 
9
18
  Requirements:
@@ -20,10 +29,10 @@ npx -y @besales/mcp status
20
29
  npx -y @besales/mcp
21
30
  ```
22
31
 
23
- `connect` opens the browser consent flow and stores an MCP API key plus the
24
- selected workspace in the local keychain. With one connection or an explicit session pin,
25
- workspace-level tools resolve it automatically. With several unpinned connections they refuse
26
- the call as ambiguous; inspect `besales_workspace_current` and select one deliberately.
32
+ `connect` opens the browser consent flow and stores an MCP API key plus the selected workspace in
33
+ the local keychain. With one connection or an explicit session pin, workspace-level tools resolve
34
+ it automatically. With several unpinned connections they refuse the call as ambiguous; inspect
35
+ `besales_workspace_current` and select one deliberately.
27
36
 
28
37
  For production, do not set `BESALES_API_BASE_URL` or
29
38
  `BESALES_OAUTH_AUTHORIZE_URL`. They default to:
@@ -31,24 +40,24 @@ For production, do not set `BESALES_API_BASE_URL` or
31
40
  - `BESALES_API_BASE_URL` → `https://core.besales.ai/api/v2` (backend API host —
32
41
  used for MCP tool calls)
33
42
  - `BESALES_OAUTH_AUTHORIZE_URL` →
34
- `https://app.besales.ai/settings/mcp/consent` (frontend bridge page — opened
35
- in the browser during `connect`; it mints a one-time setup ticket and forwards
36
- to the backend consent page. After approval `connect` receives a one-time `code`
37
- on the loopback callback and exchanges it with the PKCE `code_verifier` at
38
- `/api/v2/auth/mcp-token` — the API key never travels in a URL)
43
+ `https://core.besales.ai/api/v2/auth/mcp-connect/start` (the connect page served by the
44
+ API itself — opened in the browser during `connect`: sign in, choose the workspace and
45
+ approve the whole permission set; the page names every permission in words and which ones
46
+ your role does not allow. When unset it follows `BESALES_API_BASE_URL`. After approval
47
+ `connect` receives a one-time `code` on the loopback callback and exchanges it with the
48
+ PKCE `code_verifier` at `/api/v2/auth/mcp-token` — the API key never travels in a URL)
39
49
 
40
50
  For staging or local development override them per command:
41
51
 
42
52
  ```bash
43
53
  BESALES_API_BASE_URL=http://localhost:3000/api/v2 \
44
- BESALES_OAUTH_AUTHORIZE_URL=http://localhost:5173/settings/mcp/consent \
54
+ BESALES_OAUTH_AUTHORIZE_URL=http://localhost:3000/api/v2/auth/mcp-connect/start \
45
55
  npx -y @besales/mcp connect
46
56
  ```
47
57
 
48
58
  ## Configure Your MCP Host
49
59
 
50
- Step-by-step guide in Russian (Claude Code, Codex, several workspaces, updating):
51
- [docs/connect.ru.md](docs/connect.ru.md). Release order for maintainers: [RELEASING.md](RELEASING.md).
60
+ Сетевой режим работает без сессий: каждый POST независим, простой и перезапуск между запросами не требуют переподключения. Для подключения Claude Code и Codex к `https://mcp.besales.ai/mcp` с ключом из `besales-mcp key [workspace-id]` см. [сетевой режим](docs/modules/network-mode.md#подключение-claude-code-и-codex).
52
61
 
53
62
  After `connect`, add the server to your MCP host and restart the host.
54
63
 
@@ -85,13 +94,13 @@ command = "npx"
85
94
  args = ["-y", "@besales/mcp"]
86
95
  ```
87
96
 
88
- For staging/local backends, include both backend and frontend bridge URLs in the
89
- host env. For example:
97
+ For staging/local backends, set the backend URL in the host env; the connect page
98
+ follows it. For example:
90
99
 
91
100
  ```toml
92
101
  [mcp_servers.besales.env]
93
102
  BESALES_API_BASE_URL = "http://localhost:3000/api/v2"
94
- BESALES_OAUTH_AUTHORIZE_URL = "http://localhost:5173/settings/mcp/consent"
103
+ BESALES_OAUTH_AUTHORIZE_URL = "http://localhost:3000/api/v2/auth/mcp-connect/start"
95
104
  ```
96
105
 
97
106
  ## Multiple Workspaces
@@ -142,23 +151,16 @@ Workspace selection precedence, per tool call:
142
151
  2. an explicit `workspace_id` argument (only when the env var is not set).
143
152
  3. the session binding set by the `besales_workspace_use` tool (in-memory, this
144
153
  session/process only — see below).
145
- 4. the only connected workspace.
146
- 5. otherwise the call is refused — several workspaces are connected and none was
147
- chosen.
148
-
149
- **The global `active` workspace is not an implicit fallback.** It is set on the
150
- very first `connect` and never revisited, so using it silently would send calls
151
- to whichever workspace you happened to connect first — returning another
152
- workspace's data with no error at all. When several workspaces are connected and
153
- nothing above selects one, the call fails closed; the error names the current
154
- `active` so you can pass it explicitly if that is what you meant. With exactly
155
- one connection nothing changes. `besales_workspace_current` reports
156
- `source: "ambiguous"` and `workspace_id: null` in the same situation, so the
157
- diagnostic never claims a binding the real call would not use.
158
-
159
- `BESALES_WORKSPACE_ID` always overrides everything. `besales_workspace_current`
160
- lists names, safe account labels, UUIDs, the selection source, and label freshness.
161
- The assistant shows those names to the user and passes the chosen UUID itself.
154
+ 4. the only connected workspace (error if several are connected and none chosen).
155
+
156
+ The global `active` workspace set by `besales-mcp use <id>` is **not** an implicit
157
+ fallback: it is set on the very first `connect` and never revisited, so a call
158
+ without an explicit choice used to reach a different tenant and return its data
159
+ without any error. Ambiguity is now fail-closed — with several workspaces
160
+ connected you must pick one, and `active` is only suggested in the error text.
161
+ With exactly one connection nothing changed. `besales_workspace_current` lists
162
+ names, safe account labels, UUIDs, the selection source, and label freshness. The
163
+ assistant shows those names to the user and passes the chosen UUID itself.
162
164
 
163
165
  ### GUI hosts without per-session env (e.g. Claude Desktop)
164
166
 
@@ -186,9 +188,12 @@ Ask the assistant to call **`besales_workspace_use <workspaceId>`** to bind the
186
188
  current session in-memory. Each host session runs its own `besales-mcp` process,
187
189
  so it is per-session and touches neither the global `active` nor other sessions.
188
190
  Caveat: the binding is **in-memory only** — when the host respawns the server
189
- (reconnect, which GUI hosts do often), it is **lost and falls back to the global
190
- `active`**. Use it for a stable stretch, not as a durable lock; for that use the
191
- pinned named servers above. `besales_workspace_current` shows the current binding
191
+ (reconnect, which GUI hosts do often), it is **lost**, and with several
192
+ workspaces connected every call then fails until the assistant binds again.
193
+ There is no silent fallback to the global `active`: that fallback was removed
194
+ because it delivered another tenant's data without an error. Use the binding for
195
+ a stable stretch, not as a durable lock; for that use the pinned named servers
196
+ above. `besales_workspace_current` shows the current binding
192
197
  + source and lists connected workspaces; it is **refused** under a
193
198
  `BESALES_WORKSPACE_ID` pin (env wins).
194
199
 
@@ -216,20 +221,16 @@ Expected quick checks:
216
221
  4. External flows use `*_get_instructions`, execute stages locally in the host,
217
222
  then call the matching `*_submit` tool.
218
223
 
219
- If the host does not expose MCP resources to the model, ask the same request in ordinary words.
220
- The model can call `besales_help_search` and then `besales_help_get`; both tools read the same
221
- packaged documents as `besales://...` resources. `besales_help_get` returns a compact heading index
222
- by default, one section with `section`, or the complete document with `full=true`. See
224
+ If the host does not expose resources to the model, use `besales_help_search` and
225
+ `besales_help_get`. They read the same packaged documents as `besales://...`; get returns a heading
226
+ index by default, one section with `section`, or the whole document with `full=true`. See
223
227
  [`docs/help-navigation.md`](docs/help-navigation.md).
224
228
 
225
- Hosts with MCP prompts may also show five optional task entries: configure an agent, improve an
226
- agent, audit dialogues, build a campaign report, and diagnose a failure. They expand to the same
227
- ordinary instructions and tool navigation; a host without prompts loses no operation.
228
-
229
229
  To switch workspace, connect each one once (see [Multiple Workspaces](#multiple-workspaces))
230
- and either set `BESALES_WORKSPACE_ID` per host session or run
231
- `npx -y @besales/mcp use <workspaceId>`. No browser re-auth is needed once a
232
- workspace is connected.
230
+ and then choose it explicitly: set `BESALES_WORKSPACE_ID` per host session, or ask
231
+ the assistant for `besales_workspace_use <workspaceId>`. `npx -y @besales/mcp use
232
+ <workspaceId>` marks the workspace for CLI commands only — tools do not fall back
233
+ to it. No browser re-auth is needed once a workspace is connected.
233
234
 
234
235
  If a call asks for `workspace_id`, first run `besales_workspace_current`: the cause may be a real
235
236
  multi-workspace ambiguity, an env pin conflict, a missing key, or an old schema. Restart the host
@@ -243,14 +244,25 @@ marks their source. It never unions permissions from other MCP keys in the same
243
244
 
244
245
  ```bash
245
246
  yarn install
246
- yarn types:gen:api
247
- yarn types:gen:mcp
247
+ BESALES_API_CONTRACTS_DIR=/path/to/besales-api/contracts yarn contracts:sync:api
248
248
  yarn build
249
249
  ```
250
250
 
251
+ `contracts:sync:api` regenerates API types, selected tool schemas, the complete local route map and tool inventory from the explicit API checkout. It checks every HTTP tool and variant against the API method/path; the customer-only CRM reveal route is checked against its registered controller. It writes a working-tree audit and route export to `.codex-artifacts-bridge-train2/`, without modifying the API checkout or Git index. Signed `publish:mcp-registry` remains a separate step after the chair commits the bridge.
252
+
251
253
  The generated files in `src/types/` and `src/schemas/` are committed because
252
254
  the source contracts live outside this independent repository.
253
255
 
256
+ Prompt generation accepts optional `output_language`; prompt analysis accepts
257
+ optional `source_language`. The bridge sends them as `outputLanguage` and
258
+ `sourceLanguage`, without changing case or adding a default. Both accept
259
+ `ru`, `en`, `es`, `id`, `uz` and other valid external bot language codes such as `kk`.
260
+ When omitted, the API keeps the bot language, then the workspace language.
261
+ `style_hints.language` (`ru`/`en`) controls stage reasoning only. Follow the returned
262
+ `languageContext` throughout authoring and show the selected language before applying.
263
+ The Zod definitions are the source for these fields in `mcp-tools.json`; derive them
264
+ with `z.toJSONSchema` (`io: 'input'`) and preserve the surrounding registry metadata.
265
+
254
266
  Run a lightweight local mock API for MCP Inspector tool-call smoke tests:
255
267
 
256
268
  Terminal 1:
@@ -271,7 +283,7 @@ real `besales-mcp connect` credentials. They can overwrite or clear a local real
271
283
  connection for the current macOS user.
272
284
 
273
285
  The mock server only verifies request wiring. Live tool E2E depends on the
274
- matching `ai-aniomaly` `/api/v2/*` endpoints.
286
+ matching `besales-api` `/api/v2/*` endpoints.
275
287
  Remove seeded mock credentials after smoke testing:
276
288
 
277
289
  ```bash
@@ -283,7 +295,7 @@ yarn dev:mock:clear
283
295
  ```bash
284
296
  node bin/besales-mcp.js connect # connect (or refresh) a workspace
285
297
  node bin/besales-mcp.js connections # list connected workspaces (* = active)
286
- node bin/besales-mcp.js use <workspaceId> # set the active (default) workspace
298
+ node bin/besales-mcp.js use <workspaceId> # mark a workspace active for CLI commands
287
299
  node bin/besales-mcp.js status # show the active workspace
288
300
  node bin/besales-mcp.js disconnect # disconnect the active workspace only
289
301
  node bin/besales-mcp.js disconnect <id> # disconnect one workspace
@@ -293,8 +305,9 @@ node bin/besales-mcp.js # start the MCP server
293
305
 
294
306
  `BESALES_API_BASE_URL` defaults to `https://core.besales.ai/api/v2` (backend).
295
307
  `BESALES_OAUTH_AUTHORIZE_URL` defaults to
296
- `https://app.besales.ai/settings/mcp/consent` (frontend bridge). For local
297
- development point them at your local backend and frontend respectively.
308
+ `https://core.besales.ai/api/v2/auth/mcp-connect/start` (connect page on the API; follows
309
+ `BESALES_API_BASE_URL` when unset). For local development point the API URL at your local
310
+ backend.
298
311
 
299
312
  `BESALES_MCP_RESULT_ENVELOPE=on` turns on the response size ceiling: oversized
300
313
  answers are shaped or refused instead of flooding the caller's context. It is
@@ -323,66 +336,47 @@ For production users, do not set `BESALES_API_BASE_URL` or
323
336
  npx -y @besales/mcp connect
324
337
  ```
325
338
 
326
- The browser consent flow stores the connected workspace key in the local
327
- keychain. Workspace-level tools default to the session's workspace, so users
328
- should not provide `workspace_id` manually. To work with several workspaces,
329
- connect each once and pin sessions via `BESALES_WORKSPACE_ID` (or switch the
330
- global default with `besales-mcp use <id>`) — see
339
+ The browser consent flow stores the connected workspace key in the local keychain. One connection
340
+ or a session pin resolves automatically; several unpinned connections remain ambiguous. To work
341
+ with several workspaces, connect each once and pin sessions via `BESALES_WORKSPACE_ID` (or switch
342
+ the global default with `besales-mcp use <id>`) — see
331
343
  [Multiple Workspaces](#multiple-workspaces).
332
344
 
333
- ## Available tools (253 tools by category)
345
+ ## Available tools (by category)
334
346
 
335
- Итог и категории строятся из активных имён `src/schemas/mcp-tools.json`. Тест сверяет этот блок,
336
- `summary.tools_by_category` и сумму категорий с `tools.length`.
347
+ The total and categories come from active names in `src/schemas/mcp-tools.json`.
348
+ `node scripts/generate-crm-rotation-contract.mjs` regenerates the summary and table below
349
+ from those names after building the package. A test compares this block and
350
+ `summary.tools_by_category` with `tools.length`.
337
351
 
338
352
  <!-- BEGIN GENERATED TOOL INVENTORY -->
353
+
339
354
  | Category | Tools | Name prefixes |
340
355
  |---|---:|---|
341
356
  | Workspace, help, tasks and audit | 18 | `workspace_*`, `help_*`, `task_*`, `audit_*` |
342
- | Agents, behavior and routing | 14 | `agent_*`, `behavior_*`, `facts_*`, `pipeline_*`, `routing_*`, `router_*` |
343
- | Prompts, sandbox and evaluation | 33 | `prompt_*`, `qa_*`, `sandbox_*`, `simulation_*`, `test_*`, `model_*` |
344
- | ICP | 9 | `icp_*` |
345
- | Knowledge, workbooks, files and variables | 50 | `knowledge_*`, `workbook_*`, `feedback_*`, `variable_*`, `file_*` |
346
- | CRM and data sources | 27 | `crm_*`, `datasource_*` |
347
- | Channels and external API credentials | 14 | `platform_*`, `external_*` |
348
- | Dialogues and contacts | 16 | `dialogue_*`, `dialogues_*`, `dialog_*`, `contact_*` |
357
+ | Agents, behavior and routing | 15 | `agent_*`, `behavior_*`, `facts_*`, `pipeline_*`, `routing_*`, `router_*` |
358
+ | Prompts, sandbox and evaluation | 40 | `prompt_*`, `qa_*`, `sandbox_*`, `simulation_*`, `test_*`, `model_*`, `improvement_*` |
359
+ | ICP | 11 | `icp_*` |
360
+ | Knowledge, workbooks, files and variables | 52 | `knowledge_*`, `workbook_*`, `feedback_*`, `variable_*`, `file_*` |
361
+ | CRM and data sources | 30 | `crm_*`, `datasource_*` |
362
+ | Channels and external API credentials | 16 | `platform_*`, `external_*`, `get_*` |
363
+ | Dialogues and contacts | 33 | `dialogue_*`, `dialogues_*`, `dialog_*`, `contact_*` |
349
364
  | Triggers | 5 | `trigger_*` |
350
- | Outbound, follow-up and analytics | 67 | `broadcast_*`, `getcourse_*`, `wazzup_*`, `followup_*`, `scheduled_*`, `tracked_*`, `link_*`, `inbound_*`, `funnel_*`, `ai_*`, `custom_*` |
365
+ | Outbound, follow-up and analytics | 72 | `broadcast_*`, `getcourse_*`, `wazzup_*`, `followup_*`, `scheduled_*`, `tracked_*`, `link_*`, `ai_*`, `funnel_*`, `inbound_*`, `custom_*` |
366
+
351
367
  <!-- END GENERATED TOOL INVENTORY -->
352
368
 
353
369
  Recent capabilities:
354
370
 
355
- - **Intent navigation** — `besales_workspace_navigate` combines the requested task, bot type,
356
- selected objects and live workspace overview into one next tool call, required user input and a
357
- result check. It does not perform the recommended mutation.
358
- - **Complete async lifecycle** — every background start has a read-only status tool; see
359
- [docs/async-operation-lifecycle.md](docs/async-operation-lifecycle.md). Contact imports and a
360
- single cold-welcome launch use `besales_getcourse_contact_import_status`; anchor refresh uses
361
- `besales_getcourse_anchor_refresh_status` and reports a lost worker as `STALLED`.
362
- - **Funnel test outside the web UI** — `besales_followup_funnel_test_plan` freezes expanded
363
- texts and dynamic generations under one `runId`; `start` sends exactly that snapshot to the
364
- live contact and requires both `explicit_confirmation=true` and `confirmation_reason`.
365
- Status/cancel wrap the durable 15-second-gap run. All four tools require the dedicated
366
- `mcp:funnel-test` scope, which is not covered by `mcp:*`.
367
- - **Prompt lint diagnostics** — a rejected `besales_prompt_patch_commit` now carries the
368
- backend's `lintIssues` (up to 3, e.g. the exact character count over the 80000 hard
369
- limit) instead of a bare 400. `besales_prompt_headroom` answers the same question
370
- *before* a draft is built; `besales_prompt_diff` compares two agents' prompts without
371
- pulling both full texts into context.
372
- - **Fleet prompt rollout** — `besales_prompt_batch_start` applies one set of patch
373
- operations across many agents as a background run (33 agents × 3 calls do not fit the
374
- 60s client timeout). Every agent is prepared and fully linted first; only those that
375
- pass are committed. Poll `besales_prompt_batch_status`; roll forward the failures with
376
- `besales_prompt_batch_resume` — never by starting a second run.
377
371
  - **OAuth PKCE provisioning** — `besales_platform_create_oauth_init` opens the
378
372
  authorization flow in the browser for Instagram/Avito so the OAuth code never
379
373
  passes through the LLM.
380
374
  - **CRM connection via browser-secrets** — `besales_crm_create_init` provisions
381
375
  AmoCRM/Bitrix24 (and GetCourse/Telegram) using the Setup URL pattern, where the
382
376
  user pastes credentials in the browser instead of through the chat.
383
- - **External API credential handoff** — channel create/key rotation/secret rotation
384
- return `revealUrl` and its expiry. The signed-in user opens that page to receive
385
- credentials once; keys and webhook secrets never enter MCP content or host logs.
377
+ - **External API credential handoff** — create and rotate tools return a short-lived
378
+ `revealUrl`; a signed-in user opens it to receive credentials without exposing them
379
+ to the MCP transcript. The previous credentials remain valid until that page is opened.
386
380
  - **Setup URL pattern** — `*_init` returns a one-time URL; the user completes
387
381
  sensitive input in the browser and the host polls `*_status` until ready.
388
382
  - **External execution pairs** — schemas returned by `*_get_instructions` use canonical
@@ -393,32 +387,14 @@ Recent capabilities:
393
387
  - **Platform provisioning & clone** — create channels and clone an existing
394
388
  platform configuration (`besales_platform_clone_preview` / `_execute`).
395
389
  - **Knowledge ingestion** — full namespace/document/Q&A/website/table CRUD plus
396
- workbook ingestion from xlsx and Google Sheets. `besales_workbook_inspect` inventories
397
- sheets and returns a bounded sample; `besales_workbook_sheet_read` pages through late rows
398
- and columns with source identity and a page fingerprint. Metadata/classification and
399
- archival are available through dedicated workbook tools. Namespace/table reindex returns
400
- a job ID; poll the matching `_reindex_status` tool to a terminal state instead of reading
401
- worker logs.
402
- - **GetCourse wave-run batches** — queue 1–10 status-mode segments sequentially
403
- through `besales_getcourse_wave_run_batch_start`; use one `_batch_status` poll,
404
- reuse a generated `batch_key` on retry, and resume only after resolving two
405
- consecutive rejected segments. `UNKNOWN` и небезопасный `FAILED` жёстко
406
- блокируются между волнами; repeat mode не является обходом неопределённого исхода.
407
- Контакты import/run/batch принимают `email`, `phone`, `first_name`, `last_name` и передают их
408
- backend-у без потери snake_case→camelCase.
409
- - **Broadcast mailing variants** — `besales_broadcast_mailing_variant_list/create/update/delete`;
410
- архивирование через delete или `update(archived=true)` требует `explicit_confirmation=true`
411
- управляют workspace-каталогом «Вариантов рассылки». Передавай выбранный UUID как
412
- `mailing_variant_id` в direct, durable или batch GetCourse wave; analytics принимает тот же
413
- фильтр. Удаление использованного варианта архивирует его и сохраняет историю когорт.
414
- - **GetCourse school bindings** — `besales_platform_settings_update` принимает
415
- `getcourse_settings.wave_field_bindings`: роли `launch_type/product/segment/funnel/channels`
416
- связываются с numeric custom-field ID сделки; `product_value_source` выбирает код или название
417
- продукта, а `null` очищает настройку школы.
390
+ workbook ingestion from xlsx and Google Sheets. Inspect is a bounded inventory;
391
+ `besales_workbook_sheet_read` traverses late rows and columns with source identity,
392
+ truncation evidence and a page fingerprint. Dedicated tools expose saved classification
393
+ and archival state.
418
394
 
419
395
  ## Resources
420
396
 
421
- The package exposes 38 MCP resources. The dialogue-audit workflow is:
397
+ The package exposes the MCP resources declared in `src/schemas/mcp-tools.json`. The dialogue-audit workflow is:
422
398
 
423
399
  - `besales://workflows/audit-dialogues`
424
400
 
@@ -438,7 +414,10 @@ Inspect them locally:
438
414
  yarn dlx @modelcontextprotocol/inspector node bin/besales-mcp.js
439
415
  ```
440
416
 
441
- The Inspector should show 253 tools, 38 resources, and 5 optional prompts.
417
+ The Inspector should show all active tools declared in `src/schemas/mcp-tools.json`,
418
+ the resources declared in `src/schemas/mcp-tools.json`, and 5 optional task prompts. Prompts are shortcuts for configuring
419
+ or improving an agent, dialogue audit, campaign reporting, and diagnostics; the
420
+ same scenarios remain available as ordinary requests on hosts without prompts.
442
421
 
443
422
  ## Codex Dialogue Audit Skill
444
423
 
@@ -476,59 +455,25 @@ Host-specific local setup and smoke steps for MCP Inspector, Claude Desktop,
476
455
  Claude Code, and Codex CLI are documented in
477
456
  [docs/host-setup.md](docs/host-setup.md).
478
457
 
458
+ Правило переноса возможностей прежней линии (домен в `besales-api` раньше инструмента) и
459
+ состояние переноса зафиксированы в
460
+ [docs/main-transfer-dependencies.md](docs/main-transfer-dependencies.md).
461
+
479
462
  ## Scope
480
463
 
481
464
  - Claude Desktop / Claude Code / Codex call this package through MCP.
482
- - This package calls Animaly only through `ai-aniomaly` `/api/v2/*`.
465
+ - This package calls Besales only through `besales-api` `/api/v2/*`.
483
466
  - Direct calls to `prompt-services` are intentionally out of scope.
484
467
 
485
- The package exposes 253 active MCP tools from `src/schemas/mcp-tools.json`.
468
+ The package exposes the MCP tools declared in `src/schemas/mcp-tools.json`.
486
469
 
487
470
  ### Token scopes
488
471
 
489
- `besales-mcp connect` requests one canonical set, declared as `MCP_OAUTH_SCOPES`
490
- in `src/auth/oauth-client.ts`:
491
-
492
- | Scope | Covers |
493
- |---|---|
494
- | `mcp:*` | composite base — reads, PromptHub, ICP, sandbox, knowledge, dialogue export, analytics aggregates |
495
- | `mcp:platform-setup` | setup mutations: knowledge ingestion, variables, CRM pipelines, platform settings/provisioning, clone, the Platform Setup Bridge, waves |
496
- | `mcp:funnel-test` | frozen follow-up funnel test against a live person |
497
- | `read:campaigns` | cold-welcome preview, broadcast reads and their message texts |
498
- | `launch:campaigns` | cold-welcome and broadcast launches |
499
- | `read:contacts` | contact search, cards, and safe diagnostics |
500
- | `write:operators` | CAS-protected workspace-operator assignment; no message send or CRM mutation |
501
-
502
- None of these is implied by another: a plain `mcp:*` key authorizes neither setup
503
- mutations nor campaigns, and `mcp:platform-setup` does not imply the right to send
504
- to real people. Existing connections are never widened silently — after upgrading,
505
- reconnect once to be granted a newly added scope.
506
-
507
- > **⚠️ Invariant — the scope set only ever GROWS.**
508
- > A new scope is **appended** to `MCP_OAUTH_SCOPES`; existing entries are never removed,
509
- > renamed or reordered. Replacing an entry silently narrows every key issued from then on,
510
- > and `connect` gives no sign of it: consent opens, the key is issued, tools load, and the
511
- > loss only surfaces much later as a 403 from one endpoint. That is exactly how
512
- > `read:campaigns` + `launch:campaigns` were lost when `mcp:funnel-test` was added
513
- > (2026-08-19) — the set used to be one flat string, and the string was rewritten.
514
- > The same rule applies to the backend's `MCP_OPTIONAL_CONNECT_SCOPES`, the consent-page
515
- > allowlist `OPTIONAL_OAUTH_SCOPES`, and the `scope` enum in the OpenAPI contract:
516
- > add a line, never swap one.
517
-
518
- `connect` prints the granted set, and warns on stderr when the new key carries fewer
519
- permissions than the one it replaces:
520
-
521
- ```
522
- Connected to workspace Animaly [de86534d-…] (key: mcp_a1b2…, account: o***@besales.ai).
523
- Scopes: mcp:* mcp:platform-setup mcp:funnel-test read:campaigns launch:campaigns read:contacts write:operators
524
- Active workspace: de86534d-….
525
-
526
- WARNING: this key has FEWER permissions than the one it replaced.
527
- Lost: read:campaigns, launch:campaigns
528
- Tools needing them will fail with 403 "API key does not have required scopes".
529
- Update the client (npx -y @besales/mcp@latest) and run `besales-mcp connect` again.
530
- ```
472
+ Read and PromptHub/ICP/sandbox operations are covered by the composite `mcp:*`
473
+ scope granted during `connect`. Setup mutations (knowledge ingestion, variables,
474
+ CRM pipelines, platform settings/provisioning, clone, the Platform Setup Bridge,
475
+ etc.) additionally require the `mcp:platform-setup` scope — a plain `mcp:*` key
476
+ on its own does not authorize setup mutations.
531
477
 
532
- The comparison is made by the backend (`dropped_scopes` in the `/auth/mcp-token`
533
- response) against the newest live MCP key of that workspace — the client cannot read
534
- an old key's scopes on its own.
478
+ Приём прежних настроек пересказа диалога и поиска по знаниям описан в
479
+ [docs/legacy-action-settings.md](docs/legacy-action-settings.md).
@@ -0,0 +1,35 @@
1
+ # MCP для собственной установки
2
+
3
+ Мост запускается на компьютере пользователя MCP-хоста, не на сервере API. Поставщик передаёт архив под его ОС/архитектуру, готовые production dependencies (включая native keytar), `onprem.json` и Node.js ≥20. Сборка и доступ к npm клиенту не нужны. На Linux нужен libsecret и работающая пользовательская служба Secret Service; macOS использует Keychain, Windows — Credential Manager.
4
+
5
+ Распакуй архив в постоянный каталог. Проверь SHA-256, полученный с поставкой. Используй отдельный профиль ОС для этой установки: стандартный keychain service `@besales/mcp` общий с облачным мостом. Не копируй облачные credentials. Затем:
6
+
7
+ ```sh
8
+ node /absolute/besales-mcp/bin/besales-onprem.mjs connect
9
+ node /absolute/besales-mcp/bin/besales-onprem.mjs status
10
+ ```
11
+
12
+ Браузер открывает `https://<домен-клиента>/api/v2/auth/mcp-connect/start`. Одноразовый код возвращается на `http://127.0.0.1:<случайный-порт>/oauth-callback`; PKCE-обмен идёт на `https://<домен-клиента>/api/v2/auth/mcp-token`. Нужен браузер на этом же компьютере и доступ к HTTPS API. API должен иметь собственный `MCP_CONNECT_CONSENT_SECRET` (создаётся `init-config.sh`). Все проверки доступа, согласие, scopes и PKCE остаются штатными.
13
+
14
+ Настройка MCP-хоста (обычный stdio):
15
+
16
+ ```json
17
+ {
18
+ "mcpServers": {
19
+ "besales-client": {
20
+ "command": "node",
21
+ "args": ["/absolute/besales-mcp/bin/besales-onprem.mjs"],
22
+ "env": {
23
+ "BESALES_API_BASE_URL": "https://app.customer.example/api/v2",
24
+ "BESALES_OAUTH_AUTHORIZE_URL": "https://app.customer.example/api/v2/auth/mcp-connect/start"
25
+ }
26
+ }
27
+ }
28
+ }
29
+ ```
30
+
31
+ В этой поставке launcher всегда берёт оба адреса из `onprem.json` до загрузки клиента: чужие значения окружения MCP-хоста не переключают установку на облако. Не запускай `dist/cli.js` напрямую. При смене домена получи новый конфигурационный файл от администратора и подключись заново.
32
+
33
+ На сервере мост не хранит данные и не нуждается в PostgreSQL/Redis/томе. Архив и `onprem.json` сохраняются вместе с поставкой; ключи — в защищённом хранилище ОС пользователя. Для восстановления на другом компьютере распакуй архив подходящей платформы и выполни `connect` заново. Для отзыва используй штатное отключение ключа в API и `disconnect --all`.
34
+
35
+ Поставщику: в отдельной Linux/macOS/Windows build-копии с immutable install выполни `node scripts/build-onprem.mjs https://app.customer.example/api/v2 /new/output`, затем архивируй output и передай SHA-256. Скрипт переводит build-копию зависимостей в production, поэтому не запускай его в рабочем дереве разработчика.
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { runHttpMcpServer } from '../dist/http-server.js';
4
+ import { logger } from '../dist/utils/logger.js';
5
+
6
+ runHttpMcpServer().catch(() => {
7
+ logger.error('Could not start Besales MCP HTTP server');
8
+ process.exit(1);
9
+ });
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ // Конфигурация поставщика обязательна; настройки чужого MCP-хоста её не заменяют.
3
+ import { readFileSync } from 'node:fs';
4
+ const config = JSON.parse(readFileSync(new URL('../onprem.json', import.meta.url), 'utf8'));
5
+ const base = new URL(config.apiBaseUrl);
6
+ if (
7
+ base.protocol !== 'https:' ||
8
+ base.username ||
9
+ base.password ||
10
+ base.search ||
11
+ base.hash ||
12
+ base.pathname !== '/api/v2' ||
13
+ config.oauthAuthorizeUrl !== `${base.href}/auth/mcp-connect/start`
14
+ )
15
+ throw new Error('Invalid customer MCP configuration');
16
+ process.env.BESALES_API_BASE_URL = base.href;
17
+ process.env.BESALES_OAUTH_AUTHORIZE_URL = config.oauthAuthorizeUrl;
18
+ const { runCli } = await import('../dist/cli.js');
19
+ process.exitCode = await runCli();
@@ -46,7 +46,9 @@ export declare class ConnectionStore {
46
46
  * на rejected состоянии и повторить при следующем вызове.
47
47
  */
48
48
  migrateLegacy(): Promise<void>;
49
- list(): Promise<ConnectionMeta[]>;
49
+ list({ strict }?: {
50
+ readonly strict?: boolean;
51
+ }): Promise<ConnectionMeta[]>;
50
52
  getKey(workspaceId: string): Promise<string | null>;
51
53
  getActive(): Promise<string | null>;
52
54
  setActive(workspaceId: string): Promise<void>;
@@ -45,8 +45,8 @@ export class ConnectionStore {
45
45
  }
46
46
  return this.legacyMigrationPromise;
47
47
  }
48
- async list() {
49
- return this.readIndex();
48
+ async list({ strict = false } = {}) {
49
+ return this.readIndex(strict);
50
50
  }
51
51
  async getKey(workspaceId) {
52
52
  return this.storage.get(keyAccount(workspaceId));
@@ -193,7 +193,7 @@ export class ConnectionStore {
193
193
  await this.storage.delete(LEGACY_WORKSPACE_ID_ACCOUNT);
194
194
  logger.info({ workspaceId: legacyWorkspaceId }, 'Migrated legacy credentials to multi-workspace store');
195
195
  }
196
- async readIndex() {
196
+ async readIndex(strict = false) {
197
197
  const raw = await this.storage.get(INDEX_ACCOUNT);
198
198
  if (!raw) {
199
199
  return [];
@@ -201,11 +201,17 @@ export class ConnectionStore {
201
201
  try {
202
202
  const parsed = JSON.parse(raw);
203
203
  if (!Array.isArray(parsed)) {
204
+ if (strict)
205
+ throw new Error('Connection index is corrupt.');
204
206
  return [];
205
207
  }
208
+ if (strict && !parsed.every(isConnectionMeta))
209
+ throw new Error('Connection index is corrupt.');
206
210
  return parsed.filter(isConnectionMeta);
207
211
  }
208
212
  catch {
213
+ if (strict)
214
+ throw new Error('Connection index is corrupt.');
209
215
  logger.warn('Connection index is corrupt — treating as empty');
210
216
  return [];
211
217
  }
@@ -1 +1 @@
1
- {"version":3,"file":"connection-store.js","sourceRoot":"","sources":["../../src/auth/connection-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAEL,sBAAsB,EACtB,2BAA2B,EAC3B,YAAY,GACb,MAAM,oBAAoB,CAAC;AAE5B,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC;AACvC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,wEAAwE;AACxE,MAAM,UAAU,UAAU,CAAC,WAAmB;IAC5C,OAAO,GAAG,kBAAkB,GAAG,WAAW,EAAE,CAAC;AAC/C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