@agentrhq/webcmd 0.3.4 → 0.4.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 +43 -268
- package/cli-manifest.json +184 -311
- package/clis/_shared/site-auth.js +37 -40
- package/clis/_shared/site-auth.test.js +109 -22
- package/clis/amazon/auth.js +0 -6
- package/clis/band/auth.js +0 -6
- package/clis/blinkit/auth.js +13 -40
- package/clis/blinkit/blinkit.test.js +39 -2
- package/clis/chatgpt/auth.js +0 -6
- package/clis/claude/auth.js +0 -6
- package/clis/coupang/auth.js +0 -6
- package/clis/district/auth.js +0 -2
- package/clis/facebook/auth.js +0 -6
- package/clis/gemini/auth.js +0 -6
- package/clis/github/auth.js +0 -6
- package/clis/grok/auth.js +0 -6
- package/clis/hackernews/hackernews.test.js +20 -1
- package/clis/hackernews/jobs.js +1 -1
- package/clis/hf/auth.js +2 -7
- package/clis/instagram/auth.js +0 -6
- package/clis/linkedin/auth.js +0 -6
- package/clis/linkedin-learning/auth.js +0 -6
- package/clis/manus/auth.js +0 -6
- package/clis/notebooklm/auth.js +0 -6
- package/clis/pixiv/auth.js +1 -7
- package/clis/practo/login.js +12 -38
- package/clis/practo/practo.test.js +13 -9
- package/clis/reddit/auth.js +0 -6
- package/clis/reuters/auth.js +0 -14
- package/clis/suno/auth.js +0 -6
- package/clis/tiktok/auth.js +0 -6
- package/clis/twitter/auth.js +0 -6
- package/clis/upwork/auth.js +0 -6
- package/clis/youtube/auth.js +0 -6
- package/clis/zepto/auth.js +16 -29
- package/clis/zepto/zepto.test.js +45 -2
- package/dist/src/browser/cdp.js +3 -1
- package/dist/src/browser/cdp.test.js +12 -0
- package/dist/src/browser/page.js +6 -2
- package/dist/src/browser/page.test.js +1 -0
- package/dist/src/browser/protocol.d.ts +2 -0
- package/dist/src/browser/runtime/local-cloak/actions.js +42 -21
- package/dist/src/browser/runtime/local-cloak/provider.test.js +33 -5
- package/dist/src/build-manifest.js +3 -3
- package/dist/src/build-manifest.test.js +14 -0
- package/dist/src/docs-sync-review.js +2 -2
- package/dist/src/docs-sync-review.test.js +2 -2
- package/dist/src/hosted/main-lifecycle.test.js +2 -1
- package/dist/src/hosted/manifest.test.js +2 -1
- package/dist/src/hosted/output-parity.test.js +2 -1
- package/dist/src/hosted/root-command-surface.test.js +1 -1
- package/dist/src/hosted/runner.test.js +8 -4
- package/dist/src/skills.test.js +54 -0
- package/hosted-contract.json +191 -366
- package/package.json +3 -3
- package/skills/webcmd-adapter-author/SKILL.md +2 -0
- package/skills/webcmd-autofix/SKILL.md +5 -3
- package/skills/webcmd-browser/SKILL.md +12 -11
- package/skills/webcmd-usage/SKILL.md +8 -0
- package/clis/practo/whoami.js +0 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentrhq/webcmd",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Turn websites, browser sessions, desktop apps, and local tools into deterministic CLI surfaces for humans and AI agents.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.0.0"
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
],
|
|
79
79
|
"author": "AgentR",
|
|
80
80
|
"license": "Apache-2.0",
|
|
81
|
-
"homepage": "https://
|
|
81
|
+
"homepage": "https://webcmd.dev/docs",
|
|
82
82
|
"repository": {
|
|
83
83
|
"type": "git",
|
|
84
84
|
"url": "git+https://github.com/agentrhq/webcmd.git"
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"cli-table3": "^0.6.5",
|
|
92
92
|
"cloakbrowser": "0.4.5",
|
|
93
93
|
"commander": "^14.0.3",
|
|
94
|
-
"js-yaml": "^4.
|
|
94
|
+
"js-yaml": "^4.3.0",
|
|
95
95
|
"playwright-core": "1.61.1",
|
|
96
96
|
"turndown": "^7.2.2",
|
|
97
97
|
"turndown-plugin-gfm": "^1.0.2",
|
|
@@ -10,6 +10,8 @@ You are an agent writing an adapter for a site. The goal of this skill is a 30-m
|
|
|
10
10
|
|
|
11
11
|
Use the existing tools throughout: `webcmd browser *`, `webcmd doctor`, `webcmd browser init`, and `webcmd browser verify`. This skill does not introduce new commands.
|
|
12
12
|
|
|
13
|
+
Browser-profile auth commands must reuse `registerSiteAuthCommands`. Keep only site-specific `verify` and `openLogin` logic in the adapter. The login row must return `action_required` and `verify_command` (normally `webcmd <site> whoami`); after the user reports done, agents run that returned command and verification must succeed before retrying the original workflow. Credentials, MFA, and CAPTCHA always use human handoff: CAPTCHA stops automation until the user reports done and verification succeeds, and adapter code must not collect or type passwords or secrets.
|
|
14
|
+
|
|
13
15
|
When debugging browser-backed adapters, start with `--trace on --keep-tab true --window foreground`. `--trace on` writes a trace artifact every round, and `summary.md` is the entry point for reviewing both failures and successes. `--keep-tab true --window foreground` keeps the tab lease alive and puts the browser window in front so you can inspect the final page state.
|
|
14
16
|
|
|
15
17
|
---
|
|
@@ -12,9 +12,11 @@ When a `webcmd` command fails because a website changed its DOM, API, or respons
|
|
|
12
12
|
|
|
13
13
|
Hard stops before any code change:
|
|
14
14
|
|
|
15
|
-
-
|
|
15
|
+
- **Human-action handoff:** if a failure returns `handoff.status === action_required`, stop before trace collection or AutoFix. Give the user `handoff.action` and any `Webcmd browser:` or `handoff.viewUrl` link, then wait. Never request or enter credentials, passwords, or CAPTCHA answers. After the user reports done, run `handoff.verifyCommand` when present; verification must succeed before retrying. Without a verifier, inspect fresh browser state and verify the intended post-action state before any retry, especially for write commands.
|
|
16
|
+
- **`AUTH_REQUIRED`** (exit code 77): if a site login command exists, run `webcmd <site> login`, give its `action_required` instructions and any returned `action_url` or `view_url` to the user, and wait. Run the returned `verify_command` (normally `webcmd <site> whoami`); verification must succeed before retrying the original command. If no site login command exists, stop browser writes, hand the visible browser to the user, and wait. After they report done, take fresh browser state and use an available identity check or verify the intended post-action state before retrying. Their report alone is not verification. Never request, type, echo, store, or automate passwords, OTPs, recovery codes, cookies, or session secrets.
|
|
16
17
|
- **`BROWSER_CONNECT`** (exit code 69): stop. Tell the user to run `webcmd doctor`.
|
|
17
|
-
- **CAPTCHA /
|
|
18
|
+
- **CAPTCHA / raw-browser user takeover:** stop automation. Follow the human-action handoff above when one is returned; otherwise let the user act in the visible browser. Verification must succeed before retrying. With no verifier, take fresh browser state and verify the intended post-action state before any retry. The user's report alone is not verification. CAPTCHA is not an adapter issue.
|
|
19
|
+
- **Rate limiting / IP block:** stop. This is not an adapter issue.
|
|
18
20
|
|
|
19
21
|
Scope constraint:
|
|
20
22
|
|
|
@@ -124,7 +126,7 @@ Read the trace summary and adapter source. Classify root cause:
|
|
|
124
126
|
| SELECTOR | DOM restructured or class/id changed | Explore current DOM and find a stable selector |
|
|
125
127
|
| EMPTY_RESULT | API response schema changed, data moved, or real empty result | Check network and visible page before patching |
|
|
126
128
|
| API_ERROR | Endpoint URL changed or new params required | Discover current API through network evidence |
|
|
127
|
-
| AUTH_REQUIRED | Login flow changed or cookies expired |
|
|
129
|
+
| AUTH_REQUIRED | Login flow changed or cookies expired | Follow the conditional AUTH_REQUIRED policy in Safety Boundaries: use the site login command and its returned verifier when available; otherwise use human handoff plus fresh-state supported verification. |
|
|
128
130
|
| TIMEOUT | Page loads differently or lazy-load signal changed | Update wait conditions |
|
|
129
131
|
| PAGE_CHANGED | Major redesign | May need full adapter rewrite through `webcmd-adapter-author` |
|
|
130
132
|
|
|
@@ -335,18 +335,19 @@ webcmd browser hn open "https://news.ycombinator.com" \
|
|
|
335
335
|
|
|
336
336
|
## Recipes
|
|
337
337
|
|
|
338
|
-
###
|
|
338
|
+
### Authentication and human handoff
|
|
339
339
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
webcmd
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
webcmd
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
340
|
+
If a failure returns `handoff.status === action_required`, stop browser writes and AutoFix. Give the user `handoff.action` and any `Webcmd browser:` or `handoff.viewUrl` link, then wait. After the user reports done, run `handoff.verifyCommand` when present; verification must succeed before retrying.
|
|
341
|
+
|
|
342
|
+
1. On a clear login redirect or auth wall, stop browser writes.
|
|
343
|
+
2. If the site exposes a login command, run `webcmd <site> login`. `already_logged_in` is verified; `in_progress` means no current user action, so do not ask the user or wait for confirmation, and do not poll; `action_required` is a hard stop.
|
|
344
|
+
3. For `action_required`, give the user its instructions and any returned `action_url` or `view_url`. If Webcmd returned no URL, use the current visible browser.
|
|
345
|
+
4. Never ask for or type passwords, OTPs, recovery codes, cookies, or session secrets.
|
|
346
|
+
5. Run the returned `verify_command` (normally `webcmd <site> whoami`) or `handoff.verifyCommand` only after the user reports done; verification must succeed before retrying.
|
|
347
|
+
6. Without a verifier, take fresh browser state and verify the intended post-action state before any retry, especially for write commands. The user's report alone is not verification.
|
|
348
|
+
7. If login remains `in_progress`, perform a later explicit `whoami` or task retry when work next needs auth state. Use `webcmd auth refresh` only when an explicit auth-state refresh is needed.
|
|
349
|
+
|
|
350
|
+
For a CAPTCHA or user takeover, stop automation, give the user any viewer URL Webcmd returned, and apply the same verification policy above. Keep CAPTCHA outside automated retries.
|
|
350
351
|
|
|
351
352
|
### Pick from a long dropdown
|
|
352
353
|
|
|
@@ -118,6 +118,14 @@ webcmd <site> <command> [args...] --trace retain-on-failure
|
|
|
118
118
|
|
|
119
119
|
The error envelope includes a `trace` block pointing at `summary.md`. Patch only `adapterSourcePath` from that summary and retry. Maximum 3 repair rounds. See `webcmd-autofix`.
|
|
120
120
|
|
|
121
|
+
## Authentication and Human Handoff
|
|
122
|
+
|
|
123
|
+
If a failure returns `handoff.status === action_required`, stop before AutoFix. Give the user `handoff.action` and any `Webcmd browser:` or `handoff.viewUrl` link, then wait. After the user reports done, run `handoff.verifyCommand` when present; verification must succeed before retrying.
|
|
124
|
+
|
|
125
|
+
`AUTH_REQUIRED` is not an adapter failure. Run `webcmd <site> login`: `already_logged_in` is verified; `in_progress` means no current user action, so do not ask the user or wait for confirmation, and do not poll; `action_required` is a hard stop. For `action_required`, give the user its instructions and any returned `action_url` or `view_url`, then wait. If Webcmd returned no URL, use the current visible browser.
|
|
126
|
+
|
|
127
|
+
Run the returned `verify_command` (normally `webcmd <site> whoami`) or `handoff.verifyCommand` only after the user reports done; verification must succeed before retrying. Without a verifier, take fresh browser state and verify the intended post-action state before any retry, especially for write commands. Use `webcmd auth refresh` only when an explicit auth-state refresh is needed. Their report alone is not verification. Never request, type, echo, store, or automate passwords, OTPs, recovery codes, cookies, session secrets, or CAPTCHA answers; CAPTCHA stops automation and follows the same verification rule.
|
|
128
|
+
|
|
121
129
|
## Report A Webcmd Defect
|
|
122
130
|
|
|
123
131
|
After a reproducible Webcmd failure has been diagnosed or the `webcmd-autofix`
|
package/clis/practo/whoami.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { cli, Strategy } from '@agentrhq/webcmd/registry';
|
|
2
|
-
import { probeIdentity } from './utils.js';
|
|
3
|
-
|
|
4
|
-
cli({
|
|
5
|
-
site: 'practo',
|
|
6
|
-
name: 'whoami',
|
|
7
|
-
aliases: ['auth-status'],
|
|
8
|
-
access: 'read',
|
|
9
|
-
description: 'Show whether the current browser session is logged into Practo',
|
|
10
|
-
domain: 'www.practo.com',
|
|
11
|
-
strategy: Strategy.COOKIE,
|
|
12
|
-
browser: true,
|
|
13
|
-
navigateBefore: false,
|
|
14
|
-
siteSession: 'persistent',
|
|
15
|
-
args: [],
|
|
16
|
-
columns: ['logged_in', 'site', 'name'],
|
|
17
|
-
authStatus: {
|
|
18
|
-
quickCheck: async (page) => {
|
|
19
|
-
try {
|
|
20
|
-
const rows = await probeIdentity(page);
|
|
21
|
-
return { logged_in: true, name: rows[0].name };
|
|
22
|
-
} catch {
|
|
23
|
-
return { logged_in: false };
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
func: probeIdentity,
|
|
28
|
-
});
|