@eduardo191labs/opencode-free-pi 0.3.13 → 0.3.14

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.
@@ -88,6 +88,11 @@ async function applyModelRequest(deps, event) {
88
88
  void closeFreePiSession(deps, previous).catch(() => undefined);
89
89
  deps.log.info("free-pi session ended mid-stream; continuing with a fresh session id", { sessionID: event.sessionID, from: previous, to: next });
90
90
  }
91
+ else if (!deps.state.wireSessions.has(event.sessionID)) {
92
+ // First request in this process. A previous OpenCode run may have left the
93
+ // session's slot locked, so start from a fresh id instead of reopening it.
94
+ rotateWireSessionID(deps, event.sessionID);
95
+ }
91
96
  const token = await resolveToken(deps);
92
97
  if (token)
93
98
  event.headers.authorization = `Bearer ${token}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eduardo191labs/opencode-free-pi",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
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",
@@ -162,6 +162,10 @@ async function applyModelRequest(deps: Deps, event: any): Promise<void> {
162
162
  "free-pi session ended mid-stream; continuing with a fresh session id",
163
163
  { sessionID: event.sessionID, from: previous, to: next },
164
164
  );
165
+ } else if (!deps.state.wireSessions.has(event.sessionID)) {
166
+ // First request in this process. A previous OpenCode run may have left the
167
+ // session's slot locked, so start from a fresh id instead of reopening it.
168
+ rotateWireSessionID(deps, event.sessionID);
165
169
  }
166
170
  const token = await resolveToken(deps);
167
171
  if (token) event.headers.authorization = `Bearer ${token}`;