webhelm 1.0.58 → 1.0.59
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/package.json
CHANGED
package/runtime/cli-help.mjs
CHANGED
|
@@ -275,7 +275,8 @@ Options:
|
|
|
275
275
|
Lists tools registered in the selected main frame of an existing CLI-owned
|
|
276
276
|
Session. Does not navigate or invoke tools. Output: JSON with session_id,
|
|
277
277
|
target_id and tools (names, descriptions, input schemas and annotations).
|
|
278
|
-
An empty tools array means no tools were discovered
|
|
278
|
+
An empty tools array means no tools were discovered or Chrome does not
|
|
279
|
+
support WebMCP. Other unavailable discovery
|
|
279
280
|
exits nonzero.
|
|
280
281
|
|
|
281
282
|
Example:
|
package/runtime/webmcp.mjs
CHANGED
|
@@ -91,7 +91,18 @@ async function withWebMCP(browser, sessionId, {name,input,discovery_ms,timeout_m
|
|
|
91
91
|
});
|
|
92
92
|
// Subscribe before enabling: Chrome sends existing registrations as events.
|
|
93
93
|
enabled=true;
|
|
94
|
-
|
|
94
|
+
try {
|
|
95
|
+
await browser.send('WebMCP.enable',{},sessionId);
|
|
96
|
+
} catch(error) {
|
|
97
|
+
// Older Chrome reports an absent CDP domain as method not found.
|
|
98
|
+
// Do not disguise transport failures or revoked ownership as no tools.
|
|
99
|
+
const unsupported=/unknown (?:domain|method|command)|(?:method|command).*not found|(?:WebMCP\.enable).*wasn't found|not supported/i.test(error?.message||'');
|
|
100
|
+
if(unsupported){
|
|
101
|
+
enabled=false;
|
|
102
|
+
return name===undefined&&active()&&!invalidated?[]:null;
|
|
103
|
+
}
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
95
106
|
async function waitUntil(condition,ms){
|
|
96
107
|
const end=Date.now()+ms;
|
|
97
108
|
while(active()&&!invalidated&&!condition()&&Date.now()<end){
|