gazesight 0.3.5 → 0.5.0
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/README.md +22 -12
- package/dist/chrome/background.js +7 -7
- package/dist/chrome/content.js +7 -7
- package/dist/chrome/manifest.json +2 -2
- package/dist/chrome/options.css +9 -0
- package/dist/chrome/options.html +14 -0
- package/dist/chrome/options.js +38 -13
- package/dist/chrome/popup.css +5 -0
- package/dist/chrome/popup.html +9 -2
- package/dist/chrome/popup.js +1 -1
- package/dist/cli/index.js +1474 -62
- package/dist/firefox/background.js +1 -1
- package/dist/firefox/content.js +6 -6
- package/dist/firefox/manifest.json +2 -2
- package/dist/firefox/options.css +9 -0
- package/dist/firefox/options.html +14 -0
- package/dist/firefox/options.js +54 -29
- package/dist/firefox/popup.css +5 -0
- package/dist/firefox/popup.html +9 -2
- package/dist/firefox/popup.js +1 -1
- package/dist/gazesight-firefox.xpi +0 -0
- package/dist/mcp/index.js +717 -36
- package/dist/worker/visual-diff.js +21 -4
- package/package.json +2 -2
package/dist/firefox/popup.css
CHANGED
|
@@ -78,6 +78,11 @@ body[data-connected="true"] .connection-dot {
|
|
|
78
78
|
main {
|
|
79
79
|
padding: 13px 14px 0;
|
|
80
80
|
}
|
|
81
|
+
.pairing-connect { margin-bottom: 10px; padding: 14px; border: 1px solid #cfc7ff; border-radius: 10px; background: linear-gradient(135deg, #f2efff, #fff); }
|
|
82
|
+
.pairing-connect strong { font-size: 15px; }
|
|
83
|
+
.pairing-connect p { margin: 6px 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
|
|
84
|
+
.pairing-connect .pairing-code { color: #160653; font: 700 17px/1.3 ui-monospace, monospace; letter-spacing: .08em; }
|
|
85
|
+
.pairing-connect .connect { margin-top: 10px; }
|
|
81
86
|
.status {
|
|
82
87
|
display: grid;
|
|
83
88
|
grid-template-columns: 1fr 1fr;
|
package/dist/firefox/popup.html
CHANGED
|
@@ -18,6 +18,12 @@
|
|
|
18
18
|
</header>
|
|
19
19
|
<div class="paper">
|
|
20
20
|
<main>
|
|
21
|
+
<section id="pairing-connect" class="pairing-connect" hidden>
|
|
22
|
+
<strong>Connect your browser</strong>
|
|
23
|
+
<p id="pairing-message">Run <code>gazesight pair</code>, then approve the matching code.</p>
|
|
24
|
+
<p id="pairing-code" class="pairing-code" hidden></p>
|
|
25
|
+
<button id="connect" class="primary connect">Connect to GazeSight</button>
|
|
26
|
+
</section>
|
|
21
27
|
<dl class="status">
|
|
22
28
|
<div class="status-card">
|
|
23
29
|
<span class="icon-disc"
|
|
@@ -111,7 +117,9 @@
|
|
|
111
117
|
><span id="select-label">Use this tab</span>
|
|
112
118
|
</button>
|
|
113
119
|
<p class="hint">
|
|
114
|
-
|
|
120
|
+
Selecting a tab allows your configured coding agent to receive its
|
|
121
|
+
screenshots, page structure, URL, and diagnostics through your local MCP
|
|
122
|
+
runtime.
|
|
115
123
|
<span id="shortcut">Ctrl+Shift+Y</span> also selects or reauthorizes
|
|
116
124
|
a tab.
|
|
117
125
|
</p>
|
|
@@ -188,4 +196,3 @@
|
|
|
188
196
|
<script type="module" src="popup.js"></script>
|
|
189
197
|
</body>
|
|
190
198
|
</html>
|
|
191
|
-
|
package/dist/firefox/popup.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function n(e,t){document.getElementById(e).textContent=t}var
|
|
1
|
+
var r="pendingPairing";function k(){return[...crypto.getRandomValues(new Uint8Array(32))].map(t=>t.toString(16).padStart(2,"0")).join("")}function E(){return location.protocol==="moz-extension:"?"firefox":"chrome"}async function m(e,t,o,i,a=2500){return fetch(`http://127.0.0.1:${e}/gazesight/pairing/${t}`,{method:"POST",headers:{"Content-Type":"application/json",...i?{Authorization:`Bearer ${i}`}:{}},body:JSON.stringify(o),signal:AbortSignal.timeout(a)})}async function w(e,t){let{requestId:o,proof:i,code:a,expiresAt:l,port:b}=t;for(;;){if(Date.now()>=l)return await browser.storage.local.remove(r),e("expired",a),!1;e("waiting_approval",a);let g;try{g=await m(b,"status",{requestId:o,secret:i})}catch{await new Promise(p=>setTimeout(p,800));continue}let d=await g.json();if(d.state==="approved"&&d.credential&&d.pairingId)return await browser.storage.local.set({token:d.credential,pairingId:d.pairingId,port:b,pairingState:"connected"}),await browser.storage.local.remove(r),e("connected"),!0;if(d.state==="rejected")return await browser.storage.local.remove(r),e("reconnect_required",a),!1;if(d.state==="expired"||g.status===410)return await browser.storage.local.remove(r),e("expired",a),!1;await new Promise(p=>setTimeout(p,800))}}async function f(e,t=32147){e("searching");let o=k(),i;try{i=await m(t,"request",{browser:E(),extensionId:browser.runtime.id,secret:o},void 0,6e4)}catch{return e("unavailable"),!1}if(!i.ok)return e("unavailable"),!1;let a=await i.json(),l={requestId:a.requestId,proof:o,code:a.code,expiresAt:a.expiresAt,port:t};return await browser.storage.local.set({[r]:l}),e("pending",a.code),w(e,l)}async function h(e){let o=(await browser.storage.local.get(r))[r];if(o){if(Date.now()>=o.expiresAt){await browser.storage.local.remove(r);return}return w(e,o)}}function n(e,t){document.getElementById(e).textContent=t}var u=!1,y;function v(e,t=!1){clearTimeout(y),n("feedback",e),t&&(y=setTimeout(()=>n("feedback",""),3500))}async function c(e){let t=await browser.runtime.sendMessage({type:"gazesight-ui",action:e});if(!t?.ok)throw new Error(t?.error??"GazeSight unavailable. Open settings to check pairing.");return t.value}async function s(){let e=await c("status");document.body.dataset.connected=String(e.connected),n("connection",e.connected?"Connected":"Disconnected");let t=await browser.storage.local.get(["token","port"]);document.getElementById("pairing-connect").hidden=typeof t.token=="string",document.body.dataset.background=e.backgroundCapture.enabled?"enabled":"disabled",n("background-state",e.backgroundCapture.enabled?"On":"Off"),n("background-toggle",e.backgroundCapture.enabled?"Disable":"Enable"),document.getElementById("background-toggle").setAttribute("aria-pressed",String(e.backgroundCapture.enabled)),n("background-description",e.backgroundCapture.enabled?"GazeSight can capture this target while you work elsewhere.":e.backgroundCapture.permissionGranted?"Background mode is off. Firefox still reports the optional permission; remove it in Add-ons Manager if needed.":e.backgroundMode==="permission_denied"?"Permission was not granted. Standard foreground capture remains available.":"Allow GazeSight to keep capturing the selected development tab while you work in another tab or application."),document.body.dataset.continuous=e.continuousAuthorization.enabled?"enabled":"disabled",n("continuous-state",e.continuousAuthorization.enabled?"On":"Off"),n("continuous-toggle",e.continuousAuthorization.enabled?"Disable":"Enable"),document.getElementById("continuous-toggle").setAttribute("aria-pressed",String(e.continuousAuthorization.enabled)),n("continuous-description",e.continuousAuthorization.enabled?e.continuousAuthorization.authorizedOrigin?`Staying connected to ${e.continuousAuthorization.authorizedOrigin} across reloads, navigation and previews.`:"Keeps GazeSight connected across reloads, navigation and previews once you select a tab.":"Keep GazeSight connected to this development tab across reloads, navigation and responsive previews, so you don't have to reauthorize it every time."),n("pairing",e.paired?"Paired":"Not paired"),n("target",e.targetState==="authorized"?"Authorized":e.targetState==="none"?"None":"Reauthorize"),n("url",e.url??"No target selected"),n("viewport",e.viewport?`${e.viewport.width} \xD7 ${e.viewport.height} CSS \xB7 DPR ${e.viewport.devicePixelRatio}`:"Viewport unavailable"),n("select-label",e.targetState==="reauthorization_required"?"Reauthorize this tab":"Use this tab"),n("last-capture",e.lastCapture?`${e.lastCapture.mode} \xB7 ${e.lastCapture.width} \xD7 ${e.lastCapture.height} \xB7 ${new Date(e.lastCapture.time).toLocaleTimeString()}`:"None yet"),n("last-error",e.lastError?`${e.lastError.code}: ${e.lastError.message}`:"None");for(let o of["fast","stable"])document.getElementById(o).disabled=u||!e.connected||e.targetState!=="authorized";document.getElementById("disconnect").disabled=u||e.targetState==="none"}var I={not_connected:"Not connected.",searching:"Searching for local GazeSight\u2026",pending:"Pairing request pending.",waiting_approval:"Waiting for approval in your terminal\u2026",connected:"Connected.",unavailable:"Connection unavailable. Run gazesight pair and try again.",expired:"Pairing expired. Try again.",reconnect_required:"Reconnect required."};function S(e,t){let o=document.getElementById("pairing-code");n("pairing-message",I[e]),o.hidden=!t,o.textContent=t?`Verification code: ${t}`:""}document.getElementById("connect").addEventListener("click",async()=>{let e=document.getElementById("connect");e.disabled=!0;let t=await browser.storage.local.get(["port"]);await f(S,Number(t.port??32147)),e.disabled=!1,await s()});(async()=>typeof(await browser.storage.local.get(["token"])).token!="string"&&await h(S)&&await s())();for(let e of["select","disconnect","fast","stable","diagnostics"])document.getElementById(e).addEventListener("click",async()=>{if(!u){u=!0,document.querySelectorAll("button").forEach(t=>t.disabled=!0),n("feedback",e==="fast"||e==="stable"?"Capturing\u2026":"Working\u2026");try{if(e==="fast"&&!await browser.permissions.contains({permissions:["downloads"]})){await browser.windows.create({url:browser.runtime.getURL("permission.html?action=download"),type:"popup",focused:!0,width:600,height:700}),window.close();return}let t=await c(e);e==="diagnostics"&&(document.getElementById("diagnostics-panel").hidden=!1,n("diagnostics-output",JSON.stringify(t,null,2))),v(e==="disconnect"?"Target disconnected.":e==="select"?"Target selected.":e==="diagnostics"?"Diagnostics updated.":e==="fast"?`\u2713 Saved to Downloads/${t.filename}`:"Capture completed.",e==="fast")}catch(t){v(t instanceof Error?t.message:"Operation failed.")}finally{u=!1,document.querySelectorAll("button").forEach(t=>t.disabled=!1),await s().catch(t=>n("feedback",String(t)))}}});document.getElementById("copy-url").addEventListener("click",async()=>{let e=document.getElementById("url").textContent;if(!(!e||e==="No target selected"))try{await navigator.clipboard.writeText(e),n("feedback","URL copied.")}catch{n("feedback","Unable to copy URL. Select and copy it manually.")}});document.getElementById("background-toggle").addEventListener("click",async()=>{if((await c("status")).backgroundCapture.enabled){await c("background-disable"),await s();return}await browser.windows.create({url:browser.runtime.getURL("permission.html?action=background"),type:"popup",focused:!0,width:600,height:700}),window.close()});document.getElementById("continuous-toggle").addEventListener("click",async()=>{let e=await c("status");if(e.continuousAuthorization.enabled){await c("continuous-disable"),await s();return}if(e.continuousAuthorization.permissionGranted){await c("continuous-enable"),await s();return}await browser.windows.create({url:browser.runtime.getURL("permission.html?action=continuous"),type:"popup",focused:!0,width:600,height:700}),window.close()});browser.commands.getAll().then(e=>{let t=e.find(o=>o.name==="gazesight-select-target")?.shortcut;t&&n("shortcut",t)}).catch(()=>{});document.getElementById("settings").addEventListener("click",()=>void browser.runtime.openOptionsPage());s().catch(e=>n("feedback",String(e)));var P=setInterval(()=>{u||s().catch(e=>n("feedback",String(e)))},2e3);window.addEventListener("pagehide",()=>clearInterval(P),{once:!0});
|
|
Binary file
|