@openacp/cli 0.3.0 → 0.3.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.
@@ -614,6 +614,7 @@ var Session = class {
614
614
  }
615
615
  }
616
616
  async cancel() {
617
+ this.promptQueue = [];
617
618
  this.status = "cancelled";
618
619
  this.log.info("Session cancelled");
619
620
  await this.agentInstance.cancel();
@@ -2204,10 +2205,11 @@ function setupSkillCallbacks(bot, core) {
2204
2205
  }
2205
2206
  async function executeNewSession(bot, core, chatId, agentName, workspace) {
2206
2207
  const threadId = await createSessionTopic(bot, chatId, "\u{1F504} New Session");
2207
- await bot.api.sendMessage(chatId, "\u23F3 Setting up session, please wait...", {
2208
+ const setupMsg = await bot.api.sendMessage(chatId, "\u23F3 Setting up session, please wait...", {
2208
2209
  message_thread_id: threadId,
2209
2210
  parse_mode: "HTML"
2210
2211
  });
2212
+ const firstMsgId = setupMsg.message_id;
2211
2213
  try {
2212
2214
  const session = await core.handleNewSession(
2213
2215
  "telegram",
@@ -2221,7 +2223,7 @@ async function executeNewSession(bot, core, chatId, agentName, workspace) {
2221
2223
  const finalName = `\u{1F504} ${session.agentName} \u2014 New Session`;
2222
2224
  await renameSessionTopic(bot, chatId, threadId, finalName);
2223
2225
  session.warmup().catch((err) => log6.error({ err }, "Warm-up error"));
2224
- return { session, threadId };
2226
+ return { session, threadId, firstMsgId };
2225
2227
  } catch (err) {
2226
2228
  try {
2227
2229
  await bot.api.deleteForumTopic(chatId, threadId);
@@ -2495,6 +2497,9 @@ var UsageMessage = class {
2495
2497
  log9.warn({ err }, "UsageMessage.send() failed");
2496
2498
  }
2497
2499
  }
2500
+ getMsgId() {
2501
+ return this.msgId;
2502
+ }
2498
2503
  async delete() {
2499
2504
  if (!this.msgId) return;
2500
2505
  const id = this.msgId;
@@ -2632,6 +2637,9 @@ var ActivityTracker = class {
2632
2637
  async sendUsage(data) {
2633
2638
  await this.usage.send(data);
2634
2639
  }
2640
+ getUsageMsgId() {
2641
+ return this.usage.getMsgId();
2642
+ }
2635
2643
  async onComplete() {
2636
2644
  if (this.hasPlanCard) {
2637
2645
  await this.planCard.finalize();
@@ -2650,6 +2658,7 @@ var ActivityTracker = class {
2650
2658
  }
2651
2659
  }
2652
2660
  destroy() {
2661
+ this.thinking.dismiss();
2653
2662
  this.planCard.destroy();
2654
2663
  }
2655
2664
  async _firstEventGuard() {
@@ -2807,14 +2816,14 @@ function setupActionCallbacks(bot, core, chatId, getAssistantSessionId) {
2807
2816
  try {
2808
2817
  if (action.action === "new_session") {
2809
2818
  await ctx.answerCallbackQuery({ text: "\u23F3 Creating session..." });
2810
- const { threadId } = await executeNewSession(
2819
+ const { threadId, firstMsgId } = await executeNewSession(
2811
2820
  bot,
2812
2821
  core,
2813
2822
  chatId,
2814
2823
  action.agent,
2815
2824
  action.workspace
2816
2825
  );
2817
- const topicLink = `https://t.me/c/${String(chatId).replace("-100", "")}/${threadId}`;
2826
+ const topicLink = `https://t.me/c/${String(chatId).replace("-100", "")}/${firstMsgId ?? threadId}`;
2818
2827
  const originalText = ctx.callbackQuery.message?.text ?? "";
2819
2828
  try {
2820
2829
  await ctx.editMessageText(
@@ -3242,7 +3251,8 @@ Workspace: <code>${workspace}</code>
3242
3251
  const sessionName = sess?.name || "Session";
3243
3252
  const chatIdStr = String(this.telegramConfig.chatId);
3244
3253
  const numericId = chatIdStr.startsWith("-100") ? chatIdStr.slice(4) : chatIdStr.replace("-", "");
3245
- const deepLink = `https://t.me/c/${numericId}/${threadId}`;
3254
+ const usageMsgId = tracker.getUsageMsgId();
3255
+ const deepLink = `https://t.me/c/${numericId}/${usageMsgId ?? threadId}`;
3246
3256
  const text = `\u2705 <b>${escapeHtml(sessionName)}</b>
3247
3257
  Task completed.
3248
3258
 
@@ -3537,4 +3547,4 @@ export {
3537
3547
  ApiServer,
3538
3548
  TelegramAdapter
3539
3549
  };
3540
- //# sourceMappingURL=chunk-C6IFPAWN.js.map
3550
+ //# sourceMappingURL=chunk-SWQRUVBW.js.map