@wirecat/tg-cli 0.101.0 → 0.102.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 (95) hide show
  1. package/dist/bin/tg.js +1 -1
  2. package/dist/bot/transport.d.ts.map +1 -1
  3. package/dist/bot/transport.js +14 -17
  4. package/dist/bot/transport.js.map +1 -1
  5. package/dist/bundle/{adapter-A3VD4Y6Z.js → adapter-M2HRSFFL.js} +90 -28
  6. package/dist/bundle/{all-profiles-UPVNHXB2.js → all-profiles-GOD2QNTK.js} +29 -8
  7. package/dist/bundle/{anthropic-IRKNWPIB.js → anthropic-LKU7RWMA.js} +3 -3
  8. package/dist/bundle/{bot-api-UNTQG2M5.js → bot-api-X3MPFVPL.js} +42 -46
  9. package/dist/bundle/{bot-history-V4RTY5K7.js → bot-history-OUMVVG22.js} +10 -10
  10. package/dist/bundle/{bun-2JZPG2NL.js → bun-LIZ6MKFS.js} +2 -2
  11. package/dist/bundle/{bun-sqlite-TZHKM225.js → bun-sqlite-2IFQYQ44.js} +2 -2
  12. package/dist/bundle/{chunk-VA5YEJS3.js → chunk-264DAFJV.js} +4 -4
  13. package/dist/bundle/{chunk-ZV24I2UJ.js → chunk-2SUTCDGO.js} +1 -1
  14. package/dist/bundle/{chunk-BX6HH4F6.js → chunk-334UBWOB.js} +10 -10
  15. package/dist/bundle/{chunk-2DGOFLDA.js → chunk-4PDEQL6T.js} +1 -1
  16. package/dist/bundle/chunk-4QB4WDLT.js +922 -0
  17. package/dist/bundle/{chunk-MLLJ74LM.js → chunk-5D6OJREA.js} +1 -1
  18. package/dist/bundle/{chunk-RF54YDBB.js → chunk-5DFGJPT6.js} +4 -4
  19. package/dist/bundle/{chunk-TGREFJVA.js → chunk-5VSR5ENL.js} +7 -7
  20. package/dist/bundle/{chunk-VCGL2ETF.js → chunk-AUOXTGTU.js} +1 -1
  21. package/dist/bundle/{chunk-X4Y2ROJI.js → chunk-BBC546ZA.js} +91 -2
  22. package/dist/bundle/{chunk-QOWSVDPZ.js → chunk-BQYTIYGB.js} +106 -95
  23. package/dist/bundle/{chunk-XCKD54TN.js → chunk-CLWYQNSC.js} +5 -5
  24. package/dist/bundle/{chunk-7CBUCTB6.js → chunk-CRZPQQHE.js} +27 -33
  25. package/dist/bundle/chunk-DE7LFMY2.js +440 -0
  26. package/dist/bundle/{chunk-ODSVNH3H.js → chunk-ENE5CSVY.js} +2373 -1266
  27. package/dist/bundle/{chunk-G2US6LJB.js → chunk-ERQDBK5I.js} +1 -1
  28. package/dist/bundle/{chunk-W2336E7Y.js → chunk-F2TG3BA2.js} +4 -4
  29. package/dist/bundle/{chunk-DYNSP6FW.js → chunk-FBWOQMPE.js} +1442 -769
  30. package/dist/bundle/{chunk-5TPT2S2Z.js → chunk-FOUE7XLK.js} +1 -1
  31. package/dist/bundle/{chunk-RVCS7Q3A.js → chunk-GSKFAE3I.js} +1287 -512
  32. package/dist/bundle/{chunk-6IPY2QRG.js → chunk-HLAZ65AW.js} +1 -1
  33. package/dist/bundle/{chunk-A5JSTZZZ.js → chunk-JFSVXMN6.js} +2 -2
  34. package/dist/bundle/{chunk-N5UFBWDM.js → chunk-M5UH5CF3.js} +5 -7
  35. package/dist/bundle/{chunk-F7TDFWXY.js → chunk-MGG7JSNO.js} +2 -2
  36. package/dist/bundle/{chunk-H6OXALTJ.js → chunk-OCWARAFE.js} +1 -1
  37. package/dist/bundle/{chunk-S7ZNLLY5.js → chunk-OHBHHBYL.js} +2 -2
  38. package/dist/bundle/{chunk-5GKXETRP.js → chunk-PSH7K6TL.js} +610 -51
  39. package/dist/bundle/{chunk-VYDTI254.js → chunk-Q2NYEX4A.js} +53 -34
  40. package/dist/bundle/{chunk-G3ZRY436.js → chunk-QEPZUFPL.js} +46 -46
  41. package/dist/bundle/{chunk-BXQS5RCE.js → chunk-QL7CQ6VZ.js} +253 -78
  42. package/dist/bundle/{chunk-NC5WS7OP.js → chunk-SRU3OF4R.js} +1 -1
  43. package/dist/bundle/{chunk-PUBS2F5J.js → chunk-TV5DGHBT.js} +242 -242
  44. package/dist/bundle/{chunk-ZEOCU24Z.js → chunk-TXBUDJ3P.js} +1 -1
  45. package/dist/bundle/{chunk-ACGTFLEB.js → chunk-U4RRZUNP.js} +8 -8
  46. package/dist/bundle/{chunk-LPB2MDUW.js → chunk-UK3GAN7Q.js} +6 -6
  47. package/dist/bundle/{chunk-UN6CKIBN.js → chunk-UR6ASUSG.js} +8 -5
  48. package/dist/bundle/{chunk-U46UNBMT.js → chunk-V52SBQYF.js} +236 -13
  49. package/dist/bundle/{chunk-S2JSZWEC.js → chunk-VUJ34PEQ.js} +9 -9
  50. package/dist/bundle/{chunk-QYVVRQTN.js → chunk-W5EB4JLV.js} +2 -2
  51. package/dist/bundle/{chunk-3KHKYYCR.js → chunk-WMOEOVWZ.js} +1 -0
  52. package/dist/bundle/{chunk-VRSN7VLO.js → chunk-WVEHUKCZ.js} +1 -1
  53. package/dist/bundle/{chunk-64DK7S4F.js → chunk-XXTJUZMB.js} +1 -1
  54. package/dist/bundle/{chunk-54R2GDQ3.js → chunk-Y4XSWI22.js} +3 -3
  55. package/dist/bundle/{chunk-4ZS73HTJ.js → chunk-YHB57PFN.js} +1 -1
  56. package/dist/bundle/{chunk-G77QOTXE.js → chunk-ZRNRQFTF.js} +1 -1
  57. package/dist/bundle/{command-contract-TKDI7E56.js → command-contract-A6VZN3ZR.js} +11 -11
  58. package/dist/bundle/{echarts-QZ6PR3VC.js → echarts-27W2CIBD.js} +2 -2
  59. package/dist/bundle/{embed-UBXCXSRD.js → embed-FGJ273X2.js} +2 -2
  60. package/dist/bundle/{embedder-B4ZTKC23.js → embedder-7ELL3CQ3.js} +5 -5
  61. package/dist/bundle/{entry-BTUTHO5M.js → entry-SEE5YWIX.js} +3 -3
  62. package/dist/bundle/{first-run-UC4HRIFV.js → first-run-BD7FEC3W.js} +5 -5
  63. package/dist/bundle/{first-screen-SMCX6YKY.js → first-screen-ASZV6LSA.js} +12 -12
  64. package/dist/bundle/{identity-QSDEGDH7.js → identity-QR4F42T6.js} +1 -1
  65. package/dist/bundle/{instructions-BBGLZKO3.js → instructions-L74K64PV.js} +1 -1
  66. package/dist/bundle/{node-LZZX22VR.js → node-RSL3HANO.js} +2 -2
  67. package/dist/bundle/{node-sqlite-BPGT6T5U.js → node-sqlite-7R3PYQGJ.js} +2 -2
  68. package/dist/bundle/{oauth-XNE2KPKJ.js → oauth-4ESGXF6U.js} +5 -5
  69. package/dist/bundle/{open-SXGYZLB5.js → open-DFYEUGTA.js} +1 -1
  70. package/dist/bundle/{process-GPUXC4PG.js → process-RMV3AKLB.js} +1 -1
  71. package/dist/bundle/{program-NEXEAL7T.js → program-PIUYQHBF.js} +54 -59
  72. package/dist/bundle/{prompt-SORGLEYI.js → prompt-H7GYQQLL.js} +2 -2
  73. package/dist/bundle/{recognize-UJBXORVD.js → recognize-3GMOLZF4.js} +3 -3
  74. package/dist/bundle/{remote-W72AR7KH.js → remote-IRWTCI2B.js} +3 -3
  75. package/dist/bundle/{rerank-3Y2VZM3J.js → rerank-W3OSXXBN.js} +3 -3
  76. package/dist/bundle/{serve-VDZIVOPR.js → serve-ZCPO44NO.js} +7 -7
  77. package/dist/bundle/{server-ZFHN4GUF.js → server-FXU4QFRB.js} +35 -32
  78. package/dist/bundle/{server-BERXP4GW.js → server-YWL4HDOP.js} +68 -59
  79. package/dist/bundle/{state-DGR4EE3E.js → state-MJPTDIB5.js} +3 -3
  80. package/dist/bundle/{store-MRCFSCZD.js → store-6VNQG56O.js} +7 -7
  81. package/dist/bundle/store-maintenance-command-62TQTMER.js +43 -0
  82. package/dist/bundle/tg.js +2 -2
  83. package/dist/telegram/sending.d.ts.map +1 -1
  84. package/dist/telegram/sending.js +52 -3
  85. package/dist/telegram/sending.js.map +1 -1
  86. package/dist/version.d.ts +1 -1
  87. package/dist/version.js +1 -1
  88. package/package.json +2 -2
  89. package/dist/bundle/chunk-22PQUX72.js +0 -190
  90. package/dist/bundle/chunk-CJ6IYCYP.js +0 -583
  91. package/dist/bundle/chunk-NKJJJAIJ.js +0 -237
  92. package/dist/bundle/chunk-NMGO6LW6.js +0 -1950
  93. package/dist/bundle/chunk-OILBDLWL.js +0 -724
  94. package/dist/bundle/chunk-OPBTNQ35.js +0 -1007
  95. package/dist/bundle/store-maintenance-command-DCMZDMYS.js +0 -46
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-AFV74GK3.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/mcp/bot/instructions.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/mcp/bot/instructions.js
8
8
  var botInstructions = /* @__PURE__ */ __name(({ command, name, profile, writes, skill }) => [
9
9
  `The owner's ${name} bot "${profile}", through the official Bot API \u2014 not the owner's personal account. What it writes, people see as the bot.`,
10
10
  "Use these tools to read the chats this bot is in, find a message or a person, and \u2014 when the profile allows \u2014 write as the bot.",
@@ -4,15 +4,15 @@ import {
4
4
  organization,
5
5
  project,
6
6
  reminder
7
- } from "./chunk-54R2GDQ3.js";
7
+ } from "./chunk-Y4XSWI22.js";
8
8
  import {
9
9
  queryFieldsOf
10
- } from "./chunk-G3ZRY436.js";
10
+ } from "./chunk-QEPZUFPL.js";
11
11
 
12
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/snapshot.js
12
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/snapshot.js
13
13
  var MAX_BYTES = 16 * 1024 * 1024;
14
14
 
15
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
15
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
16
16
  var ORGANIZATIONS_QUERY = {
17
17
  entity: "organization",
18
18
  backend: "sql",
@@ -7,7 +7,7 @@ import {
7
7
  __name
8
8
  } from "./chunk-AFV74GK3.js";
9
9
 
10
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/search/languages.js
10
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/languages.js
11
11
  var LANGUAGES = [
12
12
  { name: "russian", code: "ru", label: "Russian", script: "cyrillic", dictionary: "dictionary-ru" },
13
13
  { name: "english", code: "en", label: "English", script: "latin", dictionary: "dictionary-en" },
@@ -15,12 +15,12 @@ var LANGUAGES = [
15
15
  ];
16
16
  var languagesOf = /* @__PURE__ */ __name((script) => LANGUAGES.filter((one) => one.script === script).map(({ name }) => name), "languagesOf");
17
17
 
18
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/store/normalize.js
18
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/normalize.js
19
19
  var NORMALIZER_VERSION = 1;
20
20
  var fold = /* @__PURE__ */ __name((text) => text.normalize("NFKD").replace(new RegExp("\\p{M}+", "gu"), "").normalize("NFC").toLowerCase(), "fold");
21
21
  var normalize = /* @__PURE__ */ __name((text) => fold(text).replace(new RegExp("\\p{Cc}", "gu"), " ").replace(/\s+/gu, " ").trim(), "normalize");
22
22
 
23
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/search/snowball/base-stemmer.js
23
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/snowball/base-stemmer.js
24
24
  var BaseStemmer = class {
25
25
  static {
26
26
  __name(this, "BaseStemmer");
@@ -395,7 +395,7 @@ var BaseStemmer = class {
395
395
  }
396
396
  };
397
397
 
398
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/search/snowball/english-stemmer.js
398
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/snowball/english-stemmer.js
399
399
  var a_0 = [
400
400
  ["arsen", -1],
401
401
  ["commun", -1],
@@ -1096,7 +1096,7 @@ var english_stemmer_default = class extends BaseStemmer {
1096
1096
  stemWord = this.stem;
1097
1097
  };
1098
1098
 
1099
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/search/snowball/russian-stemmer.js
1099
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/snowball/russian-stemmer.js
1100
1100
  var a_02 = [
1101
1101
  ["\u0432", 1],
1102
1102
  ["\u0438\u0432", 2, 1],
@@ -1519,7 +1519,7 @@ var russian_stemmer_default = class extends BaseStemmer {
1519
1519
  stemWord = this.stem;
1520
1520
  };
1521
1521
 
1522
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/search/snowball/spanish-stemmer.js
1522
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/snowball/spanish-stemmer.js
1523
1523
  var a_03 = [
1524
1524
  ["", 6],
1525
1525
  ["\xE1", 1, 1],
@@ -2195,7 +2195,7 @@ var spanish_stemmer_default = class extends BaseStemmer {
2195
2195
  stemWord = this.stem;
2196
2196
  };
2197
2197
 
2198
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/search/stem.js
2198
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/search/stem.js
2199
2199
  var SNOWBALL_VERSION = "3.1.1";
2200
2200
  var CYRILLIC_STEMMERS = [...languagesOf("cyrillic"), "none"];
2201
2201
  var LATIN_STEMMERS = [...languagesOf("latin"), "none"];
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-AFV74GK3.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/http/listen.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/http/listen.js
8
8
  import { createServer } from "node:http";
9
9
  import { Readable } from "node:stream";
10
10
  var MAX_BODY = 4 * 1024 * 1024;
@@ -1,6 +1,7 @@
1
1
  import { createRequire as __tgRequire } from "node:module";
2
2
  const require = __tgRequire(import.meta.url);
3
3
  import {
4
+ CLIENT_INFO_META_KEY,
4
5
  DEFAULT_MAX_SUBSCRIPTIONS,
5
6
  McpServer,
6
7
  ProtocolErrorCode,
@@ -23,7 +24,11 @@ import {
23
24
  serverIdentityOf,
24
25
  setNegotiatedProtocolVersion,
25
26
  validateEnvelopeMeta
26
- } from "./chunk-3KHKYYCR.js";
27
+ } from "./chunk-WMOEOVWZ.js";
28
+ import {
29
+ agentOf,
30
+ clientHash
31
+ } from "./chunk-DE7LFMY2.js";
27
32
  import {
28
33
  __name
29
34
  } from "./chunk-AFV74GK3.js";
@@ -535,7 +540,91 @@ function toError(value) {
535
540
  }
536
541
  __name(toError, "toError");
537
542
 
543
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/mcp/caller.js
544
+ var CALLER_META_KEY = "wirecat.dev/caller";
545
+ var PROXY_CLIENT_NAME = "all-profiles";
546
+ var NAME = /^[\w .@()/+-]{1,64}$/;
547
+ var plain = /* @__PURE__ */ __name((value) => typeof value === "string" && NAME.test(value.trim()) ? value.trim() : void 0, "plain");
548
+ var clientFrom = /* @__PURE__ */ __name((value) => {
549
+ if (!value || typeof value !== "object")
550
+ return void 0;
551
+ const { name, version } = value;
552
+ const named = plain(name);
553
+ if (!named)
554
+ return void 0;
555
+ const versioned = plain(version);
556
+ return { name: named, ...versioned ? { version: versioned } : {} };
557
+ }, "clientFrom");
558
+ var callerOf = /* @__PURE__ */ __name((ctx, tool, source) => {
559
+ const meta = ctx?.mcpReq?._meta;
560
+ const requestId = ctx?.mcpReq?.id;
561
+ const initialized = source.client?.();
562
+ const proxied = initialized?.name === PROXY_CLIENT_NAME ? passedOn(meta?.[CALLER_META_KEY], tool) : void 0;
563
+ if (proxied)
564
+ return proxied;
565
+ const client = clientFrom(meta?.[CLIENT_INFO_META_KEY]) ?? clientFrom(initialized);
566
+ const mcp = /* @__PURE__ */ __name((connection) => ({
567
+ tool,
568
+ ...requestId === void 0 ? {} : { request_id: String(requestId) },
569
+ ...connection ? { connection_id: connection } : {}
570
+ }), "mcp");
571
+ const auth = ctx?.http?.authInfo;
572
+ if (auth) {
573
+ const registered = plain(auth.extra?.clientName);
574
+ return {
575
+ via: "mcp-http",
576
+ agent: {
577
+ kind: "mcp-client",
578
+ session_id: ctx?.sessionId ?? null,
579
+ client: {
580
+ name: registered ?? client?.name ?? "unknown",
581
+ ...client?.version ? { version: client.version } : {},
582
+ id: clientHash(auth.clientId)
583
+ }
584
+ },
585
+ mcp: mcp(ctx?.sessionId)
586
+ };
587
+ }
588
+ const agent = agentOf(source.env) ?? { kind: "mcp-client", session_id: null };
589
+ return { via: "mcp-stdio", agent: { ...agent, ...client ? { client } : {} }, mcp: mcp(source.connectionId) };
590
+ }, "callerOf");
591
+ var passedOn = /* @__PURE__ */ __name((value, tool) => {
592
+ if (!value || typeof value !== "object")
593
+ return void 0;
594
+ const { via, agent, mcp } = value;
595
+ if (via !== "mcp-stdio" && via !== "mcp-http")
596
+ return void 0;
597
+ const a = agent && typeof agent === "object" ? agent : void 0;
598
+ const kind = plain(a?.kind);
599
+ const session = typeof a?.session_id === "string" && /^[A-Za-z0-9._:-]{1,128}$/.test(a.session_id) ? a.session_id : null;
600
+ const client = clientFrom(a?.client);
601
+ const id = a?.client && typeof a.client === "object" ? a.client.id : void 0;
602
+ const m = mcp && typeof mcp === "object" ? mcp : {};
603
+ const request = plain(m.request_id);
604
+ const connection = typeof m.connection_id === "string" && /^[\w-]{1,128}$/.test(m.connection_id) ? m.connection_id : void 0;
605
+ return {
606
+ via,
607
+ ...kind ? {
608
+ agent: {
609
+ kind,
610
+ session_id: session,
611
+ ...a?.from_chat === true ? { from_chat: true } : {},
612
+ ...client ? { client: { ...client, ...typeof id === "string" && /^[0-9a-f]{8}$/.test(id) ? { id } : {} } } : {}
613
+ }
614
+ } : {},
615
+ mcp: {
616
+ tool,
617
+ ...request ? { request_id: request } : {},
618
+ ...connection ? { connection_id: connection } : {},
619
+ proxied: true
620
+ }
621
+ };
622
+ }, "passedOn");
623
+
538
624
  export {
539
625
  StdioServerTransport,
540
- serveStdio
626
+ serveStdio,
627
+ CALLER_META_KEY,
628
+ PROXY_CLIENT_NAME,
629
+ callerOf
541
630
  };