@whoz-oss/coday-web 0.0.0-workstream-setup.2 → 0.0.0-workstream-forge.135
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 +110 -137
- package/index.js +38 -85
- package/package.json +4 -6
- package/launcher.js +0 -69
package/README.md
CHANGED
|
@@ -1,184 +1,157 @@
|
|
|
1
1
|
# Coday Web Package
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
the Express server, and runs AgentOS and the Factory next to them.
|
|
3
|
+
This package provides the web interface launcher for Coday, bundling both the client (Angular app) and server components into a single executable package.
|
|
5
4
|
|
|
6
|
-
##
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
The web package acts as a thin orchestration layer:
|
|
7
8
|
|
|
8
|
-
```bash
|
|
9
|
-
npx @whoz-oss/coday-web
|
|
10
9
|
```
|
|
10
|
+
┌─────────────────────────────────────────┐
|
|
11
|
+
│ coday-web (index.js) │
|
|
12
|
+
│ ┌───────────────────────────────────┐ │
|
|
13
|
+
│ │ 1. Resolve client package path │ │
|
|
14
|
+
│ │ 2. Set CODAY_CLIENT_PATH env var │ │
|
|
15
|
+
│ │ 3. Import and run server │ │
|
|
16
|
+
│ └───────────────────────────────────┘ │
|
|
17
|
+
└─────────────────────────────────────────┘
|
|
18
|
+
│
|
|
19
|
+
┌───────────┴───────────┐
|
|
20
|
+
▼ ▼
|
|
21
|
+
┌──────────────┐ ┌──────────────┐
|
|
22
|
+
│ coday-server │ │ coday-client │
|
|
23
|
+
│ (Express) │───────▶│ (Angular) │
|
|
24
|
+
└──────────────┘ └──────────────┘
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage Modes
|
|
11
28
|
|
|
12
|
-
|
|
29
|
+
### Production Mode (Published Package)
|
|
13
30
|
|
|
14
|
-
|
|
15
|
-
the background as soon as the page is open.
|
|
16
|
-
2. **Providers.** Anthropic, OpenAI and/or Requesty, each with an API key. With several, drag the cards (or use the
|
|
17
|
-
arrows) to rank them: rank 1 is preferred. At least one is required.
|
|
18
|
-
3. **Files folder.** Pick the folder your agent reads and writes (default `~/Coday`, created when missing).
|
|
19
|
-
4. **Checklist.** Download %, Java, AgentOS, providers, models, your personal namespace, the Coday agent, then
|
|
20
|
-
**Start with Coday**.
|
|
31
|
+
Use the published npm package via npx:
|
|
21
32
|
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
```bash
|
|
34
|
+
# Using the published package
|
|
35
|
+
pnpm web
|
|
36
|
+
|
|
37
|
+
# Or directly with npx
|
|
38
|
+
npx @whoz-oss/coday-web --no_auth
|
|
39
|
+
```
|
|
24
40
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
In production mode:
|
|
42
|
+
- The web launcher resolves the client package from node_modules
|
|
43
|
+
- Server serves pre-built static files from the client package
|
|
44
|
+
- Single process handles both server and client
|
|
29
45
|
|
|
30
|
-
|
|
31
|
-
otherwise the app opens directly.
|
|
46
|
+
### Development Mode (Local Sources)
|
|
32
47
|
|
|
33
|
-
|
|
48
|
+
For development with live reload and local sources:
|
|
34
49
|
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
coday-web (index.js) coday-web (index.js)
|
|
39
|
-
└─ 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)
|
|
50
|
+
```bash
|
|
51
|
+
# Start both client and server in development mode
|
|
52
|
+
pnpm web:dev
|
|
44
53
|
```
|
|
45
54
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
- **Managed mode** (no TTY, `--managed`, or `CODAY_NO_NX=1`). Same code, one process, no Nx. The desktop apps spawn
|
|
52
|
-
`coday-web` without a terminal and keep working unchanged.
|
|
55
|
+
This command:
|
|
56
|
+
- Starts the Angular dev server on port 4200 (with HMR)
|
|
57
|
+
- Starts the Express server on port 4100 (with tsx watch)
|
|
58
|
+
- Server proxies non-API requests to Angular dev server
|
|
59
|
+
- Changes to client or server code trigger automatic reloads
|
|
53
60
|
|
|
54
|
-
|
|
55
|
-
|
|
61
|
+
**How it works in dev mode:**
|
|
62
|
+
1. Client runs with Angular CLI dev server (localhost:4200)
|
|
63
|
+
2. Server runs with tsx watch (localhost:4100)
|
|
64
|
+
3. Server detects `BUILD_ENV=development` and proxies to Angular
|
|
65
|
+
4. API routes (e.g., `/api/*`) are handled by the server
|
|
66
|
+
5. All other routes are proxied to Angular for client-side routing
|
|
56
67
|
|
|
57
|
-
|
|
68
|
+
## Development Workflow
|
|
58
69
|
|
|
59
|
-
|
|
70
|
+
### Running Individual Services
|
|
60
71
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
You can also run services separately for debugging:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Run only the client (Angular dev server)
|
|
76
|
+
pnpm client
|
|
77
|
+
|
|
78
|
+
# Run only the server (Express with tsx watch)
|
|
79
|
+
pnpm server
|
|
65
80
|
```
|
|
66
81
|
|
|
67
|
-
|
|
82
|
+
### Building for Production
|
|
68
83
|
|
|
69
|
-
|
|
84
|
+
The web package depends on built client and server packages:
|
|
70
85
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
`<configDir>/runtime/secrets.json` (mode `0600`). An install that already holds unencrypted data keeps `NONE` for that
|
|
75
|
-
service and logs a warning (encrypting existing data is a manual migration).
|
|
86
|
+
```bash
|
|
87
|
+
# Build all packages
|
|
88
|
+
pnpm nx run-many --target=build --projects=client,server,web
|
|
76
89
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
90
|
+
# Or build everything
|
|
91
|
+
pnpm nx run-many --target=build --all
|
|
92
|
+
```
|
|
80
93
|
|
|
81
|
-
|
|
94
|
+
### Testing Changes
|
|
82
95
|
|
|
83
|
-
|
|
84
|
-
|---|---|
|
|
85
|
-
| `--configDir <dir>` | Config directory (default `~/.coday`) |
|
|
86
|
-
| `--host <addr>` / `CODAY_HOST` | Interface Express listens on (default `127.0.0.1`; `0.0.0.0` with `--auth`) |
|
|
87
|
-
| `--managed` / `CODAY_NO_NX=1` | Force the single-process mode (no Nx) |
|
|
88
|
-
| `PORT` | Express port (strict when set; default 3000, 4100 in dev) |
|
|
89
|
-
| `AGENTOS_URL`, `FACTORY_URL` | Use an external AgentOS / Factory instead of managed ones |
|
|
90
|
-
| `AGENTOS_EXTERNAL_USERID` | Impose the identity forwarded to AgentOS (disables the wizard) |
|
|
91
|
-
| `CODAY_AGENTOS_VERSION`, `CODAY_FACTORY_VERSION` | JAR version to run (`dev` = JARs placed by hand in `<configDir>/{agentos,factory}`) |
|
|
92
|
-
| `CODAY_DEFAULT_FILES_DIR` | Folder proposed by the wizard instead of `~/Coday` |
|
|
93
|
-
| `CODAY_CLIENT_PATH`, `CODAY_FACTORY_COCKPIT_PATH` | Set by the launcher: where the static apps are |
|
|
94
|
-
| `BUILD_ENV=development` | Dev mode (proxy to the Angular dev servers) |
|
|
96
|
+
When making changes to the web launcher:
|
|
95
97
|
|
|
96
|
-
|
|
98
|
+
1. Modify `apps/web/index.js`
|
|
99
|
+
2. Test with local server: `node apps/web/index.js --no_auth`
|
|
100
|
+
3. Verify client resolution works correctly
|
|
101
|
+
4. Check that server starts and serves the client
|
|
97
102
|
|
|
98
|
-
|
|
99
|
-
is:
|
|
103
|
+
## Environment Variables
|
|
100
104
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
pnpm nx run web:local -- --managed # single process, plain console (instead of the Nx TUI)
|
|
105
|
-
pnpm nx run web:local -- --port 3100 # pick the port
|
|
106
|
-
```
|
|
105
|
+
- `CODAY_CLIENT_PATH`: Set by the web launcher to tell server where client files are
|
|
106
|
+
- `BUILD_ENV`: Set to `development` by server's serve target for dev mode
|
|
107
|
+
- `PORT`: Override default server port (default: 3000 production, 4100 dev)
|
|
107
108
|
|
|
108
|
-
|
|
109
|
-
rebuild and restart as often as you like. The target builds the client, factory cockpit, server and web packages plus
|
|
110
|
-
the AgentOS and Factory boot JARs, then `scripts/web-local.ts` works in a **persistent root, `~/.coday-local`**:
|
|
109
|
+
## Package Dependencies
|
|
111
110
|
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
files/Coday folder proposed by the wizard instead of ~/Coday
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"@whoz-oss/coday-client": "workspace:*",
|
|
114
|
+
"@whoz-oss/coday-server": "workspace:*"
|
|
115
|
+
}
|
|
118
116
|
```
|
|
119
117
|
|
|
120
|
-
|
|
121
|
-
`config/{agentos,factory}` (`agentos-service-dev.jar`, plugins in `plugins/`; the data directories are left alone) and
|
|
122
|
-
runs the installed `coday-web --configDir ~/.coday-local/config` with `CODAY_AGENTOS_VERSION=dev
|
|
123
|
-
CODAY_FACTORY_VERSION=dev`. It prints every path and whether this is a **first run** (no `setupDone` in
|
|
124
|
-
`web-setup.json`) or a **resume**. Your `~/.coday` and `~/Coday` are never touched (the script refuses a root that is, or
|
|
125
|
-
lies in, them, your home or the repository), and nothing is published.
|
|
118
|
+
These use workspace protocol in development and resolve to specific versions when published.
|
|
126
119
|
|
|
127
|
-
|
|
128
|
-
|---|---|
|
|
129
|
-
| `--fresh` | Delete `config/` and `files/` (printed) before starting: a brand-new first run |
|
|
130
|
-
| `--managed`, `--port <n>` | Single-process mode, Express port |
|
|
131
|
-
| `--prepare-only` | Prepare everything, print the paths as JSON on the last line, no server |
|
|
132
|
-
| `--clean` | Delete the **whole** root when the server stops (setup and data included) |
|
|
133
|
-
| `CODAY_LOCAL_DIR=<dir>` | Use another root than `~/.coday-local` (`CODAY_FIRST_RUN_DIR` is a deprecated alias) |
|
|
134
|
-
|
|
135
|
-
`web:first-run` is kept as an alias of `web:local -- --fresh`.
|
|
120
|
+
## Troubleshooting
|
|
136
121
|
|
|
137
|
-
|
|
138
|
-
(dummy keys, no LLM call) and checks the providers, models, personal namespace, Coday agent and shared folder through
|
|
139
|
-
the AgentOS REST API. It runs `web:local --fresh` on its own throwaway root (`FIRST_RUN_E2E_DIR` to choose it, it never
|
|
140
|
-
reads `CODAY_LOCAL_DIR`) and skips itself, with a reason, when Java 25 or the built JARs are missing.
|
|
122
|
+
### "Could not resolve @whoz-oss/coday-client package"
|
|
141
123
|
|
|
142
|
-
|
|
124
|
+
This means the client package isn't built or installed:
|
|
143
125
|
|
|
144
126
|
```bash
|
|
145
|
-
|
|
146
|
-
pnpm
|
|
147
|
-
pnpm
|
|
148
|
-
|
|
127
|
+
# In development
|
|
128
|
+
pnpm install
|
|
129
|
+
pnpm nx run client:build
|
|
130
|
+
|
|
131
|
+
# Or use the web:dev command which doesn't require builds
|
|
132
|
+
pnpm web:dev
|
|
149
133
|
```
|
|
150
134
|
|
|
151
|
-
|
|
152
|
-
`web:dev-server` (Express, 4100), `web:dev-agentos` (`agentos-service:bootRun`, 8124) and `web:dev-factory`
|
|
153
|
-
(`factory-service:bootRun`, 8141). The dev server uses the external-service mode (`AGENTOS_URL`/`FACTORY_URL`), so the
|
|
154
|
-
wizard is not shown: use `web:local -- --fresh` to test it.
|
|
135
|
+
### "Failed to start server"
|
|
155
136
|
|
|
156
|
-
|
|
137
|
+
Check that all dependencies are installed:
|
|
157
138
|
|
|
158
139
|
```bash
|
|
159
|
-
pnpm
|
|
160
|
-
pnpm nx run-many -t lint test -p server,web,client,agentos-ui,scripts
|
|
140
|
+
pnpm install
|
|
161
141
|
```
|
|
162
142
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
```json
|
|
166
|
-
{
|
|
167
|
-
"@whoz-oss/coday-client": "workspace:*",
|
|
168
|
-
"@whoz-oss/coday-factory-cockpit": "workspace:*",
|
|
169
|
-
"@whoz-oss/coday-server": "workspace:*",
|
|
170
|
-
"nx": "catalog:dev"
|
|
171
|
-
}
|
|
172
|
-
```
|
|
143
|
+
### Development mode not proxying correctly
|
|
173
144
|
|
|
174
|
-
|
|
175
|
-
|
|
145
|
+
Ensure both services are running:
|
|
146
|
+
1. Angular dev server should be on port 4200
|
|
147
|
+
2. Express server should be on port 4100
|
|
148
|
+
3. Access the app via http://localhost:4100
|
|
176
149
|
|
|
177
|
-
##
|
|
150
|
+
## Quick Reference
|
|
178
151
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
152
|
+
| Command | Mode | Ports | Use Case |
|
|
153
|
+
|---------|------|-------|----------|
|
|
154
|
+
| `pnpm web` | Production | 3000 | Testing published package |
|
|
155
|
+
| `pnpm web:dev` | Development | 4100→4200 | Active development |
|
|
156
|
+
| `pnpm client` | Development | 4200 | Client-only work |
|
|
157
|
+
| `pnpm server` | Development | 4100 | Server-only work |
|
package/index.js
CHANGED
|
@@ -2,30 +2,30 @@
|
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
3
3
|
import { dirname, resolve } from 'path';
|
|
4
4
|
import { existsSync } from 'fs';
|
|
5
|
-
import { spawn, spawnSync } from 'child_process';
|
|
6
5
|
import { createRequire } from 'module';
|
|
7
|
-
import { chooseMode, nxArgs, nxEnv, parseWorkspaceDir, resolveConfigDir, serverArgs } from './launcher.js';
|
|
8
6
|
|
|
9
7
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
8
|
const __dirname = dirname(__filename);
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* Coday Web Launcher
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* 3.
|
|
19
|
-
* exactly like before (it still prints `Server is running on http://localhost:PORT`).
|
|
12
|
+
*
|
|
13
|
+
* This script orchestrates the web interface by:
|
|
14
|
+
* 1. Resolving the client package location at runtime
|
|
15
|
+
* 2. Setting the client path for the server to use
|
|
16
|
+
* 3. Delegating execution to the server package
|
|
20
17
|
*/
|
|
21
18
|
|
|
22
19
|
// Create require function for resolving packages
|
|
23
20
|
const require = createRequire(import.meta.url);
|
|
24
21
|
|
|
25
22
|
/**
|
|
26
|
-
* Resolve
|
|
23
|
+
* Resolve the client package location
|
|
24
|
+
*
|
|
25
|
+
* Tries multiple resolution strategies:
|
|
27
26
|
* 1. Standard node_modules resolution (production/npx)
|
|
28
|
-
* 2.
|
|
27
|
+
* 2. Workspace protocol resolution (development)
|
|
28
|
+
* 3. Relative path fallback (monorepo development)
|
|
29
29
|
*/
|
|
30
30
|
function resolveStaticPackagePath(packageName, developmentPath, displayName) {
|
|
31
31
|
const developmentBrowserPath = resolve(__dirname, developmentPath);
|
|
@@ -65,27 +65,7 @@ function resolveStaticPackagePath(packageName, developmentPath, displayName) {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
try {
|
|
70
|
-
const serverPackagePath = require.resolve('@whoz-oss/coday-server/package.json');
|
|
71
|
-
const packagedServerMainPath = resolve(dirname(serverPackagePath), 'server.js');
|
|
72
|
-
const developmentServerMainPath = resolve(__dirname, '../server/dist/server.js');
|
|
73
|
-
const serverMainPath = existsSync(packagedServerMainPath) ? packagedServerMainPath : developmentServerMainPath;
|
|
74
|
-
if (!existsSync(serverMainPath)) {
|
|
75
|
-
throw new Error(
|
|
76
|
-
`Server entry point is missing. Checked paths: ${packagedServerMainPath}, ${developmentServerMainPath}`
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
return serverMainPath;
|
|
80
|
-
} catch (error) {
|
|
81
|
-
console.error('Could not resolve @whoz-oss/coday-server package.');
|
|
82
|
-
console.error('Please ensure dependencies are installed: pnpm install');
|
|
83
|
-
console.error('Error:', error.message);
|
|
84
|
-
process.exit(1);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Resolve and expose static application paths to the server (and, through env inheritance, to every Nx task).
|
|
68
|
+
// Resolve and expose static application paths to the server.
|
|
89
69
|
const clientPath = resolveStaticPackagePath('@whoz-oss/coday-client', '../client/dist/browser', 'Client');
|
|
90
70
|
const factoryCockpitPath = resolveStaticPackagePath(
|
|
91
71
|
'@whoz-oss/coday-factory-cockpit',
|
|
@@ -98,61 +78,34 @@ process.env.CODAY_FACTORY_COCKPIT_PATH = factoryCockpitPath;
|
|
|
98
78
|
console.log(`Coday Web: Using client files from ${clientPath}`);
|
|
99
79
|
console.log(`Coday Web: Using factory cockpit files from ${factoryCockpitPath}`);
|
|
100
80
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
nxBin = require.resolve('nx/bin/nx.js');
|
|
118
|
-
} catch (error) {
|
|
119
|
-
console.warn(`Nx is not available (${error.message}): falling back to the in-process mode.`);
|
|
120
|
-
return runManaged();
|
|
81
|
+
// Import and run the server
|
|
82
|
+
// The server package exports its main module which starts the server
|
|
83
|
+
try {
|
|
84
|
+
// Try to resolve the server package
|
|
85
|
+
const serverPackagePath = require.resolve('@whoz-oss/coday-server/package.json');
|
|
86
|
+
const serverDir = dirname(serverPackagePath);
|
|
87
|
+
const packagedServerMainPath = resolve(serverDir, 'server.js');
|
|
88
|
+
const developmentServerMainPath = resolve(__dirname, '../server/dist/server.js');
|
|
89
|
+
const serverMainPath = existsSync(packagedServerMainPath)
|
|
90
|
+
? packagedServerMainPath
|
|
91
|
+
: developmentServerMainPath;
|
|
92
|
+
|
|
93
|
+
if (!existsSync(serverMainPath)) {
|
|
94
|
+
throw new Error(
|
|
95
|
+
`Server entry point is missing. Checked paths: ${packagedServerMainPath}, ${developmentServerMainPath}`
|
|
96
|
+
);
|
|
121
97
|
}
|
|
122
|
-
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
});
|
|
129
|
-
const workspaceDir = parseWorkspaceDir(generated.stdout);
|
|
130
|
-
if (generated.status !== 0 || !workspaceDir || !existsSync(workspaceDir)) {
|
|
131
|
-
console.error('Could not generate the runtime workspace; falling back to the in-process mode.');
|
|
132
|
-
return runManaged();
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
console.log(`Coday Web: runtime workspace ${workspaceDir} (logs in ${resolve(configDir, 'logs')})`);
|
|
136
|
-
|
|
137
|
-
// 2. Run the continuous tasks. Nx draws one pane per process, in the terminal.
|
|
138
|
-
const nx = spawn(process.execPath, [nxBin, ...nxArgs()], {
|
|
139
|
-
cwd: workspaceDir,
|
|
140
|
-
env: nxEnv(process.env, configDir),
|
|
141
|
-
stdio: 'inherit',
|
|
142
|
-
});
|
|
143
|
-
for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
|
|
144
|
-
process.on(signal, () => nx.kill(signal));
|
|
145
|
-
}
|
|
146
|
-
nx.on('error', (error) => {
|
|
147
|
-
console.error('Failed to start nx:', error.message);
|
|
98
|
+
|
|
99
|
+
// Import the server module
|
|
100
|
+
// Convert Windows absolute path to file:// URL for ESM import
|
|
101
|
+
const serverModuleURL = pathToFileURL(serverMainPath).href;
|
|
102
|
+
import(serverModuleURL).catch((error) => {
|
|
103
|
+
console.error('Failed to start server:', error);
|
|
148
104
|
process.exit(1);
|
|
149
105
|
});
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
console.log(`Coday Web: ${mode} mode (${reason})`);
|
|
155
|
-
(mode === 'nx' ? Promise.resolve().then(runNx) : runManaged()).catch((error) => {
|
|
156
|
-
console.error('Failed to start server:', error);
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error('Could not resolve @whoz-oss/coday-server package.');
|
|
108
|
+
console.error('Please ensure dependencies are installed: pnpm install');
|
|
109
|
+
console.error('Error:', error.message);
|
|
157
110
|
process.exit(1);
|
|
158
|
-
}
|
|
111
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whoz-oss/coday-web",
|
|
3
|
-
"version": "0.0.0-workstream-
|
|
3
|
+
"version": "0.0.0-workstream-forge.135",
|
|
4
4
|
"repository": "https://github.com/whoz-oss/coday",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"index.js",
|
|
11
|
-
"launcher.js",
|
|
12
11
|
"README.md"
|
|
13
12
|
],
|
|
14
13
|
"dependencies": {
|
|
15
|
-
"
|
|
16
|
-
"@whoz-oss/coday-
|
|
17
|
-
"@whoz-oss/coday-
|
|
18
|
-
"@whoz-oss/coday-server": "0.0.0-workstream-setup.2"
|
|
14
|
+
"@whoz-oss/coday-client": "0.0.0-workstream-forge.135",
|
|
15
|
+
"@whoz-oss/coday-factory-cockpit": "0.0.0-workstream-forge.135",
|
|
16
|
+
"@whoz-oss/coday-server": "0.0.0-workstream-forge.135"
|
|
19
17
|
},
|
|
20
18
|
"publishConfig": {
|
|
21
19
|
"access": "public"
|
package/launcher.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure helpers of the coday-web launcher (no side effects at import time).
|
|
3
|
-
* Tested with `node --test` (see launcher.test.js, run by the `web:test` Nx target).
|
|
4
|
-
*/
|
|
5
|
-
import { homedir } from 'os';
|
|
6
|
-
import { join } from 'path';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Decide how to run: `nx` (generated workspace, one pane per process) or `managed` (everything in the
|
|
10
|
-
* server process, which is what the desktop apps need).
|
|
11
|
-
*
|
|
12
|
-
* managed when: `--managed` flag, `CODAY_NO_NX=1`, or stdout is not a TTY (desktop apps spawn us
|
|
13
|
-
* without one, and the Nx TUI needs a terminal anyway).
|
|
14
|
-
*/
|
|
15
|
-
export function chooseMode({ argv, env, isTTY }) {
|
|
16
|
-
if (argv.includes('--managed')) return { mode: 'managed', reason: '--managed flag' };
|
|
17
|
-
if (env.CODAY_NO_NX === '1' || env.CODAY_NO_NX === 'true') return { mode: 'managed', reason: 'CODAY_NO_NX is set' };
|
|
18
|
-
if (!isTTY) return { mode: 'managed', reason: 'no TTY (desktop app, CI, pipe)' };
|
|
19
|
-
return { mode: 'nx', reason: 'interactive terminal' };
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** `--configDir <dir>` / `--configDir=<dir>` / `--coday_config_dir ...`, default `~/.coday`. */
|
|
23
|
-
export function resolveConfigDir(argv, home = homedir()) {
|
|
24
|
-
for (let i = 0; i < argv.length; i++) {
|
|
25
|
-
const arg = argv[i];
|
|
26
|
-
for (const flag of ['--configDir', '--coday_config_dir']) {
|
|
27
|
-
if (arg === flag && argv[i + 1]) return argv[i + 1];
|
|
28
|
-
if (arg.startsWith(`${flag}=`)) return arg.slice(flag.length + 1);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return join(home, '.coday');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/** The arguments the server must see: the launcher's own (`--managed`) are removed. */
|
|
35
|
-
export function serverArgs(argv) {
|
|
36
|
-
return argv.filter((a) => a !== '--managed');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** Marker the server's `workspace` command prints before the directory it generated. */
|
|
40
|
-
export const WORKSPACE_MARKER = 'CODAY_RUNTIME_WORKSPACE=';
|
|
41
|
-
|
|
42
|
-
/** The generated workspace directory, found among any other stdout lines; undefined when absent. */
|
|
43
|
-
export function parseWorkspaceDir(stdout) {
|
|
44
|
-
const line = String(stdout ?? '')
|
|
45
|
-
.split('\n')
|
|
46
|
-
.map((l) => l.trim())
|
|
47
|
-
.reverse()
|
|
48
|
-
.find((l) => l.startsWith(WORKSPACE_MARKER));
|
|
49
|
-
const dir = line?.slice(WORKSPACE_MARKER.length).trim();
|
|
50
|
-
return dir || undefined;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** Arguments of `nx run-many` for the three continuous tasks (each gets its own TUI pane). */
|
|
54
|
-
export function nxArgs() {
|
|
55
|
-
return ['run-many', '-t', 'server', 'agentos', 'factory', '-p', 'coday', '--parallel=5', '--outputStyle=tui'];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** Environment of the Nx process: no daemon, no cloud, no cache. */
|
|
59
|
-
export function nxEnv(env, configDir) {
|
|
60
|
-
return {
|
|
61
|
-
...env,
|
|
62
|
-
NX_DAEMON: 'false',
|
|
63
|
-
NX_NO_CLOUD: 'true',
|
|
64
|
-
NX_SKIP_NX_CACHE: 'true',
|
|
65
|
-
NX_TUI: 'true',
|
|
66
|
-
NX_WORKSPACE_DATA_DIRECTORY: join(configDir, 'runtime', '.nx'),
|
|
67
|
-
NX_CACHE_DIRECTORY: join(configDir, 'runtime', '.nx', 'cache'),
|
|
68
|
-
};
|
|
69
|
-
}
|