@mastra/telegram 0.2.1 → 0.2.2-alpha.1

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/dist/index.cjs CHANGED
@@ -19375,7 +19375,7 @@ function isUint8Array(value) {
19375
19375
  return Boolean(value && typeof value === "object" && "byteLength" in value && "byteOffset" in value);
19376
19376
  }
19377
19377
  //#endregion
19378
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/chat/4.40.0/812501c7a15f847e73b05ce99c81d2d9c3310ee4f208ad61509a2d1b4aae4089/node_modules/chat/dist/chunk-VB76CUI4.js
19378
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/chat/4.40.0/e3b0aa067aace4be4e5fc7363bfc9caeacc76aef4f0427935e22a21ee554e837/node_modules/chat/dist/chunk-VB76CUI4.js
19379
19379
  function isListNode(node) {
19380
19380
  return node.type === "list";
19381
19381
  }
@@ -20276,7 +20276,7 @@ var vn = (n, r) => {
20276
20276
  };
20277
20277
  var $e = vn;
20278
20278
  //#endregion
20279
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/chat/4.40.0/812501c7a15f847e73b05ce99c81d2d9c3310ee4f208ad61509a2d1b4aae4089/node_modules/chat/dist/chunk-BKACWYIW.js
20279
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/chat/4.40.0/e3b0aa067aace4be4e5fc7363bfc9caeacc76aef4f0427935e22a21ee554e837/node_modules/chat/dist/chunk-BKACWYIW.js
20280
20280
  var adapterMap = /* @__PURE__ */ new WeakMap();
20281
20281
  var Message = class _Message {
20282
20282
  /** Unique message ID */
@@ -20687,7 +20687,7 @@ function wrapTablesForAppend(text2, closeFences = false) {
20687
20687
  new AbortController().signal;
20688
20688
  new async_hooks.AsyncLocalStorage();
20689
20689
  //#endregion
20690
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/chat/4.40.0/812501c7a15f847e73b05ce99c81d2d9c3310ee4f208ad61509a2d1b4aae4089/node_modules/chat/dist/index.js
20690
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/chat/4.40.0/e3b0aa067aace4be4e5fc7363bfc9caeacc76aef4f0427935e22a21ee554e837/node_modules/chat/dist/index.js
20691
20691
  var emojiRegistry = /* @__PURE__ */ new Map();
20692
20692
  function getEmoji(name) {
20693
20693
  let emojiValue = emojiRegistry.get(name);
@@ -21353,7 +21353,7 @@ createEmoji();
21353
21353
  var cardChildToFallbackText2 = cardChildToFallbackText;
21354
21354
  var isCardElement2 = isCardElement;
21355
21355
  //#endregion
21356
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@chat-adapter/shared/4.40.0/fce4918c61c1df207adfd85bd40413a154f91b156c76778268cca9eac6100664/node_modules/@chat-adapter/shared/dist/index.js
21356
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@chat-adapter/shared/4.40.0/f1f3c17376ef6c917201d234c00ad297a945fd4ddb3785825da1b1e6e03acb1b/node_modules/@chat-adapter/shared/dist/index.js
21357
21357
  function extractCard(message) {
21358
21358
  if (isCardElement2(message)) return message;
21359
21359
  if (typeof message === "object" && message !== null && "card" in message) return message.card;
@@ -21493,7 +21493,7 @@ function blocklist(ranges, family) {
21493
21493
  blocklist(IPV4, "ipv4");
21494
21494
  blocklist(IPV6, "ipv6");
21495
21495
  //#endregion
21496
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@chat-adapter/telegram/4.40.0/2ef492177ff8ab13f86cb97c925417d9e41f7412cd1657efee41ac94fe25b285/node_modules/@chat-adapter/telegram/dist/index.js
21496
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@chat-adapter/telegram/4.40.0/7e18d809461d867625958d9efe887af8483ea427280b1205a4dfa6aeb7484ea8/node_modules/@chat-adapter/telegram/dist/index.js
21497
21497
  var CALLBACK_DATA_PREFIX = "chat:";
21498
21498
  var TELEGRAM_CALLBACK_DATA_LIMIT_BYTES = 64;
21499
21499
  function convertLabel(label) {
@@ -24478,7 +24478,7 @@ var TelegramProvider = class {
24478
24478
  return {
24479
24479
  id: this.id,
24480
24480
  name: "Telegram",
24481
- isConfigured: this.#configured,
24481
+ isConfigured: this.isConfigured(),
24482
24482
  connectOptionsSchema: {
24483
24483
  type: "object",
24484
24484
  properties: {
@@ -24728,12 +24728,15 @@ var TelegramProvider = class {
24728
24728
  return await (await this.#getStore()).getByAgent(agentId) ?? null;
24729
24729
  }
24730
24730
  /**
24731
- * Whether at least one bot is actively registered. Mirrors
24732
- * `SlackProvider.isConfigured` (Telegram has no global credential to check —
24733
- * "configured" means an active installation exists).
24731
+ * Whether the provider is ready to connect agents: either a bot is already
24732
+ * registered (#configured) or a credential source exists — a default
24733
+ * `botToken`, or a `tokenResolver` in delegated mode (@mastra/connect).
24734
+ * Without the credential-source half, a freshly attached platform credential
24735
+ * reports unconfigured and UIs hide the connect action entirely. Mirrors
24736
+ * `DiscordProvider.isConfigured` / `SlackProvider.isConfigured`.
24734
24737
  */
24735
24738
  isConfigured() {
24736
- return this.#configured;
24739
+ return this.#configured || Boolean(this.#config.tokenResolver ?? this.#config.botToken);
24737
24740
  }
24738
24741
  /**
24739
24742
  * Get the live `TelegramAdapter` for an installation id, if one is active.
@@ -24893,6 +24896,9 @@ var TelegramProvider = class {
24893
24896
  #getBaseUrl() {
24894
24897
  if (this.#config.baseUrl) return stripTrailingSlash(this.#config.baseUrl);
24895
24898
  const server = this.#mastra?.getServer();
24899
+ const hasPublicOverride = server?.studioHost != null || server?.studioPort != null || server?.studioProtocol != null;
24900
+ const envUrl = process.env.MASTRA_SERVER_URL?.trim();
24901
+ if (!hasPublicOverride && envUrl) return stripTrailingSlash(envUrl);
24896
24902
  if (!server) return void 0;
24897
24903
  const protocol = server.studioProtocol ?? "http";
24898
24904
  const host = server.studioHost ?? server.host ?? "localhost";