gazesight 0.5.0 → 0.5.2

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.
@@ -1,90 +1,90 @@
1
- {
2
- "manifest_version": 2,
3
- "name": "GazeSight",
4
- "version": "0.5.0",
5
- "description": "Give coding agents visual access to the Firefox tab you're already using.",
6
- "icons": {
7
- "16": "icons/icon-16.png",
8
- "32": "icons/icon-32.png",
9
- "48": "icons/icon-48.png",
10
- "64": "icons/icon-64.png",
11
- "96": "icons/icon-96.png",
12
- "128": "icons/icon-128.png"
13
- },
14
- "browser_specific_settings": {
15
- "gecko": {
16
- "id": "extension@gazesight.dev",
17
- "strict_min_version": "142.0",
18
- "data_collection_permissions": {
19
- "required": [
20
- "websiteContent",
21
- "browsingActivity"
22
- ]
23
- }
24
- }
25
- },
26
- "permissions": [
27
- "activeTab",
28
- "tabs",
29
- "storage",
30
- "scripting",
31
- "webRequest",
32
- "http://localhost/*",
33
- "https://localhost/*",
34
- "http://127.0.0.1/*",
35
- "https://127.0.0.1/*",
36
- "http://[::1]/*",
37
- "https://[::1]/*"
38
- ],
39
- "optional_permissions": [
40
- "<all_urls>",
41
- "downloads"
42
- ],
43
- "background": {
44
- "scripts": [
45
- "background.js"
46
- ],
47
- "persistent": true
48
- },
49
- "browser_action": {
50
- "default_title": "GazeSight — target and connection",
51
- "default_popup": "popup.html",
52
- "default_icon": {
53
- "16": "icons/icon-16.png",
54
- "32": "icons/icon-32.png",
55
- "48": "icons/icon-48.png",
56
- "64": "icons/icon-64.png",
57
- "96": "icons/icon-96.png",
58
- "128": "icons/icon-128.png"
59
- }
60
- },
61
- "commands": {
62
- "gazesight-select-target": {
63
- "suggested_key": {
64
- "default": "Ctrl+Shift+Y"
65
- },
66
- "description": "Select or reauthorize this tab with GazeSight"
67
- }
68
- },
69
- "options_ui": {
70
- "page": "options.html",
71
- "open_in_tab": true
72
- },
73
- "content_security_policy": "script-src 'self'; object-src 'none'; connect-src ws://127.0.0.1:* http://127.0.0.1:* data:",
74
- "content_scripts": [
75
- {
76
- "matches": [
77
- "http://localhost/*",
78
- "https://localhost/*",
79
- "http://127.0.0.1/*",
80
- "https://127.0.0.1/*",
81
- "http://[::1]/*",
82
- "https://[::1]/*"
83
- ],
84
- "js": [
85
- "content.js"
86
- ],
87
- "run_at": "document_start"
88
- }
89
- ]
90
- }
1
+ {
2
+ "manifest_version": 2,
3
+ "name": "GazeSight",
4
+ "version": "0.5.2",
5
+ "description": "Give coding agents visual access to the Firefox tab you're already using.",
6
+ "icons": {
7
+ "16": "icons/icon-16.png",
8
+ "32": "icons/icon-32.png",
9
+ "48": "icons/icon-48.png",
10
+ "64": "icons/icon-64.png",
11
+ "96": "icons/icon-96.png",
12
+ "128": "icons/icon-128.png"
13
+ },
14
+ "browser_specific_settings": {
15
+ "gecko": {
16
+ "id": "extension@gazesight.dev",
17
+ "strict_min_version": "142.0",
18
+ "data_collection_permissions": {
19
+ "required": [
20
+ "websiteContent",
21
+ "browsingActivity"
22
+ ]
23
+ }
24
+ }
25
+ },
26
+ "permissions": [
27
+ "activeTab",
28
+ "tabs",
29
+ "storage",
30
+ "scripting",
31
+ "webRequest",
32
+ "http://localhost/*",
33
+ "https://localhost/*",
34
+ "http://127.0.0.1/*",
35
+ "https://127.0.0.1/*",
36
+ "http://[::1]/*",
37
+ "https://[::1]/*"
38
+ ],
39
+ "optional_permissions": [
40
+ "<all_urls>",
41
+ "downloads"
42
+ ],
43
+ "background": {
44
+ "scripts": [
45
+ "background.js"
46
+ ],
47
+ "persistent": true
48
+ },
49
+ "browser_action": {
50
+ "default_title": "GazeSight — target and connection",
51
+ "default_popup": "popup.html",
52
+ "default_icon": {
53
+ "16": "icons/icon-16.png",
54
+ "32": "icons/icon-32.png",
55
+ "48": "icons/icon-48.png",
56
+ "64": "icons/icon-64.png",
57
+ "96": "icons/icon-96.png",
58
+ "128": "icons/icon-128.png"
59
+ }
60
+ },
61
+ "commands": {
62
+ "gazesight-select-target": {
63
+ "suggested_key": {
64
+ "default": "Ctrl+Shift+Y"
65
+ },
66
+ "description": "Select or reauthorize this tab with GazeSight"
67
+ }
68
+ },
69
+ "options_ui": {
70
+ "page": "options.html",
71
+ "open_in_tab": true
72
+ },
73
+ "content_security_policy": "script-src 'self'; object-src 'none'; connect-src ws://127.0.0.1:* http://127.0.0.1:* data:",
74
+ "content_scripts": [
75
+ {
76
+ "matches": [
77
+ "http://localhost/*",
78
+ "https://localhost/*",
79
+ "http://127.0.0.1/*",
80
+ "https://127.0.0.1/*",
81
+ "http://[::1]/*",
82
+ "https://[::1]/*"
83
+ ],
84
+ "js": [
85
+ "content.js"
86
+ ],
87
+ "run_at": "document_start"
88
+ }
89
+ ]
90
+ }
@@ -19,8 +19,8 @@
19
19
  <div class="paper">
20
20
  <main>
21
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>
22
+ <strong id="pairing-title">Connect your browser</strong>
23
+ <p id="pairing-message">Click Connect to GazeSight and approve the matching code in your terminal.</p>
24
24
  <p id="pairing-code" class="pairing-code" hidden></p>
25
25
  <button id="connect" class="primary connect">Connect to GazeSight</button>
26
26
  </section>
@@ -1 +1 @@
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});
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 c=await g.json();if(c.state==="approved"&&c.credential&&c.pairingId)return await browser.storage.local.set({token:c.credential,pairingId:c.pairingId,port:b,pairingState:"connected"}),await browser.storage.local.remove(r),e("connected"),!0;if(c.state==="rejected")return await browser.storage.local.remove(r),e("reconnect_required",a),!1;if(c.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 h(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 f(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 d(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 d("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=e.connected,n("pairing-title",typeof t.token=="string"?"Reconnect or re-pair":"Connect your browser"),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. Choose Connect and approve the matching code in your terminal.",searching:"Searching for local GazeSight\u2026",pending:"Pairing request pending.",waiting_approval:"Check that this code matches the one in your terminal.",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 h(S,Number(t.port??32147)),e.disabled=!1,await s()});(async()=>typeof(await browser.storage.local.get(["token"])).token!="string"&&await f(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 d(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 d("status")).backgroundCapture.enabled){await d("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 d("status");if(e.continuousAuthorization.enabled){await d("continuous-disable"),await s();return}if(e.continuousAuthorization.permissionGranted){await d("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