pi-freeflow 1.1.5 → 1.1.6
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/extensions/index.ts +37 -3
- package/package.json +1 -1
package/extensions/index.ts
CHANGED
|
@@ -1729,12 +1729,46 @@ export default async function (pi: ExtensionAPI) {
|
|
|
1729
1729
|
pi.registerCommand("freeflow", commandSpec);
|
|
1730
1730
|
pi.registerCommand("bansos", commandSpec);
|
|
1731
1731
|
|
|
1732
|
-
|
|
1732
|
+
function updateStatusBar(ui?: ExtensionContext["ui"], providerName?: string) {
|
|
1733
|
+
if (!ui) return;
|
|
1734
|
+
if (relayState.enabled && relayState.relays.length > 0) {
|
|
1735
|
+
const label = shortRelayLabel(relayState.url);
|
|
1736
|
+
const idx = Math.max(
|
|
1737
|
+
1,
|
|
1738
|
+
relayState.relays.findIndex((r) => r.url === relayState.url) + 1,
|
|
1739
|
+
);
|
|
1740
|
+
const total = relayState.relays.length;
|
|
1741
|
+
ui.setStatus?.("freeflow", `relay: ON | ${label} ${idx}/${total}`);
|
|
1742
|
+
} else {
|
|
1743
|
+
ui.setStatus?.("freeflow", undefined);
|
|
1744
|
+
}
|
|
1745
|
+
ui.setStatus?.("bansos", undefined);
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
// Reload persisted state on session start/resume and show status if active
|
|
1733
1749
|
pi.on?.("session_start", async (_event, ctx) => {
|
|
1734
1750
|
relayState = resolveRelayState();
|
|
1735
1751
|
statusUi = ctx.ui;
|
|
1736
|
-
ctx.ui
|
|
1737
|
-
|
|
1752
|
+
updateStatusBar(ctx.ui);
|
|
1753
|
+
});
|
|
1754
|
+
|
|
1755
|
+
// Update status bar immediately when user switches models
|
|
1756
|
+
pi.on?.("model_select", async (event, ctx) => {
|
|
1757
|
+
statusUi = ctx.ui;
|
|
1758
|
+
const model =
|
|
1759
|
+
event && typeof event === "object" && "model" in event
|
|
1760
|
+
? event.model
|
|
1761
|
+
: null;
|
|
1762
|
+
const provider =
|
|
1763
|
+
model && typeof model === "object" && "provider" in model
|
|
1764
|
+
? String(model.provider)
|
|
1765
|
+
: null;
|
|
1766
|
+
if (provider === "freeflow") {
|
|
1767
|
+
updateStatusBar(ctx.ui, "freeflow");
|
|
1768
|
+
} else if (provider) {
|
|
1769
|
+
// Clear status when switched to other providers (e.g. anthropic, openai)
|
|
1770
|
+
ctx.ui?.setStatus?.("freeflow", undefined);
|
|
1771
|
+
}
|
|
1738
1772
|
});
|
|
1739
1773
|
|
|
1740
1774
|
// Pi normally pauses after threshold compaction. Queue a follow-up while the
|