opencode-visual-cache 1.2.8 → 1.2.9-beta.0
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/dist/_version.d.ts +1 -1
- package/dist/_version.js +1 -1
- package/dist/index.js +20 -7
- package/package.json +1 -1
- package/src/_version.ts +1 -1
- package/src/index.tsx +17 -7
package/dist/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PLUGIN_VERSION = "1.2.
|
|
1
|
+
export declare const PLUGIN_VERSION = "1.2.9-beta.0";
|
package/dist/_version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// auto-generated
|
|
2
|
-
export const PLUGIN_VERSION = "1.2.
|
|
2
|
+
export const PLUGIN_VERSION = "1.2.9-beta.0";
|
package/dist/index.js
CHANGED
|
@@ -574,8 +574,17 @@ function TokenCachePanel(props) {
|
|
|
574
574
|
doRestore();
|
|
575
575
|
}
|
|
576
576
|
else {
|
|
577
|
+
// Poll kv.ready with a 1-second timeout to avoid infinite busy-wait
|
|
578
|
+
// on platforms where kv initialisation may be delayed (Linux single-thread
|
|
579
|
+
// mode, session switch storms, etc.).
|
|
580
|
+
const MAX_POLL = 100;
|
|
581
|
+
let tries = 0;
|
|
577
582
|
const pollRestore = () => {
|
|
578
583
|
if (!props.api.kv.ready) {
|
|
584
|
+
if (++tries > MAX_POLL) {
|
|
585
|
+
doRestore();
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
579
588
|
setTimeout(pollRestore, 10);
|
|
580
589
|
return;
|
|
581
590
|
}
|
|
@@ -583,13 +592,17 @@ function TokenCachePanel(props) {
|
|
|
583
592
|
};
|
|
584
593
|
pollRestore();
|
|
585
594
|
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
595
|
+
// Debounce partVersion updates so that event bursts during session
|
|
596
|
+
// switching / streaming don't cause data() to re-compute on every
|
|
597
|
+
// single event (up to hundreds per second on Linux single-thread).
|
|
598
|
+
let partTimer;
|
|
599
|
+
const bumpPartVersion = () => {
|
|
600
|
+
clearTimeout(partTimer);
|
|
601
|
+
partTimer = setTimeout(() => setPartVersion((v) => v + 1), 100);
|
|
602
|
+
};
|
|
603
|
+
const unsubPart = props.api.event.on("message.part.updated", bumpPartVersion);
|
|
604
|
+
const unsubMsg = props.api.event.on("message.updated", bumpPartVersion);
|
|
605
|
+
onCleanup(() => { clearTimeout(partTimer); unsubPart(); unsubMsg(); });
|
|
593
606
|
});
|
|
594
607
|
// ── colours ──
|
|
595
608
|
// Pull from the current theme, auto-desaturate if too punchy,
|
package/package.json
CHANGED
package/src/_version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// auto-generated
|
|
2
|
-
export const PLUGIN_VERSION="1.2.
|
|
2
|
+
export const PLUGIN_VERSION="1.2.9-beta.0";
|
package/src/index.tsx
CHANGED
|
@@ -633,8 +633,14 @@ function TokenCachePanel(props: {
|
|
|
633
633
|
if (props.api.kv.ready) {
|
|
634
634
|
doRestore()
|
|
635
635
|
} else {
|
|
636
|
+
// Poll kv.ready with a 1-second timeout to avoid infinite busy-wait
|
|
637
|
+
// on platforms where kv initialisation may be delayed (Linux single-thread
|
|
638
|
+
// mode, session switch storms, etc.).
|
|
639
|
+
const MAX_POLL = 100
|
|
640
|
+
let tries = 0
|
|
636
641
|
const pollRestore = () => {
|
|
637
642
|
if (!props.api.kv.ready) {
|
|
643
|
+
if (++tries > MAX_POLL) { doRestore(); return }
|
|
638
644
|
setTimeout(pollRestore, 10)
|
|
639
645
|
return
|
|
640
646
|
}
|
|
@@ -643,13 +649,17 @@ function TokenCachePanel(props: {
|
|
|
643
649
|
pollRestore()
|
|
644
650
|
}
|
|
645
651
|
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
652
|
+
// Debounce partVersion updates so that event bursts during session
|
|
653
|
+
// switching / streaming don't cause data() to re-compute on every
|
|
654
|
+
// single event (up to hundreds per second on Linux single-thread).
|
|
655
|
+
let partTimer: ReturnType<typeof setTimeout> | undefined
|
|
656
|
+
const bumpPartVersion = () => {
|
|
657
|
+
clearTimeout(partTimer)
|
|
658
|
+
partTimer = setTimeout(() => setPartVersion((v) => v + 1), 100)
|
|
659
|
+
}
|
|
660
|
+
const unsubPart = props.api.event.on("message.part.updated", bumpPartVersion)
|
|
661
|
+
const unsubMsg = props.api.event.on("message.updated", bumpPartVersion)
|
|
662
|
+
onCleanup(() => { clearTimeout(partTimer); unsubPart(); unsubMsg() })
|
|
653
663
|
})
|
|
654
664
|
|
|
655
665
|
// ── colours ──
|