@ai-digital-factory/lmt-web-cli 0.1.4 → 0.1.5

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 CHANGED
@@ -43,7 +43,8 @@ npx --yes @ai-digital-factory/lmt-web-cli@latest zerodha-login --session SESSION
43
43
  npx --yes @ai-digital-factory/lmt-web-cli@latest zerodha-otp --session SESSION_ID --attempt ATTEMPT_ID --stdin
44
44
  ```
45
45
 
46
- The user supplies the OTP for the active attempt. Never put it in a command-line
46
+ `zerodha-cancel --session SESSION_ID` cancels a waiting attempt through the page's
47
+ **Cancel login** control. The user supplies the OTP for the active attempt. Never put it in a command-line
47
48
  argument or ask the CLI to retrieve it. Inspect the latest JSON result after each
48
49
  command. Control references are short-lived: every new observation or action returns
49
50
  fresh references, so use only references from the most recent result.
@@ -67,6 +68,31 @@ Broker activity. The CLI also supports `inspect`, `click`, `fill`, `select`, and
67
68
  `navigate`; run `npx --yes @ai-digital-factory/lmt-web-cli@latest --help` for the
68
69
  complete command list.
69
70
 
71
+ ## Interactive Zerodha login (human)
72
+
73
+ Agents cannot receive the Zerodha OTP, so a human logs the saved Web CLI session
74
+ into Zerodha once and agents then restore it with `start`. Run `lmt-web` with no
75
+ arguments (or `lmt-web interactive`) in a terminal:
76
+
77
+ ```sh
78
+ npx --yes @ai-digital-factory/lmt-web-cli@latest
79
+ ```
80
+
81
+ Use ↑/↓ and Enter to choose **Login to Zerodha** or **Logout from Zerodha**; press
82
+ `q` to quit. Logout asks for `y` to confirm, then uses Web's Logout Zerodha control;
83
+ the Operator stays logged in, so the next login needs only the OTP. Interactive
84
+ mode targets `--env dev --device desktop` by default; pass `--env local` or
85
+ `--device mobile` to log in to another saved session. It restores or reuses that
86
+ saved headless browser, logs in to the Operator with the provisioned SMS credential
87
+ when required, starts the Zerodha Login Attempt, and asks for the OTP as a masked
88
+ six-digit field. An attempt left waiting from earlier (for example by an agent) is
89
+ cancelled first, so every run issues a fresh challenge. A rejected OTP can be
90
+ retried on the same attempt; Esc cancels without submitting. An uncertain submission is never replayed—check the page with
91
+ `inspect` first. On exit, a browser started by interactive mode is stopped (its
92
+ login stays saved); a browser that was already running stays open.
93
+
94
+ Interactive mode requires a terminal; without one it exits with status 2.
95
+
70
96
  ## Install
71
97
 
72
98
  Requires Node.js 22.13 or later, Chromium, and a macOS or Linux session owner.
@@ -274,8 +300,9 @@ also accept `--timeout` and `--full-page`.
274
300
  Credential fields are detected from their type, labels, and attributes. Use
275
301
  `fill --secret` for sensitive values in other fields. Entered secrets remain in the
276
302
  live session's redaction registry, including when echoed into text or revealed in
277
- an input. JSON observations omit field values and redact secret text. Screenshots
278
- show the rendered page without additional masking.
303
+ an input. General JSON observations omit field values and redact secret text; explicit
304
+ reads follow the ordinary-value/secret-metadata contract below. Screenshots mask secret
305
+ values and their learned echoes.
279
306
  A click whose completion cannot be confirmed returns `outcome: "uncertain"` and a
280
307
  nonzero exit status. Pending browser loading is stopped to retain evidence, but the
281
308
  submitted server operation may still complete. Inspect before deciding what to do
@@ -393,6 +420,7 @@ this check performs no npm publication or live dev login.
393
420
  ```sh
394
421
  lmt-web read --session ID --ref FIELD
395
422
  lmt-web clipboard --session ID
423
+ lmt-web paste --session ID --ref FIELD
396
424
  lmt-web check --session ID --ref FIELD --stdin < /path/to/protected-expectation
397
425
  lmt-web clipboard-check --session ID --ref FIELD
398
426
  lmt-web scroll --session ID --ref FIELD
@@ -400,19 +428,49 @@ lmt-web scroll --session ID --y 600
400
428
  lmt-web inspect --session ID --full-page
401
429
  ```
402
430
 
403
- read returns an ordinary field value. clipboard returns content only when it matches
404
- a verified ordinary field on the current page; unknown or secret content is refused.
431
+ `read` returns `value` for an ordinary field, including Settings User ID. A protected
432
+ field returns only `secret: {present, length, fingerprint}`. `fingerprint` is the
433
+ 12-hex SHA-256 prefix used in Broker token logs, or null for an empty value.
434
+ `clipboard` returns an ordinary value only when it matches a verified ordinary field;
435
+ otherwise it returns the same safe secret metadata. Reveal the saved token before
436
+ reading it: hidden/capture-safe placeholders report `value_unreadable`, never metadata
437
+ for the placeholder. Copy still permits safe clipboard metadata in capture-safe mode.
405
438
  check compares the field with one stdin-supplied expectation (an optional final newline
406
439
  is removed). clipboard-check compares clipboard and field inside the browser session.
407
440
  Comparisons return only matches: true or matches: false. An unreadable field/clipboard
408
441
  or an expired reference is an error without a matches result. Inspect/action observations
409
442
  continue to redact secrets, including revealed fields.
410
443
 
444
+ `paste` reads the clipboard and updates a protected input or textarea entirely inside
445
+ the browser. It returns secret metadata and `matches: true` only after the field retains
446
+ the value. It does not submit the form. Read-only, ordinary, missing or rejecting fields
447
+ and unreadable clipboards fail explicitly. A failed paste has no equality result.
448
+
449
+ For current-token verification, use the existing saved browser session: navigate to
450
+ Settings, click Copy access token, inspect clipboard metadata, click Replace access token,
451
+ then `paste --ref` the Replacement access token input. Use fresh references from each
452
+ result. `clipboard-check` can prove the pasted field matches. Explicitly click Validate
453
+ and replace and inspect the resulting verification or refusal message. All actions use
454
+ the rendered controls; no HTTP Runner profile or direct API probing is required.
455
+
456
+ Screenshots mask protected field values and learned secret echoes while keeping ordinary
457
+ fields and labels readable. Every result still includes its independent screenshot outcome.
458
+ Same-origin browser requests carry `x-lmt-client-kind: cli` and
459
+ `x-lmt-client-profile: web-cli-desktop|web-cli-mobile`. Control actions also send a
460
+ `journey_step` audit through the browser to Gate's existing `/api/journey-records` ingest:
461
+ step `Web CLI <action>`, browser session correlation, CLI attribution, action outcome and
462
+ screenshot outcome only. No field/clipboard value, reference label or payload is logged.
463
+ `audit.outcome` reports `recorded` only for HTTP 202; `failed`/`unavailable` means logging
464
+ has not been established and does not reverse an already completed browser action.
465
+ In OpenObserve, discover the current `journey_step` fields and filter by step, browser
466
+ session and the bounded run window; join API traces using the attributed request rows.
467
+
411
468
  Referenced scrolling brings the control into view through its ancestors. Pixel scrolling
412
469
  targets the largest scrolling content area. Results include before/after positions and
413
470
  moved, already_visible, or at_boundary. Each observation expires older references.
471
+ A referenced control still outside the clipped visible area reports `target_unreachable`.
414
472
 
415
473
  Full-page capture temporarily expands inner scrolling content and restores its styles
416
474
  and positions afterward. A screenshot with unexpanded clipped content reports failed;
417
- browser-action and screenshot outcomes remain separate. Screenshots retain the existing
418
- rendered-page confidentiality behavior: protect their files as you would the visible UI.
475
+ browser-action and screenshot outcomes remain separate. Protect screenshot files as
476
+ evidence even though their secret values are masked.