@agentrhq/webcmd 0.3.4 → 0.4.1

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 (67) hide show
  1. package/README.md +43 -268
  2. package/cli-manifest.json +184 -311
  3. package/clis/_shared/site-auth.js +37 -40
  4. package/clis/_shared/site-auth.test.js +109 -22
  5. package/clis/amazon/auth.js +0 -6
  6. package/clis/band/auth.js +0 -6
  7. package/clis/blinkit/auth.js +13 -40
  8. package/clis/blinkit/blinkit.test.js +39 -2
  9. package/clis/chatgpt/auth.js +0 -6
  10. package/clis/claude/auth.js +0 -6
  11. package/clis/coupang/auth.js +0 -6
  12. package/clis/district/auth.js +0 -2
  13. package/clis/facebook/auth.js +0 -6
  14. package/clis/gemini/auth.js +0 -6
  15. package/clis/github/auth.js +0 -6
  16. package/clis/grok/auth.js +0 -6
  17. package/clis/hackernews/hackernews.test.js +20 -1
  18. package/clis/hackernews/jobs.js +1 -1
  19. package/clis/hf/auth.js +2 -7
  20. package/clis/instagram/auth.js +0 -6
  21. package/clis/linkedin/auth.js +0 -6
  22. package/clis/linkedin-learning/auth.js +0 -6
  23. package/clis/manus/auth.js +0 -6
  24. package/clis/notebooklm/auth.js +0 -6
  25. package/clis/pixiv/auth.js +1 -7
  26. package/clis/practo/login.js +12 -38
  27. package/clis/practo/practo.test.js +13 -9
  28. package/clis/reddit/auth.js +0 -6
  29. package/clis/reuters/auth.js +0 -14
  30. package/clis/suno/auth.js +0 -6
  31. package/clis/tiktok/auth.js +0 -6
  32. package/clis/twitter/auth.js +0 -6
  33. package/clis/upwork/auth.js +0 -6
  34. package/clis/youtube/auth.js +0 -6
  35. package/clis/zepto/auth.js +16 -29
  36. package/clis/zepto/zepto.test.js +45 -2
  37. package/dist/src/browser/cdp.js +3 -1
  38. package/dist/src/browser/cdp.test.js +12 -0
  39. package/dist/src/browser/page.js +6 -2
  40. package/dist/src/browser/page.test.js +1 -0
  41. package/dist/src/browser/protocol.d.ts +2 -0
  42. package/dist/src/browser/runtime/local-cloak/actions.js +42 -21
  43. package/dist/src/browser/runtime/local-cloak/provider.test.js +33 -5
  44. package/dist/src/build-manifest.js +3 -3
  45. package/dist/src/build-manifest.test.js +14 -0
  46. package/dist/src/completion-shared.js +1 -1
  47. package/dist/src/docs-sync-review.js +15 -7
  48. package/dist/src/docs-sync-review.test.js +38 -2
  49. package/dist/src/generate-release-notes-cli.test.js +1 -1
  50. package/dist/src/hosted/client.d.ts +14 -2
  51. package/dist/src/hosted/client.js +46 -5
  52. package/dist/src/hosted/client.test.js +73 -20
  53. package/dist/src/hosted/main-lifecycle.test.js +2 -1
  54. package/dist/src/hosted/manifest.test.js +4 -2
  55. package/dist/src/hosted/output-parity.test.js +2 -1
  56. package/dist/src/hosted/root-command-surface.test.js +8 -1
  57. package/dist/src/hosted/runner.js +93 -0
  58. package/dist/src/hosted/runner.test.js +134 -5
  59. package/dist/src/hosted/types.d.ts +9 -2
  60. package/dist/src/skills.test.js +54 -0
  61. package/hosted-contract.json +191 -366
  62. package/package.json +4 -4
  63. package/skills/webcmd-adapter-author/SKILL.md +2 -0
  64. package/skills/webcmd-autofix/SKILL.md +5 -3
  65. package/skills/webcmd-browser/SKILL.md +12 -11
  66. package/skills/webcmd-usage/SKILL.md +8 -0
  67. 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.4",
3
+ "version": "0.4.1",
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://docs.webcmd.dev",
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.1.0",
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",
@@ -114,4 +114,4 @@
114
114
  "overrides": {
115
115
  "postcss": "^8.5.10"
116
116
  }
117
- }
117
+ }
@@ -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
- - **`AUTH_REQUIRED`** (exit code 77): stop. Tell the user to log into the site in Chrome or the webcmd-managed browser profile.
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 / rate limiting / IP block:** stop. This is not an adapter issue.
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 | Stop; ask user to log in |
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
- ### Fill a login form
338
+ ### Authentication and human handoff
339
339
 
340
- ```bash
341
- webcmd browser login open "https://example.com/login"
342
- webcmd browser login state # find [N] for email, password, submit
343
- webcmd browser login type 4 "me@example.com"
344
- webcmd browser login type 5 "hunter2"
345
- webcmd browser login get value 4 # verify (autocomplete can eat chars)
346
- webcmd browser login click 6 # submit
347
- webcmd browser login wait selector "[data-testid=account-menu]" --timeout 15000
348
- webcmd browser login state # fresh refs on the logged-in page
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`
@@ -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
- });