storyboard-bridge 0.7.3 → 0.7.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/tryinfer_client.py +22 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storyboard-bridge",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "description": "Desktop bridge that powers a hosted Storyboard AI webapp with your own local Claude Code / Gemini CLI login (no API key).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -151,10 +151,28 @@ class BrowserSession:
151
151
  break
152
152
  if not tid:
153
153
  raise RuntimeError(f"No open tab whose URL contains '{self.match}'. Open tryinfer.com and log in.")
154
- self.cdp = CDP(self.browser_ws)
155
- self.session_id = self.cdp.call("Target.attachToTarget", {"targetId": tid, "flatten": True})["sessionId"]
156
- self.cdp.call("Runtime.enable", session_id=self.session_id)
157
- log(f"Routing API calls through tab: {url}")
154
+ # A HOST tab left in the background gets DISCARDED/frozen by Chrome (no live renderer). Attaching still
155
+ # works, but Runtime.enable then hangs waiting for a renderer → "Timed out waiting for CDP response".
156
+ # Activate (foreground/wake) the tab first, and retry attach+enable a couple times so a just-woken tab
157
+ # gets a moment to spin its renderer back up.
158
+ last = None
159
+ for attempt in range(3):
160
+ self.cdp = CDP(self.browser_ws)
161
+ try:
162
+ try: self.cdp.call("Target.activateTarget", {"targetId": tid}, timeout=10) # wake a discarded tab
163
+ except Exception: pass
164
+ self.session_id = self.cdp.call("Target.attachToTarget", {"targetId": tid, "flatten": True}, timeout=15)["sessionId"]
165
+ self.cdp.call("Runtime.enable", session_id=self.session_id, timeout=20)
166
+ log(f"Routing API calls through tab: {url}")
167
+ return
168
+ except Exception as e:
169
+ last = e
170
+ try: self.cdp.close()
171
+ except Exception: pass
172
+ if attempt < 2:
173
+ log(f" CDP attach stalled (tab may be waking) — retrying… ({e})")
174
+ time.sleep(2)
175
+ raise RuntimeError(f"couldn't attach to the tryinfer tab — is it awake + logged in? ({last})")
158
176
 
159
177
  def request(self, method, url, body=None, timeout=120, retries=4):
160
178
  last = None