ompchamber 0.5.0 → 0.7.0
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 +67 -6
- package/dist/client/index.html +1 -1
- package/dist/client/static/css/{index.5291f58223.css → index.51f68210a5.css} +1 -1
- package/dist/client/static/js/async/{3y.ededeebde8.js → 3y.4c2596f64c.js} +3 -3
- package/dist/client/static/js/async/73.308dff4da8.js +1 -0
- package/dist/client/static/js/async/{ty.3d93cf5f5f.js → 7g.a7814350c3.js} +1 -1
- package/dist/client/static/js/async/a.bce4542392.js +1 -0
- package/dist/client/static/js/async/g.86e2256a70.js +2 -0
- package/dist/client/static/js/async/hn.b645041e00.js +1 -0
- package/dist/client/static/js/async/{jg.69a4beade8.js → jg.d86ebd4013.js} +1 -1
- package/dist/client/static/js/async/l.12dd34e1be.js +1 -0
- package/dist/client/static/js/async/ls.9d9a01026c.js +104 -0
- package/dist/client/static/js/async/mw.ca1512563c.js +10 -0
- package/dist/client/static/js/async/nk.fc7e58325e.js +1 -0
- package/dist/client/static/js/async/{q.7fb4d2f374.js → q.542c184fec.js} +3 -3
- package/dist/client/static/js/async/t.cda4891526.js +1 -0
- package/dist/client/static/js/async/tr.e878658140.js +309 -0
- package/dist/client/static/js/async/uf.24ca3d49c3.js +2 -0
- package/dist/client/static/js/index.eccad0b70a.js +33 -0
- package/dist/client/static/js/{uy.5f791144ce.js → uy.2e8929ed0c.js} +2 -2
- package/package.json +15 -5
- package/src/cli/lib/args.js +6 -6
- package/src/cli/lib/commands/logs.js +76 -34
- package/src/cli/lib/commands/restart.js +40 -8
- package/src/cli/lib/commands/serve.js +12 -4
- package/src/cli/lib/commands/status.js +40 -18
- package/src/cli/lib/commands/stop.js +12 -7
- package/src/cli/lib/commands/update.js +23 -12
- package/src/cli/lib/paths.js +8 -28
- package/src/cli/lib/runtime.js +121 -108
- package/src/client/components/common/code-editor/index.tsx +5 -1
- package/src/client/components/common/code-surface/index.tsx +49 -1
- package/src/client/components/common/code-surface/measure.ts +99 -0
- package/src/client/components/layout/RightActivityBar.tsx +42 -69
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +5 -6
- package/src/client/components/layout/desktop-layout/index.tsx +11 -9
- package/src/client/components/layout/desktop-layout/resizer/index.tsx +22 -29
- package/src/client/components/layout/desktop-layout/resizer/utils.test.ts +33 -0
- package/src/client/components/layout/desktop-layout/resizer/utils.ts +34 -0
- package/src/client/components/mobile/RightSidebar.tsx +42 -119
- package/src/client/components/mobile/mobile-main-view/Header.tsx +17 -1
- package/src/client/components/workspace/editor/index.tsx +4 -1
- package/src/client/hooks/chat/omp/index.ts +4 -109
- package/src/client/hooks/chat/omp/prompt-send.ts +161 -0
- package/src/client/hooks/chat/timeline/send.ts +3 -2
- package/src/client/hooks/editor/use-file-editor.test.ts +158 -0
- package/src/client/hooks/editor/use-file-editor.ts +35 -19
- package/src/server/index.ts +52 -1
- package/src/server/lib/lifecycle/bun.ts +18 -0
- package/src/server/lib/lifecycle/identity.ts +108 -0
- package/src/server/lib/lifecycle/instance.ts +102 -0
- package/src/server/lib/lifecycle/launch-mode.test.ts +32 -0
- package/src/server/lib/lifecycle/launch-mode.ts +40 -0
- package/src/server/lib/lifecycle/occupant.ts +101 -0
- package/src/server/lib/lifecycle/paths.ts +50 -0
- package/src/server/lib/lifecycle/port-guard.ts +170 -0
- package/src/server/lib/lifecycle/probe.ts +121 -0
- package/src/server/lib/lifecycle/restart.test.ts +21 -0
- package/src/server/lib/lifecycle/restart.ts +111 -0
- package/src/server/lib/omp/rpc/session-commands.ts +15 -1
- package/src/server/lib/updates/apply.ts +8 -5
- package/src/server/lib/updates/install.ts +7 -4
- package/src/server/plugins/static.test.ts +63 -0
- package/src/server/plugins/static.ts +28 -4
- package/src/server/routes/health/probe.ts +9 -0
- package/src/shared/lib/markdown/mermaid.ts +8 -0
- package/src/shared/lib/omp/session/stream-state.server.ts +16 -1
- package/src/shared/lib/workspace/panel-widths.test.ts +5 -5
- package/src/shared/lib/workspace/panel-widths.ts +23 -10
- package/src/shared/lib/workspace/right-panels.ts +10 -4
- package/dist/client/static/js/async/73.50280ce58d.js +0 -1
- package/dist/client/static/js/async/a.e05da304c8.js +0 -10
- package/dist/client/static/js/async/ar.1e14da5588.js +0 -1
- package/dist/client/static/js/async/g.7a4bbd4798.js +0 -2
- package/dist/client/static/js/async/hn.7568bdb58b.js +0 -1
- package/dist/client/static/js/async/l.102a97fce6.js +0 -104
- package/dist/client/static/js/async/l6.c56640c205.js +0 -1
- package/dist/client/static/js/async/nk.6de011832e.js +0 -1
- package/dist/client/static/js/async/t.cb3fcf8615.js +0 -1
- package/dist/client/static/js/async/uf.46ad6209fa.js +0 -2
- package/dist/client/static/js/async/vn.e98e2f3b61.js +0 -309
- package/dist/client/static/js/index.0ac93ee878.js +0 -33
- /package/dist/client/static/js/async/{3y.ededeebde8.js.LICENSE.txt → 3y.4c2596f64c.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{g.7a4bbd4798.js.LICENSE.txt → g.86e2256a70.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{a.e05da304c8.js.LICENSE.txt → mw.ca1512563c.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{q.7fb4d2f374.js.LICENSE.txt → q.542c184fec.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{uf.46ad6209fa.js.LICENSE.txt → uf.24ca3d49c3.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/{index.0ac93ee878.js.LICENSE.txt → index.eccad0b70a.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/{uy.5f791144ce.js.LICENSE.txt → uy.2e8929ed0c.js.LICENSE.txt} +0 -0
package/README.md
CHANGED
|
@@ -70,7 +70,8 @@ ompchamber logs -f -n 200 # follow the server log
|
|
|
70
70
|
- **Two data modes** — `MOCK=false` (the default, also when unset) runs purely on the real SQLite
|
|
71
71
|
database and real workspace files; `MOCK=true` opts into demo datasets for previews.
|
|
72
72
|
- **Self-update** — `ompchamber update` installs the latest GitHub release (bun global or git
|
|
73
|
-
checkout) and restarts
|
|
73
|
+
checkout) and restarts the instance it started; **About → Updates** does the same from the console,
|
|
74
|
+
restart included.
|
|
74
75
|
|
|
75
76
|
## Install
|
|
76
77
|
|
|
@@ -125,8 +126,16 @@ release tag and rebuilt (`bun install`, `bun run build`). Uncommitted work is ne
|
|
|
125
126
|
the update refuses and asks you to commit or stash first. An install owned by another package
|
|
126
127
|
manager is not touched — the command prints the exact command to run instead.
|
|
127
128
|
|
|
128
|
-
The same check runs from the console — **About → Updates
|
|
129
|
-
|
|
129
|
+
The same check runs from the console — **About → Updates**. Its Update button performs the same
|
|
130
|
+
install and then restarts the instance serving that console, exactly as `ompchamber update` restarts
|
|
131
|
+
the instance it finds: a detached `ompchamber restart --port <port>` is armed a moment after the
|
|
132
|
+
response, so the server that answered is replaced without losing the reply, and the console
|
|
133
|
+
reconnects on its own.
|
|
134
|
+
|
|
135
|
+
A server OMPChamber did not start is never restarted. `bun run dev`, `bun run start`, a manual
|
|
136
|
+
`bun src/server/index.ts` and an instance owned by a supervisor (systemd, pm2, a container) all
|
|
137
|
+
record themselves as `direct`, so the update leaves them running and says so — their own launcher is
|
|
138
|
+
what picks up the new files. `--no-restart` turns the restart off entirely.
|
|
130
139
|
|
|
131
140
|
## CLI
|
|
132
141
|
|
|
@@ -135,9 +144,9 @@ same install, then asks you to restart the server, because a running server cann
|
|
|
135
144
|
| Command | Purpose |
|
|
136
145
|
|---|---|
|
|
137
146
|
| `serve` | Start the web server (daemon by default) |
|
|
138
|
-
| `update` | Install the latest GitHub release, then restart
|
|
147
|
+
| `update` | Install the latest GitHub release, then restart the instance it started |
|
|
139
148
|
| `stop` | Stop the running instance |
|
|
140
|
-
| `restart` | Stop, then start again |
|
|
149
|
+
| `restart` | Stop, then start again — leaving servers started from source alone |
|
|
141
150
|
| `status` | Report whether an instance is running |
|
|
142
151
|
| `logs` | Print or follow the server log |
|
|
143
152
|
|
|
@@ -155,6 +164,54 @@ same install, then asks you to restart the server, because a running server cann
|
|
|
155
164
|
| `-f, --follow` / `-n, --lines <count>` | Tail the log, optionally from a line count |
|
|
156
165
|
| `--json` / `-q, --quiet` | Machine-readable output / suppress non-essential output |
|
|
157
166
|
|
|
167
|
+
### Ports and multiple instances
|
|
168
|
+
|
|
169
|
+
One port is served by exactly one process, and `bun run dev`, `ompchamber serve` and the production
|
|
170
|
+
server all default to `3000`. **A starting instance never stops another one** — not a CLI server
|
|
171
|
+
and not a dev run. If the port is taken by OMPChamber, the newcomer reports who holds it and exits
|
|
172
|
+
non-zero so you can pick another port and re-run:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
ompchamber serve --port 3001 # CLI flag
|
|
176
|
+
OMPCHAMBER_PORT=3001 ompchamber serve
|
|
177
|
+
PORT=3001 bun run dev # or: PORT=3001 bun run start
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
- Nothing is ever signalled to free a port. `ompchamber stop --port 3000` is the deliberate way to
|
|
181
|
+
free one, and it is per port.
|
|
182
|
+
- A process that is **not** OMPChamber is never signalled either: the server exits with an error
|
|
183
|
+
naming the port and the `lsof -nP -iTCP:<port> -sTCP:LISTEN` command to identify it.
|
|
184
|
+
- The refusal exists because a second bind would *succeed*: Elysia's Bun adapter hardcodes
|
|
185
|
+
`reusePort: true`, so two servers would share a port and only the first-bound socket would receive
|
|
186
|
+
connections — the newcomer would look healthy while the browser kept talking to the old build.
|
|
187
|
+
- `bun run dev` hot reload is unaffected: `--hot` re-evaluates the server entry *inside the running
|
|
188
|
+
process*, and a port held by that same process is recognized as its own, so Bun swaps the handler
|
|
189
|
+
on the next `listen`. Saving a file neither trips the guard nor resets the reported uptime.
|
|
190
|
+
|
|
191
|
+
Running several ports at once is supported. `status`, `stop`, `restart` and `logs` act on **every**
|
|
192
|
+
live instance by default, and `--port <port>` narrows them to one. `restart` is the one exception to
|
|
193
|
+
"every": an instance started from source is reported and left running, exactly as `ompchamber update`
|
|
194
|
+
leaves it — `status`/`stop`/`logs` still see it, and `stop` still ends it:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
ompchamber status # every instance: port, pid, mode, launch mode, health, log
|
|
198
|
+
ompchamber status --port 3001 # just that one
|
|
199
|
+
ompchamber logs -n 200 # one header per instance, sources included
|
|
200
|
+
ompchamber logs --port 3001 -f # follow one instance's log
|
|
201
|
+
ompchamber stop # stop them all (--all is the explicit spelling)
|
|
202
|
+
ompchamber stop --port 3001 # stop just that one
|
|
203
|
+
ompchamber restart # restart the CLI-started ones, skip a `bun run dev`
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The server writes `~/.ompchamber/run/<port>.json` (`pid`, `host`, `mode`, `launchMode`,
|
|
207
|
+
`startedAt`) once it owns the port, which is why `status`/`stop`/`logs` also see servers started by
|
|
208
|
+
`bun run dev` or `--foreground` — not just daemon-spawned ones. `launchMode` is `daemon` or
|
|
209
|
+
`foreground` for a server the CLI spawned and `direct` for every other launch, and it is derived from
|
|
210
|
+
the process's **argv**, never from an environment variable: env is inherited, so a `bun run dev`
|
|
211
|
+
started inside an OMPChamber shell would otherwise be mislabelled and replaced by an update. Records
|
|
212
|
+
left by a killed server are pruned as soon as their PID stops answering, so a recycled PID is never
|
|
213
|
+
reported as an instance.
|
|
214
|
+
|
|
158
215
|
## Configuration
|
|
159
216
|
|
|
160
217
|
Environment variables, read from `.env` (see [`.env.example`](.env.example)):
|
|
@@ -189,7 +246,7 @@ src/
|
|
|
189
246
|
│ └─ tailwind.css theme tokens (--theme-ink, --theme-paper, …)
|
|
190
247
|
├─ server/ Bun-only — Elysia routes, SQLite, omp RPC bridge, fs/git/terminal
|
|
191
248
|
│ ├─ routes/ one plugin per domain, mounted in routes/index.ts
|
|
192
|
-
│ ├─ lib/ omp session/subagent/config, updates, browser runtime
|
|
249
|
+
│ ├─ lib/ omp session/subagent/config, updates, browser runtime, port lifecycle
|
|
193
250
|
│ └─ plugins/ SSR shell, static assets, compression, dev assets
|
|
194
251
|
├─ shared/ Imported by both — types, chat timeline folding, pure helpers
|
|
195
252
|
└─ cli/ ompchamber command (plain ESM, runs under Bun)
|
|
@@ -219,6 +276,10 @@ There is no HMR: the server reloads on save, the client bundle rebuilds, refresh
|
|
|
219
276
|
`dist/client/index.html` is the shell for both dev and prod, so run `dev:client` at least once
|
|
220
277
|
after a clean checkout.
|
|
221
278
|
|
|
279
|
+
Dev and prod share the default port `3000`: a second starter on an occupied port refuses and exits
|
|
280
|
+
with the port options to re-run ([Ports and multiple instances](#ports-and-multiple-instances));
|
|
281
|
+
nothing is stopped for you.
|
|
282
|
+
|
|
222
283
|
Verification gates, all mandatory:
|
|
223
284
|
|
|
224
285
|
```bash
|
package/dist/client/index.html
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap"
|
|
25
25
|
/>
|
|
26
26
|
<!--app-head-->
|
|
27
|
-
<script defer src="/static/js/markdown-vendor.71e43278b3.js"></script><script defer src="/static/js/shiki-vendor.cb8452ddcd.js"></script><script defer src="/static/js/uy.
|
|
27
|
+
<script defer src="/static/js/markdown-vendor.71e43278b3.js"></script><script defer src="/static/js/shiki-vendor.cb8452ddcd.js"></script><script defer src="/static/js/uy.2e8929ed0c.js"></script><script defer src="/static/js/index.eccad0b70a.js"></script><link href="/static/css/index.51f68210a5.css" rel="stylesheet"></head>
|
|
28
28
|
<body>
|
|
29
29
|
<div id="app"></div>
|
|
30
30
|
<!--app-bootstrap-->
|