@colony2/cortex 0.0.5 → 0.0.7
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 +62 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ npm (Node.js 14 or newer and `tar` required):
|
|
|
17
17
|
```sh
|
|
18
18
|
npm install -g @colony2/cortex
|
|
19
19
|
cortex version
|
|
20
|
-
cortex --jobdb
|
|
20
|
+
cortex --jobdb http://127.0.0.1:9047/c2 --working-dir /path/to/cell
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
The npm installer downloads the matching binary from
|
|
@@ -33,15 +33,45 @@ with a c2j cell configuration; see the
|
|
|
33
33
|
| Option | Environment variable | Default |
|
|
34
34
|
| --- | --- | --- |
|
|
35
35
|
| `--addr` | `CORTEX_ADDR` | `:8080` |
|
|
36
|
-
| `--jobdb
|
|
36
|
+
| `--jobdb` | `C2J_JOBDB` | `jobdb` from `.c2j/config.yaml` |
|
|
37
37
|
| `--working-dir` | `CORTEX_WORKING_DIR` | Current directory |
|
|
38
|
-
| `--tenant-id` | `CORTEX_TENANT_ID` | `1` |
|
|
39
38
|
| `--cors-origins` | `CORTEX_CORS_ORIGINS` | Empty; comma-separated origins |
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
Cortex uses Cobra, like c2j: long flags use `--` (`--jobdb`, `--addr`) and
|
|
41
|
+
short flags use `-` (`-h` for help). `cortex serve` explicitly starts the server;
|
|
42
|
+
`cortex` with the same flags is equivalent. Use `cortex version` or
|
|
43
|
+
`cortex --version` to identify the release. Source builds report `dev`.
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
The JobDB URI includes the tenant, just like c2j:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
cortex serve --jobdb http://localhost:9047/c2
|
|
49
|
+
# Or share the same environment setting with c2j:
|
|
50
|
+
C2J_JOBDB=http://localhost:9047/c2 cortex
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Resolution follows `--jobdb`, then `C2J_JOBDB`, then the nearest ancestor
|
|
54
|
+
`.c2j/config.yaml`. Cortex calls c2j's `pkg/config.LoadProjectConfig` and
|
|
55
|
+
`ProjectConfig.JobDBURI` directly, including support for command-valued settings:
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
jobdb: http://localhost:9047/c2
|
|
59
|
+
# Alternatively:
|
|
60
|
+
# jobdb:
|
|
61
|
+
# command: your-command-that-prints-a-jobdb-uri
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Run `cortex` from that cell or a subdirectory, or select the discovery directory
|
|
65
|
+
with `--working-dir`. Cortex requires a remote HTTP(S) JobDB server; `embed:///`
|
|
66
|
+
is not supported.
|
|
67
|
+
|
|
68
|
+
For migration, `--jobdb-url` remains a deprecated alias accepting either the new
|
|
69
|
+
URI or a server-only URL with `--tenant-id`. Legacy `JOBDB_URL` is used only when
|
|
70
|
+
neither a connection flag nor `C2J_JOBDB` is set, before consulting the config.
|
|
71
|
+
`CORTEX_TENANT_ID` applies only to legacy server-only URLs (default `1`).
|
|
72
|
+
|
|
73
|
+
Opening the UI uses the tenant in your configured JobDB URI. To override it,
|
|
74
|
+
select a tenant in the header, use `/?tenantId=42`, or open a tenant route such as
|
|
45
75
|
`/project/42/jobs`. The email screen records an identity cookie; it does not
|
|
46
76
|
provide server-side authentication.
|
|
47
77
|
|
|
@@ -54,7 +84,7 @@ downloads enabled. The Go wrapper selects the version in [`.go-version`](.go-ver
|
|
|
54
84
|
pnpm install --frozen-lockfile
|
|
55
85
|
bash scripts/go.sh -C server mod download
|
|
56
86
|
make build
|
|
57
|
-
./build/cortex --jobdb
|
|
87
|
+
./build/cortex --jobdb http://127.0.0.1:9047/c2 --working-dir /path/to/cell
|
|
58
88
|
```
|
|
59
89
|
|
|
60
90
|
`make build` builds the web packages, copies their output into the Go embed
|
|
@@ -67,7 +97,7 @@ checkout is required.
|
|
|
67
97
|
Start the API and web dev server in separate terminals:
|
|
68
98
|
|
|
69
99
|
```sh
|
|
70
|
-
|
|
100
|
+
C2J_JOBDB=http://127.0.0.1:9047/c2 CORTEX_WORKING_DIR=/path/to/cell pnpm dev:api
|
|
71
101
|
pnpm dev:web
|
|
72
102
|
```
|
|
73
103
|
|
|
@@ -88,7 +118,7 @@ when you need job execution.
|
|
|
88
118
|
| --- | --- |
|
|
89
119
|
| `server/cmd/cortex` | Production API and embedded UI |
|
|
90
120
|
| `server/cmd/api` | Development API using remote JobDB |
|
|
91
|
-
| `server/cmd/uitestserver` | In-memory test API and HTTP test JobDB |
|
|
121
|
+
| `server/cmd/uitestserver` | In-memory test API and HTTP test JobDB; `--jobdb-only --sqlite` uses temporary SQLite storage |
|
|
92
122
|
| `server/internal/cortex` | Routes, tenant/cell mapping, and c2j integration |
|
|
93
123
|
| `server/internal/webdist` | Embedded production web assets |
|
|
94
124
|
| `web/app` | React application |
|
|
@@ -103,14 +133,34 @@ pnpm test:api # Go tests, including remote JobDB integration
|
|
|
103
133
|
pnpm typecheck:web
|
|
104
134
|
pnpm test:web
|
|
105
135
|
pnpm test:e2e # Browser tests against development and embedded production UI
|
|
136
|
+
pnpm --filter @colony2/app test:e2e --project=production recipe-input.spec.ts
|
|
106
137
|
node --test npm/cortex/test/*.test.cjs
|
|
107
138
|
```
|
|
108
139
|
|
|
109
140
|
Playwright installs Chromium if missing. On a fresh Linux host, first run
|
|
110
141
|
`pnpm --filter @colony2/app exec playwright install-deps chromium`.
|
|
111
|
-
The suite manages its own servers on ports 15173 and 18081–18083
|
|
112
|
-
|
|
113
|
-
|
|
142
|
+
The suite manages its own servers on ports 15173 and 18081–18083. It covers
|
|
143
|
+
submission, stories, tenants, cells, and input events. The production tests use
|
|
144
|
+
HTTP JobDB backed by temporary SQLite storage.
|
|
145
|
+
|
|
146
|
+
The recipe-input tests build the pinned c2j command and execute real Git-backed
|
|
147
|
+
recipes with single-question and multi-field input requests. They submit jobs
|
|
148
|
+
through the browser, observe pending requests in a second tab over SSE, check
|
|
149
|
+
required fields and page reloads, submit answers while the worker is stopped,
|
|
150
|
+
and restart it to verify the exact recipe output and completed story. They also
|
|
151
|
+
cover cancellation from another client, rejected late answers, and consecutive
|
|
152
|
+
prompts in one job without reloading either tab. Each test has a separate tenant
|
|
153
|
+
and temporary Git repository; the fixture cell's Git URL
|
|
154
|
+
is mapped to that repository in the worker's environment. No API or EventSource
|
|
155
|
+
mocks are used in these tests. Worker logs and recipe outcomes are attached to
|
|
156
|
+
the Playwright report in `web/app/playwright-report`.
|
|
157
|
+
|
|
158
|
+
The timeout regression also runs against the real worker. It currently records
|
|
159
|
+
an **expected failure**: with c2j v0.0.53 / JobDB v0.0.19, an unanswered external
|
|
160
|
+
input task remains pending past its recipe deadline. Step deadlines have the
|
|
161
|
+
same limitation. The test first verifies that the prompt appears, then marks
|
|
162
|
+
only a confirmed still-pending outcome after the deadline as expected; setup
|
|
163
|
+
and other failures still fail CI. Timeout handling needs an upstream JobDB fix.
|
|
114
164
|
|
|
115
165
|
## Releases
|
|
116
166
|
|