@wirecat/bitrix24-cli 0.0.0-stage → 0.1.0

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 (245) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/LICENSE +204 -0
  3. package/README.md +17 -2
  4. package/dist/api-keys.d.ts +21 -0
  5. package/dist/api-keys.d.ts.map +1 -0
  6. package/dist/api-keys.js +58 -0
  7. package/dist/api-keys.js.map +1 -0
  8. package/dist/bin/b24.d.ts +3 -0
  9. package/dist/bin/b24.d.ts.map +1 -0
  10. package/dist/bin/b24.js +40 -0
  11. package/dist/bin/b24.js.map +1 -0
  12. package/dist/bitrix/errors.d.ts +22 -0
  13. package/dist/bitrix/errors.d.ts.map +1 -0
  14. package/dist/bitrix/errors.js +76 -0
  15. package/dist/bitrix/errors.js.map +1 -0
  16. package/dist/bitrix/methods.d.ts +13 -0
  17. package/dist/bitrix/methods.d.ts.map +1 -0
  18. package/dist/bitrix/methods.js +33 -0
  19. package/dist/bitrix/methods.js.map +1 -0
  20. package/dist/bitrix/transport.d.ts +50 -0
  21. package/dist/bitrix/transport.d.ts.map +1 -0
  22. package/dist/bitrix/transport.js +189 -0
  23. package/dist/bitrix/transport.js.map +1 -0
  24. package/dist/bitrix/webhook.d.ts +14 -0
  25. package/dist/bitrix/webhook.d.ts.map +1 -0
  26. package/dist/bitrix/webhook.js +29 -0
  27. package/dist/bitrix/webhook.js.map +1 -0
  28. package/dist/bundle/all-profiles-QJ444GSX.js +24 -0
  29. package/dist/bundle/anthropic-RHRAVHC2.js +70 -0
  30. package/dist/bundle/app-server-QIT6S7AZ.js +224 -0
  31. package/dist/bundle/b24.js +32 -0
  32. package/dist/bundle/bun-H6RSODZ3.js +169 -0
  33. package/dist/bundle/bun-sqlite-BO4LTQHX.js +69 -0
  34. package/dist/bundle/chunk-2KCZ7BKW.js +215 -0
  35. package/dist/bundle/chunk-2SNUMZ7S.js +1028 -0
  36. package/dist/bundle/chunk-45AKJVKV.js +24 -0
  37. package/dist/bundle/chunk-4PDYYS5K.js +2 -0
  38. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  39. package/dist/bundle/chunk-6WY72XVQ.js +216 -0
  40. package/dist/bundle/chunk-7GRZAKBB.js +639 -0
  41. package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
  42. package/dist/bundle/chunk-BCF7P4FZ.js +558 -0
  43. package/dist/bundle/chunk-CNNEA2M4.js +54 -0
  44. package/dist/bundle/chunk-CXL33BFL.js +570 -0
  45. package/dist/bundle/chunk-CZ23EVP4.js +1691 -0
  46. package/dist/bundle/chunk-D5S6QV6R.js +95 -0
  47. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  48. package/dist/bundle/chunk-DTXERR44.js +35 -0
  49. package/dist/bundle/chunk-EVYSBZ3I.js +153 -0
  50. package/dist/bundle/chunk-EXOOKUEA.js +82 -0
  51. package/dist/bundle/chunk-FLUEXJ4X.js +53 -0
  52. package/dist/bundle/chunk-FOTREPNS.js +366 -0
  53. package/dist/bundle/chunk-FZL7F5NR.js +2022 -0
  54. package/dist/bundle/chunk-H2ADPPSH.js +50910 -0
  55. package/dist/bundle/chunk-HAXNUIGQ.js +1245 -0
  56. package/dist/bundle/chunk-HGL63O5V.js +288 -0
  57. package/dist/bundle/chunk-INFYLWUA.js +929 -0
  58. package/dist/bundle/chunk-IRV2PCQ2.js +5213 -0
  59. package/dist/bundle/chunk-K3UIB6ZF.js +45 -0
  60. package/dist/bundle/chunk-LRGYKOCP.js +91 -0
  61. package/dist/bundle/chunk-LSPIOT6Z.js +459 -0
  62. package/dist/bundle/chunk-MBDK4YXG.js +34 -0
  63. package/dist/bundle/chunk-N6FLBXZS.js +73 -0
  64. package/dist/bundle/chunk-OTD2ZRXD.js +161 -0
  65. package/dist/bundle/chunk-P33NDCDI.js +78 -0
  66. package/dist/bundle/chunk-P364PLIK.js +257 -0
  67. package/dist/bundle/chunk-PH5FZX6E.js +193 -0
  68. package/dist/bundle/chunk-POC3V3AO.js +36616 -0
  69. package/dist/bundle/chunk-QC53QBNC.js +143 -0
  70. package/dist/bundle/chunk-QGMDQ2PM.js +122 -0
  71. package/dist/bundle/chunk-QIPTIUMJ.js +281 -0
  72. package/dist/bundle/chunk-QMPN6WKD.js +3512 -0
  73. package/dist/bundle/chunk-QQXH2OPB.js +594 -0
  74. package/dist/bundle/chunk-QSNROIJL.js +413 -0
  75. package/dist/bundle/chunk-RRJNNPR4.js +76 -0
  76. package/dist/bundle/chunk-SFRNX2TI.js +6848 -0
  77. package/dist/bundle/chunk-SGRYYE4X.js +266 -0
  78. package/dist/bundle/chunk-TE3FR6MI.js +884 -0
  79. package/dist/bundle/chunk-U5ACMCAQ.js +12049 -0
  80. package/dist/bundle/chunk-VEWWAGTD.js +2315 -0
  81. package/dist/bundle/chunk-VL6SPMZV.js +194 -0
  82. package/dist/bundle/chunk-WII44RXN.js +58 -0
  83. package/dist/bundle/chunk-WKRQ44EH.js +528 -0
  84. package/dist/bundle/chunk-WTPMJYMD.js +8308 -0
  85. package/dist/bundle/chunk-XD4FRDSL.js +565 -0
  86. package/dist/bundle/chunk-XJXONOB5.js +63 -0
  87. package/dist/bundle/chunk-XNHSPHUN.js +48 -0
  88. package/dist/bundle/chunk-XRFJWHY5.js +131 -0
  89. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  90. package/dist/bundle/chunk-YYO7D2MO.js +783 -0
  91. package/dist/bundle/chunk-YZ5LHE5Q.js +31 -0
  92. package/dist/bundle/chunk-ZDQQCXFG.js +392 -0
  93. package/dist/bundle/chunk-ZEW4P6AH.js +158 -0
  94. package/dist/bundle/chunk-ZGZT5S6B.js +3480 -0
  95. package/dist/bundle/chunk-ZIAQPTUS.js +82 -0
  96. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  97. package/dist/bundle/command-contract-OKQOE6G4.js +30 -0
  98. package/dist/bundle/decode-5ZPLTYV6.js +160 -0
  99. package/dist/bundle/dist-PII6Z6X3.js +7577 -0
  100. package/dist/bundle/echarts-J6LAPIX7.js +42501 -0
  101. package/dist/bundle/embed-YG5LDHME.js +35 -0
  102. package/dist/bundle/embedder-7FNUA5OZ.js +108 -0
  103. package/dist/bundle/first-run-JPZNWIJN.js +23 -0
  104. package/dist/bundle/first-screen-VQM4MTS7.js +28 -0
  105. package/dist/bundle/instructions-AXWTQHMR.js +11 -0
  106. package/dist/bundle/mcp-7F46P6AM.js +165 -0
  107. package/dist/bundle/mcp-J5R5A65I.js +87 -0
  108. package/dist/bundle/mcp-WALJM6QX.js +160 -0
  109. package/dist/bundle/node-CWKAIOEM.js +176 -0
  110. package/dist/bundle/node-P4E63KXA.js +2340 -0
  111. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  112. package/dist/bundle/node-sqlite-LSEKVRDA.js +67 -0
  113. package/dist/bundle/oauth-THYNLRLD.js +17 -0
  114. package/dist/bundle/open-E47QYKFC.js +20 -0
  115. package/dist/bundle/openai-EWSGC3BC.js +227 -0
  116. package/dist/bundle/process-WKTEA3WE.js +91 -0
  117. package/dist/bundle/program-GO3RVP2H.js +20847 -0
  118. package/dist/bundle/prompt-CAQ7QR3U.js +12 -0
  119. package/dist/bundle/recognize-6KGHNZC3.js +23 -0
  120. package/dist/bundle/remote-3UO2WDC3.js +26 -0
  121. package/dist/bundle/rerank-2JVDPZBX.js +49 -0
  122. package/dist/bundle/serve-ES7AG5IK.js +19 -0
  123. package/dist/bundle/server-5LE5LNUQ.js +45 -0
  124. package/dist/bundle/server-BU4VBM6S.js +58 -0
  125. package/dist/bundle/state-7NH5G4XJ.js +33 -0
  126. package/dist/bundle/store-7O4JQD2Z.js +127 -0
  127. package/dist/bundle/store-maintenance-command-UDVGEY2D.js +47 -0
  128. package/dist/commands/api.d.ts +3 -0
  129. package/dist/commands/api.d.ts.map +1 -0
  130. package/dist/commands/api.js +130 -0
  131. package/dist/commands/api.js.map +1 -0
  132. package/dist/commands/crm-writes.d.ts +4 -0
  133. package/dist/commands/crm-writes.d.ts.map +1 -0
  134. package/dist/commands/crm-writes.js +182 -0
  135. package/dist/commands/crm-writes.js.map +1 -0
  136. package/dist/commands/crm.d.ts +3 -0
  137. package/dist/commands/crm.d.ts.map +1 -0
  138. package/dist/commands/crm.js +142 -0
  139. package/dist/commands/crm.js.map +1 -0
  140. package/dist/commands/doctor.d.ts +77 -0
  141. package/dist/commands/doctor.d.ts.map +1 -0
  142. package/dist/commands/doctor.js +74 -0
  143. package/dist/commands/doctor.js.map +1 -0
  144. package/dist/commands/mcp.d.ts +3 -0
  145. package/dist/commands/mcp.d.ts.map +1 -0
  146. package/dist/commands/mcp.js +97 -0
  147. package/dist/commands/mcp.js.map +1 -0
  148. package/dist/commands/session.d.ts +3 -0
  149. package/dist/commands/session.d.ts.map +1 -0
  150. package/dist/commands/session.js +101 -0
  151. package/dist/commands/session.js.map +1 -0
  152. package/dist/commands/write.d.ts +21 -0
  153. package/dist/commands/write.d.ts.map +1 -0
  154. package/dist/commands/write.js +47 -0
  155. package/dist/commands/write.js.map +1 -0
  156. package/dist/config.d.ts +9 -0
  157. package/dist/config.d.ts.map +1 -0
  158. package/dist/config.js +17 -0
  159. package/dist/config.js.map +1 -0
  160. package/dist/crm/conditions.d.ts +25 -0
  161. package/dist/crm/conditions.d.ts.map +1 -0
  162. package/dist/crm/conditions.js +78 -0
  163. package/dist/crm/conditions.js.map +1 -0
  164. package/dist/crm/deal.d.ts +27 -0
  165. package/dist/crm/deal.d.ts.map +1 -0
  166. package/dist/crm/deal.js +76 -0
  167. package/dist/crm/deal.js.map +1 -0
  168. package/dist/crm/items.d.ts +30 -0
  169. package/dist/crm/items.d.ts.map +1 -0
  170. package/dist/crm/items.js +76 -0
  171. package/dist/crm/items.js.map +1 -0
  172. package/dist/crm/lead.d.ts +36 -0
  173. package/dist/crm/lead.d.ts.map +1 -0
  174. package/dist/crm/lead.js +86 -0
  175. package/dist/crm/lead.js.map +1 -0
  176. package/dist/crm/organization.d.ts +32 -0
  177. package/dist/crm/organization.d.ts.map +1 -0
  178. package/dist/crm/organization.js +68 -0
  179. package/dist/crm/organization.js.map +1 -0
  180. package/dist/crm/person.d.ts +31 -0
  181. package/dist/crm/person.d.ts.map +1 -0
  182. package/dist/crm/person.js +68 -0
  183. package/dist/crm/person.js.map +1 -0
  184. package/dist/crm/pipeline.d.ts +17 -0
  185. package/dist/crm/pipeline.d.ts.map +1 -0
  186. package/dist/crm/pipeline.js +42 -0
  187. package/dist/crm/pipeline.js.map +1 -0
  188. package/dist/crm/product.d.ts +43 -0
  189. package/dist/crm/product.d.ts.map +1 -0
  190. package/dist/crm/product.js +42 -0
  191. package/dist/crm/product.js.map +1 -0
  192. package/dist/crm/stage.d.ts +20 -0
  193. package/dist/crm/stage.d.ts.map +1 -0
  194. package/dist/crm/stage.js +65 -0
  195. package/dist/crm/stage.js.map +1 -0
  196. package/dist/crm/user.d.ts +39 -0
  197. package/dist/crm/user.d.ts.map +1 -0
  198. package/dist/crm/user.js +54 -0
  199. package/dist/crm/user.js.map +1 -0
  200. package/dist/crm/values.d.ts +30 -0
  201. package/dist/crm/values.d.ts.map +1 -0
  202. package/dist/crm/values.js +50 -0
  203. package/dist/crm/values.js.map +1 -0
  204. package/dist/crm/walk.d.ts +19 -0
  205. package/dist/crm/walk.d.ts.map +1 -0
  206. package/dist/crm/walk.js +22 -0
  207. package/dist/crm/walk.js.map +1 -0
  208. package/dist/identity.d.ts +5 -0
  209. package/dist/identity.d.ts.map +1 -0
  210. package/dist/identity.js +18 -0
  211. package/dist/identity.js.map +1 -0
  212. package/dist/index.d.ts +3 -0
  213. package/dist/index.d.ts.map +1 -0
  214. package/dist/index.js +3 -0
  215. package/dist/index.js.map +1 -0
  216. package/dist/mcp.d.ts +29 -0
  217. package/dist/mcp.d.ts.map +1 -0
  218. package/dist/mcp.js +99 -0
  219. package/dist/mcp.js.map +1 -0
  220. package/dist/portal.d.ts +33 -0
  221. package/dist/portal.d.ts.map +1 -0
  222. package/dist/portal.js +46 -0
  223. package/dist/portal.js.map +1 -0
  224. package/dist/program.d.ts +6 -0
  225. package/dist/program.d.ts.map +1 -0
  226. package/dist/program.js +45 -0
  227. package/dist/program.js.map +1 -0
  228. package/dist/reasons.d.ts +10 -0
  229. package/dist/reasons.d.ts.map +1 -0
  230. package/dist/reasons.js +28 -0
  231. package/dist/reasons.js.map +1 -0
  232. package/dist/token.d.ts +12 -0
  233. package/dist/token.d.ts.map +1 -0
  234. package/dist/token.js +41 -0
  235. package/dist/token.js.map +1 -0
  236. package/dist/version.d.ts +2 -0
  237. package/dist/version.d.ts.map +1 -0
  238. package/dist/version.js +2 -0
  239. package/dist/version.js.map +1 -0
  240. package/dist/whoami.d.ts +8 -0
  241. package/dist/whoami.d.ts.map +1 -0
  242. package/dist/whoami.js +9 -0
  243. package/dist/whoami.js.map +1 -0
  244. package/package.json +83 -4
  245. package/skills/bitrix24-cli/SKILL.md +41 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ Notable changes to `@wirecat/bitrix24-cli`. One section per version, newest first.
4
+
5
+ ## 0.1.0 — 06.11.2026
6
+
7
+ ### Fixed
8
+
9
+ - An error reason that a newer cli-core also defines no longer makes every failing command crash instead of printing
10
+ its error.
11
+
12
+ ### Added
13
+
14
+ - Started from `@wirecat/cli-template` 0.14.0.
15
+ - The client for Bitrix24's REST API over an incoming webhook: REST 3.0 for deals, leads, contacts and companies,
16
+ REST 2 for the rest; the portal's rate limits paced and waited out; a write repeated only with an
17
+ `Idempotency-Key`; the webhook's secret kept out of every error and run record.
18
+ - `session start | status | end` per profile and `session list`: the webhook address read hidden or from stdin,
19
+ checked against the portal, kept in the keyring under `bitrix24-cli`; `session status --check` says whose rights
20
+ the webhook carries.
21
+ - `list` and `show` for `deals`, `leads`, `people` (contacts), `organizations` (companies), `pipelines`, `stages`
22
+ (with each stage's outcome), `products` and `users`, live from the portal. A list takes a query that becomes the
23
+ portal's own filter; a free word in it matches part of a title or name. A name two records share is refused with
24
+ both as candidates.
25
+ - `create` and `update` for `deals`, `leads`, `people` and `organizations`, and `move` for deals and leads: each
26
+ write answers its `operation_id`, which Bitrix24 receives as the `Idempotency-Key`, so `--operation-id` repeats a
27
+ write safely; `--dry-run` previews; assigning a record to another employee is denied until allowed
28
+ (`crm.assign-others`).
29
+ - `api list`, `api show <method>` and `api call <method> --body <json>`: any Bitrix24 method, on the REST version it
30
+ lives on, checking `api.<method>` and the command key it does the same as; messaging, automation, tasks and
31
+ `batch` writes are denied until allowed.
package/LICENSE ADDED
@@ -0,0 +1,204 @@
1
+ Copyright (c) 2026 Viacheslav Ptsarev
2
+
3
+
4
+ Apache License
5
+ Version 2.0, January 2004
6
+ http://www.apache.org/licenses/
7
+
8
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
9
+
10
+ 1. Definitions.
11
+
12
+ "License" shall mean the terms and conditions for use, reproduction,
13
+ and distribution as defined by Sections 1 through 9 of this document.
14
+
15
+ "Licensor" shall mean the copyright owner or entity authorized by
16
+ the copyright owner that is granting the License.
17
+
18
+ "Legal Entity" shall mean the union of the acting entity and all
19
+ other entities that control, are controlled by, or are under common
20
+ control with that entity. For the purposes of this definition,
21
+ "control" means (i) the power, direct or indirect, to cause the
22
+ direction or management of such entity, whether by contract or
23
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
24
+ outstanding shares, or (iii) beneficial ownership of such entity.
25
+
26
+ "You" (or "Your") shall mean an individual or Legal Entity
27
+ exercising permissions granted by this License.
28
+
29
+ "Source" form shall mean the preferred form for making modifications,
30
+ including but not limited to software source code, documentation
31
+ source, and configuration files.
32
+
33
+ "Object" form shall mean any form resulting from mechanical
34
+ transformation or translation of a Source form, including but
35
+ not limited to compiled object code, generated documentation,
36
+ and conversions to other media types.
37
+
38
+ "Work" shall mean the work of authorship, whether in Source or
39
+ Object form, made available under the License, as indicated by a
40
+ copyright notice that is included in or attached to the work
41
+ (an example is provided in the Appendix below).
42
+
43
+ "Derivative Works" shall mean any work, whether in Source or Object
44
+ form, that is based on (or derived from) the Work and for which the
45
+ editorial revisions, annotations, elaborations, or other modifications
46
+ represent, as a whole, an original work of authorship. For the purposes
47
+ of this License, Derivative Works shall not include works that remain
48
+ separable from, or merely link (or bind by name) to the interfaces of,
49
+ the Work and Derivative Works thereof.
50
+
51
+ "Contribution" shall mean any work of authorship, including
52
+ the original version of the Work and any modifications or additions
53
+ to that Work or Derivative Works thereof, that is intentionally
54
+ submitted to Licensor for inclusion in the Work by the copyright owner
55
+ or by an individual or Legal Entity authorized to submit on behalf of
56
+ the copyright owner. For the purposes of this definition, "submitted"
57
+ means any form of electronic, verbal, or written communication sent
58
+ to the Licensor or its representatives, including but not limited to
59
+ communication on electronic mailing lists, source code control systems,
60
+ and issue tracking systems that are managed by, or on behalf of, the
61
+ Licensor for the purpose of discussing and improving the Work, but
62
+ excluding communication that is conspicuously marked or otherwise
63
+ designated in writing by the copyright owner as "Not a Contribution."
64
+
65
+ "Contributor" shall mean Licensor and any individual or Legal Entity
66
+ on behalf of whom a Contribution has been received by Licensor and
67
+ subsequently incorporated within the Work.
68
+
69
+ 2. Grant of Copyright License. Subject to the terms and conditions of
70
+ this License, each Contributor hereby grants to You a perpetual,
71
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
72
+ copyright license to reproduce, prepare Derivative Works of,
73
+ publicly display, publicly perform, sublicense, and distribute the
74
+ Work and such Derivative Works in Source or Object form.
75
+
76
+ 3. Grant of Patent License. Subject to the terms and conditions of
77
+ this License, each Contributor hereby grants to You a perpetual,
78
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
79
+ (except as stated in this section) patent license to make, have made,
80
+ use, offer to sell, sell, import, and otherwise transfer the Work,
81
+ where such license applies only to those patent claims licensable
82
+ by such Contributor that are necessarily infringed by their
83
+ Contribution(s) alone or by combination of their Contribution(s)
84
+ with the Work to which such Contribution(s) was submitted. If You
85
+ institute patent litigation against any entity (including a
86
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
87
+ or a Contribution incorporated within the Work constitutes direct
88
+ or contributory patent infringement, then any patent licenses
89
+ granted to You under this License for that Work shall terminate
90
+ as of the date such litigation is filed.
91
+
92
+ 4. Redistribution. You may reproduce and distribute copies of the
93
+ Work or Derivative Works thereof in any medium, with or without
94
+ modifications, and in Source or Object form, provided that You
95
+ meet the following conditions:
96
+
97
+ (a) You must give any other recipients of the Work or
98
+ Derivative Works a copy of this License; and
99
+
100
+ (b) You must cause any modified files to carry prominent notices
101
+ stating that You changed the files; and
102
+
103
+ (c) You must retain, in the Source form of any Derivative Works
104
+ that You distribute, all copyright, patent, trademark, and
105
+ attribution notices from the Source form of the Work,
106
+ excluding those notices that do not pertain to any part of
107
+ the Derivative Works; and
108
+
109
+ (d) If the Work includes a "NOTICE" text file as part of its
110
+ distribution, then any Derivative Works that You distribute must
111
+ include a readable copy of the attribution notices contained
112
+ within such NOTICE file, excluding those notices that do not
113
+ pertain to any part of the Derivative Works, in at least one
114
+ of the following places: within a NOTICE text file distributed
115
+ as part of the Derivative Works; within the Source form or
116
+ documentation, if provided along with the Derivative Works; or,
117
+ within a display generated by the Derivative Works, if and
118
+ wherever such third-party notices normally appear. The contents
119
+ of the NOTICE file are for informational purposes only and
120
+ do not modify the License. You may add Your own attribution
121
+ notices within Derivative Works that You distribute, alongside
122
+ or as an addendum to the NOTICE text from the Work, provided
123
+ that such additional attribution notices cannot be construed
124
+ as modifying the License.
125
+
126
+ You may add Your own copyright statement to Your modifications and
127
+ may provide additional or different license terms and conditions
128
+ for use, reproduction, or distribution of Your modifications, or
129
+ for any such Derivative Works as a whole, provided Your use,
130
+ reproduction, and distribution of the Work otherwise complies with
131
+ the conditions stated in this License.
132
+
133
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
134
+ any Contribution intentionally submitted for inclusion in the Work
135
+ by You to the Licensor shall be under the terms and conditions of
136
+ this License, without any additional terms or conditions.
137
+ Notwithstanding the above, nothing herein shall supersede or modify
138
+ the terms of any separate license agreement you may have executed
139
+ with Licensor regarding such Contributions.
140
+
141
+ 6. Trademarks. This License does not grant permission to use the trade
142
+ names, trademarks, service marks, or product names of the Licensor,
143
+ except as required for reasonable and customary use in describing the
144
+ origin of the Work and reproducing the content of the NOTICE file.
145
+
146
+ 7. Disclaimer of Warranty. Unless required by applicable law or
147
+ agreed to in writing, Licensor provides the Work (and each
148
+ Contributor provides its Contributions) on an "AS IS" BASIS,
149
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
150
+ implied, including, without limitation, any warranties or conditions
151
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
152
+ PARTICULAR PURPOSE. You are solely responsible for determining the
153
+ appropriateness of using or redistributing the Work and assume any
154
+ risks associated with Your exercise of permissions under this License.
155
+
156
+ 8. Limitation of Liability. In no event and under no legal theory,
157
+ whether in tort (including negligence), contract, or otherwise,
158
+ unless required by applicable law (such as deliberate and grossly
159
+ negligent acts) or agreed to in writing, shall any Contributor be
160
+ liable to You for damages, including any direct, indirect, special,
161
+ incidental, or consequential damages of any character arising as a
162
+ result of this License or out of the use or inability to use the
163
+ Work (including but not limited to damages for loss of goodwill,
164
+ work stoppage, computer failure or malfunction, or any and all
165
+ other commercial damages or losses), even if such Contributor
166
+ has been advised of the possibility of such damages.
167
+
168
+ 9. Accepting Warranty or Additional Liability. While redistributing
169
+ the Work or Derivative Works thereof, You may choose to offer,
170
+ and charge a fee for, acceptance of support, warranty, indemnity,
171
+ or other liability obligations and/or rights consistent with this
172
+ License. However, in accepting such obligations, You may act only
173
+ on Your own behalf and on Your sole responsibility, not on behalf
174
+ of any other Contributor, and only if You agree to indemnify,
175
+ defend, and hold each Contributor harmless for any liability
176
+ incurred by, or claims asserted against, such Contributor by reason
177
+ of your accepting any such warranty or additional liability.
178
+
179
+ END OF TERMS AND CONDITIONS
180
+
181
+ APPENDIX: How to apply the Apache License to your work.
182
+
183
+ To apply the Apache License to your work, attach the following
184
+ boilerplate notice, with the fields enclosed by brackets "[]"
185
+ replaced with your own identifying information. (Don't include
186
+ the brackets!) The text should be enclosed in the appropriate
187
+ comment syntax for the file format. We also recommend that a
188
+ file or class name and description of purpose be included on the
189
+ same "printed page" as the copyright notice for easier
190
+ identification within third-party archives.
191
+
192
+ Copyright [yyyy] [name of copyright owner]
193
+
194
+ Licensed under the Apache License, Version 2.0 (the "License");
195
+ you may not use this file except in compliance with the License.
196
+ You may obtain a copy of the License at
197
+
198
+ http://www.apache.org/licenses/LICENSE-2.0
199
+
200
+ Unless required by applicable law or agreed to in writing, software
201
+ distributed under the License is distributed on an "AS IS" BASIS,
202
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
203
+ See the License for the specific language governing permissions and
204
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,18 @@
1
- # Temporary Holding Version
1
+ # b24
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `b24` reads and changes a Bitrix24 portal's sales data from the terminal, from scripts and from AI agents: deals,
4
+ leads, contacts, companies, pipelines and their stages, products and employees. It signs in with one of the portal's
5
+ incoming webhooks and acts with the rights of the employee who made it.
6
+
7
+ ```sh
8
+ npm install -g @wirecat/bitrix24-cli
9
+ b24 work session start # paste the webhook address; it is kept in the keyring
10
+ b24 work deals list outcome:open
11
+ b24 work leads list updated_at>=7d --json
12
+ b24 work deals move 42 --stage "Contract signed"
13
+ ```
14
+
15
+ Every command answers JSON with `--json`, every write answers an `operation_id` and can be previewed with
16
+ `--dry-run`, and `b24 work mcp serve` gives the same commands to an agent. Start with
17
+ [installation](docs/installation.md), then [usage](docs/usage.md). The design is in
18
+ [docs/dev/DESIGN.md](docs/dev/DESIGN.md).
@@ -0,0 +1,21 @@
1
+ import type { Level } from "@wirecat/cli-core/sends";
2
+ import { type Effect } from "./bitrix/methods.js";
3
+ export declare const apiKey: (method: string) => string;
4
+ /**
5
+ * Families whose writes reach people or start the portal's own automation: messages and notifications (im,
6
+ * imopenlines, imbot; read-only for now, NEED-2278 A), SMS and mail services, telephony, workflows, CRM activities
7
+ * (an e-mail activity sends the mail), tasks (the assignee is told), invitations (`user.add` mails one), and `batch`,
8
+ * which can hold any of them. Denied until the owner allows them.
9
+ */
10
+ export declare const DENIED_FAMILIES: string[];
11
+ /** A method's default, as WC-PERM-22 has it: a read and an ordinary change allowed, a delete asked. */
12
+ export declare const apiDefault: (method: string, effect?: Effect) => Level;
13
+ /**
14
+ * The command key a raw call does the same as, so `api call crm.deal.update` cannot get round `deals.update: deny`
15
+ * (gcal-cli's `WRITE_METHODS`). An update that sets a stage is a move too.
16
+ */
17
+ export declare const commandKeysOf: (method: string, body?: Record<string, unknown>) => string[];
18
+ /** The keys `permissions` may name for `api`: the known methods and the denied families. */
19
+ export declare const API_KEYS: string[];
20
+ export declare const API_DEFAULTS: Record<string, Level>;
21
+ //# sourceMappingURL=api-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../src/api-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,KAAK,MAAM,EAA2B,MAAM,qBAAqB,CAAA;AAE1E,eAAO,MAAM,MAAM,WAAY,MAAM,KAAG,MAAyB,CAAA;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,eAAe,UAe3B,CAAA;AAKD,uGAAuG;AACvG,eAAO,MAAM,UAAU,WAAY,MAAM,WAAU,MAAM,KAA6B,KAGrF,CAAA;AAKD;;;GAGG;AACH,eAAO,MAAM,aAAa,WAAY,MAAM,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAQ,MAAM,EASxF,CAAA;AAED,4FAA4F;AAC5F,eAAO,MAAM,QAAQ,UAAoF,CAAA;AAEzG,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAQ9C,CAAA"}
@@ -0,0 +1,58 @@
1
+ import { KNOWN_METHODS, methodOf } from "./bitrix/methods.js";
2
+ export const apiKey = (method) => `api.${method}`;
3
+ /**
4
+ * Families whose writes reach people or start the portal's own automation: messages and notifications (im,
5
+ * imopenlines, imbot; read-only for now, NEED-2278 A), SMS and mail services, telephony, workflows, CRM activities
6
+ * (an e-mail activity sends the mail), tasks (the assignee is told), invitations (`user.add` mails one), and `batch`,
7
+ * which can hold any of them. Denied until the owner allows them.
8
+ */
9
+ export const DENIED_FAMILIES = [
10
+ "im",
11
+ "imopenlines",
12
+ "imbot",
13
+ "messageservice",
14
+ "mailservice",
15
+ "telephony",
16
+ "voximplant",
17
+ "bizproc",
18
+ "crm.automation",
19
+ "crm.activity",
20
+ "tasks",
21
+ "task",
22
+ "user.add",
23
+ "batch",
24
+ ];
25
+ const deniedFamily = (method) => DENIED_FAMILIES.some((family) => method === family || method.startsWith(`${family}.`));
26
+ /** A method's default, as WC-PERM-22 has it: a read and an ordinary change allowed, a delete asked. */
27
+ export const apiDefault = (method, effect = methodOf(method).effect) => {
28
+ if (effect !== "read" && deniedFamily(method))
29
+ return "deny";
30
+ return effect === "destructive" ? "ask" : "allow";
31
+ };
32
+ const NOUNS = { deal: "deals", lead: "leads", contact: "people", company: "organizations" };
33
+ const ACTIONS = { add: "create", update: "update", delete: "delete" };
34
+ /**
35
+ * The command key a raw call does the same as, so `api call crm.deal.update` cannot get round `deals.update: deny`
36
+ * (gcal-cli's `WRITE_METHODS`). An update that sets a stage is a move too.
37
+ */
38
+ export const commandKeysOf = (method, body = {}) => {
39
+ const [, type, action] = /^crm\.(deal|lead|contact|company)\.(add|update|delete)$/.exec(method) ?? [];
40
+ if (!type || !action)
41
+ return [];
42
+ const noun = NOUNS[type];
43
+ const keys = [`${noun}.${ACTIONS[action]}`];
44
+ const fields = (body.fields ?? {});
45
+ if (action === "update" && fields.stageId !== undefined && (type === "deal" || type === "lead"))
46
+ keys.push(`${noun}.move`);
47
+ return keys;
48
+ };
49
+ /** The keys `permissions` may name for `api`: the known methods and the denied families. */
50
+ export const API_KEYS = [...KNOWN_METHODS.map((one) => apiKey(one.name)), ...DENIED_FAMILIES.map(apiKey)];
51
+ export const API_DEFAULTS = {
52
+ ...Object.fromEntries(KNOWN_METHODS.filter((one) => apiDefault(one.name, one.effect) !== "allow").map((one) => [
53
+ apiKey(one.name),
54
+ apiDefault(one.name, one.effect),
55
+ ])),
56
+ ...Object.fromEntries(DENIED_FAMILIES.map((family) => [apiKey(family), "deny"])),
57
+ };
58
+ //# sourceMappingURL=api-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../src/api-keys.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,aAAa,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE1E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,OAAO,MAAM,EAAE,CAAA;AAEjE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI;IACJ,aAAa;IACb,OAAO;IACP,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,YAAY;IACZ,SAAS;IACT,gBAAgB;IAChB,cAAc;IACd,OAAO;IACP,MAAM;IACN,UAAU;IACV,OAAO;CACR,CAAA;AAED,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,EAAE,CACtC,eAAe,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,CAAA;AAExF,uGAAuG;AACvG,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,MAAM,GAAW,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,EAAS,EAAE;IAC5F,IAAI,MAAM,KAAK,MAAM,IAAI,YAAY,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAA;IAC5D,OAAO,MAAM,KAAK,aAAa,CAAC,CAAC,C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MAAM,CAAC,CAAC,CAAA;AAEzG,MAAM,CAAC,MAAM,YAAY,GAA0B;IACjD,GAAG,MAAM,CAAC,WAAW,CACnB,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;QACvF,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;QAChB,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC;KACjC,CAAC,CACH;IACD,GAAG,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAe,CAAC,CAAC,CAAC;CAC1F,CAAA"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=b24.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"b24.d.ts","sourceRoot":"","sources":["../../src/bin/b24.ts"],"names":[],"mappings":""}
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+ // cli-dev bundle loader
3
+ import * as module from "node:module"
4
+
5
+ const words = process.argv.slice(2)
6
+ // As the CLI answers it, unless a test records the argv: then the CLI writes the record too.
7
+ if (
8
+ words.length === 1 &&
9
+ (words[0] === "--version" || words[0] === "-V") &&
10
+ !Object.keys(process.env).some((key) => key.endsWith("_TEST_ARGV_LOG"))
11
+ ) {
12
+ process.stdout.write("0.1.0\n")
13
+ } else {
14
+ // Before the bundle compiles: the bundle's own call comes after its chunks.
15
+ module.enableCompileCache()
16
+ const serves = ((words) => {
17
+ const plain = words.filter((word) => !word.startsWith("-"));
18
+ return plain
19
+ .slice(0, 4)
20
+ .some((word, at) => word === "serve" || word === "watch" || (word === "mcp" && plain[at + 1] === undefined));
21
+ })(words)
22
+ if (serves && module.registerHooks) {
23
+ const bundle = new URL("../bundle/", import.meta.url).href
24
+ module.registerHooks({
25
+ resolve: (specifier, context, next) =>
26
+ specifier.startsWith("./") && context.parentURL?.startsWith(bundle)
27
+ ? { url: new URL(specifier, context.parentURL).href, format: "module", shortCircuit: true }
28
+ : next(specifier, context),
29
+ })
30
+ }
31
+ const chunks = ["../bundle/all-profiles-QJ444GSX.js","../bundle/anthropic-RHRAVHC2.js","../bundle/app-server-QIT6S7AZ.js","../bundle/bun-H6RSODZ3.js","../bundle/bun-sqlite-BO4LTQHX.js","../bundle/decode-5ZPLTYV6.js","../bundle/dist-PII6Z6X3.js","../bundle/echarts-J6LAPIX7.js","../bundle/embed-YG5LDHME.js","../bundle/embedder-7FNUA5OZ.js","../bundle/first-screen-VQM4MTS7.js","../bundle/instructions-AXWTQHMR.js","../bundle/mcp-7F46P6AM.js","../bundle/mcp-J5R5A65I.js","../bundle/mcp-WALJM6QX.js","../bundle/node-CWKAIOEM.js","../bundle/node-P4E63KXA.js","../bundle/node-TLZSIHIJ.js","../bundle/node-sqlite-LSEKVRDA.js","../bundle/oauth-THYNLRLD.js","../bundle/open-E47QYKFC.js","../bundle/openai-EWSGC3BC.js","../bundle/process-WKTEA3WE.js","../bundle/program-GO3RVP2H.js","../bundle/prompt-CAQ7QR3U.js","../bundle/recognize-6KGHNZC3.js","../bundle/remote-3UO2WDC3.js","../bundle/rerank-2JVDPZBX.js","../bundle/serve-ES7AG5IK.js","../bundle/server-5LE5LNUQ.js","../bundle/server-BU4VBM6S.js","../bundle/state-7NH5G4XJ.js","../bundle/store-7O4JQD2Z.js","../bundle/store-maintenance-command-UDVGEY2D.js"]
32
+ if (((words) => words
33
+ .filter((word) => !word.startsWith("-"))
34
+ .slice(0, 2)
35
+ .includes("upgrade"))(words)) await Promise.allSettled(chunks.map((chunk) => import(chunk)))
36
+ const running = import("../bundle/b24.js")
37
+ // After the server answers its first request, so it starts no later.
38
+ if (serves) setTimeout(() => void Promise.allSettled(chunks.map((chunk) => import(chunk))), 2000).unref()
39
+ await running
40
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"b24.js","sourceRoot":"","sources":["../../src/bin/b24.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,kBAAkB,EAAE,CAAA;AACpB,MAAM,YAAY,GAAG,YAAY,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC,CAAA;AACxG,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAA;AAC7C,IAAI,CAAC;IACH,OAAO,CAAC,QAAQ,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AACrD,CAAC;QAAS,CAAC;IACT,YAAY,EAAE,CAAA;AAChB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { CliError } from "@wirecat/cli-base";
2
+ /** REST 2: `{ error, error_description }`, where `error` may be empty; REST 3.0: `{ error: { code, message, validation } }`. */
3
+ export interface BitrixFailure {
4
+ error?: string | {
5
+ code?: unknown;
6
+ message?: unknown;
7
+ validation?: unknown;
8
+ };
9
+ error_description?: unknown;
10
+ time?: {
11
+ operating_reset_at?: unknown;
12
+ };
13
+ }
14
+ /**
15
+ * Bitrix24's refusal as one of the stable codes a script branches on. The message names the method and Bitrix24's
16
+ * code, never its description.
17
+ */
18
+ export declare const bitrixError: (method: string, status: number, body: BitrixFailure | undefined, { now, waitMs }?: {
19
+ now?: number;
20
+ waitMs?: number | undefined;
21
+ }) => CliError;
22
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/bitrix/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAwC,MAAM,mBAAmB,CAAA;AAalF,gIAAgI;AAChI,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG;QAAE,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;IAC5E,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,IAAI,CAAC,EAAE;QAAE,kBAAkB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CACxC;AA2BD;;;GAGG;AACH,eAAO,MAAM,WAAW,WACd,MAAM,UACN,MAAM,QACR,aAAa,GAAG,SAAS,oBACD;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,KAC1E,QAqDF,CAAA"}
@@ -0,0 +1,76 @@
1
+ import { CliError } from "@wirecat/cli-base";
2
+ import { retryableStatus, statusToCode } from "@wirecat/cli-base/http";
3
+ /** The 503 refusal of a portal over its 2 requests a second (apidocs "REST API limits"). */
4
+ const QUERY_LIMIT_WAIT_MS = 1_000;
5
+ /** A 429 without `operating_reset_at`: the operating limit is counted over ten one-minute baskets. */
6
+ const OPERATING_WAIT_MS = 60_000;
7
+ const SIGN_IN = new Set(["NO_AUTH_FOUND", "INVALID_CREDENTIALS", "EXPIRED_TOKEN", "INVALID_TOKEN", "WRONG_AUTH_TYPE"]);
8
+ const SCOPE = new Set(["INSUFFICIENT_SCOPE", "BITRIX_REST_V3_EXCEPTION_INSUFFICIENTSCOPEEXCEPTION"]);
9
+ const DENIED = new Set(["ACCESS_DENIED", "USER_ACCESS_ERROR", "BITRIX_REST_V3_EXCEPTION_ACCESSDENIEDEXCEPTION"]);
10
+ const NOT_FOUND = new Set(["NOT_FOUND", "BITRIX_REST_V3_EXCEPTION_ENTITYNOTFOUNDEXCEPTION"]);
11
+ const CODE = /^[A-Za-z0-9_]{1,128}$/;
12
+ /** Only a code-shaped name: a description can quote a field's value, which is somebody's data (WC-SECR-6). */
13
+ const codeOf = (body) => {
14
+ const raw = typeof body?.error === "object" && body.error !== null ? body.error.code : body?.error;
15
+ if (typeof raw === "string" && CODE.test(raw))
16
+ return raw.toUpperCase();
17
+ // REST 2 answers a missing record with an empty code and "Not found".
18
+ if (raw === "" && typeof body?.error_description === "string" && /^not found$/i.test(body.error_description.trim()))
19
+ return "NOT_FOUND";
20
+ return undefined;
21
+ };
22
+ const fieldsOf = (body) => {
23
+ const validation = typeof body?.error === "object" && body.error !== null ? body.error.validation : undefined;
24
+ if (!Array.isArray(validation))
25
+ return [];
26
+ return validation
27
+ .map((one) => one?.field)
28
+ .filter((field) => typeof field === "string" && CODE.test(field.replace(/\./g, "_")));
29
+ };
30
+ const operatingWaitMs = (body, now) => {
31
+ const reset = Number(body?.time?.operating_reset_at);
32
+ return Number.isFinite(reset) && reset * 1000 > now ? reset * 1000 - now : OPERATING_WAIT_MS;
33
+ };
34
+ /**
35
+ * Bitrix24's refusal as one of the stable codes a script branches on. The message names the method and Bitrix24's
36
+ * code, never its description.
37
+ */
38
+ export const bitrixError = (method, status, body, { now = Date.now(), waitMs } = {}) => {
39
+ const code = codeOf(body);
40
+ const details = { operation: method, status, ...(code ? { provider_error: code } : {}) };
41
+ const named = code ? ` (${code})` : "";
42
+ const as = (errorCode, message, more = {}) => new CliError(errorCode, message, { ...details, ...more });
43
+ if (code === "QUERY_LIMIT_EXCEEDED")
44
+ return as("rate_limited", `Bitrix24 asks to slow down before ${method}: the portal's request limit is reached`, {
45
+ retry_after_ms: waitMs ?? QUERY_LIMIT_WAIT_MS,
46
+ retryable: true,
47
+ });
48
+ if (code === "OPERATION_TIME_LIMIT")
49
+ return as("rate_limited", `Bitrix24 holds ${method} for a while: this webhook used up its time on that method`, {
50
+ retry_after_ms: waitMs ?? operatingWaitMs(body, now),
51
+ retryable: true,
52
+ });
53
+ if (code && SCOPE.has(code))
54
+ return as("permission_error", `this webhook has no scope for ${method}${named}; add it in Bitrix24`, {
55
+ reason: "webhook.scope-missing",
56
+ });
57
+ if (code === "PORTAL_DELETED")
58
+ return as("authentication_error", "this Bitrix24 portal was deleted");
59
+ if ((code && DENIED.has(code)) || status === 403)
60
+ return as("permission_error", `the webhook's user may not do ${method}${named}`, { reason: "bitrix.access-denied" });
61
+ if ((code && SIGN_IN.has(code)) || status === 401)
62
+ return as("authentication_error", `Bitrix24 refused this webhook${named}; set a working one with \`b24 <profile> session start\``, { reason: "webhook.refused" });
63
+ if (code === "ERROR_METHOD_NOT_FOUND")
64
+ return as("not_found", `Bitrix24 does not know ${method}, or the webhook has no scope for it (ERROR_METHOD_NOT_FOUND)`, { reason: "method.unknown" });
65
+ if (code && NOT_FOUND.has(code))
66
+ return as("not_found", `${method}: Bitrix24 has no such record${named}`);
67
+ if (code === "BITRIX_REST_V3_EXCEPTION_IDEMPOTENCYKEYREUSEDEXCEPTION")
68
+ return as("conflict", `${method}: this --operation-id was already used for a different request; leave it out for a new write`, { reason: "operation.reused" });
69
+ const fields = fieldsOf(body);
70
+ if (status === 400 || code?.startsWith("BITRIX_REST_V3_EXCEPTION_"))
71
+ return as("validation_error", `Bitrix24 refused ${method}${named}${fields.length ? `; check ${fields.join(", ")}` : ""}`, fields.length ? { fields } : {});
72
+ if (status >= 500)
73
+ return as("provider_unavailable", `Bitrix24 failed on ${method}${named}`, { retryable: retryableStatus(status) });
74
+ return as(status >= 400 ? statusToCode(status) : "provider_error", `Bitrix24 refused ${method}${named}`);
75
+ };
76
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/bitrix/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAwC,MAAM,mBAAmB,CAAA;AAClF,OAAO,E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AM,IAAI,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,oBAAoB,MAAM,GAAG,KAAK,EAAE,CAAC,CAAA;AAC1G,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ export type RestVersion = 2 | 3;
2
+ export type Effect = "read" | "write" | "destructive";
3
+ export interface Method {
4
+ name: string;
5
+ api: RestVersion;
6
+ effect: Effect;
7
+ scope: string;
8
+ }
9
+ /** Which REST version answers a method, what it does, and its scope; unknown methods go to REST 2, the older API. */
10
+ export declare const methodOf: (name: string) => Method;
11
+ /** Methods `b24`'s own commands call; `api list` starts from them. */
12
+ export declare const KNOWN_METHODS: readonly Method[];
13
+ //# sourceMappingURL=methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../src/bitrix/methods.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC,CAAA;AAC/B,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,CAAA;AAErD,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,WAAW,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd;AAuBD,qHAAqH;AACrH,eAAO,MAAM,QAAQ,SAAU,MAAM,KAAG,MAKtC,CAAA;AAEF,sEAAsE;AACtE,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAM1C,CAAA"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The CRM objects REST 3.0 serves (`crm.<type>.<action>`, apidocs "REST 3.0 items", 2026-11-05). Pipelines, lead
3
+ * stages, products and users stay on REST 2: lead stages have no REST 3.0 method yet, and one path for all stages
4
+ * keeps the outcome rule in one place.
5
+ */
6
+ const REST3_TYPES = /^crm\.(deal|lead|contact|company|quote|smartinvoice|smartprocess\d+)\./;
7
+ const READ_ACTIONS = new Set(["list", "get", "fields", "current", "search", "aggregate", "admin", "access"]);
8
+ const effectOf = (name) => {
9
+ const action = name.slice(name.lastIndexOf(".") + 1);
10
+ if (action === "delete" || action === "deletefieldvalue")
11
+ return "destructive";
12
+ if (READ_ACTIONS.has(action) || name.endsWith(".field.list"))
13
+ return "read";
14
+ return "write";
15
+ };
16
+ const scopeOf = (name) => {
17
+ const first = name.slice(0, name.indexOf("."));
18
+ return first === "crm" || first === "user" || first === "catalog" || first === "task" ? first : "basic";
19
+ };
20
+ /** Which REST version answers a method, what it does, and its scope; unknown methods go to REST 2, the older API. */
21
+ export const methodOf = (name) => ({
22
+ name,
23
+ api: REST3_TYPES.test(name) ? 3 : 2,
24
+ effect: effectOf(name),
25
+ scope: scopeOf(name),
26
+ });
27
+ /** Methods `b24`'s own commands call; `api list` starts from them. */
28
+ export const KNOWN_METHODS = [
29
+ ...["deal", "lead", "contact", "company"].flatMap((type) => ["list", "get", "add", "update", "delete"].map((action) => methodOf(`crm.${type}.${action}`))),
30
+ ...["crm.item.list", "crm.category.list", "crm.status.list", "crm.product.list", "crm.product.get"].map(methodOf),
31
+ ...["user.current", "user.get", "user.admin"].map(methodOf),
32
+ ];
33
+ //# sourceMappingURL=methods.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methods.js","sourceRoot":"","sources":["../../src/bitrix/methods.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,MAAM,WAAW,GAAG,wEAAwE,CAAA;AAE5F,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAA;AAE5G,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAU,EAAE;IACxC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GA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,CAAC,CAC9F;IACD,GAAG,CAAC,eAAe,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC;IACjH,GAAG,CAAC,cAAc,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC;CAC5D,CAAA"}
@@ -0,0 +1,50 @@
1
+ import { type SleepLike } from "@wirecat/cli-base";
2
+ import { type EventSink } from "@wirecat/cli-core/cli";
3
+ import type { Pacer } from "@wirecat/cli-core/sends";
4
+ import { type RestVersion } from "./methods.js";
5
+ import { type Webhook } from "./webhook.js";
6
+ export type FetchLike = (url: string, init: RequestInit) => Promise<Response>;
7
+ export interface BitrixTransportOptions {
8
+ webhook: Webhook;
9
+ fetch?: FetchLike;
10
+ timeoutMs?: number;
11
+ signal?: AbortSignal;
12
+ events?: EventSink;
13
+ /** Shared by every `b24` process of the profile: the portal's limit is per portal, not per process. */
14
+ pacer?: Pacer;
15
+ sleep?: SleepLike;
16
+ now?: () => number;
17
+ random?: () => number;
18
+ }
19
+ export interface CallOptions {
20
+ /** A write's operation id, sent as REST 3.0's `Idempotency-Key`, which makes the write safe to repeat. */
21
+ idempotencyKey?: string;
22
+ /** Overrides the method table, for `api call --rest`. */
23
+ api?: RestVersion;
24
+ }
25
+ /** REST 2 lists carry `total` and `next` beside `result`; REST 3.0 answers carry neither. */
26
+ export interface BitrixAnswer {
27
+ result: unknown;
28
+ total?: number;
29
+ next?: number;
30
+ }
31
+ /**
32
+ * Bitrix24's REST API over an incoming webhook, method by method.
33
+ *
34
+ * ⚠ **The webhook's secret is part of every address** — `/rest/<user>/<secret>/<method>` — so the address never
35
+ * leaves this class: not in an error, not in a run record, and never by passing on a failed request's own error,
36
+ * whose text may hold it. Modelled on tg-cli's Bot API transport, which has the same problem.
37
+ */
38
+ export declare class BitrixTransport {
39
+ #private;
40
+ constructor(options: BitrixTransportOptions);
41
+ /** The employee the webhook acts as. */
42
+ get userId(): string;
43
+ /**
44
+ * Reads are tried again on a refused rate or a lost answer. A write is tried again only on REST 3.0 with an
45
+ * `Idempotency-Key`, which Bitrix24 answers from its store instead of running twice; any other write that got no
46
+ * answer is `outcome_unknown`.
47
+ */
48
+ call(method: string, params?: Record<string, unknown>, options?: CallOptions): Promise<BitrixAnswer>;
49
+ }
50
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/bitrix/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EAEf,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAA2B,KAAK,SAAS,EAAkC,MAAM,uBAAuB,CAAA;AAC/G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAEpD,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,cAAc,CAAA;AAQtD,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAE7E,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,uGAAuG;IACvG,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,0GAA0G;IAC1G,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,yDAAyD;IACzD,GAAG,CAAC,EA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