@beyondwork/wb-cli 0.1.60 → 0.1.61

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publisher": "beyondwork",
4
4
  "displayName": "Beyond Work",
5
5
  "description": "Tool for interacting with Beyond Work workblocks from VS Code and CLI.",
6
- "version": "0.1.60",
6
+ "version": "0.1.61",
7
7
  "vsce": {
8
8
  "baseContentUrl": "https://github.com/bwllaming/code/blob/HEAD/src/vscode/beyondwork",
9
9
  "baseImagesUrl": "https://github.com/bwllaming/code/raw/HEAD/src/vscode/beyondwork"
@@ -100,8 +100,10 @@ follow the confirmation warning above before sending the API request.
100
100
  A run stops at a task UI. Check the whole run in Studio on the tenant, as a person uses it, to
101
101
  the result: with `wb-cli ui playwright exec <script>` when Playwright and the browser session of wb-cli
102
102
  are there, otherwise in the user's browser through a browser tool. Start the module, use each
103
- UI, press Submit, and look at the screenshots. `references/browser-validation.md` says when the
104
- check is needed and how to choose, and describes both ways and the sign-in.
103
+ UI, press Submit, and look at the screenshots. For a workblock whose main module shows its UI
104
+ without a run, `wb-cli ui` can open its preview page instead, the page that a user of the
105
+ workblock opens; its `ready` line names the page. `references/browser-validation.md` says when
106
+ the check is needed and how to choose, and describes both ways, both pages, and the sign-in.
105
107
  An agent module acts only when someone chats with it. Prove it with `wb-cli chat <module-id> "<what
106
108
  a user would write>"` (`--persona <id>` picks one of its `agent_configs`): the agent loads your pushed branch, and the command prints its reply, each
107
109
  tool it called with the arguments and result, and the conversation id. Follow up with `wb-cli chat
@@ -1,10 +1,14 @@
1
- # Check a workblock in Studio
1
+ # Check a workblock in the browser
2
2
 
3
3
  `wb-cli run` proves Python tasks by their outputs, but a run stops at a task UI. Check the whole run
4
4
  in Studio on the tenant, the page that a person uses: each screen in order, then the result.
5
5
  There, every `bw.*` call of a UI behaves as it does for a person, file uploads included. No other
6
6
  page shows a task UI as Studio does.
7
7
 
8
+ `wb-cli ui` opens the page to check, and its `ready` line names it in `page`: `studio` for the
9
+ workspace in Studio, or `preview` for the preview page of the workblock (below), which a workblock
10
+ whose main module shows its UI without a run, such as an app, can have.
11
+
8
12
  ## When
9
13
 
10
14
  Check in Studio in these cases:
@@ -30,10 +34,39 @@ a signed-in browser of wb-cli.
30
34
 
31
35
  Both browsers act as the user, with all of the user's rights, not only the scopes of wb-cli's token.
32
36
 
37
+ ## The preview page
38
+
39
+ When the `ready` line of `wb-cli ui` has `page` `preview`, wb-cli opens the preview page of the
40
+ workblock's main module at your pushed commit: the page that a user of the workblock gets, with
41
+ the UI and everything that the platform shows around it. Studio shows only the UI, so a control
42
+ around the UI that does not work shows only here.
43
+
44
+ - In a script, `ui` is the UI on screen, and `page` is the whole page. What the platform shows
45
+ around the UI is on `page`, outside `ui`: find it by its role and name, such as
46
+ `page.getByRole("link", { name: "Invoices" })`. Studio's toolbar is not on this page. Open the
47
+ other pages of the workblock as a user does.
48
+ - A click on the page or in the UI can change the route of the page. The page stays at your
49
+ commit. After a new push, open the page again.
50
+ - Before a deploy, this page is also where the user sees your version. To show it to the user,
51
+ give the complete `url` of a `ready` line with `page` `preview` for the commit that you report:
52
+ without its `ref`, the page does not open. Only an editor of the workblock can open it.
53
+ - A version with a draft data model reads its data in its version environment. Until that
54
+ environment exists, the calls of the UI fail. To prepare it, open the workspace in Studio,
55
+ `https://<tenant>/w/studio/s/<workspace_id>` with the `workspace_id` of the `ready` line, and
56
+ press the toolbar button with the test id `start-module`. Studio opens a dialog that prepares
57
+ the environment of the version. When the dialog says that the environment is ready, run the
58
+ `wb-cli ui` command again.
59
+ - The rules of Studio below apply here too. In place of the run controls, use what a user of the
60
+ workblock uses on this page. Keep the data environment that the page opens in.
61
+ - While a run of the workblock is active in the workspace, `wb-cli ui` opens the workspace in
62
+ Studio, which shows the task UIs of the run. To check the preview page again, end the run with
63
+ `wb-cli cancel`.
64
+
33
65
  ## Rules in Studio
34
66
 
35
- - Open only this checkout's workspace, the URL that `wb-cli ui url` prints. Opening it can publish
36
- the conversation to its version branch (SKILL.md, The loop).
67
+ - Open only the page that `wb-cli ui url` prints for this checkout, and its workspace when the
68
+ preview page needs the version environment (above). Opening the workspace can publish the
69
+ conversation to its version branch (SKILL.md, The loop).
37
70
  - Use only what a person who runs the workblock uses: the run controls (`Start <module>`, `Try
38
71
  changes`, `Start specific module`), the controls of each task UI, Submit, the run's result, and
39
72
  the details of a toast.
@@ -43,11 +76,13 @@ Both browsers act as the user, with all of the user's rights, not only the scope
43
76
  ## Check a run
44
77
 
45
78
  1. Push. `wb-cli ui url`, `exec` and `screenshot` each refuse unpushed edits, an unfinished merge,
46
- or a workspace at a different commit, and print the workspace URL in a `ready` line. For the
79
+ or a workspace at a different commit, and print the URL of the page in a `ready` line. For the
47
80
  user's browser, run `wb-cli ui url` and open that URL.
48
81
  2. Start the run, unless a run that you just started with `wb-cli run` waits at a task UI: Studio
49
82
  shows that UI. While an older run waits, Studio shows Stop instead of Start: run
50
- `wb-cli cancel` first. To start the run, use one of these:
83
+ `wb-cli cancel` first. When the `ready` line has `page` `preview`, start the run with
84
+ `wb-cli run`, then run the `wb-cli ui` command again: while the run is active, it opens Studio.
85
+ To start the run, use one of these:
51
86
  - In Studio, press `Start <module>` or `Try changes` in the toolbar, or pick the module under
52
87
  `Start specific module`. If Start opens the "Configure & Run module" form instead of a task
53
88
  UI, stop. The module has inputs, which is a finding against step 3 of the skill, not a form to
@@ -79,8 +114,8 @@ Both browsers act as the user, with all of the user's rights, not only the scope
79
114
  6. When the run ends, run `wb-cli run --wait-for latest` and compare the outputs with the request.
80
115
  When the next task waits at a UI, repeat steps 3 to 5 for it.
81
116
 
82
- A UI-only module has no run. In Studio, pick `Show the UI of <module>` under `Start specific
83
- module`; Studio shows its UI in the same kind of iframe.
117
+ A UI-only module has no run. When the `ready` line has `page` `studio`, pick `Show the UI of
118
+ <module>` under `Start specific module`; Studio shows its UI in the same kind of iframe.
84
119
 
85
120
  In the user's browser, check that `document.visibilityState` is `visible`. A task UI runs in a
86
121
  sandboxed iframe in a process of its own. While the tab is hidden, the clicks and keys that you send
@@ -134,10 +169,12 @@ A script's default export gets these values. Keep the script next to the checkou
134
169
 
135
170
  | Name | What it is |
136
171
  | --- | --- |
137
- | `page` | The Playwright page. It shows the workspace in Studio. |
172
+ | `page` | The Playwright page. It shows the page of the `ready` line. |
138
173
  | `ui` | A frame locator for the task UI on screen: locators inside it reach the UI. |
139
174
  | `context` | The Playwright browser context. |
140
- | `url` | The workspace URL. |
175
+ | `url` | The URL of the page of the `ready` line. |
176
+
177
+ This example drives a run in Studio, so it needs a `ready` line with `page` `studio`.
141
178
 
142
179
  ```js
143
180
  // ../drive.mjs
@@ -186,7 +223,7 @@ Each `wb-cli ui` command prints one JSON object per line.
186
223
 
187
224
  | `event` | Fields | Meaning |
188
225
  | --- | --- | --- |
189
- | `ready` | `url`, `workspace_id`, `commit_ref` | The workspace is at the checkout's commit. |
226
+ | `ready` | `url`, `page`, `workspace_id`, `commit_ref` | The workspace is at the checkout's commit. `page` is `studio` or `preview`: the page that wb-cli opens. |
190
227
  | `console` | `level`, `message` | An error line in the console of Studio or of a task UI. |
191
228
  | `page_error` | `message` | An uncaught error in the page. |
192
229
  | `result` | `value` | What the script returned. |