pi-lilac-provider 1.4.0 → 1.4.1
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/index.ts +8 -7
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -590,10 +590,11 @@ let lastDiscountFetchTime = 0;
|
|
|
590
590
|
const STATUS_CACHE_TTL_MS = 60000;
|
|
591
591
|
// Lilac refreshes discounts ~every 10 minutes (per their docs: "Discounts refresh
|
|
592
592
|
// approximately every 10 minutes and are locked in when a request starts"). Poll
|
|
593
|
-
//
|
|
594
|
-
//
|
|
595
|
-
// only refresh on a user message and are
|
|
596
|
-
|
|
593
|
+
// every 5 min during idle — half the refresh window — so a long-idle session
|
|
594
|
+
// catches supply/sub changes within ~5 min instead of waiting up to a full
|
|
595
|
+
// window. Turn fetches alone only refresh on a user message and are
|
|
596
|
+
// TTL-throttled to 1/min.
|
|
597
|
+
const STATUS_POLL_INTERVAL_MS = 5 * 60 * 1000;
|
|
597
598
|
let pollInterval: ReturnType<typeof setInterval> | null = null;
|
|
598
599
|
// List-price (patch-applied, pre-discount) models, cached until the base set
|
|
599
600
|
// changes. Reset in cacheModels() so the next getListModels() rebuilds from the
|
|
@@ -656,7 +657,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
656
657
|
}
|
|
657
658
|
|
|
658
659
|
/**
|
|
659
|
-
* Background /status poll, fired every STATUS_POLL_INTERVAL_MS (
|
|
660
|
+
* Background /status poll, fired every STATUS_POLL_INTERVAL_MS (5 min) from
|
|
660
661
|
* session_start to cover idle sessions. Mirrors the discount half of
|
|
661
662
|
* before_provider_request, but without an in-flight turn model to mutate: it
|
|
662
663
|
* only refreshes latestDiscounts, re-registers (so the next turn's models carry
|
|
@@ -749,8 +750,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
749
750
|
});
|
|
750
751
|
|
|
751
752
|
// Background poll for idle sessions: Lilac refreshes discounts ~every 10
|
|
752
|
-
// minutes, so poll
|
|
753
|
-
// user is idle (turn fetches only run when a message is
|
|
753
|
+
// minutes, so poll every 5 min (half the refresh window) to catch supply/sub
|
|
754
|
+
// changes while the user is idle (turn fetches only run when a message is. The callback
|
|
754
755
|
// bails on a missing API key or an aborted/shut-down session. Cleared in
|
|
755
756
|
// session_shutdown and at the top of the next session_start.
|
|
756
757
|
pollInterval = setInterval(() => pollStatusDiscounts(ctx, signal), STATUS_POLL_INTERVAL_MS);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-lilac-provider",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Lilac provider extension for pi - Access Kimi K2.6, GLM 5.1, and Gemma 4 models through Lilac's OpenAI-compatible API on idle GPUs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|