@mestreyoda/fabrica 0.1.10 → 0.1.11

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.js CHANGED
@@ -111329,8 +111329,8 @@ import fsSync from "node:fs";
111329
111329
  import path5 from "node:path";
111330
111330
  import { fileURLToPath as fileURLToPath3 } from "node:url";
111331
111331
  function getCurrentVersion() {
111332
- if ("0.1.10") {
111333
- return "0.1.10";
111332
+ if ("0.1.11") {
111333
+ return "0.1.11";
111334
111334
  }
111335
111335
  try {
111336
111336
  const pkgPath = path5.join(THIS_DIR, "..", "..", "package.json");
@@ -142611,8 +142611,12 @@ function registerTelegramBootstrapHook(api, ctx) {
142611
142611
  api.on("before_prompt_build", async (_event, eventCtx) => {
142612
142612
  const hookCtx = eventCtx;
142613
142613
  if (hookCtx.channelId !== "telegram") return {};
142614
- const conversationId = String(hookCtx.conversationId ?? "").trim();
142615
- if (!conversationId || conversationId.includes(":topic:") || conversationId.startsWith("-")) return {};
142614
+ const sessionKey = hookCtx.sessionKey ?? "";
142615
+ if (sessionKey.includes(":topic:") || sessionKey.includes(":group:")) return {};
142616
+ const sessionKeyParts = sessionKey.split(":");
142617
+ const chatId = sessionKeyParts.length >= 5 ? sessionKeyParts[sessionKeyParts.length - 1] : "";
142618
+ const conversationId = chatId ? `telegram:${chatId}` : "";
142619
+ if (!conversationId) return {};
142616
142620
  const workspaceDir = resolveWorkspaceDir(ctx.config);
142617
142621
  if (!workspaceDir) return {};
142618
142622
  const session = await readTelegramBootstrapSession(workspaceDir, conversationId);
@@ -142625,11 +142629,14 @@ function registerTelegramBootstrapHook(api, ctx) {
142625
142629
  ].join("\n")
142626
142630
  };
142627
142631
  });
142628
- api.on("message_sending", async (_event, eventCtx) => {
142632
+ api.on("message_sending", async (event, eventCtx) => {
142629
142633
  const hookCtx = eventCtx;
142630
142634
  if (hookCtx.channelId !== "telegram") return;
142631
- const conversationId = String(hookCtx.conversationId ?? "").trim();
142632
- if (!conversationId || conversationId.includes(":topic:") || conversationId.startsWith("-")) return;
142635
+ const sendEvent = event;
142636
+ const rawTo = String(sendEvent.to ?? "").trim();
142637
+ if (!rawTo || rawTo.startsWith("-")) return;
142638
+ const conversationId = rawTo.includes(":") ? rawTo : `telegram:${rawTo}`;
142639
+ if (conversationId.includes(":topic:")) return;
142633
142640
  const workspaceDir = resolveWorkspaceDir(ctx.config);
142634
142641
  if (!workspaceDir) return;
142635
142642
  const session = await readTelegramBootstrapSession(workspaceDir, conversationId);