@whoz-oss/coday-web 0.0.0-workstream-setup.2 → 0.0.0-workstream-setup.3

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 (3) hide show
  1. package/README.md +45 -10
  2. package/launcher.js +8 -2
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -9,7 +9,13 @@ the Express server, and runs AgentOS and the Factory next to them.
9
9
  npx @whoz-oss/coday-web
10
10
  ```
11
11
 
12
- The first time, the browser opens on **`/welcome`** (`http://localhost:3000/welcome`), a four-step wizard:
12
+ In a terminal (Nx mode, see below) the browser opens by itself. On a **first run** it opens the wizard immediately,
13
+ on **`/welcome`** (`http://localhost:3000/welcome`): the wizard only talks to Coday's own server, so it does not wait
14
+ for AgentOS. Otherwise (setup done) it opens `/` **once AgentOS is healthy**, because the app calls AgentOS straight
15
+ away and would show a blank page until then; if AgentOS never becomes healthy (about 3 minutes: Java missing,
16
+ download failed...) nothing is opened and the `server` pane prints the URL to open yourself. Pass `--no-open` or set
17
+ `CODAY_NO_OPEN=1` to keep it closed. Without a terminal (`--managed`, desktop apps) nothing is opened: open the URL
18
+ printed as `Server is running on http://localhost:PORT` yourself. The wizard is a four-step flow:
13
19
 
14
20
  1. **Your email.** It becomes your user ID and the AgentOS administrator. AgentOS and Factory JARs start downloading in
15
21
  the background as soon as the page is open.
@@ -37,22 +43,43 @@ otherwise the app opens directly.
37
43
  ──────────────────── ───────────────────────────────────
38
44
  coday-web (index.js) coday-web (index.js)
39
45
  └─ writes <configDir>/runtime/{nx,project}.json
40
- └─ nx run-many -t server agentos factory └─ one process: Express + AgentOS + Factory
41
- provision ─┬─ server (pane 1) (what the desktop apps use; prints
42
- ├─ agentos (pane 2) `Server is running on http://localhost:PORT`)
43
- └─ factory (pane 3)
46
+ └─ nx run coday:status └─ one process: Express + AgentOS + Factory
47
+ provision ─┬─ status (entry task) (what the desktop apps use; prints
48
+ │ ├─ server (pinned next `Server is running on http://localhost:PORT`)
49
+ │ │ to status,
50
+ │ │ opens the browser)
51
+ │ ├─ agentos (own pane)
52
+ │ └─ factory (own pane)
44
53
  ```
45
54
 
46
55
  - **Nx mode** (default in a terminal). The launcher generates a tiny Nx workspace under `<configDir>/runtime/`
47
56
  (no daemon, no cloud, no cache) and runs the bundled `nx`. `provision` is a quick task (profile, secrets, Java check,
48
- ports → `runtime/state.json`); `server`, `agentos` and `factory` are continuous tasks, each with its own pane. `agentos`
49
- prints *Waiting for first-run setup → http://localhost:3000/welcome* until you gave your email; `factory` waits for
50
- AgentOS to be healthy.
57
+ ports → `runtime/state.json`); `status`, `server`, `agentos` and `factory` are continuous tasks, each with its own
58
+ pane. The launcher runs ONE target, `nx run coday:status`, and `status` depends on the three services, so Nx starts
59
+ them for it. `agentos` prints *Waiting for first-run setup → http://localhost:3000/welcome* until you gave your email;
60
+ `factory` waits for AgentOS to be healthy. Once Express listens, the `server` task opens the browser (see
61
+ *First run* for when); it never does when `--auth`, a non-loopback `--host`, `CI`, `--no-open` or `CODAY_NO_OPEN` say
62
+ so. The wait for AgentOS runs beside the server and never delays it or its shutdown. For an external AgentOS
63
+ (`AGENTOS_URL`) it probes that URL's `/management/health`, which is what the proxy targets.
64
+ - **The `status` pane.** The Nx TUI has no status bar, so a small dedicated task reads `runtime/state.json` and probes
65
+ the health URLs every second. It prints one line per meaningful change only: `agentos download 42%` (one line per
66
+ 10%), `java ok` or the install hint, `agentos healthy :8124`, `factory healthy :8141`, `agentos external <origin>`
67
+ for an `AGENTOS_URL`/`FACTORY_URL`, and `Open -> http://localhost:3000/welcome` on a first run (`/` once the setup is
68
+ done; then the line says `(once agentos is healthy)` and is repeated without that note when it is: same rule as
69
+ the browser). In the
70
+ TUI, select a pane and pin it next to another one to keep the download and the URL on screen while you read the
71
+ logs of the others; press `?` for the key help of the Nx TUI. At startup `status` is pinned next to `server`: Nx
72
+ pins the initiating task and its first continuous dependency, but only for a single-target run (`nx run`), which is
73
+ why the launcher does not use `run-many`. That behaviour was derived from reading the Nx 23 sources (the native
74
+ TUI rendering of pinned panes could not be inspected): confirm it visually.
75
+ Because `status` depends on the services, none of them may exit while it runs (Nx would report an exited
76
+ dependency as crashed, and a failed one would skip `status`): a service that cannot start (no Java, download
77
+ failed, port taken) or that is external (`AGENTOS_URL`/`FACTORY_URL`) prints why and stays open until Ctrl+C.
51
78
  - **Managed mode** (no TTY, `--managed`, or `CODAY_NO_NX=1`). Same code, one process, no Nx. The desktop apps spawn
52
79
  `coday-web` without a terminal and keep working unchanged.
53
80
 
54
81
  All the logic lives in the server package (`apps/server/src/lib/runtime`, `lib/setup`); the Nx workspace is only a
55
- manifest calling `coday-server provision|agentos|factory|server`.
82
+ manifest calling `coday-server provision|agentos|factory|server|status`.
56
83
 
57
84
  ### Logs
58
85
 
@@ -85,6 +112,7 @@ existing installs without a wizard identity keep their previous behaviour: no wi
85
112
  | `--configDir <dir>` | Config directory (default `~/.coday`) |
86
113
  | `--host <addr>` / `CODAY_HOST` | Interface Express listens on (default `127.0.0.1`; `0.0.0.0` with `--auth`) |
87
114
  | `--managed` / `CODAY_NO_NX=1` | Force the single-process mode (no Nx) |
115
+ | `--no-open` / `CODAY_NO_OPEN=1` | Do not open the browser on start (only Nx mode opens it; never with `--auth`, a non-loopback host or `CI`) |
88
116
  | `PORT` | Express port (strict when set; default 3000, 4100 in dev) |
89
117
  | `AGENTOS_URL`, `FACTORY_URL` | Use an external AgentOS / Factory instead of managed ones |
90
118
  | `AGENTOS_EXTERNAL_USERID` | Impose the identity forwarded to AgentOS (disables the wizard) |
@@ -102,6 +130,7 @@ is:
102
130
  pnpm nx run web:local # everyday: build local code, run it like an npx user, keeps your setup
103
131
  pnpm nx run web:local -- --fresh # test the first-run wizard again (deletes the local config first)
104
132
  pnpm nx run web:local -- --managed # single process, plain console (instead of the Nx TUI)
133
+ pnpm nx run web:local -- --no-open # do not open the browser (every restart would otherwise open a tab)
105
134
  pnpm nx run web:local -- --port 3100 # pick the port
106
135
  ```
107
136
 
@@ -128,6 +157,7 @@ lies in, them, your home or the repository), and nothing is published.
128
157
  |---|---|
129
158
  | `--fresh` | Delete `config/` and `files/` (printed) before starting: a brand-new first run |
130
159
  | `--managed`, `--port <n>` | Single-process mode, Express port |
160
+ | `--no-open` | Do not open the browser (also `CODAY_NO_OPEN=1`) |
131
161
  | `--prepare-only` | Prepare everything, print the paths as JSON on the last line, no server |
132
162
  | `--clean` | Delete the **whole** root when the server stops (setup and data included) |
133
163
  | `CODAY_LOCAL_DIR=<dir>` | Use another root than `~/.coday-local` (`CODAY_FIRST_RUN_DIR` is a deprecated alias) |
@@ -179,6 +209,11 @@ than the former thin launcher. Versions of the `platform:npm` packages move in l
179
209
  - **"Could not resolve @whoz-oss/coday-client package"**: the client is not built or installed. `pnpm install` and
180
210
  `pnpm nx run client:build`, or use `pnpm web:serve:dev`.
181
211
  - **The Nx panes do not show / garbled output**: use `--managed` (or `CODAY_NO_NX=1`) for plain console output.
182
- - **"Waiting for first-run setup" never ends**: open the URL printed in the pane and answer the wizard.
212
+ - **"Waiting for first-run setup" never ends**: open the URL printed in the pane (or the `Open ->` line of the `status`
213
+ pane) and answer the wizard.
214
+ - **The browser did not open**: headless Linux or no `xdg-open`, or AgentOS is not healthy yet (the app is only opened
215
+ once it is); the `server` pane logs one line and the `status` pane shows the URL.
216
+ - **A blank page on `/`**: AgentOS is not up yet (the app waits up to 90 s for it). Look at the `agentos` pane / log,
217
+ Java 25 is the usual cause.
183
218
  - **Java missing or too old**: install Java 25 (the wizard shows the command), the page continues by itself.
184
219
  - **Port already in use**: `PORT=3100 npx @whoz-oss/coday-web`.
package/launcher.js CHANGED
@@ -50,9 +50,15 @@ export function parseWorkspaceDir(stdout) {
50
50
  return dir || undefined;
51
51
  }
52
52
 
53
- /** Arguments of `nx run-many` for the three continuous tasks (each gets its own TUI pane). */
53
+ /**
54
+ * Arguments of `nx run`: ONE target, `coday:status`, whose continuous dependencies are the server, AgentOS and the
55
+ * Factory (each gets its own TUI pane). A single-target run makes the Nx TUI pin the initiating task (`status`) and
56
+ * its first continuous dependency (`server`) at startup; `run-many` pins nothing. The target names are those of
57
+ * NX_ENTRY_TASK / NX_SERVICES in apps/server/src/lib/runtime/workspace.ts (a server spec checks they match).
58
+ * `--parallel` only caps discrete tasks (`provision`): continuous tasks have their own threads.
59
+ */
54
60
  export function nxArgs() {
55
- return ['run-many', '-t', 'server', 'agentos', 'factory', '-p', 'coday', '--parallel=5', '--outputStyle=tui'];
61
+ return ['run', 'coday:status', '--parallel=5', '--outputStyle=tui'];
56
62
  }
57
63
 
58
64
  /** Environment of the Nx process: no daemon, no cloud, no cache. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whoz-oss/coday-web",
3
- "version": "0.0.0-workstream-setup.2",
3
+ "version": "0.0.0-workstream-setup.3",
4
4
  "repository": "https://github.com/whoz-oss/coday",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,9 +13,9 @@
13
13
  ],
14
14
  "dependencies": {
15
15
  "nx": "23.1.1",
16
- "@whoz-oss/coday-client": "0.0.0-workstream-setup.2",
17
- "@whoz-oss/coday-factory-cockpit": "0.0.0-workstream-setup.2",
18
- "@whoz-oss/coday-server": "0.0.0-workstream-setup.2"
16
+ "@whoz-oss/coday-factory-cockpit": "0.0.0-workstream-setup.3",
17
+ "@whoz-oss/coday-client": "0.0.0-workstream-setup.3",
18
+ "@whoz-oss/coday-server": "0.0.0-workstream-setup.3"
19
19
  },
20
20
  "publishConfig": {
21
21
  "access": "public"