openclaw-navigator 4.1.0 → 4.2.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/cli.mjs +88 -0
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -344,6 +344,94 @@ function handleRequest(req, res) {
|
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
+
// ── GET /navigator/capabilities ──
|
|
348
|
+
if (req.method === "GET" && path === "/navigator/capabilities") {
|
|
349
|
+
sendJSON(res, 200, {
|
|
350
|
+
ok: true,
|
|
351
|
+
version: "4.0.0",
|
|
352
|
+
commands: [
|
|
353
|
+
{
|
|
354
|
+
name: "navigate",
|
|
355
|
+
description: "Navigate to a URL in the OpenClaw group",
|
|
356
|
+
payload: { url: "required string", browserID: "optional string — target a specific tab" },
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
name: "tabs.list",
|
|
360
|
+
description: "List all tabs in the OpenClaw group",
|
|
361
|
+
payload: {},
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
name: "tabs.open",
|
|
365
|
+
description: "Open a new tab in the OpenClaw group",
|
|
366
|
+
payload: { url: "optional string — URL to load (blank tab if omitted)" },
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
name: "tabs.close",
|
|
370
|
+
description: "Close a tab in the OpenClaw group",
|
|
371
|
+
payload: { tabIndex: "optional int", tabId: "optional string — close by index or ID" },
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
name: "page.content",
|
|
375
|
+
description: "Get the text content of the active tab",
|
|
376
|
+
payload: {},
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
name: "snapshot",
|
|
380
|
+
description: "Get a snapshot of the OpenClaw group state",
|
|
381
|
+
payload: {},
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
name: "click",
|
|
385
|
+
description: "Click an element by CSS selector",
|
|
386
|
+
payload: { selector: "required string — CSS selector" },
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
name: "input.fill",
|
|
390
|
+
description: "Fill an input field with a value",
|
|
391
|
+
payload: {
|
|
392
|
+
selector: "required string — CSS selector",
|
|
393
|
+
value: "required string — text to fill",
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
name: "input.submit",
|
|
398
|
+
description: "Submit a form",
|
|
399
|
+
payload: { selector: "optional string — CSS selector of form or element inside form" },
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
name: "scroll",
|
|
403
|
+
description: "Scroll the page",
|
|
404
|
+
payload: {
|
|
405
|
+
direction: "optional string — 'up', 'down', 'top', 'bottom'",
|
|
406
|
+
x: "optional int — horizontal pixels",
|
|
407
|
+
y: "optional int — vertical pixels",
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
name: "execute",
|
|
412
|
+
description: "Execute arbitrary JavaScript and return the result",
|
|
413
|
+
payload: { code: "required string — JavaScript code to execute" },
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
name: "page.html",
|
|
417
|
+
description: "Get the full HTML of the page",
|
|
418
|
+
payload: {},
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
name: "dom.query",
|
|
422
|
+
description: "Query a DOM element for its tag, text, and attributes",
|
|
423
|
+
payload: { selector: "required string — CSS selector" },
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
name: "wait.ready",
|
|
427
|
+
description: "Wait until document.readyState is 'complete'",
|
|
428
|
+
payload: { timeout: "optional int — milliseconds (default: 10000)" },
|
|
429
|
+
},
|
|
430
|
+
],
|
|
431
|
+
});
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
|
|
347
435
|
// ── GET /navigator/events ──
|
|
348
436
|
if (req.method === "GET" && path === "/navigator/events") {
|
|
349
437
|
const limit = parseInt(url.searchParams.get("limit") ?? "50", 10);
|