@eduardo191labs/opencode-free-pi 0.7.15 → 0.7.16
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/session/overflow.js
CHANGED
|
@@ -163,6 +163,10 @@ export function noteSpuriousOverflow(deps, sessionID) {
|
|
|
163
163
|
const now = Date.now();
|
|
164
164
|
const previous = deps.state.spuriousOverflows.get(sessionID);
|
|
165
165
|
const count = previous && now - previous.at <= STORM_WINDOW_MS ? previous.count + 1 : 1;
|
|
166
|
+
// Delete first so an existing session moves to the end of the insertion
|
|
167
|
+
// order: `Map.set` on a present key keeps its old position, and the trim
|
|
168
|
+
// below would otherwise evict a session that is still being rejected.
|
|
169
|
+
deps.state.spuriousOverflows.delete(sessionID);
|
|
166
170
|
deps.state.spuriousOverflows.set(sessionID, { at: now, count });
|
|
167
171
|
if (deps.state.spuriousOverflows.size > STORM_LIMIT_PER_SESSION) {
|
|
168
172
|
const oldest = deps.state.spuriousOverflows.keys().next().value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eduardo191labs/opencode-free-pi",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.16",
|
|
4
4
|
"description": "Ad-supported free-pi provider plugin for OpenCode on Windows, Linux, macOS and Termux",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json",
|
|
26
26
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
27
|
-
"test": "npm run build && node test/catalog.mjs && node test/compaction.mjs && node test/diet.mjs && node test/smoke.mjs && node test/registry.mjs && node test/models.mjs && node test/live.mjs && node test/hooks.mjs && node test/title.mjs && node test/errors.mjs && node test/vision.mjs && node test/agents.mjs && node test/wire.mjs && node test/network.mjs && node test/tools.mjs",
|
|
27
|
+
"test": "npm run build && node test/catalog.mjs && node test/compaction.mjs && node test/diet.mjs && node test/smoke.mjs && node test/registry.mjs && node test/models.mjs && node test/live.mjs && node test/hooks.mjs && node test/title.mjs && node test/errors.mjs && node test/overflow.mjs && node test/vision.mjs && node test/agents.mjs && node test/wire.mjs && node test/network.mjs && node test/tools.mjs",
|
|
28
28
|
"prepublishOnly": "npm run build",
|
|
29
29
|
"postinstall": "node scripts/postinstall.mjs"
|
|
30
30
|
},
|
package/src/session/overflow.ts
CHANGED
|
@@ -187,6 +187,10 @@ export function noteSpuriousOverflow(deps: Deps, sessionID: string): number {
|
|
|
187
187
|
const previous = deps.state.spuriousOverflows.get(sessionID);
|
|
188
188
|
const count =
|
|
189
189
|
previous && now - previous.at <= STORM_WINDOW_MS ? previous.count + 1 : 1;
|
|
190
|
+
// Delete first so an existing session moves to the end of the insertion
|
|
191
|
+
// order: `Map.set` on a present key keeps its old position, and the trim
|
|
192
|
+
// below would otherwise evict a session that is still being rejected.
|
|
193
|
+
deps.state.spuriousOverflows.delete(sessionID);
|
|
190
194
|
deps.state.spuriousOverflows.set(sessionID, { at: now, count });
|
|
191
195
|
if (deps.state.spuriousOverflows.size > STORM_LIMIT_PER_SESSION) {
|
|
192
196
|
const oldest = deps.state.spuriousOverflows.keys().next().value;
|