@attson/atwebpilot-mcp 0.0.57 → 0.0.58

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/dist/index.js +28 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2088,9 +2088,19 @@ function renderPairPage(payload) {
2088
2088
  <script>
2089
2089
  (function () {
2090
2090
  var payload = ${json};
2091
- window.postMessage({ source: "atwebpilot-pair", payload: payload }, "*");
2091
+ var done = false;
2092
+
2093
+ function announce() {
2094
+ if (!done) window.postMessage({ source: "atwebpilot-pair", payload: payload }, "*");
2095
+ }
2096
+
2092
2097
  window.addEventListener("message", function (e) {
2093
- if (!e.data || e.data.source !== "atwebpilot-pair-result") return;
2098
+ if (!e.data) return;
2099
+ // The extension's relay installs at document_idle, i.e. after this script
2100
+ // has already run. It says hello when it is ready; that is our cue.
2101
+ if (e.data.source === "atwebpilot-pair-ready") { announce(); return; }
2102
+ if (e.data.source !== "atwebpilot-pair-result") return;
2103
+ done = true;
2094
2104
  var el = document.getElementById("atwebpilot-status");
2095
2105
  if (e.data.ok) {
2096
2106
  el.textContent = e.data.trusted ? "\u5DF2\u4FE1\u4EFB\uFF0C\u8FDE\u63A5\u4E2D\u2026" : "\u5DF2\u8FDE\u63A5";
@@ -2099,6 +2109,22 @@ function renderPairPage(payload) {
2099
2109
  el.textContent = "\u5DF2\u62D2\u7EDD\u3002\u53EF\u4EE5\u5173\u95ED\u672C\u9875\u3002";
2100
2110
  }
2101
2111
  });
2112
+
2113
+ // Belt and braces: announce now in case the relay was already listening, and
2114
+ // keep announcing for a while in case the ready signal itself was missed.
2115
+ announce();
2116
+ var tries = 0;
2117
+ var timer = setInterval(function () {
2118
+ if (done || ++tries > 40) {
2119
+ clearInterval(timer);
2120
+ if (!done) {
2121
+ document.getElementById("atwebpilot-status").textContent =
2122
+ "\u6CA1\u6709\u8054\u7CFB\u4E0A\u6269\u5C55\u3002\u8BF7\u786E\u8BA4\u8FD9\u4E2A\u6D4F\u89C8\u5668\u5DF2\u5B89\u88C5\u5E76\u542F\u7528 AtWebPilot \u6269\u5C55\uFF0C\u7136\u540E\u5237\u65B0\u672C\u9875\u3002";
2123
+ }
2124
+ return;
2125
+ }
2126
+ announce();
2127
+ }, 500);
2102
2128
  })();
2103
2129
  </script>
2104
2130
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attson/atwebpilot-mcp",
3
- "version": "0.0.57",
3
+ "version": "0.0.58",
4
4
  "license": "Apache-2.0",
5
5
  "description": "MCP server for the atwebpilot browser extension — let Claude Code drive your browser.",
6
6
  "homepage": "https://github.com/attson/atwebpilot#readme",