ompchamber 0.5.0 → 0.6.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.
Files changed (76) hide show
  1. package/README.md +46 -1
  2. package/dist/client/index.html +1 -1
  3. package/dist/client/static/css/{index.5291f58223.css → index.51f68210a5.css} +1 -1
  4. package/dist/client/static/js/async/{3y.ededeebde8.js → 3y.4c2596f64c.js} +3 -3
  5. package/dist/client/static/js/async/73.308dff4da8.js +1 -0
  6. package/dist/client/static/js/async/{ty.3d93cf5f5f.js → 7g.a7814350c3.js} +1 -1
  7. package/dist/client/static/js/async/a.bce4542392.js +1 -0
  8. package/dist/client/static/js/async/g.8515cbc6f7.js +2 -0
  9. package/dist/client/static/js/async/hn.b645041e00.js +1 -0
  10. package/dist/client/static/js/async/{jg.69a4beade8.js → jg.d86ebd4013.js} +1 -1
  11. package/dist/client/static/js/async/l.12dd34e1be.js +1 -0
  12. package/dist/client/static/js/async/ls.9d9a01026c.js +104 -0
  13. package/dist/client/static/js/async/mw.ca1512563c.js +10 -0
  14. package/dist/client/static/js/async/nk.fc7e58325e.js +1 -0
  15. package/dist/client/static/js/async/{q.7fb4d2f374.js → q.542c184fec.js} +3 -3
  16. package/dist/client/static/js/async/t.cda4891526.js +1 -0
  17. package/dist/client/static/js/async/tr.e878658140.js +309 -0
  18. package/dist/client/static/js/async/uf.24ca3d49c3.js +2 -0
  19. package/dist/client/static/js/{index.0ac93ee878.js → index.47d3b04d5f.js} +7 -7
  20. package/dist/client/static/js/{uy.5f791144ce.js → uy.2e8929ed0c.js} +2 -2
  21. package/package.json +13 -5
  22. package/src/cli/lib/args.js +6 -6
  23. package/src/cli/lib/commands/logs.js +76 -34
  24. package/src/cli/lib/commands/restart.js +30 -9
  25. package/src/cli/lib/commands/serve.js +12 -4
  26. package/src/cli/lib/commands/status.js +40 -18
  27. package/src/cli/lib/commands/stop.js +12 -7
  28. package/src/cli/lib/commands/update.js +2 -5
  29. package/src/cli/lib/paths.js +8 -28
  30. package/src/cli/lib/runtime.js +118 -108
  31. package/src/client/components/common/code-editor/index.tsx +5 -1
  32. package/src/client/components/common/code-surface/index.tsx +49 -1
  33. package/src/client/components/common/code-surface/measure.ts +99 -0
  34. package/src/client/components/layout/RightActivityBar.tsx +42 -69
  35. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +5 -6
  36. package/src/client/components/layout/desktop-layout/index.tsx +11 -9
  37. package/src/client/components/layout/desktop-layout/resizer/index.tsx +22 -29
  38. package/src/client/components/layout/desktop-layout/resizer/utils.test.ts +33 -0
  39. package/src/client/components/layout/desktop-layout/resizer/utils.ts +34 -0
  40. package/src/client/components/mobile/RightSidebar.tsx +42 -119
  41. package/src/client/components/mobile/mobile-main-view/Header.tsx +17 -1
  42. package/src/client/components/workspace/editor/index.tsx +4 -1
  43. package/src/client/hooks/editor/use-file-editor.test.ts +158 -0
  44. package/src/client/hooks/editor/use-file-editor.ts +35 -19
  45. package/src/server/index.ts +51 -1
  46. package/src/server/lib/lifecycle/identity.ts +108 -0
  47. package/src/server/lib/lifecycle/instance.ts +102 -0
  48. package/src/server/lib/lifecycle/occupant.ts +101 -0
  49. package/src/server/lib/lifecycle/paths.ts +50 -0
  50. package/src/server/lib/lifecycle/port-guard.ts +170 -0
  51. package/src/server/lib/lifecycle/probe.ts +121 -0
  52. package/src/server/plugins/static.test.ts +63 -0
  53. package/src/server/plugins/static.ts +28 -4
  54. package/src/server/routes/health/probe.ts +8 -0
  55. package/src/shared/lib/markdown/mermaid.ts +8 -0
  56. package/src/shared/lib/workspace/panel-widths.test.ts +5 -5
  57. package/src/shared/lib/workspace/panel-widths.ts +23 -10
  58. package/src/shared/lib/workspace/right-panels.ts +10 -4
  59. package/dist/client/static/js/async/73.50280ce58d.js +0 -1
  60. package/dist/client/static/js/async/a.e05da304c8.js +0 -10
  61. package/dist/client/static/js/async/ar.1e14da5588.js +0 -1
  62. package/dist/client/static/js/async/g.7a4bbd4798.js +0 -2
  63. package/dist/client/static/js/async/hn.7568bdb58b.js +0 -1
  64. package/dist/client/static/js/async/l.102a97fce6.js +0 -104
  65. package/dist/client/static/js/async/l6.c56640c205.js +0 -1
  66. package/dist/client/static/js/async/nk.6de011832e.js +0 -1
  67. package/dist/client/static/js/async/t.cb3fcf8615.js +0 -1
  68. package/dist/client/static/js/async/uf.46ad6209fa.js +0 -2
  69. package/dist/client/static/js/async/vn.e98e2f3b61.js +0 -309
  70. /package/dist/client/static/js/async/{3y.ededeebde8.js.LICENSE.txt → 3y.4c2596f64c.js.LICENSE.txt} +0 -0
  71. /package/dist/client/static/js/async/{g.7a4bbd4798.js.LICENSE.txt → g.8515cbc6f7.js.LICENSE.txt} +0 -0
  72. /package/dist/client/static/js/async/{a.e05da304c8.js.LICENSE.txt → mw.ca1512563c.js.LICENSE.txt} +0 -0
  73. /package/dist/client/static/js/async/{q.7fb4d2f374.js.LICENSE.txt → q.542c184fec.js.LICENSE.txt} +0 -0
  74. /package/dist/client/static/js/async/{uf.46ad6209fa.js.LICENSE.txt → uf.24ca3d49c3.js.LICENSE.txt} +0 -0
  75. /package/dist/client/static/js/{index.0ac93ee878.js.LICENSE.txt → index.47d3b04d5f.js.LICENSE.txt} +0 -0
  76. /package/dist/client/static/js/{uy.5f791144ce.js.LICENSE.txt → uy.2e8929ed0c.js.LICENSE.txt} +0 -0
package/README.md CHANGED
@@ -155,6 +155,47 @@ same install, then asks you to restart the server, because a running server cann
155
155
  | `-f, --follow` / `-n, --lines <count>` | Tail the log, optionally from a line count |
156
156
  | `--json` / `-q, --quiet` | Machine-readable output / suppress non-essential output |
157
157
 
158
+ ### Ports and multiple instances
159
+
160
+ One port is served by exactly one process, and `bun run dev`, `ompchamber serve` and the production
161
+ server all default to `3000`. **A starting instance never stops another one** — not a CLI server
162
+ and not a dev run. If the port is taken by OMPChamber, the newcomer reports who holds it and exits
163
+ non-zero so you can pick another port and re-run:
164
+
165
+ ```bash
166
+ ompchamber serve --port 3001 # CLI flag
167
+ OMPCHAMBER_PORT=3001 ompchamber serve
168
+ PORT=3001 bun run dev # or: PORT=3001 bun run start
169
+ ```
170
+
171
+ - Nothing is ever signalled to free a port. `ompchamber stop --port 3000` is the deliberate way to
172
+ free one, and it is per port.
173
+ - A process that is **not** OMPChamber is never signalled either: the server exits with an error
174
+ naming the port and the `lsof -nP -iTCP:<port> -sTCP:LISTEN` command to identify it.
175
+ - The refusal exists because a second bind would *succeed*: Elysia's Bun adapter hardcodes
176
+ `reusePort: true`, so two servers would share a port and only the first-bound socket would receive
177
+ connections — the newcomer would look healthy while the browser kept talking to the old build.
178
+ - `bun run dev` hot reload is unaffected: `--hot` re-evaluates the server entry *inside the running
179
+ process*, and a port held by that same process is recognized as its own, so Bun swaps the handler
180
+ on the next `listen`. Saving a file neither trips the guard nor resets the reported uptime.
181
+
182
+ Running several ports at once is supported. `status`, `stop`, `restart` and `logs` act on **every**
183
+ live instance by default, and `--port <port>` narrows them to one:
184
+
185
+ ```bash
186
+ ompchamber status # every instance: port, pid, mode, launch mode, health, log
187
+ ompchamber status --port 3001 # just that one
188
+ ompchamber logs -n 200 # one header per instance, sources included
189
+ ompchamber logs --port 3001 -f # follow one instance's log
190
+ ompchamber stop # stop them all (--all is the explicit spelling)
191
+ ompchamber stop --port 3001 # stop just that one
192
+ ```
193
+
194
+ The server writes `~/.ompchamber/run/<port>.json` (`pid`, `host`, `mode`, `launchMode`,
195
+ `startedAt`) once it owns the port, which is why `status`/`stop`/`logs` also see servers started by
196
+ `bun run dev` or `--foreground` — not just daemon-spawned ones. Records left by a killed server are
197
+ pruned as soon as their PID stops answering, so a recycled PID is never reported as an instance.
198
+
158
199
  ## Configuration
159
200
 
160
201
  Environment variables, read from `.env` (see [`.env.example`](.env.example)):
@@ -189,7 +230,7 @@ src/
189
230
  │ └─ tailwind.css theme tokens (--theme-ink, --theme-paper, …)
190
231
  ├─ server/ Bun-only — Elysia routes, SQLite, omp RPC bridge, fs/git/terminal
191
232
  │ ├─ routes/ one plugin per domain, mounted in routes/index.ts
192
- │ ├─ lib/ omp session/subagent/config, updates, browser runtime
233
+ │ ├─ lib/ omp session/subagent/config, updates, browser runtime, port lifecycle
193
234
  │ └─ plugins/ SSR shell, static assets, compression, dev assets
194
235
  ├─ shared/ Imported by both — types, chat timeline folding, pure helpers
195
236
  └─ cli/ ompchamber command (plain ESM, runs under Bun)
@@ -219,6 +260,10 @@ There is no HMR: the server reloads on save, the client bundle rebuilds, refresh
219
260
  `dist/client/index.html` is the shell for both dev and prod, so run `dev:client` at least once
220
261
  after a clean checkout.
221
262
 
263
+ Dev and prod share the default port `3000`: a second starter on an occupied port refuses and exits
264
+ with the port options to re-run ([Ports and multiple instances](#ports-and-multiple-instances));
265
+ nothing is stopped for you.
266
+
222
267
  Verification gates, all mandatory:
223
268
 
224
269
  ```bash
@@ -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.5f791144ce.js"></script><script defer src="/static/js/index.0ac93ee878.js"></script><link href="/static/css/index.5291f58223.css" rel="stylesheet"></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.2e8929ed0c.js"></script><script defer src="/static/js/index.47d3b04d5f.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-->