@wirecat/bitrix24-cli 0.3.0 → 0.5.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.
- package/CHANGELOG.md +130 -0
- package/README.md +84 -9
- package/dist/api-keys.d.ts +36 -9
- package/dist/api-keys.d.ts.map +1 -1
- package/dist/api-keys.js +139 -19
- package/dist/api-keys.js.map +1 -1
- package/dist/bin/b24.js +2 -2
- package/dist/bitrix/errors.js +1 -1
- package/dist/bitrix/errors.js.map +1 -1
- package/dist/bitrix/methods.d.ts.map +1 -1
- package/dist/bitrix/methods.js +7 -3
- package/dist/bitrix/methods.js.map +1 -1
- package/dist/bitrix/transport.d.ts +4 -7
- package/dist/bitrix/transport.d.ts.map +1 -1
- package/dist/bitrix/transport.js +29 -19
- package/dist/bitrix/transport.js.map +1 -1
- package/dist/body.d.ts +14 -0
- package/dist/body.d.ts.map +1 -0
- package/dist/body.js +44 -0
- package/dist/body.js.map +1 -0
- package/dist/bundle/{chunk-QIPTIUMJ.js → all-profiles-CANIDIDS.js} +12 -7
- package/dist/bundle/{anthropic-RHRAVHC2.js → anthropic-JUJB4DCF.js} +5 -5
- package/dist/bundle/{app-server-QIT6S7AZ.js → app-server-3V5Z4PTK.js} +68 -54
- package/dist/bundle/b24.js +18 -12
- package/dist/bundle/{bun-H6RSODZ3.js → bun-LKMV5TY7.js} +2 -2
- package/dist/bundle/{bun-sqlite-BO4LTQHX.js → bun-sqlite-S56EF74S.js} +3 -3
- package/dist/bundle/{chunk-D5S6QV6R.js → chunk-2I4KWS3H.js} +6 -6
- package/dist/bundle/chunk-36PO5NWY.js +147 -0
- package/dist/bundle/{chunk-ZIAQPTUS.js → chunk-42F7Q7V6.js} +3 -3
- package/dist/bundle/{chunk-6WY72XVQ.js → chunk-4D3K6GZW.js} +18 -4
- package/dist/bundle/chunk-5D4MJQ6X.js +22 -0
- package/dist/bundle/chunk-5JOPERVF.js +84 -0
- package/dist/bundle/chunk-6A4UPWDC.js +15 -0
- package/dist/bundle/{chunk-P33NDCDI.js → chunk-6MGWIZG4.js} +1 -1
- package/dist/bundle/{chunk-ZDQQCXFG.js → chunk-6YJTNZ7U.js} +13 -13
- package/dist/bundle/{chunk-MBDK4YXG.js → chunk-7FBFJ6B4.js} +4 -2
- package/dist/bundle/chunk-7VCMOTQP.js +55 -0
- package/dist/bundle/{chunk-P364PLIK.js → chunk-A5IMMGYU.js} +36 -34
- package/dist/bundle/{chunk-45AKJVKV.js → chunk-ASEHTBNK.js} +1 -1
- package/dist/bundle/{chunk-HGL63O5V.js → chunk-B6LPJYPQ.js} +2 -2
- package/dist/bundle/{chunk-LSPIOT6Z.js → chunk-BHEE2K6C.js} +7 -7
- package/dist/bundle/chunk-BYZQBE63.js +971 -0
- package/dist/bundle/{program-H3TGGRQ6.js → chunk-COKGNTDQ.js} +15761 -16685
- package/dist/bundle/{chunk-XJXONOB5.js → chunk-DVFYRQGE.js} +1 -1
- package/dist/bundle/{chunk-FLUEXJ4X.js → chunk-DVSIBZ3G.js} +1 -1
- package/dist/bundle/chunk-EJEIXC6Y.js +273 -0
- package/dist/bundle/chunk-EYTGCM44.js +130 -0
- package/dist/bundle/{chunk-IRV2PCQ2.js → chunk-EYYOKT23.js} +26 -26
- package/dist/bundle/{chunk-PH5FZX6E.js → chunk-FCWPIWSR.js} +2 -2
- package/dist/bundle/{chunk-YZ5LHE5Q.js → chunk-FSWRMQWX.js} +2 -2
- package/dist/bundle/{chunk-ADLS6FVG.js → chunk-FXBHOCJK.js} +1 -1
- package/dist/bundle/chunk-G5MW6RCM.js +723 -0
- package/dist/bundle/{chunk-VEWWAGTD.js → chunk-GLTKRLFT.js} +8 -8
- package/dist/bundle/chunk-GUUZQ7NE.js +581 -0
- package/dist/bundle/{chunk-QSNROIJL.js → chunk-H6RIPOOI.js} +42 -9
- package/dist/bundle/{chunk-H2ADPPSH.js → chunk-HGFNC4CR.js} +1819 -597
- package/dist/bundle/{chunk-7GRZAKBB.js → chunk-IERYD2N2.js} +6 -6
- package/dist/bundle/{chunk-N6FLBXZS.js → chunk-IGCLMEMB.js} +3 -3
- package/dist/bundle/{chunk-U5ACMCAQ.js → chunk-J7WCSZ2Q.js} +411 -919
- package/dist/bundle/{chunk-W5YAO5G5.js → chunk-JZYHQ4HB.js} +9 -4
- package/dist/bundle/{chunk-EVYSBZ3I.js → chunk-K4QM3X5F.js} +4 -4
- package/dist/bundle/{chunk-DTXERR44.js → chunk-KFSMY7SZ.js} +2 -2
- package/dist/bundle/{chunk-LRGYKOCP.js → chunk-KPEDH5T4.js} +1 -1
- package/dist/bundle/{chunk-XRFJWHY5.js → chunk-KUY7LII2.js} +4 -4
- package/dist/bundle/{chunk-QC53QBNC.js → chunk-LFXDHLFR.js} +3 -3
- package/dist/bundle/{chunk-CNNEA2M4.js → chunk-LGLT4JB6.js} +3 -3
- package/dist/bundle/{chunk-QGMDQ2PM.js → chunk-LM4OOBAW.js} +3 -3
- package/dist/bundle/chunk-M74BSKMA.js +234 -0
- package/dist/bundle/{chunk-2KCZ7BKW.js → chunk-MMMT6ORT.js} +11 -11
- package/dist/bundle/{chunk-WII44RXN.js → chunk-NGYD6QTE.js} +2 -2
- package/dist/bundle/{chunk-FOTREPNS.js → chunk-NO6QOPVT.js} +10 -19
- package/dist/bundle/chunk-O6XC7DZI.js +804 -0
- package/dist/bundle/chunk-OE3NFB53.js +64 -0
- package/dist/bundle/{chunk-XD4FRDSL.js → chunk-OUMFNB34.js} +13 -149
- package/dist/bundle/{chunk-ZGZT5S6B.js → chunk-P2RQTNVJ.js} +806 -850
- package/dist/bundle/{chunk-RRJNNPR4.js → chunk-PBIBGIZ7.js} +1 -1
- package/dist/bundle/{chunk-EXOOKUEA.js → chunk-Q6VQHTRW.js} +2 -2
- package/dist/bundle/{chunk-TE3FR6MI.js → chunk-QHBCNVUG.js} +5 -5
- package/dist/bundle/{chunk-SGRYYE4X.js → chunk-QNOXAQ6Y.js} +4 -4
- package/dist/bundle/{chunk-QQXH2OPB.js → chunk-R5F2O5GX.js} +15 -272
- package/dist/bundle/{chunk-SFRNX2TI.js → chunk-R5PBSKJL.js} +1 -1
- package/dist/bundle/{chunk-OTD2ZRXD.js → chunk-RS2BARUU.js} +4 -4
- package/dist/bundle/chunk-TG3DSPT5.js +14 -0
- package/dist/bundle/{chunk-BCF7P4FZ.js → chunk-U22JMKUO.js} +6 -125
- package/dist/bundle/chunk-U66Q5TVK.js +106 -0
- package/dist/bundle/{chunk-QMPN6WKD.js → chunk-UCHMQWON.js} +211 -89
- package/dist/bundle/{chunk-POC3V3AO.js → chunk-VMJS7FJZ.js} +526 -467
- package/dist/bundle/{chunk-FZL7F5NR.js → chunk-VMVAQHDC.js} +77 -615
- package/dist/bundle/{chunk-K3UIB6ZF.js → chunk-WWMCJFMT.js} +2 -2
- package/dist/bundle/{chunk-CXL33BFL.js → chunk-XTA5TN3H.js} +1 -1
- package/dist/bundle/{chunk-WTPMJYMD.js → chunk-XUHHBEA7.js} +652 -131
- package/dist/bundle/{chunk-WKRQ44EH.js → chunk-YDZHO4LT.js} +13 -13
- package/dist/bundle/{chunk-2SNUMZ7S.js → chunk-ZKINZFIT.js} +6 -6
- package/dist/bundle/{chunk-HAXNUIGQ.js → chunk-ZSQXSIFQ.js} +89 -39
- package/dist/bundle/{chunk-YYO7D2MO.js → chunk-ZZEHDIEG.js} +58 -54
- package/dist/bundle/command-contract-OQV6H7SR.js +36 -0
- package/dist/bundle/{decode-5ZPLTYV6.js → decode-QSTBX4MG.js} +3 -3
- package/dist/bundle/{echarts-J6LAPIX7.js → echarts-JZELFH2N.js} +2 -2
- package/dist/bundle/{embed-YG5LDHME.js → embed-4RIW2LVH.js} +4 -4
- package/dist/bundle/{embedder-7FNUA5OZ.js → embedder-SW7DTWSL.js} +7 -7
- package/dist/bundle/{first-run-JPZNWIJN.js → first-run-7AISOSOM.js} +8 -8
- package/dist/bundle/first-screen-NMHNFZ2B.js +34 -0
- package/dist/bundle/{instructions-AXWTQHMR.js → instructions-BZE5YUGG.js} +1 -1
- package/dist/bundle/{mcp-7F46P6AM.js → mcp-SDWHDJTY.js} +2 -2
- package/dist/bundle/{node-P4E63KXA.js → node-KM3CUABH.js} +9 -9
- package/dist/bundle/{node-CWKAIOEM.js → node-LTKZIO4U.js} +2 -2
- package/dist/bundle/{node-sqlite-LSEKVRDA.js → node-sqlite-HQ5PN2RH.js} +4 -4
- package/dist/bundle/{oauth-THYNLRLD.js → oauth-UH6FOZQL.js} +5 -5
- package/dist/bundle/{open-E47QYKFC.js → open-TSUP3XGL.js} +3 -3
- package/dist/bundle/{openai-EWSGC3BC.js → openai-GVEE52E3.js} +14 -14
- package/dist/bundle/{process-WKTEA3WE.js → process-AGXY76ZE.js} +1 -1
- package/dist/bundle/program-BI4A4HFJ.js +2247 -0
- package/dist/bundle/{prompt-CAQ7QR3U.js → prompt-NRSUY7FA.js} +3 -3
- package/dist/bundle/{recognize-6KGHNZC3.js → recognize-NPDPQ6PJ.js} +2 -2
- package/dist/bundle/{remote-3UO2WDC3.js → remote-HFASMVLB.js} +5 -5
- package/dist/bundle/{rerank-2JVDPZBX.js → rerank-TL6Z6F7K.js} +5 -5
- package/dist/bundle/{chunk-VL6SPMZV.js → serve-VB4DHDZQ.js} +8 -6
- package/dist/bundle/server-T5EDRPJI.js +68 -0
- package/dist/bundle/{chunk-ZEW4P6AH.js → server-Z6MW6C37.js} +50 -14
- package/dist/bundle/source-4IGO5J7E.js +237 -0
- package/dist/bundle/sqlite-runtime-YS4POY3W.js +17 -0
- package/dist/bundle/{state-7NH5G4XJ.js → state-ISZVVZGR.js} +4 -4
- package/dist/bundle/store-IZJBAKJV.js +58 -0
- package/dist/bundle/{store-7O4JQD2Z.js → store-L76MSQC3.js} +17 -12
- package/dist/bundle/store-PBTIB7BD.js +207 -0
- package/dist/bundle/store-maintenance-command-YFKII7TF.js +58 -0
- package/dist/bundle/writer-3O5EYMFE.js +214 -0
- package/dist/commands/api.d.ts.map +1 -1
- package/dist/commands/api.js +81 -30
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/crm-shared.d.ts +4 -0
- package/dist/commands/crm-shared.d.ts.map +1 -0
- package/dist/commands/crm-shared.js +94 -0
- package/dist/commands/crm-shared.js.map +1 -0
- package/dist/commands/crm-writes.d.ts +0 -1
- package/dist/commands/crm-writes.d.ts.map +1 -1
- package/dist/commands/crm-writes.js +43 -88
- package/dist/commands/crm-writes.js.map +1 -1
- package/dist/commands/crm.d.ts.map +1 -1
- package/dist/commands/crm.js +30 -48
- package/dist/commands/crm.js.map +1 -1
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +1 -0
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/write.d.ts +6 -6
- package/dist/commands/write.d.ts.map +1 -1
- package/dist/commands/write.js +11 -18
- package/dist/commands/write.js.map +1 -1
- package/dist/config.d.ts +0 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -8
- package/dist/config.js.map +1 -1
- package/dist/crm/capabilities.d.ts +7 -0
- package/dist/crm/capabilities.d.ts.map +1 -0
- package/dist/crm/capabilities.js +7 -0
- package/dist/crm/capabilities.js.map +1 -0
- package/dist/crm/conditions.d.ts +1 -1
- package/dist/crm/conditions.d.ts.map +1 -1
- package/dist/crm/conditions.js +4 -6
- package/dist/crm/conditions.js.map +1 -1
- package/dist/crm/custom-query.d.ts +19 -0
- package/dist/crm/custom-query.d.ts.map +1 -0
- package/dist/crm/custom-query.js +79 -0
- package/dist/crm/custom-query.js.map +1 -0
- package/dist/crm/deal.d.ts +4 -27
- package/dist/crm/deal.d.ts.map +1 -1
- package/dist/crm/deal.js +15 -48
- package/dist/crm/deal.js.map +1 -1
- package/dist/crm/fields.d.ts +20 -0
- package/dist/crm/fields.d.ts.map +1 -0
- package/dist/crm/fields.js +78 -0
- package/dist/crm/fields.js.map +1 -0
- package/dist/crm/items.d.ts +7 -1
- package/dist/crm/items.d.ts.map +1 -1
- package/dist/crm/items.js +21 -18
- package/dist/crm/items.js.map +1 -1
- package/dist/crm/lead.d.ts +5 -36
- package/dist/crm/lead.d.ts.map +1 -1
- package/dist/crm/lead.js +15 -61
- package/dist/crm/lead.js.map +1 -1
- package/dist/crm/organization.d.ts +1 -0
- package/dist/crm/organization.d.ts.map +1 -1
- package/dist/crm/person.d.ts +1 -0
- package/dist/crm/person.d.ts.map +1 -1
- package/dist/crm/pipelines.d.ts +5 -0
- package/dist/crm/pipelines.d.ts.map +1 -0
- package/dist/crm/pipelines.js +54 -0
- package/dist/crm/pipelines.js.map +1 -0
- package/dist/crm/product.d.ts.map +1 -1
- package/dist/crm/product.js +2 -2
- package/dist/crm/product.js.map +1 -1
- package/dist/crm/rest3-fields.d.ts +3 -0
- package/dist/crm/rest3-fields.d.ts.map +1 -0
- package/dist/crm/rest3-fields.js +38 -0
- package/dist/crm/rest3-fields.js.map +1 -0
- package/dist/crm/source.d.ts +15 -0
- package/dist/crm/source.d.ts.map +1 -0
- package/dist/crm/source.js +122 -0
- package/dist/crm/source.js.map +1 -0
- package/dist/crm/user.d.ts.map +1 -1
- package/dist/crm/user.js +2 -2
- package/dist/crm/user.js.map +1 -1
- package/dist/crm/values.d.ts +26 -5
- package/dist/crm/values.d.ts.map +1 -1
- package/dist/crm/values.js +40 -5
- package/dist/crm/values.js.map +1 -1
- package/dist/crm/writer.d.ts +9 -0
- package/dist/crm/writer.d.ts.map +1 -0
- package/dist/crm/writer.js +119 -0
- package/dist/crm/writer.js.map +1 -0
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +53 -5
- package/dist/program.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +6 -1
- package/dist/reasons.js.map +1 -1
- package/dist/store.d.ts +15 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +33 -0
- package/dist/store.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -6
- package/skills/bitrix24-cli/SKILL.md +16 -10
- package/dist/bundle/all-profiles-QJ444GSX.js +0 -24
- package/dist/bundle/chunk-XNHSPHUN.js +0 -48
- package/dist/bundle/command-contract-OKQOE6G4.js +0 -30
- package/dist/bundle/first-screen-VQM4MTS7.js +0 -28
- package/dist/bundle/mcp-5RSWNTHS.js +0 -160
- package/dist/bundle/mcp-J5R5A65I.js +0 -87
- package/dist/bundle/serve-ES7AG5IK.js +0 -19
- package/dist/bundle/server-5LE5LNUQ.js +0 -45
- package/dist/bundle/server-BU4VBM6S.js +0 -58
- package/dist/bundle/store-maintenance-command-UDVGEY2D.js +0 -47
- package/dist/commands/doctor.d.ts +0 -77
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -74
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -3
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -97
- package/dist/commands/mcp.js.map +0 -1
- package/dist/crm/pipeline.d.ts +0 -17
- package/dist/crm/pipeline.d.ts.map +0 -1
- package/dist/crm/pipeline.js +0 -42
- package/dist/crm/pipeline.js.map +0 -1
- package/dist/crm/stage.d.ts +0 -20
- package/dist/crm/stage.d.ts.map +0 -1
- package/dist/crm/stage.js +0 -65
- package/dist/crm/stage.js.map +0 -1
- package/dist/mcp.d.ts +0 -29
- package/dist/mcp.d.ts.map +0 -1
- package/dist/mcp.js +0 -99
- package/dist/mcp.js.map +0 -1
- /package/dist/bundle/{chunk-4PDYYS5K.js → chunk-ZQ3GWKDQ.js} +0 -0
package/dist/bitrix/methods.js
CHANGED
|
@@ -4,12 +4,16 @@
|
|
|
4
4
|
* keeps the outcome rule in one place.
|
|
5
5
|
*/
|
|
6
6
|
const REST3_TYPES = /^crm\.(deal|lead|contact|company|quote|smartinvoice|smartprocess\d+)\./;
|
|
7
|
+
/** `crm.<type>.userfield.*` is REST 2 only; REST 3.0's own is `crm.<type>.field.custom.*`. */
|
|
8
|
+
const REST2_ONLY = /^crm\.[a-z]+\.userfield\./;
|
|
7
9
|
const READ_ACTIONS = new Set(["list", "get", "fields", "current", "search", "aggregate", "admin", "access"]);
|
|
10
|
+
/** Reads whose names end in no read action. */
|
|
11
|
+
const READ_METHODS = new Set(["profile", "methods", "scope", "server.time", "app.info"]);
|
|
8
12
|
const effectOf = (name) => {
|
|
9
13
|
const action = name.slice(name.lastIndexOf(".") + 1);
|
|
10
14
|
if (action === "delete" || action === "deletefieldvalue")
|
|
11
15
|
return "destructive";
|
|
12
|
-
if (READ_ACTIONS.has(action) || name.endsWith(".field.list"))
|
|
16
|
+
if (READ_ACTIONS.has(action) || READ_METHODS.has(name) || name.endsWith(".field.list"))
|
|
13
17
|
return "read";
|
|
14
18
|
return "write";
|
|
15
19
|
};
|
|
@@ -20,13 +24,13 @@ const scopeOf = (name) => {
|
|
|
20
24
|
/** Which REST version answers a method, what it does, and its scope; unknown methods go to REST 2, the older API. */
|
|
21
25
|
export const methodOf = (name) => ({
|
|
22
26
|
name,
|
|
23
|
-
api: REST3_TYPES.test(name) ? 3 : 2,
|
|
27
|
+
api: REST3_TYPES.test(name) && !REST2_ONLY.test(name) ? 3 : 2,
|
|
24
28
|
effect: effectOf(name),
|
|
25
29
|
scope: scopeOf(name),
|
|
26
30
|
});
|
|
27
31
|
/** Methods `b24`'s own commands call; `api list` starts from them. */
|
|
28
32
|
export const KNOWN_METHODS = [
|
|
29
|
-
...["deal", "lead", "contact", "company"].flatMap((type) => ["list", "get", "add", "update", "delete"].map((action) => methodOf(`crm.${type}.${action}`))),
|
|
33
|
+
...["deal", "lead", "contact", "company"].flatMap((type) => ["list", "get", "add", "update", "delete", "field.list", "userfield.list"].map((action) => methodOf(`crm.${type}.${action}`))),
|
|
30
34
|
...["crm.item.list", "crm.category.list", "crm.status.list", "crm.product.list", "crm.product.get"].map(methodOf),
|
|
31
35
|
...["user.current", "user.get", "user.admin"].map(methodOf),
|
|
32
36
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"methods.js","sourceRoot":"","sources":["../../src/bitrix/methods.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IAAI,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAA;AACzG,CAAC,CAAA;AAED,qHAAqH;AACrH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,CAAC;IACjD,IAAI;IACJ,GAAG,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC;CACrB,CAAC,CAAA;AAEF,sEAAsE;AACtE,MAAM,CAAC,MAAM,aAAa,GAAsB;IAC9C,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CACzD,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACxF,QAAQ,CAAC,OAAO,IAAI,IAAI,MAAM,EAAE,CAAC,CAClC,CACF;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"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type SleepLike } from "@wirecat/cli-base";
|
|
2
2
|
import { type EventSink } from "@wirecat/cli-core/cli";
|
|
3
3
|
import type { Pacer } from "@wirecat/cli-core/sends";
|
|
4
|
-
import { type RestVersion } from "./methods.js";
|
|
5
4
|
import { type Webhook } from "./webhook.js";
|
|
6
5
|
export type FetchLike = (url: string, init: RequestInit) => Promise<Response>;
|
|
7
6
|
export interface BitrixTransportOptions {
|
|
@@ -17,10 +16,8 @@ export interface BitrixTransportOptions {
|
|
|
17
16
|
random?: () => number;
|
|
18
17
|
}
|
|
19
18
|
export interface CallOptions {
|
|
20
|
-
/** A write's operation id, sent as REST 3.0's `Idempotency-Key
|
|
19
|
+
/** A write's operation id, sent as REST 3.0's `Idempotency-Key`; a live portal still did a repeat again. */
|
|
21
20
|
idempotencyKey?: string;
|
|
22
|
-
/** Overrides the method table, for `api call --rest`. */
|
|
23
|
-
api?: RestVersion;
|
|
24
21
|
}
|
|
25
22
|
/** REST 2 lists carry `total` and `next` beside `result`; REST 3.0 answers carry neither. */
|
|
26
23
|
export interface BitrixAnswer {
|
|
@@ -41,9 +38,9 @@ export declare class BitrixTransport {
|
|
|
41
38
|
/** The employee the webhook acts as. */
|
|
42
39
|
get userId(): string;
|
|
43
40
|
/**
|
|
44
|
-
* Reads are tried again on a refused rate or a lost answer. A write is
|
|
45
|
-
* `Idempotency-Key
|
|
46
|
-
*
|
|
41
|
+
* Reads are tried again on a refused rate or a lost answer. A write is sent once: whether Bitrix24 honours
|
|
42
|
+
* `Idempotency-Key` is not checked on a live portal, so a write that got no answer is `outcome_unknown` and the
|
|
43
|
+
* owner repeats it by hand.
|
|
47
44
|
*/
|
|
48
45
|
call(method: string, params?: Record<string, unknown>, options?: CallOptions): Promise<BitrixAnswer>;
|
|
49
46
|
}
|
|
@@ -1 +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;
|
|
1
|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AM,EAAE,OAAO,CAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CAqBjH;CAoIF"}
|
package/dist/bitrix/transport.js
CHANGED
|
@@ -4,15 +4,15 @@ import { apiJson, currentAttempt, providerEvent, providerRequest } from "@wireca
|
|
|
4
4
|
import { bitrixError } from "./errors.js";
|
|
5
5
|
import { methodOf } from "./methods.js";
|
|
6
6
|
import { methodUrl } from "./webhook.js";
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* A third of a one-shot command's 30 s deadline (cli-core `DEFAULT_COMMAND_MS`), so a read that timed out can still be
|
|
9
|
+
* tried again before the command ends. cli-core does not hand the run's remaining time to a transport.
|
|
10
|
+
*/
|
|
11
|
+
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
8
12
|
const LARGEST_ANSWER = 16 * 1024 * 1024;
|
|
9
13
|
const RETRY = { retries: 3, baseDelayMs: 1_000, maxDelayMs: 10_000, maxRetryAfterMs: 30_000 };
|
|
10
14
|
/** A pace wait longer than this ends the run instead of sitting in it, as cli-core's messenger pacing does. */
|
|
11
15
|
const LONGEST_PACE_WAIT_MS = 60_000;
|
|
12
|
-
/** A keyed write that never got an answer may have run: the caller repeats it with the same operation id. */
|
|
13
|
-
const lastOf = (method, error, reads) => reads || (error.code !== "timeout" && error.code !== "network_error")
|
|
14
|
-
? error
|
|
15
|
-
: new CliError("outcome_unknown", `${method} got no answer; repeat it with the same --operation-id, which Bitrix24 will not run twice`, { operation: method, retryable: true });
|
|
16
16
|
/**
|
|
17
17
|
* Bitrix24's REST API over an incoming webhook, method by method.
|
|
18
18
|
*
|
|
@@ -46,16 +46,15 @@ export class BitrixTransport {
|
|
|
46
46
|
return this.#webhook.userId;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* Reads are tried again on a refused rate or a lost answer. A write is
|
|
50
|
-
* `Idempotency-Key
|
|
51
|
-
*
|
|
49
|
+
* Reads are tried again on a refused rate or a lost answer. A write is sent once: whether Bitrix24 honours
|
|
50
|
+
* `Idempotency-Key` is not checked on a live portal, so a write that got no answer is `outcome_unknown` and the
|
|
51
|
+
* owner repeats it by hand.
|
|
52
52
|
*/
|
|
53
53
|
async call(method, params = {}, options = {}) {
|
|
54
54
|
const known = methodOf(method);
|
|
55
|
-
const api =
|
|
55
|
+
const api = known.api;
|
|
56
56
|
const reads = known.effect === "read";
|
|
57
57
|
const key = api === 3 && !reads ? options.idempotencyKey : undefined;
|
|
58
|
-
const repeatable = reads || key !== undefined;
|
|
59
58
|
let waited;
|
|
60
59
|
for (let attempt = 1;; attempt++) {
|
|
61
60
|
try {
|
|
@@ -63,13 +62,13 @@ export class BitrixTransport {
|
|
|
63
62
|
return await this.#once(method, params, { api, reads, key, attempt, waited });
|
|
64
63
|
}
|
|
65
64
|
catch (error) {
|
|
66
|
-
if (!isCliError(error) || !
|
|
65
|
+
if (!isCliError(error) || !reads)
|
|
67
66
|
throw error;
|
|
68
67
|
const asked = error.details.retry_after_ms;
|
|
69
68
|
const wait = typeof asked === "number" ? asked : backoffMs(attempt, RETRY, this.#random);
|
|
70
69
|
const again = error.code === "rate_limited" || error.details.retryable === true;
|
|
71
70
|
if (!again || wait > RETRY.maxRetryAfterMs || attempt > RETRY.retries)
|
|
72
|
-
throw
|
|
71
|
+
throw error;
|
|
73
72
|
if (error.code === "rate_limited")
|
|
74
73
|
await this.#pacer?.holdFor(wait);
|
|
75
74
|
await this.#wait(wait, method);
|
|
@@ -131,7 +130,7 @@ export class BitrixTransport {
|
|
|
131
130
|
});
|
|
132
131
|
}
|
|
133
132
|
catch (error) {
|
|
134
|
-
const failure = this.#unanswered(method, error, run
|
|
133
|
+
const failure = this.#unanswered(method, error, run);
|
|
135
134
|
end({ errorCode: failure.code });
|
|
136
135
|
throw failure;
|
|
137
136
|
}
|
|
@@ -141,13 +140,13 @@ export class BitrixTransport {
|
|
|
141
140
|
}
|
|
142
141
|
catch (error) {
|
|
143
142
|
if (signal.aborted) {
|
|
144
|
-
const failure = this.#unanswered(method, error, run
|
|
143
|
+
const failure = this.#unanswered(method, error, run);
|
|
145
144
|
end({ status: response.status, errorCode: failure.code });
|
|
146
145
|
throw failure;
|
|
147
146
|
}
|
|
148
147
|
end({ status: response.status, errorCode: "invalid_response" });
|
|
149
148
|
if (!response.ok)
|
|
150
|
-
throw bitrixError(method, response.status, undefined);
|
|
149
|
+
throw this.#refused(method, bitrixError(method, response.status, undefined), run.reads);
|
|
151
150
|
throw new CliError("invalid_response", `Bitrix24 answered ${method} with something that is not JSON`, {
|
|
152
151
|
operation: method,
|
|
153
152
|
status: response.status,
|
|
@@ -164,7 +163,7 @@ export class BitrixTransport {
|
|
|
164
163
|
errorCode: refusal.code,
|
|
165
164
|
providerError: String(refusal.details.provider_error ?? ""),
|
|
166
165
|
});
|
|
167
|
-
throw refusal;
|
|
166
|
+
throw this.#refused(method, refusal, run.reads);
|
|
168
167
|
}
|
|
169
168
|
end({ status: response.status });
|
|
170
169
|
return {
|
|
@@ -177,11 +176,22 @@ export class BitrixTransport {
|
|
|
177
176
|
clearTimeout(timer);
|
|
178
177
|
}
|
|
179
178
|
}
|
|
180
|
-
|
|
179
|
+
/** A gateway or server failure may come after a write was made; only a refusal says it was not. */
|
|
180
|
+
#refused(method, refusal, reads) {
|
|
181
|
+
if (reads || refusal.code !== "provider_unavailable")
|
|
182
|
+
return refusal;
|
|
183
|
+
return new CliError("outcome_unknown", `Bitrix24 failed on ${method}; it may or may not have carried it out`, {
|
|
184
|
+
...refusal.details,
|
|
185
|
+
retryable: false,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
#unanswered(method, error, run) {
|
|
189
|
+
// A cut write may have reached the portal: never "cancelled", which a caller would repeat (WC-LIFE-9). A keyed
|
|
190
|
+
// write's caller names how to repeat it; a REST 2 write has no key to repeat it safely with.
|
|
191
|
+
if (!run.reads)
|
|
192
|
+
return new CliError("outcome_unknown", `${method} got no answer; Bitrix24 may or may not have carried it out${run.key ? "" : " — check before repeating it"}`, { operation: method, retryable: false });
|
|
181
193
|
if (this.#signal?.aborted && this.#signal.reason?.name !== "TimeoutError")
|
|
182
194
|
return new CliError("cancelled", `${method} was cancelled`, { operation: method });
|
|
183
|
-
if (!repeatable)
|
|
184
|
-
return new CliError("outcome_unknown", `${method} got no answer; Bitrix24 may or may not have carried it out — check before repeating it`, { operation: method, retryable: false });
|
|
185
195
|
const timedOut = error?.name === "TimeoutError";
|
|
186
196
|
return new CliError(timedOut ? "timeout" : "network_error", timedOut ? `${method} got no answer within ${this.#timeoutMs} ms` : `${method} could not reach Bitrix24`, { operation: method, retryable: true });
|
|
187
197
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/bitrix/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,UAAU,EAEV,SAAS,EAET,SAAS,GACV,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAkB,aAAa,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE/G,OAAO,EAAsB,WAAW,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAoB,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,SAAS,EAAgB,MAAM,cAAc,CAAA;AAEtD,MAAM,kBAAkB,GAAG,MAAM,CAAA;AACjC,MAAM,cAAc,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;AACvC,MAAM,KAAK,GAAgB,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,CAAA;AAC1G,+GAA+G;AAC/G,MAAM,oBAAoB,GAAG,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src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,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CACxC,CAAA;QACH,IAAI,IAAI,CAAC,OAAO,EAAE,OAAO,IAAK,IAAI,CAAC,OAAO,CAAC,MAA4B,EAAE,IAAI,KAAK,cAAc;YAC9F,OAAO,IAAI,QAAQ,CAAC,WAAW,EAAE,GAAG,MAAM,gBAAgB,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAA;QACpF,MAAM,QAAQ,GAAI,KAA2B,EAAE,IAAI,KAAK,cAAc,CAAA;QACtE,OAAO,IAAI,QAAQ,CACjB,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,EACtC,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,yBAAyB,IAAI,CAAC,UAAU,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,2BAA2B,EACxG,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CACvC,CAAA;IACH,CAAC;CACF"}
|
package/dist/body.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Body = Readonly<Record<string, unknown>>;
|
|
2
|
+
/** `parseApiJson` keeps every number as its JSON text, so an id past 2^53 is sent as typed. */
|
|
3
|
+
export declare const jsonNumber: (value: unknown) => string | undefined;
|
|
4
|
+
export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
5
|
+
/** Bitrix24 takes `stageId` and `STAGE_ID` alike: one field code in any letter case, with or without underscores. */
|
|
6
|
+
export declare const foldCode: (name: string) => string;
|
|
7
|
+
/**
|
|
8
|
+
* Bitrix24 takes `stageId` and `STAGE_ID` alike, and which of two it applies is not documented: a body that names a
|
|
9
|
+
* key twice in any spelling is refused, so the checks and the portal cannot read it differently (NEED-2338).
|
|
10
|
+
*/
|
|
11
|
+
export declare const unambiguous: (value: unknown) => void;
|
|
12
|
+
/** `--body` as the one object every check reads and the portal is sent. */
|
|
13
|
+
export declare const parseBody: (text: string | undefined, what: string) => Body;
|
|
14
|
+
//# sourceMappingURL=body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body.d.ts","sourceRoot":"","sources":["../src/body.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;AAKpD,+FAA+F;AAC/F,eAAO,MAAM,UAAU,UAAW,OAAO,KAAG,MAAM,GAAG,SAOtC,CAAA;AAEf,eAAO,MAAM,QAAQ,UAAW,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CACgC,CAAA;AAEzG,qHAAqH;AACrH,eAAO,MAAM,QAAQ,SAAU,MAAM,WAA2C,CAAA;AAEhF;;;GAGG;AACH,eAAO,MAAM,WAAW,UAAW,OAAO,KAAG,IAW5C,CAAA;AAED,2EAA2E;AAC3E,eAAO,MAAM,SAAS,SAAU,MAAM,GAAG,SAAS,QAAQ,MAAM,KAAG,IAMlE,CAAA"}
|
package/dist/body.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { parseApiJson } from "@wirecat/cli-core/cli";
|
|
3
|
+
const refused = (message) => new CliError("validation_error", message, { param: "--body", reason: "body.invalid", sent: false });
|
|
4
|
+
/** `parseApiJson` keeps every number as its JSON text, so an id past 2^53 is sent as typed. */
|
|
5
|
+
export const jsonNumber = (value) => typeof value === "object" &&
|
|
6
|
+
value !== null &&
|
|
7
|
+
// A body's own `{"isLosslessNumber":true}` is a plain object; the parser's numbers are class instances.
|
|
8
|
+
Object.getPrototypeOf(value) !== Object.prototype &&
|
|
9
|
+
value.isLosslessNumber === true
|
|
10
|
+
? String(value.value)
|
|
11
|
+
: undefined;
|
|
12
|
+
export const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && jsonNumber(value) === undefined;
|
|
13
|
+
/** Bitrix24 takes `stageId` and `STAGE_ID` alike: one field code in any letter case, with or without underscores. */
|
|
14
|
+
export const foldCode = (name) => name.replaceAll("_", "").toLowerCase();
|
|
15
|
+
/**
|
|
16
|
+
* Bitrix24 takes `stageId` and `STAGE_ID` alike, and which of two it applies is not documented: a body that names a
|
|
17
|
+
* key twice in any spelling is refused, so the checks and the portal cannot read it differently (NEED-2338).
|
|
18
|
+
*/
|
|
19
|
+
export const unambiguous = (value) => {
|
|
20
|
+
if (Array.isArray(value))
|
|
21
|
+
for (const one of value)
|
|
22
|
+
unambiguous(one);
|
|
23
|
+
if (!isRecord(value))
|
|
24
|
+
return;
|
|
25
|
+
const seen = new Map();
|
|
26
|
+
for (const [key, inner] of Object.entries(value)) {
|
|
27
|
+
const other = seen.get(foldCode(key));
|
|
28
|
+
if (other !== undefined)
|
|
29
|
+
throw refused(`${other} and ${key} name the same Bitrix24 field, which may then take either value; keep one`);
|
|
30
|
+
seen.set(foldCode(key), key);
|
|
31
|
+
unambiguous(inner);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/** `--body` as the one object every check reads and the portal is sent. */
|
|
35
|
+
export const parseBody = (text, what) => {
|
|
36
|
+
if (text === undefined)
|
|
37
|
+
return Object.freeze({});
|
|
38
|
+
const parsed = parseApiJson(text);
|
|
39
|
+
if (!isRecord(parsed))
|
|
40
|
+
throw refused(`--body takes a JSON object: ${what}`);
|
|
41
|
+
unambiguous(parsed);
|
|
42
|
+
return Object.freeze(parsed);
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=body.js.map
|
package/dist/body.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body.js","sourceRoot":"","sources":["../src/body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAIpD,MAAM,OAAO,GAAG,CAAC,OAAe,EAAE,EAAE,C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KAAK,CAAC,EAAE,CAAC;QACjD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;QACrC,IAAI,KAAK,KAAK,SAAS;YACrB,MAAM,OAAO,CAAC,GAAG,KAAK,QAAQ,GAAG,2EAA2E,CAAC,CAAA;QAC/G,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAA;QAC5B,WAAW,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;AACH,CAAC,CAAA;AAED,2EAA2E;AAC3E,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAwB,EAAE,IAAY,EAAQ,EAAE;IACxE,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAChD,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IACjC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,MAAM,OAAO,CAAC,+BAA+B,IAAI,EAAE,CAAC,CAAA;IAC3E,WAAW,CAAC,MAAM,CAAC,CAAA;IACnB,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AAC9B,CAAC,CAAA"}
|
|
@@ -2,22 +2,28 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
answeredWire
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PBIBGIZ7.js";
|
|
6
6
|
import {
|
|
7
7
|
CALLER_META_KEY,
|
|
8
8
|
PROXY_CLIENT_NAME,
|
|
9
9
|
StdioServerTransport,
|
|
10
10
|
callerOf,
|
|
11
11
|
serveStdio
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-IERYD2N2.js";
|
|
13
13
|
import {
|
|
14
14
|
McpServer
|
|
15
15
|
} from "./chunk-5D4AEUVA.js";
|
|
16
|
+
import "./chunk-NO6QOPVT.js";
|
|
17
|
+
import "./chunk-5D4MJQ6X.js";
|
|
18
|
+
import "./chunk-KPEDH5T4.js";
|
|
19
|
+
import "./chunk-ZQ3GWKDQ.js";
|
|
20
|
+
import "./chunk-EYYOKT23.js";
|
|
21
|
+
import "./chunk-Y5E2WNWB.js";
|
|
16
22
|
import {
|
|
17
23
|
__name
|
|
18
24
|
} from "./chunk-ZVVMGPBJ.js";
|
|
19
25
|
|
|
20
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.601.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4fddd50439ae4e4f952967ea26554e7b/node_modules/@wirecat/cli-core/dist/mcp/all-profiles.js
|
|
21
27
|
import { spawn } from "node:child_process";
|
|
22
28
|
import { randomUUID } from "node:crypto";
|
|
23
29
|
var PROTOCOL = "2025-06-18";
|
|
@@ -251,7 +257,7 @@ var serveAllProfilesOverStdio = /* @__PURE__ */ __name(async (options, io = {})
|
|
|
251
257
|
}, "serveAllProfilesOverStdio");
|
|
252
258
|
var serveAllProfilesOverHttp = /* @__PURE__ */ __name(async (options, http) => {
|
|
253
259
|
const { build, close } = allProfilesServer(options);
|
|
254
|
-
const { serveOverHttp } = await import("./serve-
|
|
260
|
+
const { serveOverHttp } = await import("./serve-VB4DHDZQ.js");
|
|
255
261
|
const listening = await serveOverHttp(build, {
|
|
256
262
|
...http,
|
|
257
263
|
appName: options.command,
|
|
@@ -271,11 +277,10 @@ var serveAllProfilesOverHttp = /* @__PURE__ */ __name(async (options, http) => {
|
|
|
271
277
|
}, "close")
|
|
272
278
|
};
|
|
273
279
|
}, "serveAllProfilesOverHttp");
|
|
274
|
-
|
|
275
280
|
export {
|
|
276
281
|
CHILD_IDLE_MS,
|
|
277
|
-
withProfile,
|
|
278
282
|
allProfilesServer,
|
|
283
|
+
serveAllProfilesOverHttp,
|
|
279
284
|
serveAllProfilesOverStdio,
|
|
280
|
-
|
|
285
|
+
withProfile
|
|
281
286
|
};
|
|
@@ -2,26 +2,26 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
checkedOptions
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FSWRMQWX.js";
|
|
6
6
|
import {
|
|
7
7
|
messagesFor,
|
|
8
8
|
systemFor
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WWMCJFMT.js";
|
|
10
10
|
import {
|
|
11
11
|
Anthropic
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-FXBHOCJK.js";
|
|
13
13
|
import {
|
|
14
14
|
array,
|
|
15
15
|
optional,
|
|
16
16
|
strictObject,
|
|
17
17
|
string
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-EYYOKT23.js";
|
|
19
19
|
import "./chunk-Y5E2WNWB.js";
|
|
20
20
|
import {
|
|
21
21
|
__name
|
|
22
22
|
} from "./chunk-ZVVMGPBJ.js";
|
|
23
23
|
|
|
24
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.601.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4fddd50439ae4e4f952967ea26554e7b/node_modules/@wirecat/cli-core/dist/models/anthropic.js
|
|
25
25
|
var options = strictObject({
|
|
26
26
|
stop_sequences: optional(array(string()))
|
|
27
27
|
});
|
|
@@ -3,87 +3,98 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
PER_RUN,
|
|
5
5
|
envelope
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-HAXNUIGQ.js";
|
|
8
|
-
import {
|
|
9
|
-
mcpUrlOf
|
|
10
|
-
} from "./chunk-XNHSPHUN.js";
|
|
11
|
-
import {
|
|
12
|
-
answeredWire
|
|
13
|
-
} from "./chunk-RRJNNPR4.js";
|
|
6
|
+
} from "./chunk-ZZEHDIEG.js";
|
|
14
7
|
import {
|
|
15
8
|
answered,
|
|
16
9
|
failed,
|
|
17
10
|
registerCommands,
|
|
18
11
|
runCommandForAgent,
|
|
19
12
|
toolsFromCommands
|
|
20
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-UCHMQWON.js";
|
|
14
|
+
import {
|
|
15
|
+
mcpUrlOf
|
|
16
|
+
} from "./chunk-ZSQXSIFQ.js";
|
|
21
17
|
import {
|
|
22
18
|
agentJson,
|
|
23
19
|
skillResource
|
|
24
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-YDZHO4LT.js";
|
|
21
|
+
import {
|
|
22
|
+
answeredWire
|
|
23
|
+
} from "./chunk-PBIBGIZ7.js";
|
|
25
24
|
import {
|
|
26
25
|
StdioServerTransport,
|
|
27
26
|
serveStdio
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
import "./chunk-
|
|
27
|
+
} from "./chunk-IERYD2N2.js";
|
|
28
|
+
import {
|
|
29
|
+
McpServer
|
|
30
|
+
} from "./chunk-5D4AEUVA.js";
|
|
31
|
+
import "./chunk-VMVAQHDC.js";
|
|
32
|
+
import "./chunk-VMJS7FJZ.js";
|
|
33
|
+
import "./chunk-6YJTNZ7U.js";
|
|
34
|
+
import "./chunk-GUUZQ7NE.js";
|
|
35
|
+
import "./chunk-6A4UPWDC.js";
|
|
36
|
+
import "./chunk-WWMCJFMT.js";
|
|
37
|
+
import "./chunk-KUY7LII2.js";
|
|
33
38
|
import {
|
|
34
39
|
DEFAULT_OUTPUT_BYTES,
|
|
35
40
|
changesAuthorityAt,
|
|
36
41
|
describeProgram,
|
|
37
42
|
environmentOf,
|
|
38
43
|
judgedTargets,
|
|
39
|
-
readOnlyLockOf,
|
|
40
44
|
readsOverMcpAt,
|
|
41
45
|
rootOf2 as rootOf
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import "./chunk-FOTREPNS.js";
|
|
44
|
-
import "./chunk-EVYSBZ3I.js";
|
|
45
|
-
import "./chunk-CXL33BFL.js";
|
|
46
|
-
import "./chunk-CNNEA2M4.js";
|
|
47
|
-
import {
|
|
48
|
-
appInstructions
|
|
49
|
-
} from "./chunk-FLUEXJ4X.js";
|
|
46
|
+
} from "./chunk-J7WCSZ2Q.js";
|
|
50
47
|
import {
|
|
51
|
-
|
|
52
|
-
} from "./chunk-
|
|
48
|
+
readOnlyLockOf
|
|
49
|
+
} from "./chunk-G5MW6RCM.js";
|
|
50
|
+
import "./chunk-NO6QOPVT.js";
|
|
51
|
+
import "./chunk-5D4MJQ6X.js";
|
|
52
|
+
import "./chunk-K4QM3X5F.js";
|
|
53
|
+
import "./chunk-XTA5TN3H.js";
|
|
54
|
+
import "./chunk-LGLT4JB6.js";
|
|
53
55
|
import {
|
|
54
56
|
mcpHttpMarker
|
|
55
|
-
} from "./chunk-
|
|
56
|
-
import "./chunk-
|
|
57
|
-
import "./chunk-
|
|
58
|
-
import
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
import "./chunk-
|
|
62
|
-
import "./chunk-
|
|
63
|
-
import "./chunk-
|
|
64
|
-
import "./chunk-
|
|
65
|
-
import "./chunk-
|
|
66
|
-
import "./chunk-
|
|
67
|
-
import "./chunk-
|
|
68
|
-
import "./chunk-
|
|
69
|
-
import "./chunk-
|
|
70
|
-
import "./chunk-
|
|
71
|
-
import "./chunk-
|
|
72
|
-
import "./chunk-
|
|
73
|
-
import "./chunk-
|
|
74
|
-
import "./chunk-
|
|
75
|
-
import "./chunk-
|
|
57
|
+
} from "./chunk-RS2BARUU.js";
|
|
58
|
+
import "./chunk-IGCLMEMB.js";
|
|
59
|
+
import "./chunk-DVFYRQGE.js";
|
|
60
|
+
import {
|
|
61
|
+
appInstructions
|
|
62
|
+
} from "./chunk-DVSIBZ3G.js";
|
|
63
|
+
import "./chunk-LM4OOBAW.js";
|
|
64
|
+
import "./chunk-ZKINZFIT.js";
|
|
65
|
+
import "./chunk-QNOXAQ6Y.js";
|
|
66
|
+
import "./chunk-BYZQBE63.js";
|
|
67
|
+
import "./chunk-OE3NFB53.js";
|
|
68
|
+
import "./chunk-H6RIPOOI.js";
|
|
69
|
+
import "./chunk-U22JMKUO.js";
|
|
70
|
+
import "./chunk-EYTGCM44.js";
|
|
71
|
+
import "./chunk-36PO5NWY.js";
|
|
72
|
+
import "./chunk-OUMFNB34.js";
|
|
73
|
+
import "./chunk-Q6VQHTRW.js";
|
|
74
|
+
import "./chunk-HGFNC4CR.js";
|
|
75
|
+
import "./chunk-A5IMMGYU.js";
|
|
76
|
+
import "./chunk-GLTKRLFT.js";
|
|
77
|
+
import "./chunk-QHBCNVUG.js";
|
|
78
|
+
import "./chunk-KFSMY7SZ.js";
|
|
79
|
+
import "./chunk-EJEIXC6Y.js";
|
|
80
|
+
import "./chunk-R5F2O5GX.js";
|
|
81
|
+
import "./chunk-5JOPERVF.js";
|
|
82
|
+
import "./chunk-P2RQTNVJ.js";
|
|
83
|
+
import "./chunk-KPEDH5T4.js";
|
|
84
|
+
import "./chunk-ZQ3GWKDQ.js";
|
|
85
|
+
import "./chunk-2I4KWS3H.js";
|
|
86
|
+
import "./chunk-7FBFJ6B4.js";
|
|
76
87
|
import {
|
|
77
88
|
CliError,
|
|
78
89
|
mcpErrorResult
|
|
79
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-EYYOKT23.js";
|
|
80
91
|
import "./chunk-Y5E2WNWB.js";
|
|
81
|
-
import "./chunk-
|
|
92
|
+
import "./chunk-R5PBSKJL.js";
|
|
82
93
|
import {
|
|
83
94
|
__name
|
|
84
95
|
} from "./chunk-ZVVMGPBJ.js";
|
|
85
96
|
|
|
86
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
97
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.601.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4fddd50439ae4e4f952967ea26554e7b/node_modules/@wirecat/cli-core/dist/mcp/app-server.js
|
|
87
98
|
var EXCLUDED = [["mcp"]];
|
|
88
99
|
var createAppServer = /* @__PURE__ */ __name((command, context, options) => {
|
|
89
100
|
const { app } = options;
|
|
@@ -183,9 +194,12 @@ var serveAppOverStdio = /* @__PURE__ */ __name(async (command, context, options)
|
|
|
183
194
|
});
|
|
184
195
|
const ended = await new Promise((resolve) => {
|
|
185
196
|
wire.ended.then(() => resolve("input"));
|
|
186
|
-
if (own)
|
|
187
|
-
signal?.
|
|
188
|
-
|
|
197
|
+
if (own) {
|
|
198
|
+
if (signal?.aborted)
|
|
199
|
+
resolve("stopped");
|
|
200
|
+
else
|
|
201
|
+
signal?.addEventListener("abort", () => resolve("stopped"), { once: true });
|
|
202
|
+
} else {
|
|
189
203
|
process.once("SIGINT", () => resolve("stopped"));
|
|
190
204
|
process.once("SIGTERM", () => resolve("stopped"));
|
|
191
205
|
}
|
|
@@ -198,7 +212,7 @@ var serveAppOverStdio = /* @__PURE__ */ __name(async (command, context, options)
|
|
|
198
212
|
var serveAppOverHttp = /* @__PURE__ */ __name(async (command, context, options, http) => {
|
|
199
213
|
const { app } = options;
|
|
200
214
|
const { build } = createAppServer(command, context, options);
|
|
201
|
-
const { serveOverHttp } = await import("./serve-
|
|
215
|
+
const { serveOverHttp } = await import("./serve-VB4DHDZQ.js");
|
|
202
216
|
const listening = await serveOverHttp(build, {
|
|
203
217
|
...http,
|
|
204
218
|
appName: app.command,
|
package/dist/bundle/b24.js
CHANGED
|
@@ -3,20 +3,26 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
3
3
|
const require = __bundleRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
IDENTITY
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-JZYHQ4HB.js";
|
|
7
|
+
import "./chunk-TG3DSPT5.js";
|
|
8
|
+
import "./chunk-H6RIPOOI.js";
|
|
9
|
+
import "./chunk-FCWPIWSR.js";
|
|
10
|
+
import "./chunk-U22JMKUO.js";
|
|
11
|
+
import "./chunk-EYTGCM44.js";
|
|
10
12
|
import "./chunk-INFYLWUA.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-36PO5NWY.js";
|
|
14
|
+
import "./chunk-OUMFNB34.js";
|
|
15
|
+
import "./chunk-42F7Q7V6.js";
|
|
16
|
+
import "./chunk-Q6VQHTRW.js";
|
|
17
|
+
import "./chunk-EJEIXC6Y.js";
|
|
18
|
+
import "./chunk-R5F2O5GX.js";
|
|
19
|
+
import "./chunk-5JOPERVF.js";
|
|
20
|
+
import "./chunk-P2RQTNVJ.js";
|
|
21
|
+
import "./chunk-KPEDH5T4.js";
|
|
22
|
+
import "./chunk-ZQ3GWKDQ.js";
|
|
17
23
|
import {
|
|
18
24
|
catchCrashes
|
|
19
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-EYYOKT23.js";
|
|
20
26
|
import "./chunk-Y5E2WNWB.js";
|
|
21
27
|
import "./chunk-ZVVMGPBJ.js";
|
|
22
28
|
|
|
@@ -24,7 +30,7 @@ import "./chunk-ZVVMGPBJ.js";
|
|
|
24
30
|
import { enableCompileCache } from "node:module";
|
|
25
31
|
enableCompileCache();
|
|
26
32
|
var stopCatching = catchCrashes({ cli: IDENTITY.command, interactive: process.stdout.isTTY === true });
|
|
27
|
-
var { run } = await import("./program-
|
|
33
|
+
var { run } = await import("./program-BI4A4HFJ.js");
|
|
28
34
|
try {
|
|
29
35
|
process.exitCode = await run(process.argv.slice(2));
|
|
30
36
|
} finally {
|