@revyl/verify 0.0.0-stage → 0.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/LICENSE +201 -0
  3. package/README.md +137 -2
  4. package/SECURITY.md +13 -0
  5. package/dist/api/client.d.ts +63 -0
  6. package/dist/api/client.js +201 -0
  7. package/dist/api/types.d.ts +222 -0
  8. package/dist/api/types.js +1 -0
  9. package/dist/auth.d.ts +17 -0
  10. package/dist/auth.js +65 -0
  11. package/dist/cleanup.d.ts +13 -0
  12. package/dist/cleanup.js +72 -0
  13. package/dist/cli/init.d.ts +14 -0
  14. package/dist/cli/init.js +115 -0
  15. package/dist/cli/main.d.ts +3 -0
  16. package/dist/cli/main.js +127 -0
  17. package/dist/computer-session.d.ts +43 -0
  18. package/dist/computer-session.js +418 -0
  19. package/dist/config.d.ts +88 -0
  20. package/dist/config.js +212 -0
  21. package/dist/errors.d.ts +9 -0
  22. package/dist/errors.js +14 -0
  23. package/dist/index.d.ts +8 -0
  24. package/dist/index.js +3 -0
  25. package/dist/open.d.ts +13 -0
  26. package/dist/open.js +33 -0
  27. package/dist/screen-readiness.d.ts +1 -0
  28. package/dist/screen-readiness.js +27 -0
  29. package/dist/session.d.ts +153 -0
  30. package/dist/session.js +443 -0
  31. package/dist/version.d.ts +2 -0
  32. package/dist/version.js +6 -0
  33. package/docs/README.md +19 -0
  34. package/docs/agents.md +43 -0
  35. package/docs/api.md +120 -0
  36. package/docs/ci.md +70 -0
  37. package/docs/computers.md +83 -0
  38. package/docs/configuration.md +92 -0
  39. package/docs/end-to-end.md +105 -0
  40. package/docs/errors.md +39 -0
  41. package/docs/getting-started.md +88 -0
  42. package/docs/linux-computers-contract.md +53 -0
  43. package/docs/llms.txt +19 -0
  44. package/docs/mobile.md +49 -0
  45. package/docs/web.md +37 -0
  46. package/package.json +71 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,35 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ - Add a standard-library-only Go SDK for web, iOS, Android, and early-access Mac and Linux computers. Computer commands, binary files, process handles, screenshots, recording metadata, and confirmed-release cleanup require an enabled staging organization and are not yet available in production. Capacity refusals have a distinct `COMPUTER_LIMIT` code; no start or operation is automatically replayed.
6
+
7
+ ## 0.2.0
8
+
9
+ Prepared for release; see npm for publication status.
10
+
11
+ - Enable Linux named and inline computer targets with the shared Mac command, file, process, screenshot, and confirmed-release cleanup surface. Both operating systems remain early access on staging for enabled organizations/OSes, not yet available in production.
12
+ - Add `COMPUTER_LIMIT` for queued work (including iOS) or concurrency admission refusals, without retrying or stopping a definitely refused start. Preserve `SESSION_BUSY` for operation limits.
13
+ - Explain the 120-second unclaimed-start failure without shortening the default 10-minute start timeout.
14
+ - Expose optional `expiresAt` and bound operation/screenshot observation by the hard 60-minute lifetime from create, while keeping explicit close possible.
15
+ - Add computer `recording()` metadata retrieval after terminal state and confirmed release, including after close. Missing recordings return null; signed URLs remain private, with no automatic waiting or download.
16
+ - Keep Linux CLI init intentionally unavailable; use inline targets or config entries. Computer instruction/validation remain locally unavailable.
17
+ - Observe mobile first-screen content best-effort for up to 10 seconds after connection/launch, without pretending the runtime provides rendered-readiness guarantees. Generated mobile examples begin with an instruction to wait for the first screen before validation.
18
+ - Retry structured computer screen-not-ready responses with bounded backoff during the fixed startup window; do not replay mutations or unrelated failures.
19
+ - Skip CI publication when the exact version is already on npm, require explicit administrator opt-in for new CI publications, fail closed on registry lookup errors, and document manual Mac publication, optional trusted publishing, and independent Go module tags.
20
+
21
+ Regression validation uses fake API responses. The [end-to-end record](https://github.com/RevylAI/verify/blob/v0.2.0/packages/verify/docs/end-to-end.md) distinguishes baseline live runs from startup fixes still awaiting live re-verification.
22
+
23
+ ## 0.1.0
24
+
25
+ Published manually from a maintainer's Mac without provenance.
26
+
27
+ - Open Revyl cloud web browsers, iOS simulators, and Android emulators from TypeScript.
28
+ - Run natural-language instruction and validation steps, with typed failures and optional soft validation results.
29
+ - Save screenshots, share session links, and close sessions explicitly or during best-effort process cleanup.
30
+ - Configure named targets and initialize a script with the `verify` or `revyl-verify` command.
31
+ - Use environment credentials or an existing Revyl CLI login, with documentation included in the package.
32
+ - Include **early-access Mac computers, not yet available in Revyl production**, for commands, binary files, process handles, screenshots, and confirmed-release cleanup. Mac works only on Revyl staging for enabled organizations through the optional `REVYL_BACKEND_URL` override and matching credentials; ask support@revyl.ai about access.
33
+ - Reserve Linux target types and document the future contract; opening Linux is not available in this release.
34
+
35
+ Requires Node.js 22.18 or later and a Revyl account. There is no bundled test runner or step replay. Mac operations remain covered by source-aligned fake-API tests; a production start never reached active, so it did not prove any operation or confirmed cleanup.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,138 @@
1
- # Temporary Holding Version
1
+ <h1 align="center">Verify</h1>
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <p align="center">
4
+ <em>Cloud browsers, mobile devices and computers from TypeScript and Go.</em>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/RevylAI/verify/blob/v0.2.0/CHANGELOG.md"><img src="https://img.shields.io/badge/version-0.2.0-9D61FF" alt="Source version" /></a>
9
+ <a href="https://github.com/RevylAI/verify/blob/v0.2.0/LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" alt="License: Apache 2.0" /></a>
10
+ <a href="https://www.npmjs.com/package/@revyl/verify"><img src="https://img.shields.io/npm/v/@revyl/verify?color=9D61FF" alt="npm" /></a>
11
+ <a href="https://pkg.go.dev/github.com/RevylAI/verify/go"><img src="https://img.shields.io/badge/Go-reference-00ADD8?logo=go&logoColor=white" alt="Go reference" /></a>
12
+ <a href="https://github.com/RevylAI/verify/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/RevylAI/verify/ci.yml?branch=main&label=CI" alt="CI" /></a>
13
+ </p>
14
+
15
+ ---
16
+
17
+ Verify is a TypeScript and Go library for [Revyl](https://revyl.com). Open a cloud browser, iOS simulator or Android emulator for natural-language instructions and validations, or an early-access Mac/Linux computer for commands, files, processes and screenshots. Call it from a script, coding agent or your existing test runner.
18
+
19
+ ## For coding agents
20
+
21
+ Run these from the project's directory with Node.js ≥22.18. The authentication command requires the [Revyl CLI](https://github.com/RevylAI/revyl-cli#install); if `REVYL_API_KEY` is already supplied securely, skip login.
22
+
23
+ ```bash
24
+ npm install --save-dev @revyl/verify
25
+ npx @revyl/verify init --platform ios
26
+ revyl auth login
27
+ npx @revyl/verify whoami
28
+ ```
29
+
30
+ If login prints an approval URL, share it privately with the user so they can approve it in their browser. For unattended runs, supply `REVYL_API_KEY` through a secret manager; never put credentials in argv, source or logs. Configure the generated `verify.config.ts` before running `node verify/example.ts`. Starting a cloud session requires an authorized account and workload.
31
+
32
+ ## Install
33
+
34
+ ### npm
35
+
36
+ Use Node.js ≥22.18:
37
+
38
+ ```bash
39
+ npm install --save-dev @revyl/verify
40
+ ```
41
+
42
+ ### Go
43
+
44
+ Use Go ≥1.26.9 in an existing Go module:
45
+
46
+ ```bash
47
+ go get github.com/RevylAI/verify/go@main
48
+ ```
49
+
50
+ There is no Go release tag yet. `@main` resolves to a pseudo-version; keep the generated `go.mod` and `go.sum` to pin it. Go tags are independent of npm versions. The SDK uses only the standard library.
51
+
52
+ ## Authenticate
53
+
54
+ Both SDKs use this credential order:
55
+
56
+ 1. A usable stored CLI login marked `local_auth_override`.
57
+ 2. `REVYL_API_KEY` from the environment.
58
+ 3. Another usable CLI login stored by `revyl auth login`.
59
+
60
+ An expired access token can fall back to its stored API key. Set environment keys through a secret manager, or sign in interactively:
61
+
62
+ ```bash
63
+ revyl auth login
64
+ ```
65
+
66
+ See [configuration](https://github.com/RevylAI/verify/blob/v0.2.0/packages/verify/docs/configuration.md) for credential and endpoint options.
67
+
68
+ ## Quick Start
69
+
70
+ ### TypeScript
71
+
72
+ Run `npx @revyl/verify init --platform ios`. For this Settings example, replace the generated `app` block with `app: { bundleId: 'com.apple.Preferences' }`. Save the following as `verify/example.ts` and run `node verify/example.ts`. For your own uploaded app, set `app.appId` and adapt the steps.
73
+
74
+ ```ts
75
+ import { open } from '@revyl/verify';
76
+ const session = await open('ios');
77
+ try {
78
+ await session.instruction('Open General, then About');
79
+ await session.validation('The screen shows the operating system version');
80
+ } finally {
81
+ await session.close();
82
+ }
83
+ ```
84
+
85
+ For web, use `init --platform web` with a Revyl web app ID and public HTTPS URL. See [getting started](https://github.com/RevylAI/verify/blob/v0.2.0/packages/verify/docs/getting-started.md).
86
+
87
+ ### Go
88
+
89
+ Inside a function returning `error`, with a bounded `ctx` and imports for `context`, `time`, and `verify "github.com/RevylAI/verify/go"`:
90
+
91
+ ```go
92
+ session, err := verify.Open(ctx, verify.Target{Platform: verify.IOS, BundleID: "com.apple.Preferences"})
93
+ if err != nil {
94
+ return err
95
+ }
96
+ defer func() {
97
+ cleanup, cancel := context.WithTimeout(context.Background(), 30*time.Second)
98
+ defer cancel()
99
+ _ = session.Close(cleanup)
100
+ }()
101
+ if _, err := session.Instruction(ctx, "Open General, then About"); err != nil {
102
+ return err
103
+ }
104
+ _, err = session.Validation(ctx, "The screen shows the operating system version")
105
+ return err
106
+ ```
107
+
108
+ This sketch ignores cleanup errors; the [complete Go examples](https://github.com/RevylAI/verify/blob/v0.2.0/go/README.md) handle them. Go has no process-exit handlers. TypeScript's automatic cleanup is best effort, bounded to 15 seconds, and skips signal/error handlers that already have listeners. Always close explicitly: device close acknowledges a stop request; computer close requires terminal state and confirmed release.
109
+
110
+ ### Platforms
111
+
112
+ | Platform | Instructions / validations | Commands / files / processes | PNG screenshot | Availability |
113
+ | --- | :---: | :---: | :---: | --- |
114
+ | Web | Yes | — | Yes | Production; selected backend must support web steps |
115
+ | iOS simulator | Yes | — | Yes | Production |
116
+ | Android emulator | Yes | — | Yes | Production |
117
+ | Mac computer | — | Yes | Yes | Staging-only early access; not in production |
118
+ | Linux computer | — | Yes | Yes | Staging-only early access; not in production |
119
+
120
+ Computers require enablement for your organization and requested OS, plus approved `REVYL_BACKEND_URL`, matching `REVYL_APP_URL` and credentials. They have a hard 60-minute lifetime from create. Mac supports `init --platform mac`; Linux init is unavailable, so use `open({ platform: 'linux' })` or a config target. See [computers](https://github.com/RevylAI/verify/blob/v0.2.0/packages/verify/docs/computers.md).
121
+
122
+ ## Documentation
123
+
124
+ - [Documentation index](https://github.com/RevylAI/verify/tree/v0.2.0/packages/verify/docs/) · [API](https://github.com/RevylAI/verify/blob/v0.2.0/packages/verify/docs/api.md) · [CI](https://github.com/RevylAI/verify/blob/v0.2.0/packages/verify/docs/ci.md) · [Coding agents](https://github.com/RevylAI/verify/blob/v0.2.0/packages/verify/docs/agents.md)
125
+ - [End-to-end results and limitations](https://github.com/RevylAI/verify/blob/v0.2.0/packages/verify/docs/end-to-end.md)
126
+ - [Examples](https://github.com/RevylAI/verify/tree/v0.2.0/examples/): [Web store](https://github.com/RevylAI/verify/tree/v0.2.0/examples/web-store/) · [Mobile Settings](https://github.com/RevylAI/verify/tree/v0.2.0/examples/mobile-settings/) · [Mac workspace](https://github.com/RevylAI/verify/tree/v0.2.0/examples/mac-workspace/) · [Go](https://github.com/RevylAI/verify/blob/v0.2.0/go/README.md)
127
+ - [Contributing](https://github.com/RevylAI/verify/blob/v0.2.0/CONTRIBUTING.md) · [Security](https://github.com/RevylAI/verify/blob/v0.2.0/SECURITY.md) · [Releasing](https://github.com/RevylAI/verify/blob/v0.2.0/RELEASING.md)
128
+
129
+ ## Troubleshooting
130
+
131
+ - **`NOT_AVAILABLE_ON_PLATFORM`:** computer agent steps and device command/file methods are unavailable. Computers also need staging enablement; web steps need backend support. Check the [platform contract](https://github.com/RevylAI/verify/blob/v0.2.0/packages/verify/docs/errors.md).
132
+ - **`COMPUTER_LIMIT`:** admission was refused because of queued work or a concurrency limit. Wait for capacity; Verify does not retry creation or stop a definitely refused start.
133
+ - **Blank first screen:** mobile startup makes a bounded, best-effort blank-frame observation, not a rendered/foreground-readiness guarantee. Begin with an instruction that reaches the screen you need. Computer capture retries structured startup screen-not-ready responses for a fixed 30-second window; Linux screenshot retry is tests-only, not proven live.
134
+ - **A report's counters look successful but validation failed:** inspect `effective_status`, `validation_result` and `validations_passed` against `total_validations`, not transport counts. Failed SDK validations throw by default. See [reading the verdict](https://github.com/RevylAI/verify/blob/v0.2.0/packages/verify/docs/end-to-end.md#reading-the-verdict).
135
+
136
+ ## License
137
+
138
+ [Apache 2.0](https://github.com/RevylAI/verify/blob/v0.2.0/LICENSE).
package/SECURITY.md ADDED
@@ -0,0 +1,13 @@
1
+ # Security
2
+
3
+ ## Reporting a vulnerability
4
+
5
+ Email **support@revyl.ai** with the subject “Verify security report”. Do not open a public issue for a vulnerability or include API keys, session tokens, customer data, or screenshots containing sensitive information. Share a minimal reproduction with placeholders and affected versions; arrange a private channel before sending sensitive evidence.
6
+
7
+ The maintainers review reports and coordinate fixes and disclosure. No response-time commitment is promised. Before the first release, report against the current source revision; afterward, security fixes target the latest published version.
8
+
9
+ ## Safe use
10
+
11
+ Verify starts paid remote sessions and can act on your application. Use test accounts and non-production data, explicitly authorize each workload, and close sessions in `finally`. Automatic shutdown is best effort and cannot run after a forced kill. Keep credentials in environment variables or the Revyl CLI credential store, not in source or config. Step descriptions are sent to Revyl and printed to stderr by default; do not embed private credentials or customer data in them. Treat screenshots and session reports as potentially sensitive.
12
+
13
+ Only install the package name documented in the README. The unscoped npm package named `verify` is unrelated; outside an installation, use `npx @revyl/verify`, not `npx verify`.
@@ -0,0 +1,63 @@
1
+ import { VerifyError } from '../errors.js';
2
+ import type { AppResponse, BuildResponse, DeviceSessionDetail, DeviceSessionStopResponse, StartDeviceRequest, StartDeviceResponse, WhoAmI, WorkerConnection } from './types.js';
3
+ export declare const DEFAULT_BACKEND_URL = "https://backend.revyl.ai";
4
+ export declare const DEFAULT_APP_URL = "https://app.revyl.ai";
5
+ /** Sent on every request so Revyl can attribute sessions that Verify starts. */
6
+ export declare const CLIENT_HEADER_VALUE = "verify";
7
+ export interface RevylClientOptions {
8
+ token: string;
9
+ backendUrl?: string;
10
+ fetch?: typeof fetch;
11
+ requestTimeoutMs?: number;
12
+ }
13
+ export interface RequestOptions {
14
+ body?: unknown;
15
+ query?: Record<string, string | string[] | undefined>;
16
+ timeoutMs?: number;
17
+ retry?: boolean;
18
+ signal?: AbortSignal;
19
+ headers?: Record<string, string>;
20
+ }
21
+ export interface RawResponse {
22
+ status: number;
23
+ headers: Headers;
24
+ body: Uint8Array;
25
+ }
26
+ export declare class RevylClient {
27
+ readonly backendUrl: string;
28
+ private readonly token;
29
+ private readonly fetchImpl;
30
+ private readonly requestTimeoutMs;
31
+ constructor(options: RevylClientOptions);
32
+ send(method: 'GET' | 'POST', path: string, options?: RequestOptions): Promise<RawResponse>;
33
+ json<T>(method: 'GET' | 'POST', path: string, options?: RequestOptions): Promise<T>;
34
+ startDevice(request: StartDeviceRequest, signal?: AbortSignal): Promise<StartDeviceResponse>;
35
+ getDeviceSession(sessionId: string, signal?: AbortSignal): Promise<DeviceSessionDetail>;
36
+ getWorkerConnection(workflowRunId: string, signal?: AbortSignal): Promise<WorkerConnection>;
37
+ stopDeviceSession(sessionId: string): Promise<DeviceSessionStopResponse>;
38
+ cancelDevice(workflowRunId: string): Promise<unknown>;
39
+ getApp(appId: string, signal?: AbortSignal): Promise<AppResponse>;
40
+ registerWebUrlBuild(appId: string, request: {
41
+ url: string;
42
+ branch_name?: string;
43
+ }, signal?: AbortSignal): Promise<BuildResponse>;
44
+ latestWebBuild(appId: string, branch: {
45
+ branchId?: string;
46
+ branchName?: string;
47
+ }, signal?: AbortSignal): Promise<BuildResponse | undefined>;
48
+ whoAmI(): Promise<WhoAmI>;
49
+ worker(workflowRunId: string, action: string, options: {
50
+ method: 'GET' | 'POST';
51
+ body?: unknown;
52
+ timeoutMs?: number;
53
+ signal?: AbortSignal;
54
+ retry?: boolean;
55
+ }): Promise<RawResponse>;
56
+ private sendOnce;
57
+ }
58
+ export declare function appUrl(): string;
59
+ export declare function sessionViewerUrl(sessionId: string, kind?: 'computer'): string;
60
+ export declare function parseJson<T>(response: RawResponse, what: string): T;
61
+ export declare function responseDetail(response: RawResponse): string | undefined;
62
+ export declare function responseErrorCode(response: RawResponse): string | undefined;
63
+ export declare function apiError(method: string, path: string, response: RawResponse): VerifyError;
@@ -0,0 +1,201 @@
1
+ import { setTimeout as delay } from 'node:timers/promises';
2
+ import { VerifyError, errorMessage } from '../errors.js';
3
+ import { VERSION } from '../version.js';
4
+ export const DEFAULT_BACKEND_URL = 'https://backend.revyl.ai';
5
+ export const DEFAULT_APP_URL = 'https://app.revyl.ai';
6
+ /** Sent on every request so Revyl can attribute sessions that Verify starts. */
7
+ export const CLIENT_HEADER_VALUE = 'verify';
8
+ const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
9
+ const RETRY_DELAYS_MS = [500, 1500];
10
+ const RETRYABLE_STATUSES = new Set([502, 503, 504]);
11
+ export class RevylClient {
12
+ backendUrl;
13
+ token;
14
+ fetchImpl;
15
+ requestTimeoutMs;
16
+ constructor(options) {
17
+ this.token = options.token;
18
+ this.backendUrl = validateBackendUrl(options.backendUrl ?? process.env.REVYL_BACKEND_URL ?? DEFAULT_BACKEND_URL);
19
+ this.fetchImpl = options.fetch ?? fetch;
20
+ this.requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
21
+ }
22
+ async send(method, path, options = {}) {
23
+ const url = new URL(path, this.backendUrl);
24
+ for (const [key, value] of Object.entries(options.query ?? {})) {
25
+ if (value === undefined)
26
+ continue;
27
+ for (const item of Array.isArray(value) ? value : [value])
28
+ url.searchParams.append(key, item);
29
+ }
30
+ const retry = options.retry ?? method === 'GET';
31
+ const attempts = retry ? RETRY_DELAYS_MS.length + 1 : 1;
32
+ for (let attempt = 1;; attempt += 1) {
33
+ const outcome = await this.sendOnce(method, url, options);
34
+ const retryable = outcome instanceof Error || RETRYABLE_STATUSES.has(outcome.status);
35
+ if (!retryable || attempt >= attempts || options.signal?.aborted) {
36
+ if (outcome instanceof Error)
37
+ throw outcome;
38
+ return outcome;
39
+ }
40
+ await delay(RETRY_DELAYS_MS[attempt - 1] ?? 1500, undefined, { signal: options.signal }).catch(() => undefined);
41
+ }
42
+ }
43
+ async json(method, path, options = {}) {
44
+ const response = await this.send(method, path, options);
45
+ if (response.status < 200 || response.status >= 300)
46
+ throw apiError(method, path, response);
47
+ return parseJson(response, `${method} ${path}`);
48
+ }
49
+ startDevice(request, signal) {
50
+ return this.json('POST', '/api/v1/execution/start_device', { body: request, retry: false, timeoutMs: 120_000, signal });
51
+ }
52
+ getDeviceSession(sessionId, signal) {
53
+ return this.json('GET', `/api/v1/execution/device-sessions/${encodeURIComponent(sessionId)}`, { signal });
54
+ }
55
+ getWorkerConnection(workflowRunId, signal) {
56
+ return this.json('GET', `/api/v1/execution/streaming/worker-connection/${encodeURIComponent(workflowRunId)}`, { signal });
57
+ }
58
+ stopDeviceSession(sessionId) {
59
+ return this.json('POST', `/api/v1/execution/device/sessions/${encodeURIComponent(sessionId)}/stop`, { retry: true });
60
+ }
61
+ cancelDevice(workflowRunId) {
62
+ return this.json('POST', `/api/v1/execution/device/status/cancel/${encodeURIComponent(workflowRunId)}`, { retry: true });
63
+ }
64
+ getApp(appId, signal) {
65
+ return this.json('GET', `/api/v1/apps/${encodeURIComponent(appId)}`, { signal });
66
+ }
67
+ registerWebUrlBuild(appId, request, signal) {
68
+ return this.json('POST', `/api/v1/apps/${encodeURIComponent(appId)}/builds/external`, { body: request, retry: true, signal });
69
+ }
70
+ async latestWebBuild(appId, branch, signal) {
71
+ const page = await this.json('GET', `/api/v1/apps/${encodeURIComponent(appId)}/builds`, {
72
+ query: {
73
+ artifact_kinds: ['web_external', 'web_bundle'],
74
+ branch_id: branch.branchId,
75
+ branch_name: branch.branchName,
76
+ include_jobs: 'false',
77
+ page: '1',
78
+ page_size: '1',
79
+ },
80
+ signal,
81
+ });
82
+ return page.items[0];
83
+ }
84
+ whoAmI() {
85
+ return this.json('GET', '/api/v1/entity/users/get_user_uuid');
86
+ }
87
+ worker(workflowRunId, action, options) {
88
+ const path = `/api/v1/execution/device-proxy/${encodeURIComponent(workflowRunId)}/${action}`;
89
+ return this.send(options.method, path, {
90
+ body: options.body,
91
+ timeoutMs: options.timeoutMs,
92
+ signal: options.signal,
93
+ retry: options.retry ?? false,
94
+ headers: { 'X-Revyl-Agent': 'Verify' },
95
+ });
96
+ }
97
+ async sendOnce(method, url, options) {
98
+ const timeout = AbortSignal.timeout(options.timeoutMs ?? this.requestTimeoutMs);
99
+ const signal = options.signal ? AbortSignal.any([options.signal, timeout]) : timeout;
100
+ const headers = {
101
+ Authorization: `Bearer ${this.token}`,
102
+ 'User-Agent': `revyl-verify/${VERSION} node/${process.versions.node}`,
103
+ 'X-Revyl-Client': CLIENT_HEADER_VALUE,
104
+ Accept: 'application/json',
105
+ ...options.headers,
106
+ };
107
+ if (options.body !== undefined)
108
+ headers['Content-Type'] = 'application/json';
109
+ try {
110
+ const response = await this.fetchImpl(url, {
111
+ method,
112
+ headers,
113
+ body: options.body === undefined ? undefined : JSON.stringify(options.body),
114
+ redirect: 'error',
115
+ signal,
116
+ });
117
+ return { status: response.status, headers: response.headers, body: new Uint8Array(await response.arrayBuffer()) };
118
+ }
119
+ catch (error) {
120
+ if (options.signal?.aborted) {
121
+ return new VerifyError('TIMEOUT', `Revyl request ${method} ${url.pathname} ran past its caller's deadline.`, { cause: error });
122
+ }
123
+ if (timeout.aborted) {
124
+ return new VerifyError('TIMEOUT', `Revyl request ${method} ${url.pathname} got no response within ${options.timeoutMs ?? this.requestTimeoutMs} ms.`, { cause: error });
125
+ }
126
+ return new VerifyError('API_ERROR', `Could not reach Revyl at ${url.origin}: ${errorMessage(error)}`, { cause: error });
127
+ }
128
+ }
129
+ }
130
+ export function appUrl() {
131
+ return (process.env.REVYL_APP_URL ?? DEFAULT_APP_URL).replace(/\/+$/, '');
132
+ }
133
+ export function sessionViewerUrl(sessionId, kind) {
134
+ return `${appUrl()}/sessions/${encodeURIComponent(sessionId)}${kind ? `?kind=${kind}` : ''}`;
135
+ }
136
+ export function parseJson(response, what) {
137
+ try {
138
+ return JSON.parse(new TextDecoder().decode(response.body));
139
+ }
140
+ catch (error) {
141
+ throw new VerifyError('API_ERROR', `Revyl returned a response to ${what} that is not JSON (HTTP ${response.status}).`, {
142
+ cause: error,
143
+ });
144
+ }
145
+ }
146
+ export function responseDetail(response) {
147
+ let parsed;
148
+ try {
149
+ parsed = JSON.parse(new TextDecoder().decode(response.body));
150
+ }
151
+ catch {
152
+ return undefined;
153
+ }
154
+ if (typeof parsed !== 'object' || parsed === null)
155
+ return undefined;
156
+ const record = parsed;
157
+ const detail = record.detail ?? record.message ?? record.error;
158
+ if (typeof detail === 'string')
159
+ return detail.slice(0, 500);
160
+ if (Array.isArray(detail)) {
161
+ return detail
162
+ .map((item) => (typeof item === 'object' && item !== null && 'msg' in item ? String(item.msg) : String(item)))
163
+ .join('; ')
164
+ .slice(0, 500);
165
+ }
166
+ return undefined;
167
+ }
168
+ export function responseErrorCode(response) {
169
+ try {
170
+ const parsed = JSON.parse(new TextDecoder().decode(response.body));
171
+ return typeof parsed.error === 'string' ? parsed.error : undefined;
172
+ }
173
+ catch {
174
+ return undefined;
175
+ }
176
+ }
177
+ export function apiError(method, path, response) {
178
+ const detail = responseDetail(response);
179
+ const suffix = detail ? `: ${detail}` : '';
180
+ if (response.status === 401 || response.status === 403) {
181
+ return new VerifyError('AUTH_REJECTED', `Revyl rejected the request ${method} ${path} (HTTP ${response.status})${suffix}. Check REVYL_API_KEY or run 'revyl auth login'.`);
182
+ }
183
+ return new VerifyError('API_ERROR', `Revyl request ${method} ${path} failed with HTTP ${response.status}${suffix}`);
184
+ }
185
+ function validateBackendUrl(raw) {
186
+ let url;
187
+ try {
188
+ url = new URL(raw);
189
+ }
190
+ catch {
191
+ throw new VerifyError('CONFIG_INVALID', 'REVYL_BACKEND_URL is not a valid URL.');
192
+ }
193
+ const loopback = ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname);
194
+ if (url.protocol !== 'https:' && !(loopback && url.protocol === 'http:')) {
195
+ throw new VerifyError('CONFIG_INVALID', 'REVYL_BACKEND_URL must use HTTPS (plain HTTP is allowed only on loopback).');
196
+ }
197
+ if (url.username || url.password || url.search || url.hash) {
198
+ throw new VerifyError('CONFIG_INVALID', 'REVYL_BACKEND_URL must be an origin without credentials, query, or fragment.');
199
+ }
200
+ return url.origin;
201
+ }