@whoz-oss/coday-web 0.0.0-workstream-forge.188 → 0.0.0-workstream-forge.191

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 (2) hide show
  1. package/README.md +119 -18
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -83,7 +83,7 @@ Haiku 5.5 is priced at its base tier (prompts up to 100k tokens).
83
83
  AgentOS (`AGENTOS_URL`) / Factory (`FACTORY_URL`) the setup API probes those URLs, which is what the proxy targets.
84
84
  - **The `status` pane.** The Nx TUI has no status bar, so a small dedicated task reads `runtime/state.json` and probes
85
85
  the health URLs every second. It prints one line per meaningful change only: `agentos download 42%` (one line per
86
- 10%), `java ok` or the install hint, `agentos healthy :8224`, `factory healthy :8241`, `agentos external <origin>`
86
+ 10%), `java ok` or the install hint, `agentos healthy :3005`, `factory healthy :3006`, `agentos external <origin>`
87
87
  for an `AGENTOS_URL`/`FACTORY_URL`, and `Open -> http://localhost:3000/welcome` (the same line whatever the profile and
88
88
  the setup state, same URL as the browser). In the
89
89
  TUI, select a pane and pin it next to another one to keep the download and the URL on screen while you read the
@@ -102,14 +102,110 @@ manifest calling `coday-server provision|agentos|factory|server|status`.
102
102
 
103
103
  ### Ports
104
104
 
105
- The packaged stack prefers its own ports: **AgentOS 8224, Factory 8241, AgentOS embedded Neo4j Bolt 7788** (each falls
106
- back to the next free port, the choice is written to `runtime/state.json`). The dev ports **8124 (AgentOS), 8141
107
- (Factory) and 7688 (Bolt) are reserved for dev mode** (`pnpm web:serve:dev`, `bootRun`), so a packaged instance and a
108
- dev stack run side by side without colliding or picking up each other's services.
105
+ #### Which address do I open?
109
106
 
110
- `web:local` has its own preferred ports too: **AgentOS 8324, Factory 8341, Bolt 7888** (Express 3001), so it runs next
111
- to an `npx` / `coday-web` instance (8224 / 8241 / 7788, Express 3000) without ever taking its ports. They are only
112
- preferences (`CODAY_AGENTOS_PORT`, `CODAY_FACTORY_PORT`, `CODAY_AGENTOS_BOLT_PORT`): a taken port falls back to the next free one.
107
+ | You started Coday with | Open |
108
+ |---|---|
109
+ | `npx @whoz-oss/coday-web` or `coday-web` | **http://localhost:3000** |
110
+ | `pnpm nx run web:local` (monorepo) | **http://localhost:3010** |
111
+ | `pnpm web:serve:dev`, `pnpm web:dev`, `pnpm server`, `scripts/web-dev-tmux.sh` (monorepo) | **http://localhost:4000** |
112
+ | The desktop app | nothing: the app opens its own window |
113
+
114
+ That is the only address you ever need. The Factory cockpit is on the same address, under `/factory/` (for example
115
+ http://localhost:3000/factory/). Every other port is internal: Coday uses it, you never type it.
116
+
117
+ If the terminal says Coday started on another address (for example `Coday starts on block 3020:
118
+ http://localhost:3020/`), a port was already taken by another program: open the address it prints. Nothing needs to be
119
+ stopped or disabled. See *When a port is taken* below.
120
+
121
+ Every start prints the addresses, for example:
122
+
123
+ ```
124
+ Coday http://localhost:3010/
125
+ Cockpit http://localhost:3010/factory/
126
+ Internal AgentOS 3015 · Factory 3016 · Neo4j Bolt 3017
127
+ ```
128
+
129
+ #### How the numbers are built
130
+
131
+ Each way of running Coday (a **profile**) owns a **block** of ten ports starting at its **base**. Inside a block, every
132
+ service always has the same position (offset):
133
+
134
+ | Offset | Service | Who uses it |
135
+ |---|---|---|
136
+ | +0 | Express | **you**: the address you open |
137
+ | +1 | Angular client dev server | dev only, internal (packaged Coday serves the client from Express at `/`) |
138
+ | +2 | Factory cockpit dev server | dev only, internal (packaged Coday serves it from Express at `/factory/`) |
139
+ | +3, +4 | spare | |
140
+ | +5 | AgentOS | internal |
141
+ | +6 | Factory | internal |
142
+ | +7 | AgentOS embedded Neo4j (Bolt) | internal |
143
+ | +8, +9 | spare | |
144
+
145
+ So the full table is:
146
+
147
+ | Profile | Base | Express (open this) | Client | Cockpit | AgentOS | Factory | Bolt |
148
+ |---|---|---|---|---|---|---|---|
149
+ | **prod**: npx, `coday-web`, desktop | 3000 | **3000** | 3000 `/` | 3000 `/factory/` | 3005 | 3006 | 3007 |
150
+ | **local**: `web:local` | 3010 | **3010** | 3010 `/` | 3010 `/factory/` | 3015 | 3016 | 3017 |
151
+ | **dev**: monorepo dev commands | 4000 | **4000** | 4001 | 4002 | 4005 | 4006 | 4007 |
152
+
153
+ Easy to remember: **3xxx is packaged Coday, 4xxx is development.** In dev, 4001 and 4002 are the Angular dev servers
154
+ (with hot reload). Express on 4000 forwards to them, so open 4000, not 4001.
155
+
156
+ #### When a port is taken
157
+
158
+ Coday never asks you to stop or disable anything.
159
+
160
+ - **npx, `coday-web` and `web:local`**: if any port of the block is taken, the **whole stack** moves to the next free
161
+ block of its profile and prints the new address once:
162
+ `Port 3000 is in use (by node, pid 4242), Coday starts on block 3020: http://localhost:3020/`.
163
+ - prod tries 3000, 3020, 3040 … up to 3980;
164
+ - local tries 3010, 3030, 3050 … up to 3990;
165
+ - the two never land on the same block, so a `coday-web` and a `web:local` always run side by side.
166
+
167
+ The block chosen is remembered (`runtime/state.json`, `portBlock`) and tried first at the next start, so the address
168
+ stays the same from one start to the next as long as it is free.
169
+ - **`scripts/web-dev-tmux.sh`**: takes the first free block among 4000, 4010, 4020 … so several worktrees run side by
170
+ side.
171
+ - **`pnpm web:serve:dev`**: its ports are written in Nx and Angular config files, which cannot follow a move. It stops
172
+ at once with a message naming the port and the program holding it. Stop that program, or use the tmux script.
173
+
174
+ #### Choosing the ports yourself
175
+
176
+ An explicit choice is **strict**: if the port is taken, Coday stops with a message naming the port and, when it can find
177
+ it, the program holding it, instead of moving.
178
+
179
+ | To | Use |
180
+ |---|---|
181
+ | choose the address you open | `--port <n>` or `PORT=<n>` |
182
+ | choose a whole block | `CODAY_PORT_BASE=<n>` (for example a third checkout on 3050) |
183
+ | choose one internal service | `CODAY_AGENTOS_PORT`, `CODAY_FACTORY_PORT`, `CODAY_AGENTOS_BOLT_PORT` |
184
+
185
+ The desktop app always uses port 3049 (a spare port of the prod block 3040), on purpose: the app keeps its saved
186
+ preferences per address, so that address must not change.
187
+
188
+ #### Why not 5000 or 7000?
189
+
190
+ On macOS the AirPlay Receiver listens on ports 5000 and 7000 by default. Coday avoids them so it works on every Mac
191
+ without changing any system setting. If another tool reports one of them as taken, AirPlay is the usual reason (System
192
+ Settings > General > AirDrop & Handoff > AirPlay Receiver).
193
+
194
+ A Java debugger (JDWP) listens on 5005 by default: no Coday port uses it.
195
+
196
+ #### For contributors: where the numbers live
197
+
198
+ All the numbers (block size, offsets, bases) are in **one file**: `apps/server/src/lib/runtime/port-scheme.json`.
199
+ Change them there, nowhere else.
200
+
201
+ - The server runtime (`port-scheme.ts`), `scripts/web-local.ts`, the Playwright config, the Angular dev proxy
202
+ (`apps/client/proxy.conf.mjs`) and `scripts/web-dev-tmux.sh` read that file.
203
+ - A few files cannot read it and repeat the dev values: the `port` of `apps/client/project.json` and
204
+ `apps/factory-cockpit/project.json`, the dev env values of `apps/web/project.json`, and `.idea/runConfigurations`.
205
+ `port-scheme-consistency.spec.ts` checks them against the JSON and fails, naming the file and the expected value, if
206
+ they drift. It also checks that the files that read the JSON contain no port number of their own.
207
+ - Every Coday launcher passes the embedded Neo4j Bolt port explicitly (`AGENTOS_PERSISTENCE_EMBEDDED_BOLT_PORT` and
208
+ `SPRING_NEO4J_URI`): the `7688` default of `application-embedded-neo4j.yml` is not used.
113
209
 
114
210
  ### Logs
115
211
 
@@ -143,8 +239,10 @@ existing installs without a wizard identity keep their previous behaviour: no wi
143
239
  | `--host <addr>` / `CODAY_HOST` | Interface Express listens on (default `127.0.0.1`; `0.0.0.0` with `--auth`) |
144
240
  | `--managed` / `CODAY_NO_NX=1` | Force the single-process mode (no Nx) |
145
241
  | `--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`) |
146
- | `PORT` | Express port (strict when set; default 3000, 4100 in dev) |
147
- | `CODAY_AGENTOS_PORT`, `CODAY_FACTORY_PORT`, `CODAY_AGENTOS_BOLT_PORT` | Preferred ports of the managed AgentOS, Factory and AgentOS Bolt (defaults 8224 / 8241 / 7788; next free port when taken). Set by `web:local` (8324 / 8341 / 7888) |
242
+ | `PORT` | Express port, **strict** when set (default: the first free block of the profile, see *Ports*) |
243
+ | `CODAY_PORT_BASE` | Pin the stack on this port block (**strict**, no block fallback); unset: the profile picks and falls back (see *Ports*) |
244
+ | `CODAY_PORT_PROFILE=prod\|local\|dev` | Profile whose candidate blocks are used (set to `local` by `web:local`); derived from `BUILD_ENV` otherwise. Not an explicit choice: stays non-strict |
245
+ | `CODAY_AGENTOS_PORT`, `CODAY_FACTORY_PORT`, `CODAY_AGENTOS_BOLT_PORT` | Port of the managed AgentOS, Factory and AgentOS Bolt instead of the block's (strict) |
148
246
  | `AGENTOS_URL`, `FACTORY_URL` | Use an external AgentOS / Factory instead of managed ones. A service that is external has no pane in the Nx run (nothing to run); the `status` pane still reports it |
149
247
  | `CODAY_NO_FACTORY=1` | Leave the managed Factory out: no `factory` pane in the Nx run, it is neither downloaded nor started, `/api/factory` is not proxied, and the wizard and the loading page do not mention it. An external `FACTORY_URL` is still used |
150
248
  | `--profile laptop\|managed` / `CODAY_PROFILE` | Force the profile instead of deriving it (the flag wins over the env var). E.g. a dev server (`AGENTOS_URL`) started on the configDir of a running `coday-web` with `--profile laptop` keeps forwarding the wizard identity to that AgentOS. An external AgentOS on an already provisioned configDir never rewrites `runtime/state.json` (ports, progress) in the single-process mode, except for this profile |
@@ -164,7 +262,7 @@ pnpm nx run web:local # everyday: build local code, run it l
164
262
  pnpm nx run web:local -- --fresh # test the first-run wizard again (deletes the local config first)
165
263
  pnpm nx run web:local -- --managed # single process, plain console (instead of the Nx TUI)
166
264
  pnpm nx run web:local -- --no-open # do not open the browser (every restart would otherwise open a tab)
167
- pnpm nx run web:local -- --port 3100 # pick another port (default 3001: 3000 is left to the coday-web package)
265
+ pnpm nx run web:local -- --port 3100 # pin the Express port (strict: taken, the run fails)
168
266
  ```
169
267
 
170
268
  The first time you get the wizard; afterwards the loading page and then the app, on the instance you configured, so you can stop,
@@ -189,11 +287,12 @@ lies in, them, your home or the repository), and nothing is published.
189
287
  | Option / env | Effect |
190
288
  |---|---|
191
289
  | `--fresh` | Delete `config/` and `files/` (printed) before starting: a brand-new first run |
192
- | `--managed`, `--port <n>` | Single-process mode, Express port (default **3001**, taken strictly: the run fails rather than use 3000, which belongs to the `coday-web` package) |
290
+ | `--managed`, `--port <n>` | Single-process mode, Express port (strict when given). Without `--port` the stack takes the first free LOCAL block, 3010 then 3030, 3050... (prod has 3000, 3020...: never the same block) and says which |
193
291
  | `--no-open` | Do not open the browser (also `CODAY_NO_OPEN=1`) |
194
292
  | `--prepare-only` | Prepare everything, print the paths as JSON on the last line, no server |
195
293
  | `--clean` | Delete the **whole** root when the server stops (setup and data included) |
196
294
  | `CODAY_LOCAL_DIR=<dir>` | Use another root than `~/.coday-local` (`CODAY_FIRST_RUN_DIR` is a deprecated alias) |
295
+ | `CODAY_PORT_BASE=<n>` | Pin the stack on this port block (strict: a second checkout side by side, e.g. a block of the 3xxx range your prod and local do not use) |
197
296
 
198
297
  `web:first-run` is kept as an alias of `web:local -- --fresh`.
199
298
 
@@ -207,13 +306,14 @@ reads `CODAY_LOCAL_DIR`) and skips itself, with a reason, when Java 25 or the bu
207
306
  ```bash
208
307
  pnpm web:serve:dev # nx run web:serve:dev: client, factory-cockpit, server, AgentOS and Factory, one pane each
209
308
  pnpm web:dev # lighter: client + server only (no AgentOS/Factory; set AGENTOS_URL to use your own)
210
- pnpm client # Angular dev server only (4200)
211
- pnpm server # Express with tsx watch only (4100)
309
+ pnpm client # Angular dev server only (internal dev port, see Ports)
310
+ pnpm server # Express with tsx watch only (dev base, open this one)
212
311
  ```
213
312
 
214
- `web:serve:dev` is a set of continuous Nx tasks: `client:serve` (4200), `factory-cockpit:serve` (4300),
215
- `web:dev-server` (Express, 4100), `web:dev-agentos` (`agentos-service:bootRun`, 8124) and `web:dev-factory`
216
- (`factory-service:bootRun`, 8141). These are the dev-only ports; the packaged stack uses 8224 / 8241 (see *Ports*). The dev server uses the
313
+ `web:serve:dev` is a set of continuous Nx tasks: `client:serve`, `factory-cockpit:serve`, `web:dev-server` (Express),
314
+ `web:dev-agentos` (`agentos-service:bootRun`, with its embedded Neo4j Bolt) and `web:dev-factory`
315
+ (`factory-service:bootRun`): the DEV row of the *Ports* table (open Express, 4000). They use fixed dev ports and fail
316
+ fast, with a message naming the port, when one is taken. The dev server uses the
217
317
  external-service mode (`AGENTOS_URL`/`FACTORY_URL`), so the wizard is not shown: use `web:local -- --fresh` to test it.
218
318
 
219
319
  ### Building and testing
@@ -251,4 +351,5 @@ than the former thin launcher. Versions of the `platform:npm` packages move in l
251
351
  cause. With an external `AGENTOS_URL`, check that URL answers on `/management/health`. (Opening `/` yourself
252
352
  meanwhile shows a blank page for up to 90 s, the app waits for AgentOS.)
253
353
  - **Java missing or too old**: install Java 25 (the wizard shows the command), the page continues by itself.
254
- - **Port already in use**: `PORT=3100 npx @whoz-oss/coday-web`.
354
+ - **Port already in use**: the packaged stack moves to the next free block by itself and says so; to choose, `PORT=3100
355
+ npx @whoz-oss/coday-web` (strict, see *Ports*).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whoz-oss/coday-web",
3
- "version": "0.0.0-workstream-forge.188",
3
+ "version": "0.0.0-workstream-forge.191",
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-forge.188",
17
- "@whoz-oss/coday-factory-cockpit": "0.0.0-workstream-forge.188",
18
- "@whoz-oss/coday-server": "0.0.0-workstream-forge.188"
16
+ "@whoz-oss/coday-client": "0.0.0-workstream-forge.191",
17
+ "@whoz-oss/coday-factory-cockpit": "0.0.0-workstream-forge.191",
18
+ "@whoz-oss/coday-server": "0.0.0-workstream-forge.191"
19
19
  },
20
20
  "publishConfig": {
21
21
  "access": "public"