pi-soly 0.5.7 → 0.5.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/package.json +1 -1
- package/switch/index.ts +9 -0
package/package.json
CHANGED
package/switch/index.ts
CHANGED
|
@@ -106,7 +106,16 @@ export default function piSwitchExtension(pi: ExtensionAPI) {
|
|
|
106
106
|
// ----- Hot cycle (no popup, no confirmation) -----
|
|
107
107
|
// Ctrl+Tab is the primary shortcut (most terminals support it).
|
|
108
108
|
// F2 is kept as a backup for terminals that don't pass Ctrl+Tab through.
|
|
109
|
+
// Debounced: 180ms — terminal key auto-repeat can fire the same key 5+
|
|
110
|
+
// times per second, which would spam the chat with the same agent
|
|
111
|
+
// notification. The window covers auto-repeat but allows deliberate
|
|
112
|
+
// sequential presses.
|
|
113
|
+
let lastCycleTs = 0;
|
|
114
|
+
const CYCLE_DEBOUNCE_MS = 180;
|
|
109
115
|
const cycleShortcut = (sctx: { ui: ExtensionUIContext }): void => {
|
|
116
|
+
const now = Date.now();
|
|
117
|
+
if (now - lastCycleTs < CYCLE_DEBOUNCE_MS) return;
|
|
118
|
+
lastCycleTs = now;
|
|
110
119
|
lastUi = sctx.ui;
|
|
111
120
|
refreshCycle();
|
|
112
121
|
setAgent(nextAgent(currentAgent, cycle));
|