feat: show Telegram connection in OMP status bar
Validate / validate (push) Failing after 5m14s

This commit is contained in:
evandrodevbr committed 2026-07-15 18:45:03 -03:00
1 parent a56408711e
commit d918d56dc3
8 files changed
+107 -11

No files matched your search

+1 -1
View File
@@ -100,7 +100,7 @@ test("Package declares the OMP extension entry point and Pi lifecycle compatibil
assert.deepEqual(packageJson.omp?.extensions, ["./index.ts"]);
assert.equal(
packageJson.omp?.compatibleWith?.["@oh-my-pi/pi-coding-agent"],
">=16.5.2",
">=17.0.0",
);
assert.equal(
packageJson.peerDependencies?.["@earendil-works/pi-coding-agent"],
+51
View File
@@ -18,6 +18,7 @@ import {
createTelegramStatusHtmlBuilder,
createTelegramStatusSnapshot,
createTelegramStatusRuntime,
getTelegramTopStatusSegment,
getTelegramStatusBarProcessingStatus,
recordStructuredTelegramRuntimeEvent,
recordTelegramRuntimeEvent,
@@ -401,6 +402,56 @@ test("Status runtime updates the status bar and exposes bridge lines", () => {
]);
});
test("Status runtime publishes the polling state after cost", () => {
const published: Array<[string, string, { placement: "after-cost" }]> = [];
let pollingActive = true;
const runtime = createTelegramBridgeStatusRuntime({
getConfig: () => ({ botToken: "token", allowedUserId: 7 }),
isPollingActive: () => pollingActive,
getActiveSourceMessageIds: () => undefined,
hasActiveTurn: () => false,
hasDispatchPending: () => false,
isCompactionInProgress: () => false,
getActiveToolExecutions: () => 0,
hasPendingModelSwitch: () => false,
getQueuedItems: () => [],
formatQueuedStatus: () => "",
getRecentRuntimeEvents: () => [],
setStatusSegment: (_ctx, key, text) => {
published.push([key, text, { placement: "after-cost" }]);
},
});
const ctx = {
ui: {
theme: { fg: (_token: string, text: string) => text },
setStatus: () => {},
},
};
assert.equal(
getTelegramTopStatusSegment({ pollingActive: true }),
"Telegram: conectado",
);
runtime.updateStatus(ctx);
assert.deepEqual(published.pop(), [
"telegram",
"Telegram: conectado",
{ placement: "after-cost" },
]);
pollingActive = false;
assert.equal(
getTelegramTopStatusSegment({ pollingActive: false }),
"Telegram: desconectado",
);
runtime.updateStatus(ctx);
assert.deepEqual(published.pop(), [
"telegram",
"Telegram: desconectado",
{ placement: "after-cost" },
]);
});
test("Status lines expose thread reconciliation state", () => {
const lines = buildTelegramBridgeStatusLines({
botUsername: "demo_bot",