@llblab/pi-telegram 0.18.4 → 0.18.5

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/lib/status.ts CHANGED
@@ -113,6 +113,17 @@ export interface TelegramBridgeStatusBusFollower {
113
113
  status?: string;
114
114
  }
115
115
 
116
+ export interface TelegramBridgeStatusLocalBus {
117
+ leaderSocketPath?: string;
118
+ leaderTransport?: "pipe" | "socket";
119
+ followerSocketPath?: string;
120
+ followerTransport?: "pipe" | "socket";
121
+ followerRegistered?: boolean;
122
+ followerTarget?: { chatId: number; threadId?: number };
123
+ followerSlot?: string;
124
+ followerThreadName?: string;
125
+ }
126
+
116
127
  export interface TelegramBridgeStatusTopicTarget {
117
128
  instanceId?: string;
118
129
  status?: string;
@@ -187,6 +198,7 @@ export interface TelegramBridgeStatusLineState {
187
198
  pendingModelSwitch: boolean;
188
199
  queuedItems: Array<{ queueLane: TelegramStatusQueueLane }>;
189
200
  busFollowers?: TelegramBridgeStatusBusFollower[];
201
+ localBus?: TelegramBridgeStatusLocalBus;
190
202
  topicTargets?: TelegramBridgeStatusTopicTarget[];
191
203
  threadReservations?: TelegramBridgeStatusThreadReservation[];
192
204
  topicSyncObservations?: TelegramBridgeStatusSyncObservation[];
@@ -266,6 +278,7 @@ export interface TelegramBridgeStatusRuntimeDeps<
266
278
  }
267
279
  | undefined;
268
280
  getBusFollowers?: () => TelegramBridgeStatusBusFollower[];
281
+ getLocalBus?: () => TelegramBridgeStatusLocalBus | undefined;
269
282
  getTopicTargets?: () => TelegramBridgeStatusTopicTarget[];
270
283
  getThreadReservations?: () => TelegramBridgeStatusThreadReservation[];
271
284
  getTopicSyncObservations?: () => TelegramBridgeStatusSyncObservation[];
@@ -626,6 +639,7 @@ export function createTelegramBridgeStatusRuntime<
626
639
  pendingModelSwitch: deps.hasPendingModelSwitch(),
627
640
  queuedItems: deps.getQueuedItems(),
628
641
  busFollowers: deps.getBusFollowers?.(),
642
+ localBus: deps.getLocalBus?.(),
629
643
  topicTargets: deps.getTopicTargets?.(),
630
644
  threadReservations: deps.getThreadReservations?.(),
631
645
  topicSyncObservations: deps.getTopicSyncObservations?.(),
@@ -682,6 +696,7 @@ export function createTelegramStatusSnapshot(
682
696
  },
683
697
  liveRoster: {
684
698
  busFollowers: state.busFollowers ?? [],
699
+ ...(state.localBus ? { localBus: state.localBus } : {}),
685
700
  topicTargets: state.topicTargets ?? [],
686
701
  reservations: state.threadReservations ?? [],
687
702
  syncObservations: state.topicSyncObservations ?? [],
@@ -824,6 +839,38 @@ function buildTelegramBusFollowerLines(
824
839
  ];
825
840
  }
826
841
 
842
+ function buildTelegramLocalBusLines(
843
+ state: Pick<TelegramBridgeStatusLineState, "localBus">,
844
+ options: { verbose?: boolean } = {},
845
+ ): string[] {
846
+ const localBus = state.localBus;
847
+ if (!localBus) return [];
848
+ const target = formatTelegramStatusTarget(localBus.followerTarget);
849
+ const label = formatTelegramThreadStatusLabel({
850
+ slot: localBus.followerSlot,
851
+ threadName: localBus.followerThreadName,
852
+ });
853
+ const followerLine = `- follower registered: ${localBus.followerRegistered ? "yes" : "no"}${label ? ` ${label}` : ""}${target}`;
854
+ const lines = ["", "local bus:", followerLine];
855
+ if (options.verbose) {
856
+ if (localBus.leaderSocketPath) {
857
+ const transport = localBus.leaderTransport
858
+ ? ` [${localBus.leaderTransport}]`
859
+ : "";
860
+ lines.push(`- leader endpoint${transport}: ${localBus.leaderSocketPath}`);
861
+ }
862
+ if (localBus.followerSocketPath) {
863
+ const transport = localBus.followerTransport
864
+ ? ` [${localBus.followerTransport}]`
865
+ : "";
866
+ lines.push(
867
+ `- follower endpoint${transport}: ${localBus.followerSocketPath}`,
868
+ );
869
+ }
870
+ }
871
+ return lines;
872
+ }
873
+
827
874
  function buildTelegramSyncSliceLines(
828
875
  state: Pick<TelegramBridgeStatusLineState, "syncState">,
829
876
  ): string[] {
@@ -1038,6 +1085,8 @@ function buildTelegramBridgeCompactStatusLines(
1038
1085
  : []),
1039
1086
  ...(state.pendingModelSwitch ? ["- pending model switch: yes"] : []),
1040
1087
  ...buildTelegramBridgeCompactThreadLines(state),
1088
+ ...buildTelegramBusFollowerLines(state),
1089
+ ...buildTelegramLocalBusLines(state),
1041
1090
  ...buildTelegramThreadReconciliationLines(state),
1042
1091
  "",
1043
1092
  "diagnostics:",
@@ -1100,6 +1149,7 @@ export function buildTelegramBridgeDiagnosticStatusLines(
1100
1149
  `- queued turns: ${state.queuedItems.length}`,
1101
1150
  `- lanes: control=${controlQueueCount}, priority=${priorityQueueCount}, default=${defaultQueueCount}`,
1102
1151
  ...buildTelegramBusFollowerLines(state),
1152
+ ...buildTelegramLocalBusLines(state, { verbose: true }),
1103
1153
  ...buildTelegramTopicTargetDiagnosticLines(state),
1104
1154
  ...buildTelegramThreadReconciliationLines(state),
1105
1155
  ...buildTelegramSyncSliceLines(state),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llblab/pi-telegram",
3
- "version": "0.18.4",
3
+ "version": "0.18.5",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"