@llblab/pi-telegram 0.27.6 → 0.27.8

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.27.8: Bidirectional Thread Routing Hotfix
4
+
5
+ - `Directional Ownership`: Internal cross-instance turns now bypass only ownership of the already-sent Telegram message id while preserving ownership of the destination thread. Impact: follower-to-leader turns avoid bouncing back to their sender, while leader-to-follower and follower-to-follower turns still forward through the destination follower's live registration.
6
+ - `Regression Coverage`: Focused tests independently prove source-message ownership bypass, destination-thread ownership forwarding with exact registration generation, and preservation of the internal agent-turn marker. Impact: both routing directions remain explicit instead of one fix silently disabling the opposite direction.
7
+
8
+ ## 0.27.7: Bidirectional Thread Messaging Hotfix
9
+
10
+ - `Follower-to-Leader Agent Turns`: Internal cross-instance turns now bypass ownership lookup for the already-sent Telegram message id while retaining that id as reply context. Impact: a follower targeting the leader reaches the leader queue instead of ownership routing the synthetic turn back to the sending follower.
11
+
3
12
  ## 0.27.6: Autonomous Follow-Up Delivery Hotfix
4
13
 
5
14
  - `Follow-Up Finals`: Completed public assistant blocks from unclassified Pi turns now follow the default-enabled Proactive Push path, alongside explicitly local and autonomous turns. Impact: actor terminal follow-ups and comparable extension-triggered continuations no longer show reasoning/activity in Telegram while silently dropping the final answer.
@@ -11,6 +11,7 @@ import type {
11
11
  } from "./bus.ts";
12
12
  import type { TelegramRoutedMessage } from "./routing.ts";
13
13
  import type { TelegramTarget } from "./target.ts";
14
+ import { TELEGRAM_INTERNAL_AGENT_MESSAGE } from "./updates.ts";
14
15
 
15
16
  export interface TelegramAgentMessageRuntimeDeps<TContext, TUpdate> {
16
17
  instanceId: string;
@@ -110,7 +111,10 @@ export function createTelegramAgentMessageRuntime<TContext, TUpdate>(
110
111
  message_thread_id: target.threadId,
111
112
  text: `[agent|from-thread:${sourceLabel}]\n\n${input.message.text}`,
112
113
  } as TelegramRoutedMessage;
113
- await deps.handleUpdate({ message } as TUpdate, ctx);
114
+ await deps.handleUpdate(
115
+ { message, [TELEGRAM_INTERNAL_AGENT_MESSAGE]: true } as TUpdate,
116
+ ctx,
117
+ );
114
118
  },
115
119
  };
116
120
  }
package/lib/updates.ts CHANGED
@@ -303,9 +303,14 @@ export interface TelegramMessageReactionUpdated {
303
303
  new_reaction: TelegramReactionType[];
304
304
  }
305
305
 
306
+ export const TELEGRAM_INTERNAL_AGENT_MESSAGE = Symbol(
307
+ "telegram.internalAgentMessage",
308
+ );
309
+
306
310
  export interface TelegramUpdateFlow
307
311
  extends TelegramUpdateRouting, TelegramUpdateDeletion {
308
312
  message_reaction?: TelegramMessageReactionUpdated;
313
+ [TELEGRAM_INTERNAL_AGENT_MESSAGE]?: true;
309
314
  }
310
315
 
311
316
  export type TelegramUpdateFlowAction<
@@ -807,9 +812,12 @@ export async function executeTelegramUpdate<
807
812
  NonNullable<TUpdate["message"] | TUpdate["edited_message"]>
808
813
  >,
809
814
  ): Promise<void> {
815
+ const runtimeDeps = update[TELEGRAM_INTERNAL_AGENT_MESSAGE]
816
+ ? { ...deps, getMessageOwnership: undefined }
817
+ : deps;
810
818
  await executeTelegramUpdatePlan(
811
819
  buildTelegramUpdateExecutionPlanFromUpdate(update, allowedUserId),
812
- deps,
820
+ runtimeDeps,
813
821
  );
814
822
  }
815
823
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llblab/pi-telegram",
3
- "version": "0.27.6",
3
+ "version": "0.27.8",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"