Update README.md
Browse files
README.md
CHANGED
|
@@ -1,162 +1,105 @@
|
|
| 1 |
-
-
|
| 2 |
-
|
| 3 |
-
tags:
|
| 4 |
-
- browser-extension
|
| 5 |
-
- firefox
|
| 6 |
-
- chatgpt
|
| 7 |
-
- performance
|
| 8 |
-
- memory
|
| 9 |
-
---
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
-
- If history pagination is allowed, it can **thin huge JSON responses** (keeps the latest chunk and the needed ancestors for ChatGPT’s conversation mapping).
|
| 19 |
-
- **Soft-caps the chat DOM** by trimming old conversation turns out of the page:
|
| 20 |
-
- visible tab: keep ~60 turns
|
| 21 |
-
- hidden tab: keep ~20 turns
|
| 22 |
-
- hidden for ~10 minutes: keep ~12 turns
|
| 23 |
-
- **Keeps the session warm** with low-overhead pings:
|
| 24 |
-
- **leader-only** pings from the active tab
|
| 25 |
-
- plus a low-frequency **background event-page ping** (single place, not per-tab)
|
| 26 |
-
- Adds a tiny **UI pill** so you can quickly toggle the gate or temporarily allow history.
|
| 27 |
|
| 28 |
-
|
| 29 |
|
| 30 |
-
|
| 31 |
|
| 32 |
-
|
| 33 |
|
| 34 |
-
|
| 35 |
|
| 36 |
-
|
| 37 |
-
- `chat-traffic-gate-leader-softcap.zip` — the same thing, zipped
|
| 38 |
|
| 39 |
-
|
| 40 |
|
| 41 |
-
|
| 42 |
-
- `background.js` — request gating + leader/follower role assignment + background alarm ping
|
| 43 |
-
- `content/early-shield.js` — briefly hides turns at page start, then unshields
|
| 44 |
-
- `content/net-guard.js` — patches `fetch` + XHR at `document_start` to block pagination and (when allowed) thin big JSON
|
| 45 |
-
- `content/dom-softcap.js` — trims old conversation turns out of the DOM (changes based on tab visibility)
|
| 46 |
-
- `content/keepalive.js` — leader-only keepalive pings + reconnect helper (reloads OFF by default)
|
| 47 |
-
- `content/autopilot.js` — visible-tab tuning (intent detection + adjusts keepalive/softcap if things look bad)
|
| 48 |
-
- `content/traffic-ui.js` — UI pill (“🚦 On/Off” + “Allow 10s”)
|
| 49 |
|
| 50 |
-
|
| 51 |
|
| 52 |
-
|
| 53 |
|
| 54 |
-
|
| 55 |
-
1. Download `chat-traffic-gate-leader-softcap.zip` from this repo and unzip it.
|
| 56 |
-
2. In Firefox, open: `about:debugging#/runtime/this-firefox`
|
| 57 |
-
3. Click **Load Temporary Add-on…**
|
| 58 |
-
4. Select the **`manifest.json`** inside the unzipped folder.
|
| 59 |
|
| 60 |
-
|
| 61 |
|
| 62 |
-
|
| 63 |
-
Same process as above, but download the folder contents and point Firefox at `manifest.json`.
|
| 64 |
|
| 65 |
-
|
| 66 |
|
| 67 |
-
|
| 68 |
|
| 69 |
-
|
| 70 |
-
`background.js` uses `webRequestBlocking` to cancel only **true pagination** requests:
|
| 71 |
-
- it looks for query params like `cursor`, `before`, `offset>0`, `page>1`, or backward direction markers
|
| 72 |
-
- it only applies to “history-like” endpoints
|
| 73 |
-
- it avoids blanket blocking (session and models endpoints are allow-listed)
|
| 74 |
|
| 75 |
-
|
| 76 |
-
`content/net-guard.js` runs at `document_start` and patches:
|
| 77 |
-
- `window.fetch`
|
| 78 |
-
- `XMLHttpRequest`
|
| 79 |
|
| 80 |
-
|
| 81 |
-
- some list endpoints get a **safe empty page JSON** (soft-block)
|
| 82 |
-
- others get an AbortError / aborted XHR (hard-block)
|
| 83 |
|
| 84 |
-
|
| 85 |
-
The extension decides “intent” mostly from **scroll behavior**:
|
| 86 |
-
- near the top, or scrolling upward recently → intent = true
|
| 87 |
-
- otherwise intent = false
|
| 88 |
|
| 89 |
-
|
| 90 |
-
- UI pill: **Allow 10s**
|
| 91 |
-
- programmatic: `__chatTrafficGate.allowForMs(10000)`
|
| 92 |
|
| 93 |
-
|
| 94 |
|
| 95 |
-
|
| 96 |
|
| 97 |
-
|
| 98 |
-
- if `messages[]` is huge → keep the newest ~60
|
| 99 |
-
- if `items[]` is huge → keep the newest ~60
|
| 100 |
-
- if ChatGPT’s `mapping{}` is huge → keep the newest ~60 nodes **plus ancestors** (and keep `current_node` / `root` when present)
|
| 101 |
|
| 102 |
-
|
| 103 |
|
| 104 |
-
|
| 105 |
|
| 106 |
-
|
| 107 |
|
| 108 |
-
|
| 109 |
|
| 110 |
-
|
| 111 |
|
| 112 |
-
|
| 113 |
-
- trimming in batches
|
| 114 |
-
- briefly hiding the container while trimming to reduce layout thrash
|
| 115 |
-
- unshielding the early CSS shield once the first trim completes
|
| 116 |
|
| 117 |
-
|
| 118 |
|
| 119 |
-
|
| 120 |
|
| 121 |
-
|
| 122 |
-
Only the **active tab** is intended to be “leader” and run keepalive pings. Background assigns roles and tells tabs to switch.
|
| 123 |
|
| 124 |
-
|
| 125 |
-
It probes a small set and sticks with the first one that works, e.g.:
|
| 126 |
-
- `/api/auth/session`
|
| 127 |
-
- `/backend-api/models`
|
| 128 |
-
- `/backend-api/conversations?offset=0&limit=1`
|
| 129 |
-
- `/favicon.ico`
|
| 130 |
-
- `/`
|
| 131 |
|
| 132 |
-
|
| 133 |
-
It watches the DOM for text like “reconnecting / disconnected / network error” and tries:
|
| 134 |
-
- click buttons with text like “Retry / Reconnect / Try again”
|
| 135 |
-
- **reload is OFF by default** (AutoPilot may enable it temporarily if disconnects are bad)
|
| 136 |
|
| 137 |
-
--
|
| 138 |
|
| 139 |
-
|
| 140 |
|
| 141 |
-
|
| 142 |
|
| 143 |
-
|
| 144 |
-
- **Allow 10s**: allows pagination for 10 seconds in that tab
|
| 145 |
|
| 146 |
-
|
| 147 |
|
| 148 |
-
|
| 149 |
|
| 150 |
-
|
| 151 |
|
| 152 |
-
|
| 153 |
-
__chatTrafficGate.setEnabled(true|false)
|
| 154 |
-
__chatTrafficGate.setIntent(true|false)
|
| 155 |
-
__chatTrafficGate.allowForMs(10000)
|
| 156 |
|
| 157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
-
__chatKeepalive.setMinutes(4)
|
| 160 |
-
__chatKeepalive.setAutoReconnect(true)
|
| 161 |
-
__chatKeepalive.setAllowReloads(false)
|
| 162 |
-
__chatKeepalive.reconnectNow()
|
|
|
|
| 1 |
+
Chat Traffic Gate (ChatGPT) — AutoPilot v3.1 - UPDATED VERSION
|
| 2 |
+
Status
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
+
WIP (work in progress).
|
| 5 |
+
This is not perfect and still changing.
|
| 6 |
+
It might help your workflow, or it might not. Use it if you want.
|
| 7 |
|
| 8 |
+
I use this myself, and I notice when it is not running.
|
| 9 |
|
| 10 |
+
What this is
|
| 11 |
|
| 12 |
+
A Firefox browser extension focused on ChatGPT tabs, built to help manage heavy/long sessions with a traffic-gating approach.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
Current extension metadata and scope:
|
| 15 |
|
| 16 |
+
Name: Chat Traffic Gate (ChatGPT) — AutoPilot v3.1 (Orchestrated Diagnostics)
|
| 17 |
|
| 18 |
+
Version: 1.3.0
|
| 19 |
|
| 20 |
+
Manifest: v2
|
| 21 |
|
| 22 |
+
Target sites: chat.openai.com and chatgpt.com
|
|
|
|
| 23 |
|
| 24 |
+
manifest
|
| 25 |
|
| 26 |
+
What is currently included
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
+
Content scripts are split by load phase:
|
| 29 |
|
| 30 |
+
At document_start:
|
| 31 |
|
| 32 |
+
content/core-utils.js
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
+
content/early-shield.js
|
| 35 |
|
| 36 |
+
content/net-guard.js
|
|
|
|
| 37 |
|
| 38 |
+
At document_idle:
|
| 39 |
|
| 40 |
+
content/core-utils.js
|
| 41 |
|
| 42 |
+
content/dom-softcap.js
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
+
content/keepalive.js
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
+
content/autopilot.js
|
|
|
|
|
|
|
| 47 |
|
| 48 |
+
content/traffic-ui.js
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
+
manifest
|
|
|
|
|
|
|
| 51 |
|
| 52 |
+
Background script:
|
| 53 |
|
| 54 |
+
background.js (non-persistent background)
|
| 55 |
|
| 56 |
+
manifest
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
+
Permissions
|
| 59 |
|
| 60 |
+
The manifest currently requests:
|
| 61 |
|
| 62 |
+
storage
|
| 63 |
|
| 64 |
+
webRequest
|
| 65 |
|
| 66 |
+
alarms
|
| 67 |
|
| 68 |
+
tabs
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
+
notifications
|
| 71 |
|
| 72 |
+
Site access for https://chat.openai.com/* and https://chatgpt.com/*
|
| 73 |
|
| 74 |
+
manifest
|
|
|
|
| 75 |
|
| 76 |
+
Browser target
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
+
This build includes Gecko settings with:
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
+
Extension ID: chat-traffic-gate@local
|
| 81 |
|
| 82 |
+
strict_min_version: 109.0
|
| 83 |
|
| 84 |
+
manifest
|
| 85 |
|
| 86 |
+
Install (Firefox, temporary load)
|
|
|
|
| 87 |
|
| 88 |
+
Download/clone this repo.
|
| 89 |
|
| 90 |
+
Open Firefox and go to about:debugging#/runtime/this-firefox
|
| 91 |
|
| 92 |
+
Click Load Temporary Add-on
|
| 93 |
|
| 94 |
+
Select manifest.json
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
+
Reality check
|
| 97 |
+
|
| 98 |
+
This is a personal tool and actively being worked on.
|
| 99 |
+
|
| 100 |
+
It is not a promise, not polished, and not guaranteed.
|
| 101 |
+
|
| 102 |
+
It may help some users, and do nothing for others.
|
| 103 |
+
|
| 104 |
+
If it helps you, great. If not, skip it.
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|