@llblab/pi-telegram 0.39.3 → 0.39.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/CHANGELOG.md +8 -0
- package/lib/bindings.ts +35 -8
- package/lib/status.ts +14 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
> Each release keeps at most 8 outcome records of at most 512 characters.
|
|
4
4
|
|
|
5
|
+
## 0.39.5: Auto-Compaction Notice Chronology Hotfix
|
|
6
|
+
|
|
7
|
+
- `Turn Chronology`: Defers observed automatic-compaction notices while a Telegram turn is still active, preserving the same causal order shown by the terminal: final answer, compaction started, then compaction completed. Abandoned compactions and session shutdown discard deferred notices instead of leaking them into a later turn.
|
|
8
|
+
|
|
9
|
+
## 0.39.4: Headless Status Bar Hotfix
|
|
10
|
+
|
|
11
|
+
- `Headless Hosts`: Skips status-bar rendering when a print, RPC, ACP, or other non-interactive host has not initialized its theme, preventing repeated extension errors during lifecycle status refreshes while preserving normal interactive status updates and error propagation.
|
|
12
|
+
|
|
5
13
|
## 0.39.3: Windows IPC And Outbound Voice Hotfix
|
|
6
14
|
|
|
7
15
|
- `Windows IPC Replacement`: Replaces an older same-process Named Pipe server before a new session generation listens on the stable endpoint, preventing `EADDRINUSE` during reload while keeping a late stop from invalidating its successor.
|
package/lib/bindings.ts
CHANGED
|
@@ -1028,6 +1028,7 @@ export function registerTelegramLifecycleRuntimeHooks({
|
|
|
1028
1028
|
});
|
|
1029
1029
|
};
|
|
1030
1030
|
let observedAutomaticCompaction = false;
|
|
1031
|
+
const deferredAutomaticCompactionNotices: string[] = [];
|
|
1031
1032
|
const sendCompactionNotice = async (text: string): Promise<void> => {
|
|
1032
1033
|
const turn = activeTurnRuntime.get();
|
|
1033
1034
|
const target = turn?.target ?? proactivePushTargetGetter?.();
|
|
@@ -1042,6 +1043,10 @@ export function registerTelegramLifecycleRuntimeHooks({
|
|
|
1042
1043
|
});
|
|
1043
1044
|
}
|
|
1044
1045
|
};
|
|
1046
|
+
const flushDeferredAutomaticCompactionNotices = async (): Promise<void> => {
|
|
1047
|
+
const notices = deferredAutomaticCompactionNotices.splice(0);
|
|
1048
|
+
for (const notice of notices) await sendCompactionNotice(notice);
|
|
1049
|
+
};
|
|
1045
1050
|
const compactionObserver = Lifecycle.createTelegramCompactionObserverRuntime({
|
|
1046
1051
|
isContextActive: isSessionContextActive,
|
|
1047
1052
|
setCompactionInProgress: lifecycle.setCompactionInProgress,
|
|
@@ -1054,6 +1059,7 @@ export function registerTelegramLifecycleRuntimeHooks({
|
|
|
1054
1059
|
recordRuntimeEvent,
|
|
1055
1060
|
onCompactionAbandoned: () => {
|
|
1056
1061
|
observedAutomaticCompaction = false;
|
|
1062
|
+
deferredAutomaticCompactionNotices.length = 0;
|
|
1057
1063
|
activityRuntime.onCompactionAbandoned();
|
|
1058
1064
|
},
|
|
1059
1065
|
});
|
|
@@ -1088,6 +1094,7 @@ export function registerTelegramLifecycleRuntimeHooks({
|
|
|
1088
1094
|
activityVerbosityRuntime?.reset();
|
|
1089
1095
|
assistantOutputRuntime.stop();
|
|
1090
1096
|
observedAutomaticCompaction = false;
|
|
1097
|
+
deferredAutomaticCompactionNotices.length = 0;
|
|
1091
1098
|
compactionObserver.onSessionShutdown();
|
|
1092
1099
|
if (event.reason === "quit" && disconnectOnQuit) {
|
|
1093
1100
|
try {
|
|
@@ -1109,11 +1116,17 @@ export function registerTelegramLifecycleRuntimeHooks({
|
|
|
1109
1116
|
activityRuntime.onCompactionStart(Pi.getSessionCompactionReason(event));
|
|
1110
1117
|
compactionObserver.onSessionBeforeCompact(event, ctx);
|
|
1111
1118
|
if (shouldNotify) {
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1119
|
+
if (activeTurnRuntime.has()) {
|
|
1120
|
+
deferredAutomaticCompactionNotices.push(
|
|
1121
|
+
Commands.TELEGRAM_COMPACTION_STARTED_MARKDOWN,
|
|
1122
|
+
);
|
|
1123
|
+
} else {
|
|
1124
|
+
await waitForActiveTurnDelivery();
|
|
1125
|
+
if (!isSessionContextActive(ctx)) return;
|
|
1126
|
+
await sendCompactionNotice(
|
|
1127
|
+
Commands.TELEGRAM_COMPACTION_STARTED_MARKDOWN,
|
|
1128
|
+
);
|
|
1129
|
+
}
|
|
1117
1130
|
}
|
|
1118
1131
|
},
|
|
1119
1132
|
async onSessionCompact(event, ctx) {
|
|
@@ -1122,9 +1135,18 @@ export function registerTelegramLifecycleRuntimeHooks({
|
|
|
1122
1135
|
compactionObserver.onSessionCompact(event, ctx);
|
|
1123
1136
|
if (observedAutomaticCompaction) {
|
|
1124
1137
|
observedAutomaticCompaction = false;
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1138
|
+
if (
|
|
1139
|
+
activeTurnRuntime.has() ||
|
|
1140
|
+
deferredAutomaticCompactionNotices.length > 0
|
|
1141
|
+
) {
|
|
1142
|
+
deferredAutomaticCompactionNotices.push(
|
|
1143
|
+
Commands.TELEGRAM_COMPACTION_COMPLETED_MARKDOWN,
|
|
1144
|
+
);
|
|
1145
|
+
} else {
|
|
1146
|
+
await sendCompactionNotice(
|
|
1147
|
+
Commands.TELEGRAM_COMPACTION_COMPLETED_MARKDOWN,
|
|
1148
|
+
);
|
|
1149
|
+
}
|
|
1128
1150
|
}
|
|
1129
1151
|
},
|
|
1130
1152
|
async onAgentStart(event, ctx) {
|
|
@@ -1177,6 +1199,11 @@ export function registerTelegramLifecycleRuntimeHooks({
|
|
|
1177
1199
|
if (!isSessionContextActive(ctx)) return;
|
|
1178
1200
|
activityRuntime.onAgentEnd();
|
|
1179
1201
|
await agentLifecycleHooks.onAgentEnd(event, ctx);
|
|
1202
|
+
if (deferredAutomaticCompactionNotices.length > 0) {
|
|
1203
|
+
await waitForActiveTurnDelivery();
|
|
1204
|
+
if (!isSessionContextActive(ctx)) return;
|
|
1205
|
+
await flushDeferredAutomaticCompactionNotices();
|
|
1206
|
+
}
|
|
1180
1207
|
},
|
|
1181
1208
|
async onAgentSettled(event, ctx) {
|
|
1182
1209
|
if (!isSessionContextActive(ctx)) return;
|
package/lib/status.ts
CHANGED
|
@@ -628,18 +628,28 @@ export function createTelegramStatusHtmlBuilder<TContext>(deps: {
|
|
|
628
628
|
);
|
|
629
629
|
}
|
|
630
630
|
|
|
631
|
+
function resolveStatusBarTheme(
|
|
632
|
+
ctx: TelegramStatusRuntimeContext,
|
|
633
|
+
): TelegramStatusBarTheme | undefined {
|
|
634
|
+
try {
|
|
635
|
+
const theme = ctx.ui?.theme;
|
|
636
|
+
return typeof theme?.fg === "function" ? theme : undefined;
|
|
637
|
+
} catch {
|
|
638
|
+
return undefined;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
631
642
|
export function createTelegramStatusRuntime<
|
|
632
643
|
TContext extends TelegramStatusRuntimeContext,
|
|
633
644
|
>(deps: TelegramStatusRuntimeDeps<TContext>): TelegramStatusRuntime<TContext> {
|
|
634
645
|
const statusKey = deps.statusKey ?? "telegram";
|
|
635
646
|
return {
|
|
636
647
|
updateStatus: (ctx, error) => {
|
|
648
|
+
const theme = resolveStatusBarTheme(ctx);
|
|
649
|
+
if (!theme) return;
|
|
637
650
|
ctx.ui.setStatus(
|
|
638
651
|
statusKey,
|
|
639
|
-
buildTelegramStatusBarText(
|
|
640
|
-
ctx.ui.theme,
|
|
641
|
-
deps.getStatusBarState(ctx, error),
|
|
642
|
-
),
|
|
652
|
+
buildTelegramStatusBarText(theme, deps.getStatusBarState(ctx, error)),
|
|
643
653
|
);
|
|
644
654
|
},
|
|
645
655
|
getStatusLines: (options) =>
|