@usine/server 0.2.1 → 0.4.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 (231) hide show
  1. package/LICENSE +661 -21
  2. package/README.md +54 -20
  3. package/dist/backend.d.ts +26 -5
  4. package/dist/backend.d.ts.map +1 -1
  5. package/dist/backend.js +41 -16
  6. package/dist/backend.js.map +1 -1
  7. package/dist/backup.d.ts +6 -3
  8. package/dist/backup.d.ts.map +1 -1
  9. package/dist/backup.js +26 -8
  10. package/dist/backup.js.map +1 -1
  11. package/dist/cli.d.ts +77 -11
  12. package/dist/cli.d.ts.map +1 -1
  13. package/dist/cli.js +280 -31
  14. package/dist/cli.js.map +1 -1
  15. package/dist/command.d.ts +22 -0
  16. package/dist/command.d.ts.map +1 -0
  17. package/dist/command.js +51 -0
  18. package/dist/command.js.map +1 -0
  19. package/dist/detach.d.ts +83 -0
  20. package/dist/detach.d.ts.map +1 -0
  21. package/dist/detach.js +320 -0
  22. package/dist/detach.js.map +1 -0
  23. package/dist/export-run.d.ts +1 -1
  24. package/dist/export-run.d.ts.map +1 -1
  25. package/dist/export-run.js +3 -3
  26. package/dist/export-run.js.map +1 -1
  27. package/dist/failure-message.d.ts +19 -0
  28. package/dist/failure-message.d.ts.map +1 -0
  29. package/dist/failure-message.js +127 -0
  30. package/dist/failure-message.js.map +1 -0
  31. package/dist/http.d.ts +14 -5
  32. package/dist/http.d.ts.map +1 -1
  33. package/dist/http.js +86 -33
  34. package/dist/http.js.map +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +1 -1
  38. package/dist/index.js.map +1 -1
  39. package/dist/instance/environment.d.ts +17 -0
  40. package/dist/instance/environment.d.ts.map +1 -0
  41. package/dist/instance/environment.js +51 -0
  42. package/dist/instance/environment.js.map +1 -0
  43. package/dist/instance/id.d.ts +17 -0
  44. package/dist/instance/id.d.ts.map +1 -0
  45. package/dist/instance/id.js +35 -0
  46. package/dist/instance/id.js.map +1 -0
  47. package/dist/instance/lock.d.ts +27 -0
  48. package/dist/instance/lock.d.ts.map +1 -0
  49. package/dist/instance/lock.js +127 -0
  50. package/dist/instance/lock.js.map +1 -0
  51. package/dist/instance/manifest.d.ts +52 -0
  52. package/dist/instance/manifest.d.ts.map +1 -0
  53. package/dist/instance/manifest.js +131 -0
  54. package/dist/instance/manifest.js.map +1 -0
  55. package/dist/instance/operator-api.d.ts +30 -0
  56. package/dist/instance/operator-api.d.ts.map +1 -0
  57. package/dist/instance/operator-api.js +47 -0
  58. package/dist/instance/operator-api.js.map +1 -0
  59. package/dist/instance/ports.d.ts +23 -0
  60. package/dist/instance/ports.d.ts.map +1 -0
  61. package/dist/instance/ports.js +81 -0
  62. package/dist/instance/ports.js.map +1 -0
  63. package/dist/instance/record.d.ts +82 -0
  64. package/dist/instance/record.d.ts.map +1 -0
  65. package/dist/instance/record.js +116 -0
  66. package/dist/instance/record.js.map +1 -0
  67. package/dist/instance/state.d.ts +45 -0
  68. package/dist/instance/state.d.ts.map +1 -0
  69. package/dist/instance/state.js +79 -0
  70. package/dist/instance/state.js.map +1 -0
  71. package/dist/instance/systemd.d.ts +36 -0
  72. package/dist/instance/systemd.d.ts.map +1 -0
  73. package/dist/instance/systemd.js +61 -0
  74. package/dist/instance/systemd.js.map +1 -0
  75. package/dist/logger.d.ts +3 -0
  76. package/dist/logger.d.ts.map +1 -0
  77. package/dist/logger.js +27 -0
  78. package/dist/logger.js.map +1 -0
  79. package/dist/main.js +38 -18
  80. package/dist/main.js.map +1 -1
  81. package/dist/registry.d.ts +20 -0
  82. package/dist/registry.d.ts.map +1 -0
  83. package/dist/registry.js +37 -0
  84. package/dist/registry.js.map +1 -0
  85. package/dist/reload-signal.d.ts +8 -0
  86. package/dist/reload-signal.d.ts.map +1 -0
  87. package/dist/reload-signal.js +21 -0
  88. package/dist/reload-signal.js.map +1 -0
  89. package/dist/restart.d.ts +19 -0
  90. package/dist/restart.d.ts.map +1 -0
  91. package/dist/restart.js +105 -0
  92. package/dist/restart.js.map +1 -0
  93. package/dist/shutdown.d.ts +5 -2
  94. package/dist/shutdown.d.ts.map +1 -1
  95. package/dist/shutdown.js +11 -5
  96. package/dist/shutdown.js.map +1 -1
  97. package/dist/status.d.ts +12 -0
  98. package/dist/status.d.ts.map +1 -0
  99. package/dist/status.js +99 -0
  100. package/dist/status.js.map +1 -0
  101. package/dist/stop.d.ts +81 -0
  102. package/dist/stop.d.ts.map +1 -0
  103. package/dist/stop.js +195 -0
  104. package/dist/stop.js.map +1 -0
  105. package/dist/system-sleep.d.ts +9 -0
  106. package/dist/system-sleep.d.ts.map +1 -0
  107. package/dist/system-sleep.js +42 -0
  108. package/dist/system-sleep.js.map +1 -0
  109. package/dist/tracing.d.ts +22 -0
  110. package/dist/tracing.d.ts.map +1 -0
  111. package/dist/tracing.js +61 -0
  112. package/dist/tracing.js.map +1 -0
  113. package/dist/up.d.ts +2 -2
  114. package/dist/up.d.ts.map +1 -1
  115. package/dist/up.js +62 -24
  116. package/dist/up.js.map +1 -1
  117. package/dist/upgrade.d.ts +58 -0
  118. package/dist/upgrade.d.ts.map +1 -0
  119. package/dist/upgrade.js +237 -0
  120. package/dist/upgrade.js.map +1 -0
  121. package/dist/web/assets/CompositeItem-DU6IyNMY.js +1 -0
  122. package/dist/web/assets/ToolbarRootContext-Cytu6o2e.js +1 -0
  123. package/dist/web/assets/X.es-B7iqdxa_.js +1 -0
  124. package/dist/web/assets/_agent-BVKD5odk.js +1 -0
  125. package/dist/web/assets/_loop-BFLzamuo.js +1 -0
  126. package/dist/web/assets/_name-Bh4AQ9sR.js +6 -0
  127. package/dist/web/assets/_name-CMVsmWzq.js +1 -0
  128. package/dist/web/assets/_name-DCkgEma_.js +1 -0
  129. package/dist/web/assets/_name-Ds_pWi15.js +1 -0
  130. package/dist/web/assets/_number-B9aYwvcQ.js +1 -0
  131. package/dist/web/assets/_run-BZWt47QS.js +8 -0
  132. package/dist/web/assets/_worker-Dgfufm5p.js +1 -0
  133. package/dist/web/assets/action-rCd1FeAz.js +1 -0
  134. package/dist/web/assets/agents-Drbg6qpH.js +1 -0
  135. package/dist/web/assets/agents-_6-dEjrY.js +1 -0
  136. package/dist/web/assets/button-DVWXde__.js +1 -0
  137. package/dist/web/assets/collapsible-IOhZV1qg.js +1 -0
  138. package/dist/web/assets/core-wi-Hu_JV.js +12 -0
  139. package/dist/web/assets/drawer-BiqnR_8i.js +1 -0
  140. package/dist/web/assets/dropdown-menu-C9D1kRkO.js +1 -0
  141. package/dist/web/assets/edit-and-retry-BgOR6mvP.js +1 -0
  142. package/dist/web/assets/engine-javascript-D-6se_EF.js +141 -0
  143. package/dist/web/assets/error-alert-9tKpTE3v.js +1 -0
  144. package/dist/web/assets/file-error-SjG2jLJ9.js +1 -0
  145. package/dist/web/assets/fill-cell-ClM88KFD.js +1 -0
  146. package/dist/web/assets/heading-lX1a1LNN.js +1 -0
  147. package/dist/web/assets/index-BymNZU1Q.js +10 -0
  148. package/dist/web/assets/index-Dyjfp3ET.css +2 -0
  149. package/dist/web/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
  150. package/dist/web/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
  151. package/dist/web/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
  152. package/dist/web/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
  153. package/dist/web/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
  154. package/dist/web/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
  155. package/dist/web/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
  156. package/dist/web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  157. package/dist/web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  158. package/dist/web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  159. package/dist/web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  160. package/dist/web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  161. package/dist/web/assets/label-badge-aIGT1Bry.js +1 -0
  162. package/dist/web/assets/list-v8WJp2Eq.js +1 -0
  163. package/dist/web/assets/loops-BFoFf_og.js +1 -0
  164. package/dist/web/assets/mark-CC3RwMy_.js +1 -0
  165. package/dist/web/assets/markdown-BnyfnuCL.js +29 -0
  166. package/dist/web/assets/matchContext-BquevSJS.js +2 -0
  167. package/dist/web/assets/model-BerBT6R0.js +1 -0
  168. package/dist/web/assets/moves-Dg9sshX5.js +1 -0
  169. package/dist/web/assets/overview-C_tFKGZ8.js +1 -0
  170. package/dist/web/assets/page-DWnGi6wA.js +301 -0
  171. package/dist/web/assets/project-not-found-CodaBVdu.js +1 -0
  172. package/dist/web/assets/pull-request-marks-DE00nqGW.js +1 -0
  173. package/dist/web/assets/queries-B1SHA_r4.js +1 -0
  174. package/dist/web/assets/reload-Dsl0zjJ7.js +1 -0
  175. package/dist/web/assets/repositories-BdxmD192.js +1 -0
  176. package/dist/web/assets/repositories-D4wYJfa_.js +1 -0
  177. package/dist/web/assets/route-B_gphTYG.js +1 -0
  178. package/dist/web/assets/route-Cc7dKnn5.js +1 -0
  179. package/dist/web/assets/routes-BLy5TGH_.js +65 -0
  180. package/dist/web/assets/run-again-BTKagSXR.js +1 -0
  181. package/dist/web/assets/section-B3pWIIBa.js +1 -0
  182. package/dist/web/assets/section-CD-MB5r3.js +1 -0
  183. package/dist/web/assets/section-Id99HktI.js +1 -0
  184. package/dist/web/assets/settings-YrDysQXW.js +1 -0
  185. package/dist/web/assets/slots-BraHmbNr.js +1 -0
  186. package/dist/web/assets/status-badge-DnvNo1tG.js +1 -0
  187. package/dist/web/assets/strings-CW2XaR5f.js +1 -0
  188. package/dist/web/assets/table-BjyI4fVI.js +1 -0
  189. package/dist/web/assets/tasks-DCL8kLmD.js +1 -0
  190. package/dist/web/assets/transcript-sxRJzx6t.js +5 -0
  191. package/dist/web/assets/usage-CLQJdX9-.js +1 -0
  192. package/dist/web/assets/use-now-0P8TUXeg.js +1 -0
  193. package/dist/web/assets/useAnchoredPopupScrollLock-CQ83Wy-r.js +1 -0
  194. package/dist/web/assets/useNavigate-BW1WdocJ.js +1 -0
  195. package/dist/web/assets/usePositioner-rNCxnHO-.js +1 -0
  196. package/dist/web/assets/useTimeout-_TcdZXP6.js +1 -0
  197. package/dist/web/assets/with-selector-DoElmmtd.js +1 -0
  198. package/dist/web/assets/workers-BH5CBOR3.js +1 -0
  199. package/dist/web/index.html +16 -10
  200. package/package.json +17 -12
  201. package/dist/web/assets/_name-DdyMEUN6.js +0 -6
  202. package/dist/web/assets/_name-eoobiMh0.js +0 -1
  203. package/dist/web/assets/_name-pUxlKZt5.js +0 -1
  204. package/dist/web/assets/badge-t7m0Vk1K.js +0 -146
  205. package/dist/web/assets/button-BoOukj77.js +0 -1
  206. package/dist/web/assets/core-CLXRiB63.js +0 -12
  207. package/dist/web/assets/empty-DbVYU7bi.js +0 -1
  208. package/dist/web/assets/engine-javascript-h-x4hGa4.js +0 -141
  209. package/dist/web/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  210. package/dist/web/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  211. package/dist/web/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  212. package/dist/web/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  213. package/dist/web/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
  214. package/dist/web/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
  215. package/dist/web/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
  216. package/dist/web/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
  217. package/dist/web/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
  218. package/dist/web/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
  219. package/dist/web/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  220. package/dist/web/assets/index-CVBBoW6r.css +0 -2
  221. package/dist/web/assets/index-CsW8KcJW.js +0 -10
  222. package/dist/web/assets/loops-DghpuoiG.js +0 -1
  223. package/dist/web/assets/operator-copy-DIsVXn17.js +0 -1
  224. package/dist/web/assets/overview-DmCIVPwN.js +0 -1
  225. package/dist/web/assets/rolldown-runtime-hePW80VL.js +0 -1
  226. package/dist/web/assets/routes-BDyP7vCr.js +0 -1
  227. package/dist/web/assets/run-drawer-B-xhTXe4.js +0 -157
  228. package/dist/web/assets/status-badge-yblcElE0.js +0 -1
  229. package/dist/web/assets/table-B8cLYNvq.js +0 -1
  230. package/dist/web/assets/useCompositeItem-HmBmWxUW.js +0 -1
  231. package/dist/web/assets/with-selector-N6m4X0X_.js +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @usine/server
2
2
 
3
- The foreground CLI for a local [usine](https://github.com/basaltbytes/usine) factory. It is a thin Node adapter over `@usine/orchestrator`: the library owns polling, schedule triggers, durable execution, worker composition, and operator acts; this package serves their JSON and web surfaces.
3
+ The foreground CLI for a local [usine](https://github.com/basaltbytes/usine) factory: a thin Node adapter over `@usine/orchestrator`. The library does the polling, schedule triggers, durable execution, worker composition, and operator actions; this package serves their JSON and web surfaces. The [CLI reference](https://docs.usine.dev/reference/configuration/cli/) lists every command, flag, and variable, and [Operate runs](https://docs.usine.dev/guides/operate-runs/) covers day-to-day use.
4
4
 
5
5
  Run it from an instance folder:
6
6
 
@@ -8,49 +8,83 @@ Run it from an instance folder:
8
8
  usine up
9
9
  ```
10
10
 
11
- The command prints `http://127.0.0.1:7331` and stays attached to the terminal. Pass `--port <port>` (or set `USINE_PORT`) to listen elsewhere. `usine --help` prints the complete command surface and `usine --version` prints the exact `@usine/server` version pinned by the instance. If the chosen port is occupied, the CLI names the conflict and suggests the override instead of exposing Node's bind failure.
11
+ It prints `http://127.0.0.1:7331` and stays attached to the terminal. Every command reads `.env` in the instance folder for the variables that the environment doesn't set, as dotenv does, so keep tokens there to run the commands from any shell. `--port <port>` or `USINE_PORT` changes the port; if the port is taken, the CLI names the conflict and suggests the override. `--origin <url>` or `USINE_ORIGIN` names the URL at which a proxy, such as `tailscale serve`, publishes the UI; the operator API then accepts browser requests from pages there too. `--log-level <level>` or `USINE_LOG_LEVEL` sets the lowest level it logs, `info` by default; `debug` adds the lines that say why something was skipped. Each log line starts with its date and time in UTC. `usine --version` prints the `@usine/server` version that the instance pins. On macOS, `usine up` warns if the Mac can sleep, which drops the SSH connections to workers: run `caffeinate -s` while runs are open, or turn off sleep on AC power with `sudo pmset -c sleep 0`.
12
12
 
13
- Without GitHub App credentials, it opens the setup screen in the default browser, logs the typed credential error, and leaves both trigger streams idle instead of crashing. The browser command has a two-second timeout; a failed opener produces a warning and does not stop the server. Existing Runs, transcript detail, and database-backed Loop pause state remain observable, while interventions stay unavailable. Credentials may come from `USINE_GITHUB_APP_ID` plus `USINE_GITHUB_PRIVATE_KEY`, or from a mode-0600 `.usine/github-app.json` file with `app_id` and `private_key` fields. The running process reads credentials only at startup, so stop and rerun `usine up` after adding them; the setup screen states that restart requirement explicitly.
13
+ One `usine up` runs per instance folder. It holds `.usine/instance.lock` from startup until every store closes, writes its pid to `.usine/instance.pid`, and writes its pid, port, version, start time, and command line to `.usine/instance.json`. It removes both files when it exits. It reads the instance ID from `.usine/instance-id`, and writes a new UUID there at its first start; the ID labels its attempt containers on SSH workers, so that another instance with the same GitHub App doesn't remove them. A second `usine up` there names the running process and exits nonzero before opening a store. A draining process keeps the folder until it exits.
14
14
 
15
- The local-only UI opens each project as a Board built from its authored or proposed lanes. Proposed lanes are read-only. Configure `repos[].lanes` in `usine.yaml` and restart `usine up` to enable moves; see the [lane configuration example](../../packages/config/README.md). Moving an Item into an authored label-backed lane exchanges only the labels in that map, preserving descriptive labels outside it; normal polling then evaluates label-protocol loops. Board cards show the latest Run and open its existing detail drawer. The UI can also approve, retry, or cancel a Run; pause or unpause a Loop's database runtime state; page backward through older transcript rows; and tail parent and one-level child session activity.
15
+ ## Manage the instance
16
16
 
17
- Run conversations remember the reader’s filter, inspected disclosures and reading place when the drawer reopens or the page refreshes. Bookmarks are specific to each Run and browser origin; unread activity remains pending while a saved place is restored. See the [conversation reader behavior](../web/README.md#returning-to-a-conversation) for retention and history-recovery limits.
17
+ ```sh
18
+ usine up --detach # start in the background, with the output in .usine/usine.log
19
+ usine status # running or not, pid, address, version, uptime, open runs; exit 3 if stopped
20
+ usine stop # send SIGTERM and wait for the drain; --force ends the drain
21
+ usine restart # stop, then start the recorded command line in the background
22
+ usine upgrade # back up, move the @usine/server pin, install, commit, and restart
23
+ ```
24
+
25
+ `stop`, `restart`, and `upgrade` wait `--timeout` seconds (120 by default) for each stop. With `--force`, they send `SIGKILL` to a process that still runs after the timeout. Each start, including `usine up --detach`, waits until the new process listens, which it does after startup recovery, and gives up only when the process writes no line to `.usine/usine.log` for that long. Without a readable `.usine/instance.json`, `restart` checks the pid in `.usine/instance.pid` on the port where it answers, stops it, and starts `usine up` as `usine up --detach` without flags would. `restart` and `upgrade` refuse while a run has a running attempt, unless `--force`, and when neither the shell nor `.env` sets a gateway's admin token variable, because the new process inherits the shell's environment and reads `.env`. `upgrade` applies to an instance that installs `@usine/server` from its own `package.json` pin; for a checkout, pull and build it, then run `usine restart`.
26
+
27
+ `usine up` records the systemd service whose cgroup it runs in, such as `usine.service`. If systemd reports the process as that service's main process, `stop`, `restart`, and `upgrade` stop it with `systemctl stop --no-block` and start it with `systemctl start`, so that systemd keeps managing it, and `status` names the service. A start whose service fails or waits to restart is stopped, so that it doesn't repeat.
28
+
29
+ Without GitHub App credentials, it logs the typed error, leaves both trigger streams idle, and opens the setup screen in the default browser. The browser command times out after two seconds; a failed opener only logs a warning. Runs, transcripts, and loop pause state stay readable, and the instance folder can be reloaded, but interventions are unavailable. Supply `USINE_GITHUB_APP_ID` and `USINE_GITHUB_PRIVATE_KEY`, or `app_id` and `private_key` in a mode-0600 `.usine/github-app.json`. Credentials are read only at startup, so restart `usine up` after adding them, as the setup screen says.
30
+
31
+ ## Web UI
32
+
33
+ Each project opens as a board of authored or proposed lanes; proposed lanes are read-only. To enable moves, define `repos[].lanes` in `usine.yaml` and reload (see the [lane example](../../packages/config/README.md)). Moving an item to an authored label-backed lane swaps only the labels in that map and keeps other labels; polling then evaluates label-driven loops. Cards show the latest run and open its drawer. Retry controls describe the saved harness and model. The drawer flags a changed agent definition, and **Edit and retry** uses the current loaded definition even with the same task and agent name. `POST /api/runs/:id/cancel` returns 409 for failed and succeeded runs and preserves their outcomes; repeating it on a canceled run succeeds.
18
34
 
19
- Direct browser requests for UI routes serve the application shell, so refreshing or sharing a Project or Configuration URL works. Unknown `/api/*` routes, missing `/assets/*` files, and other file-like paths remain 404 responses.
35
+ The UI can approve, retry, or cancel a run, pause or unpause a loop, page back through older transcript rows, and tail parent and first-level child activity.
20
36
 
21
- Run conversations summarize adjacent completed tools by their recorded actions, including the files read or changed and recognized test or build invocations. Expand a group to inspect each tool and its result.
37
+ Run conversations remember the reader's filter, opened disclosures, and reading position across drawer reopens and page refreshes. Bookmarks are per run and browser origin, and unread activity stays pending while a saved position is restored. See [Returning to a conversation](../web/README.md#returning-to-a-conversation) for retention and history-recovery limits. Adjacent completed tools are summarized by their recorded actions, such as files read or changed and recognized test or build commands; expand a group to see each tool and result.
22
38
 
23
- The operator API includes `POST /api/cycle-budgets/reset` with an Ask identity. It uses the same request-origin guard and typed error contract as other interventions; stale Asks return 409 and needs-setup mode rejects resets until the runtime is available.
39
+ Direct browser requests for UI routes serve the app shell, so refreshing or sharing a project or configuration URL works. Unknown `/api/*` routes, missing `/assets/*` files, and other file-like paths return 404.
24
40
 
25
- ## Runtime backup and Run evidence
41
+ `POST /api/cycle-budgets/reset` takes an ask identity, with the same origin guard and typed errors as other interventions. A stale ask returns 409, and setup mode rejects resets.
26
42
 
27
- From the instance folder, copy the runtime store while the orchestrator runs:
43
+ After `pnpm build`, reload the page to use the new web bundle; no restart is needed.
44
+
45
+ ## Reload the configuration
46
+
47
+ **Reload configuration** on any Configuration page, `POST /api/instance/reload`, and `SIGHUP` reload `usine.yaml`, `agents/`, and `loops/` without stopping the process. `SIGHUP` no longer ends the process; stop it with Ctrl+C or `SIGTERM`. The [CLI reference](https://docs.usine.dev/reference/configuration/cli/) describes what a reload applies. A refused reload keeps the running configuration and returns:
48
+
49
+ - 422 `FactoryConfigError` for an invalid `usine.yaml`;
50
+ - 409 `RestartRequiredError`, naming the field, for a changed `webhooks` block or a `workers` change that needs a restart (a worker's kind or settings, or a rename);
51
+ - 409 `ReloadPreflightError` if a worker, slot count, or agent brain that the reload adds fails preflight, or a new SSH worker's gateway admin token variable is unset.
52
+
53
+ An accepted reload's response names the loops, agents, labels, repos, and workers it added, removed, or changed. Until a removed worker's last attempt ends, Needs attention counts its running attempts, and `POST /api/workers/:worker/discard-leftovers` returns 409 `LeftoversDiscardRejectedError` with that count. GitHub credentials, the `workers` changes above, and the `webhooks` block apply only at startup.
54
+
55
+ ## Back up and export
56
+
57
+ While the orchestrator runs, `usine backup` copies `.usine/runtime.sqlite` to the path you give, and `.usine/durable.sqlite` next to it with `.durable` before the extension (`/path/to/runtime-backup.durable.sqlite`):
28
58
 
29
59
  ```sh
30
60
  usine backup /path/to/runtime-backup.sqlite
31
61
  ```
32
62
 
33
- `usine backup` copies all runtime tables, including committed WAL data, while the orchestrator runs. It opens the source read-only and doesn't need GitHub credentials.
63
+ Both copies include committed WAL data and are owner-only. The command opens each source read-only, copies the durable storage first, needs no GitHub credentials, and never overwrites a file. Use a new name in an existing writable directory on a file system with hard links. If the runtime copy fails, the durable copy is removed. Without durable storage (no attempt has run yet), it writes only the runtime copy and says so. Errors give the path and cause.
64
+
65
+ Keep backups outside the instance folder, and back up the instance files and credentials separately. To restore, stop the orchestrator and restore both files of one backup:
34
66
 
35
- Use a new filename in an existing writable directory on a filesystem that supports hard links. The command writes a complete backup with owner-only permissions and won't overwrite existing files. Errors identify the affected path and cause.
67
+ 1. Move `.usine/runtime.sqlite` and `.usine/durable.sqlite` aside, with their `-wal` and `-shm` files.
68
+ 2. Copy the runtime backup to `.usine/runtime.sqlite` and the `.durable` backup to `.usine/durable.sqlite`.
69
+ 3. Restart with the matching instance configuration and engine version.
36
70
 
37
- Keep the backup outside the instance folder to protect it against loss of that folder. Back up the authored instance files and credentials separately. To restore, stop the orchestrator, move the existing `.usine/runtime.sqlite` and any `runtime.sqlite-wal` / `runtime.sqlite-shm` files aside, and copy the backup to `.usine/runtime.sqlite`. Restart with the matching instance configuration and engine version. Restoring an older backup also restores its older deduplication ledger, so work performed after that backup can run again.
71
+ An attempt that was running at backup time reattaches if its checkout under `.usine/workers` still exists. Without its checkout or the durable copy, it fails as interrupted and the run retries. An older backup has an older dedup ledger, so work done after it can run again.
38
72
 
39
- From the instance folder, export one Run into a local JSON file:
73
+ `usine export-run` writes one run to a local JSON file:
40
74
 
41
75
  ```sh
42
76
  usine export-run <runId>
43
77
  usine export-run <runId> --output /path/to/evidence.json
44
78
  ```
45
79
 
46
- The default destination is `run-<encoded-runId>.json` in the current directory; characters such as `/` in the Run id are percent-encoded. The output directory must already exist. The command writes a complete file with owner-only permissions, preserves existing destinations, and prints its path after success. A missing Run, unreadable runtime store, encoding failure, or write failure returns a nonzero exit status.
80
+ The default is `run-<encoded-runId>.json` in the current directory, with characters such as `/` percent-encoded; the output directory must exist. The command writes a complete owner-only file, never overwrites one, and prints its path. A missing run, unreadable store, encoding failure, or write failure exits nonzero.
47
81
 
48
- The versioned JSON contains `exportedAt`, the full durable Run `snapshot` (Event, effective task and Agent, repository revision, Step result, and all Attempts), and every saved transcript envelope for those Attempts in append order. The snapshot and transcripts come from one database transaction, including history beyond the drawer's current page. Active Runs continue accumulating history, so export a settled Run for its final evidence.
82
+ The versioned JSON has `exportedAt`, the full run `snapshot` (event, effective task and agent, revision, step result, and all attempts), and every saved transcript envelope in append order, from one transaction, including history past the drawer's page. Active runs keep adding history, so export a settled run. The export opens `.usine/runtime.sqlite` read-only, without creating tables, migrating, starting attempts, or polling. Transcripts can contain repo content and tool output; check the file before you share it. For a restorable database, use `usine backup` ([ADR 0010](../../docs/adr/0010-single-sqlite-runtime-store.md)).
49
83
 
50
- Exporting opens the instance's existing `.usine/runtime.sqlite` in read-only mode, without creating tables, running migrations, starting Attempts, or polling triggers. The command keeps the output local. Transcripts can contain repository content and tool output; inspect the file before sharing it. A Run export preserves selected evidence; use `usine backup <path>` for a restorable runtime database, as described in [ADR 0010](../../docs/adr/0010-single-sqlite-runtime-store.md).
84
+ ## Stop the server
51
85
 
52
- ## Stopping and updating
86
+ Run `usine stop`, press Ctrl+C, or send `SIGTERM` once to stop polling and drain admitted attempts. The server waits up to `max_attempt_minutes` from the request, or indefinitely if unset; a second signal, or `usine stop --force`, stops the wait, and `usine stop --force` sends `SIGKILL` if the process still runs after `--timeout`. Queued runs and automatic retries stay saved, and an attempt cut off by the deadline uses normal restart recovery. Start the next `usine up` after the process exits; `usine stop` returns when it has.
53
87
 
54
- Send SIGTERM or press Ctrl+C once to stop trigger polling and drain admitted Attempts. The server waits up to `max_attempt_minutes` from the shutdown request before closing the runtime. A second SIGTERM or Ctrl+C stops the wait immediately. Queued Runs and automatic retries remain saved for the next start. An Attempt interrupted by the deadline or force stop uses normal restart recovery.
88
+ To clear a handled failure, select **Mark resolved** in the run drawer, opened from Needs attention or run history. Resolution survives restarts and keeps the failed outcome, transcript, and retry. A later failed attempt asks for attention again. After a question the button reads **Mark answered**; after a question or blocker, the loop then acts on the item's newest state.
55
89
 
56
- After `pnpm build`, reload the page to use the rebuilt web bundle; no process restart is required. Instance configuration and GitHub credentials are read at startup.
90
+ Failure resolution through `POST /api/runs/:runId/resolve-failure` records the current instance's operator login and resolution time. The next `GET /api/statistics/runs` reflects the resolution, including when the previous response was cached.
package/dist/backend.d.ts CHANGED
@@ -1,33 +1,54 @@
1
- import type { LoadedInstance } from "@usine/config/instance";
2
1
  import { LoopName } from "@usine/core/loop";
3
2
  import { CycleBudgetAskId } from "@usine/core/cycle-budget";
3
+ import { AttemptId } from "@usine/core/attempt";
4
4
  import { RunId } from "@usine/core/run";
5
5
  import { AgentName } from "@usine/core/agent";
6
- import { type BoardMove, type FactoryOverview, type RunDetailView, type TranscriptRequest, type Operator, type OperatorError, type OperatorObservation, type EditAndRetry, type SessionIntervention } from "@usine/orchestrator/operator";
6
+ import type { RunAgainResult } from "@usine/engine/engine";
7
+ import type { CurrentInstance, InstanceReload, InstanceReloadError } from "@usine/orchestrator/current-instance";
8
+ import type { WorkerName } from "@usine/core/worker";
9
+ import { type BoardMove, type ConfigurationView, type DeskView, type FactoryOverview, type RunDetailView, type RunGitHubChangesView, type TranscriptRequest, type Operator, type OperatorConfiguration, type OperatorError, type OperatorObservation, type EditAndRetry, type SessionIntervention, type RunStatisticsView, type StatisticsView, type StatisticsWindow, type TaskView } from "@usine/orchestrator/operator";
10
+ import type { ItemNumber } from "@usine/core/item";
11
+ import type { RepositoryName } from "@usine/core/repository";
7
12
  import { Context, Effect, Layer, Schema } from "effect";
8
13
  declare const BackendUnavailableError_base: Schema.Class<BackendUnavailableError, Schema.TaggedStruct<"BackendUnavailableError", {
9
14
  readonly message: Schema.String;
10
15
  }>, import("effect/Cause").YieldableError>;
11
16
  export declare class BackendUnavailableError extends BackendUnavailableError_base {
12
17
  }
13
- export type BackendError = OperatorError | BackendUnavailableError;
18
+ export type BackendError = OperatorError | BackendUnavailableError | InstanceReloadError;
14
19
  declare const FactoryBackend_base: Context.ServiceClass<FactoryBackend, "@usine/server/FactoryBackend", {
15
20
  readonly overview: Effect.Effect<FactoryOverview, BackendError>;
16
21
  readonly detail: (runId: RunId, request: TranscriptRequest) => Effect.Effect<RunDetailView, BackendError>;
22
+ readonly githubChanges: (runId: RunId) => Effect.Effect<RunGitHubChangesView, BackendError>;
17
23
  readonly approve: (runId: RunId) => Effect.Effect<void, BackendError>;
18
24
  readonly resetCycleBudget: (askId: CycleBudgetAskId) => Effect.Effect<void, BackendError>;
25
+ readonly resolveFailure: (runId: RunId, attemptId: AttemptId) => Effect.Effect<void, BackendError>;
19
26
  readonly retry: (runId: RunId) => Effect.Effect<void, BackendError>;
20
27
  readonly agents: Effect.Effect<ReadonlyArray<AgentName>, BackendError>;
21
28
  readonly editAndRetry: (runId: RunId, edit: EditAndRetry) => Effect.Effect<void, BackendError>;
29
+ readonly runAgain: (runId: RunId, edit: EditAndRetry) => Effect.Effect<RunAgainResult, BackendError>;
22
30
  readonly intervene: (runId: RunId, input: SessionIntervention) => Effect.Effect<void, BackendError>;
23
31
  readonly cancel: (runId: RunId) => Effect.Effect<void, BackendError>;
32
+ readonly discardLeftovers: (worker: WorkerName) => Effect.Effect<void, BackendError>;
24
33
  readonly moveBoardItem: (move: BoardMove) => Effect.Effect<void, BackendError>;
25
34
  readonly pause: (loop: LoopName) => Effect.Effect<void, BackendError>;
26
35
  readonly unpause: (loop: LoopName) => Effect.Effect<void, BackendError>;
36
+ readonly reload: Effect.Effect<InstanceReload, BackendError>;
37
+ readonly task: (repository: RepositoryName, item: ItemNumber) => Effect.Effect<TaskView, BackendError>;
38
+ readonly configuration: Effect.Effect<ConfigurationView, BackendError>;
39
+ readonly desk: Effect.Effect<DeskView, BackendError>;
40
+ readonly statistics: (window: StatisticsWindow) => Effect.Effect<StatisticsView, BackendError>;
41
+ readonly runStatistics: (window: StatisticsWindow) => Effect.Effect<RunStatisticsView, BackendError>;
27
42
  }>;
28
43
  export declare class FactoryBackend extends FactoryBackend_base {
29
44
  }
30
- export declare const liveBackendLayer: (instance: LoadedInstance, operator: Operator["Service"]) => Layer.Layer<FactoryBackend>;
31
- export declare const needsSetupBackendLayer: (instance: LoadedInstance, errorTag: string, observation: OperatorObservation["Service"]) => Layer.Layer<FactoryBackend>;
45
+ type BackendInstance = Pick<CurrentInstance["Service"], "get" | "reload">;
46
+ /** Provides the backend of a running factory, which reads the current instance on each request. */
47
+ export declare const liveBackendLayer: (instances: BackendInstance, operator: Operator["Service"], configuration: OperatorConfiguration["Service"]) => Layer.Layer<FactoryBackend>;
48
+ /**
49
+ * Provides the setup-mode backend, where only the overview, configuration, and reload work. Other
50
+ * operations fail with `BackendUnavailableError`.
51
+ */
52
+ export declare const needsSetupBackendLayer: (instances: BackendInstance, errorTag: string, observation: OperatorObservation["Service"], configuration: OperatorConfiguration["Service"]) => Layer.Layer<FactoryBackend>;
32
53
  export {};
33
54
  //# sourceMappingURL=backend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,KAAK,SAAS,EACd,KAAK,eAAe,EAEpB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;AAExD,qBAAa,uBAAwB,SAAQ,4BAI3C;CAAG;AAEL,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,uBAAuB,CAAC;;uBAK5C,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,YAAY,CAAC;qBAC9C,CACf,KAAK,EAAE,KAAK,EACZ,OAAO,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6 @@
1
1
  import { LoopName } from "@usine/core/loop";
2
2
  import { CycleBudgetAskId } from "@usine/core/cycle-budget";
3
+ import { AttemptId } from "@usine/core/attempt";
3
4
  import { RunId } from "@usine/core/run";
4
5
  import { AgentName } from "@usine/core/agent";
5
6
  import { NeedsSetupOverview, } from "@usine/orchestrator/operator";
@@ -10,41 +11,65 @@ export class BackendUnavailableError extends Schema.TaggedError("@usine/server/B
10
11
  }
11
12
  export class FactoryBackend extends Context.Service()("@usine/server/FactoryBackend") {
12
13
  }
13
- export const liveBackendLayer = (instance, operator) => Layer.succeed(FactoryBackend)({
14
- overview: operator.overview(instance),
15
- detail: operator.detail,
16
- approve: operator.approve,
14
+ const rosterOf = (instances) => Effect.map(instances.get, ({ agents }) => agents.map(({ name }) => name));
15
+ /** Provides the backend of a running factory, which reads the current instance on each request. */
16
+ export const liveBackendLayer = (instances, operator, configuration) => Layer.succeed(FactoryBackend)({
17
+ overview: Effect.flatMap(instances.get, operator.overview),
18
+ detail: (runId, request) => Effect.flatMap(instances.get, (instance) => operator.detail(instance, runId, request)),
19
+ githubChanges: operator.githubChanges,
20
+ approve: (runId) => Effect.flatMap(instances.get, (instance) => operator.approve(instance, runId)),
17
21
  resetCycleBudget: operator.resetCycleBudget,
18
- retry: operator.retry,
19
- agents: Effect.succeed(instance.agents.map(({ name }) => name)),
20
- editAndRetry: (runId, edit) => operator.editAndRetry(instance, runId, edit),
21
- intervene: (runId, input) => operator.intervene(instance, runId, input),
22
+ retry: (runId) => Effect.flatMap(instances.get, (instance) => operator.retry(instance, runId)),
23
+ resolveFailure: (runId, attemptId) => Effect.flatMap(instances.get, (instance) => operator.resolveFailure(instance, runId, attemptId)),
24
+ agents: rosterOf(instances),
25
+ editAndRetry: (runId, edit) => Effect.flatMap(instances.get, (instance) => operator.editAndRetry(instance, runId, edit)),
26
+ runAgain: (runId, edit) => Effect.flatMap(instances.get, (instance) => operator.runAgain(instance, runId, edit)),
27
+ intervene: (runId, input) => Effect.flatMap(instances.get, (instance) => operator.intervene(instance, runId, input)),
22
28
  cancel: operator.cancel,
23
- moveBoardItem: (move) => operator.moveBoardItem(instance, move),
29
+ discardLeftovers: operator.discardLeftovers,
30
+ moveBoardItem: (move) => Effect.flatMap(instances.get, (instance) => operator.moveBoardItem(instance, move)),
24
31
  pause: (loop) => operator.pause(loop).pipe(Effect.asVoid),
25
32
  unpause: (loop) => operator.unpause(loop).pipe(Effect.asVoid),
33
+ reload: instances.reload,
34
+ task: (repository, item) => Effect.flatMap(instances.get, (instance) => operator.task(instance, repository, item)),
35
+ configuration: Effect.flatMap(instances.get, configuration.view),
36
+ desk: Effect.flatMap(instances.get, operator.desk),
37
+ statistics: (window) => Effect.flatMap(instances.get, (instance) => operator.statistics(instance, window)),
38
+ runStatistics: (window) => Effect.flatMap(instances.get, (instance) => operator.runStatistics(instance, window)),
26
39
  });
27
- export const needsSetupBackendLayer = (instance, errorTag, observation) => {
40
+ /**
41
+ * Provides the setup-mode backend, where only the overview, configuration, and reload work. Other
42
+ * operations fail with `BackendUnavailableError`.
43
+ */
44
+ export const needsSetupBackendLayer = (instances, errorTag, observation, configuration) => {
28
45
  const unavailable = new BackendUnavailableError({
29
- message: "GitHub App setup is required before operator actions are available.",
46
+ message: "The GitHub App is not set up. Set it up to use operator actions.",
30
47
  });
31
- const overview = observation
32
- .overview(instance)
33
- .pipe(Effect.map(({ projects, loops, needsYou }) => new NeedsSetupOverview({ errorTag, projects, loops, needsYou })));
48
+ const overview = Effect.flatMap(instances.get, observation.overview).pipe(Effect.map(({ projects, loops, needsYou }) => new NeedsSetupOverview({ errorTag, projects, loops, needsYou })));
34
49
  const fail = () => Effect.fail(unavailable);
35
50
  return Layer.succeed(FactoryBackend)({
36
51
  overview,
37
- detail: observation.detail,
52
+ detail: (runId, request) => Effect.flatMap(instances.get, (instance) => observation.detail(instance, runId, request)),
53
+ githubChanges: fail,
38
54
  approve: fail,
39
55
  resetCycleBudget: fail,
40
56
  retry: fail,
41
- agents: Effect.succeed(instance.agents.map(({ name }) => name)),
57
+ resolveFailure: fail,
58
+ agents: rosterOf(instances),
42
59
  editAndRetry: fail,
60
+ runAgain: fail,
43
61
  intervene: fail,
44
62
  cancel: fail,
63
+ discardLeftovers: fail,
45
64
  moveBoardItem: fail,
46
65
  pause: fail,
47
66
  unpause: fail,
67
+ reload: instances.reload,
68
+ task: (repository, item) => Effect.flatMap(instances.get, (instance) => observation.task(instance, repository, item)),
69
+ configuration: Effect.flatMap(instances.get, configuration.view),
70
+ desk: Effect.flatMap(instances.get, observation.desk),
71
+ statistics: (window) => Effect.flatMap(instances.get, (instance) => observation.statistics(instance, window)),
72
+ runStatistics: (window) => Effect.flatMap(instances.get, (instance) => observation.runStatistics(instance, window)),
48
73
  });
49
74
  };
50
75
  //# sourceMappingURL=backend.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAGL,kBAAkB,GAQnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExD,MAAM,OAAO,uBAAwB,SAAQ,MAAM,CAAC,WAAW,CAC7D,uCAAuC,CACxC,CAAC,yBAAyB,EAAE;IAC3B,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CAAC;CAAG;AAIL,MAAM,OAAO,cAAe,SAAQ,OAAO,CAAC,OAAO,EAsBhD,CAAC,8BAA8B,CAAC;CAAG;AAEtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,QAAwB,EACxB,QAA6B,EACA,EAAE,C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AAI;QACb,MAAM,EAAE,SAAS,CAAC,MAAM;QAExB,IAAI,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CACzB,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;QAC3F,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,aAAa,CAAC,IAAI,CAAC;QAChE,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,WAAW,CAAC,IAAI,CAAC;QACrD,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CACrB,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACvF,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CACxB,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;KAC3F,CAAC,CAAC;AACL,CAAC,CAAC"}
package/dist/backup.d.ts CHANGED
@@ -1,4 +1,7 @@
1
- import { Effect, Path } from "effect";
2
- /** Copies the current instance's runtime database to `output`, resolved from the working directory. */
3
- export declare const backup: (output: string) => Effect.Effect<void, import("@usine/engine/local-sqlite").RuntimeStoreBackupError, Path.Path>;
1
+ import { Effect, FileSystem, Path } from "effect";
2
+ /**
3
+ * Copies the instance's runtime database to `output` and its durable storage next to it, durable
4
+ * storage first. If the runtime copy fails, removes the durable copy.
5
+ */
6
+ export declare const backup: (directory: string & import("effect/Brand").Brand<"InstanceDirectory">, output: string) => Effect.Effect<void, import("@usine/durable/backup").DurableStorageBackupError | import("@usine/engine/local-sqlite").RuntimeStoreBackupError, FileSystem.FileSystem | Path.Path>;
4
7
  //# sourceMappingURL=backup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"backup.d.ts","sourceRoot":"","sources":["../src/backup.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE/C,uGAAuG;AACvG,eAAO,MAAM,MAAM,kHAOjB,CAAC"}
1
+ {"version":3,"file":"backup.d.ts","sourceRoot":"","sources":["../src/backup.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAQ3D;;;GAGG;AACH,eAAO,MAAM,MAAM,6QA+BjB,CAAC"}
package/dist/backup.js CHANGED
@@ -1,13 +1,31 @@
1
- import { InstanceDirectory } from "@usine/core/instance";
1
+ import { backup as backupDurableStorage } from "@usine/durable/backup";
2
2
  import { backup as backupDatabase } from "@usine/engine/local-sqlite";
3
- import { Console, Effect, Path } from "effect";
4
- /** Copies the current instance's runtime database to `output`, resolved from the working directory. */
5
- export const backup = Effect.fn("Cli.backup")(function* (output) {
6
- const directory = InstanceDirectory.make(process.cwd());
3
+ import { Console, Effect, FileSystem, Path } from "effect";
4
+ /** Returns the durable storage copy path: `backup.sqlite` becomes `backup.durable.sqlite`. */
5
+ const durableDestination = (path, destination) => {
6
+ const { dir, name, ext } = path.parse(destination);
7
+ return path.join(dir, `${name}.durable${ext === "" ? ".sqlite" : ext}`);
8
+ };
9
+ /**
10
+ * Copies the instance's runtime database to `output` and its durable storage next to it, durable
11
+ * storage first. If the runtime copy fails, removes the durable copy.
12
+ */
13
+ export const backup = Effect.fn("Cli.backup")(function* (directory, output) {
14
+ const fileSystem = yield* FileSystem.FileSystem;
7
15
  const path = yield* Path.Path;
8
16
  const destination = path.resolve(output);
9
- yield* Effect.annotateCurrentSpan({ instanceDirectory: directory, destination });
10
- yield* backupDatabase(directory, destination);
11
- yield* Console.log(`Backed up runtime store to ${destination}`);
17
+ const durable = durableDestination(path, destination);
18
+ yield* Effect.annotateCurrentSpan({ instanceDirectory: directory, destination, durable });
19
+ const copied = yield* backupDurableStorage(directory, durable);
20
+ yield* backupDatabase(directory, destination).pipe(Effect.tapError(() => copied
21
+ ? fileSystem.remove(durable).pipe(Effect.tapError((error) => Effect.logWarning("Could not remove the durable copy of a failed backup", {
22
+ durable,
23
+ message: error.message,
24
+ })), Effect.ignore)
25
+ : Effect.void));
26
+ yield* Console.log(`Backed up the runtime store to ${destination}`);
27
+ yield* Console.log(copied
28
+ ? `Backed up the durable storage to ${durable}`
29
+ : "No durable storage to back up: .usine/durable.sqlite does not exist");
12
30
  });
13
31
  //# sourceMappingURL=backup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"backup.js","sourceRoot":"","sources":["../src/backup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE/C,uGAAuG;AACvG,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,EAAE,MAAc;IACrE,MAAM,SAAS,GAAG,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IAC9B,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,KAAK,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,iBAAiB,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC;IACjF,KAAK,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE,W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AAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;IAC1F,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,oBAAoB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC/D,KAAK,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,IAAI,CAChD,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CACnB,MAAM;QACJ,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAC7B,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,MAAM,CAAC,UAAU,CAAC,sDAAsD,EAAE;YACxE,OAAO;YACP,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CACH,EACD,MAAM,CAAC,MAAM,CACd;QACH,CAAC,CAAC,MAAM,CAAC,IAAI,CAChB,CACF,CAAC;IACF,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,kCAAkC,WAAW,EAAE,CAAC,CAAC;IACpE,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAChB,MAAM;QACJ,CAAC,CAAC,oCAAoC,OAAO,EAAE;QAC/C,CAAC,CAAC,qEAAqE,CAC1E,CAAC;AACJ,CAAC,CAAC,CAAC"}
package/dist/cli.d.ts CHANGED
@@ -1,11 +1,25 @@
1
1
  import { Duration, Effect, FileSystem, Option, Schema } from "effect";
2
- import { ChildProcessSpawner } from "effect/unstable/process";
3
- import type { ServeError } from "effect/unstable/http/HttpServerError";
2
+ import { ChildProcessSpawner } from "effect/process";
3
+ import type { ServeError } from "effect/http/HttpServerError";
4
4
  export declare const DEFAULT_PORT = 7331;
5
+ /** The address that the HTTP server listens on and the port check probes. */
6
+ export declare const SERVER_HOST = "127.0.0.1";
5
7
  export declare const BROWSER_OPEN_TIMEOUT = "2 seconds";
6
8
  export declare const Port: Schema.brand<Schema.Int, "ServerPort">;
7
9
  export type Port = typeof Port.Type;
8
- export declare const CLI_USAGE = "Usage:\n usine up [--port <port>] [--allow-volatile-instance]\n usine backup <path>\n usine export-run <runId> [--output <path>]\n usine --help\n usine --version\n\nOptions:\n -p, --port <port> Listen on this port (default: 7331)\n --allow-volatile-instance Start even when the instance folder sits under a temp path\n -o, --output <path> Write Run evidence here (default: run-<encoded-runId>.json)\n -h, --help Print this usage\n -v, --version Print the pinned @usine/server version\n\nEnvironment:\n USINE_PORT Listen on this port when --port is absent\n USINE_ALLOW_VOLATILE_INSTANCE Same as --allow-volatile-instance when set to 1";
10
+ /**
11
+ * The origin of the UI's pages behind a proxy, such as the HTTPS URL at which `tailscale serve`
12
+ * publishes the UI: an `http` or `https` scheme, a host, and a port other than the scheme's
13
+ * default, as a browser writes it in the `Origin` header.
14
+ */
15
+ export declare const UiOrigin: Schema.brand<Schema.String, "UiOrigin">;
16
+ export type UiOrigin = typeof UiOrigin.Type;
17
+ /** The minimum level of the lines `usine up` logs. */
18
+ export declare const UpLogLevel: Schema.Literals<readonly ["Trace", "Debug", "Info", "Warn", "Error"]>;
19
+ export type UpLogLevel = typeof UpLogLevel.Type;
20
+ export declare const DEFAULT_LOG_LEVEL: UpLogLevel;
21
+ export declare const DEFAULT_LIFECYCLE_TIMEOUT_SECONDS = 120;
22
+ export declare const CLI_USAGE = "Usage:\n usine up [--port <port>] [--origin <url>] [--log-level <level>] [--allow-volatile-instance] [--detach]\n usine status\n usine stop [--timeout <seconds>] [--force]\n usine restart [--timeout <seconds>] [--force]\n usine upgrade [<version>] [--check] [--timeout <seconds>] [--force]\n usine backup <path>\n usine export-run <runId> [--output <path>]\n usine --help\n usine --version\n\nOptions:\n -p, --port <port> Listen on this port (default: 7331)\n --origin <url> Also accept the UI's pages at this origin, such as the URL of tailscale serve\n --log-level <level> Log at this level and above: trace, debug, info, warn, or error (default: info)\n --allow-volatile-instance Start even when the instance folder is in a temporary directory\n --detach Start in the background, with the output in .usine/usine.log\n --timeout <seconds> Wait this long for the instance to stop, and for the new one to listen or log a line (default: 120)\n --force Stop without waiting for running attempts; the next start reattaches them\n --check Print the running and the latest @usine/server version, and change nothing\n -o, --output <path> Write the run evidence to this file (default: run-<encoded-runId>.json)\n -h, --help Print this help\n -v, --version Print the installed @usine/server version\n\nEnvironment:\n USINE_PORT Listen on this port if --port is not set\n USINE_ORIGIN Also accept the UI's pages at this origin if --origin is not set\n USINE_LOG_LEVEL Log at this level if --log-level is not set\n USINE_ALLOW_VOLATILE_INSTANCE Set to 1 for the same effect as --allow-volatile-instance\n\nEvery command reads .env in the instance folder for the variables that the environment doesn't set.";
9
23
  declare const CliUsageError_base: Schema.Class<CliUsageError, Schema.TaggedStruct<"CliUsageError", {
10
24
  readonly message: Schema.String;
11
25
  }>, import("effect/Cause").YieldableError>;
@@ -18,7 +32,10 @@ export declare class CliVersionError extends CliVersionError_base {
18
32
  }
19
33
  declare const PortInUseError_base: Schema.Class<PortInUseError, Schema.TaggedStruct<"PortInUseError", {
20
34
  readonly port: Schema.brand<Schema.Int, "ServerPort">;
35
+ /** The PID of the listening process, or `None` if lsof can't find it. */
36
+ readonly holder: Schema.Option<Schema.Int>;
21
37
  }>, import("effect/Cause").YieldableError>;
38
+ /** Another process is listening on the HTTP port. */
22
39
  export declare class PortInUseError extends PortInUseError_base {
23
40
  }
24
41
  declare const ServerStartError_base: Schema.Class<ServerStartError, Schema.TaggedStruct<"ServerStartError", {
@@ -31,7 +48,7 @@ declare const VolatileInstanceDirectoryError_base: Schema.Class<VolatileInstance
31
48
  readonly directory: Schema.String;
32
49
  readonly root: Schema.String;
33
50
  }>, import("effect/Cause").YieldableError>;
34
- /** Raised when the instance folder sits under a path the OS may clear, since its runtime store is the only copy of run history. */
51
+ /** The instance folder is in a directory the OS may clear, which would delete the run history. */
35
52
  export declare class VolatileInstanceDirectoryError extends VolatileInstanceDirectoryError_base {
36
53
  }
37
54
  declare const BrowserOpenError_base: Schema.Class<BrowserOpenError, Schema.TaggedStruct<"BrowserOpenError", {
@@ -48,10 +65,47 @@ export declare class VersionCommand extends VersionCommand_base {
48
65
  }
49
66
  declare const UpCommand_base: Schema.Class<UpCommand, Schema.TaggedStruct<"UpCommand", {
50
67
  readonly port: Schema.brand<Schema.Int, "ServerPort">;
68
+ /** The origin of the UI's pages besides the loopback ones, which the operator API accepts. */
69
+ readonly origin: Schema.Option<Schema.brand<Schema.String, "UiOrigin">>;
70
+ readonly logLevel: Schema.Literals<readonly ["Trace", "Debug", "Info", "Warn", "Error"]>;
51
71
  readonly allowVolatileInstance: Schema.Boolean;
72
+ readonly detach: Schema.Boolean;
52
73
  }>, {}>;
53
74
  export declare class UpCommand extends UpCommand_base {
54
75
  }
76
+ declare const StatusCommand_base: Schema.Class<StatusCommand, Schema.TaggedStruct<"StatusCommand", {}>, {}>;
77
+ /** Reports whether `usine up` runs in the current instance folder. */
78
+ export declare class StatusCommand extends StatusCommand_base {
79
+ }
80
+ declare const LifecycleOptions_base: Schema.Class<LifecycleOptions, Schema.Struct<{
81
+ readonly timeout: Schema.Duration;
82
+ /** Sends a second `SIGTERM`, which stops the instance without waiting for running Attempts. */
83
+ readonly force: Schema.Boolean;
84
+ }>, {}>;
85
+ /** How long a lifecycle command waits for each stop and start, and whether it ends the drain. */
86
+ export declare class LifecycleOptions extends LifecycleOptions_base {
87
+ }
88
+ declare const StopCommand_base: Schema.Class<StopCommand, Schema.TaggedStruct<"StopCommand", {
89
+ readonly options: typeof LifecycleOptions;
90
+ }>, {}>;
91
+ /** Stops the `usine up` of the current instance folder and waits for it to exit. */
92
+ export declare class StopCommand extends StopCommand_base {
93
+ }
94
+ declare const RestartCommand_base: Schema.Class<RestartCommand, Schema.TaggedStruct<"RestartCommand", {
95
+ readonly options: typeof LifecycleOptions;
96
+ }>, {}>;
97
+ /** Stops the `usine up` of the current instance folder and starts it again in the background. */
98
+ export declare class RestartCommand extends RestartCommand_base {
99
+ }
100
+ declare const UpgradeCommand_base: Schema.Class<UpgradeCommand, Schema.TaggedStruct<"UpgradeCommand", {
101
+ /** A version or dist-tag; `latest` if absent. */
102
+ readonly version: Schema.Option<Schema.NonEmptyString>;
103
+ readonly check: Schema.Boolean;
104
+ readonly options: typeof LifecycleOptions;
105
+ }>, {}>;
106
+ /** Moves the instance's `@usine/server` pin to another published version and restarts it. */
107
+ export declare class UpgradeCommand extends UpgradeCommand_base {
108
+ }
55
109
  declare const ExportRunCommand_base: Schema.Class<ExportRunCommand, Schema.TaggedStruct<"ExportRunCommand", {
56
110
  readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
57
111
  readonly output: Schema.Option<Schema.NonEmptyString>;
@@ -67,21 +121,33 @@ export declare class BackupCommand extends BackupCommand_base {
67
121
  }
68
122
  export interface CliEnvironment {
69
123
  readonly port: Option.Option<string>;
124
+ readonly origin: Option.Option<string>;
125
+ readonly logLevel: Option.Option<string>;
70
126
  readonly allowVolatileInstance: Option.Option<string>;
71
127
  }
72
- export declare const CliCommand: Schema.Union<readonly [typeof HelpCommand, typeof VersionCommand, typeof UpCommand, typeof ExportRunCommand, typeof BackupCommand]>;
128
+ export declare const CliCommand: Schema.Union<readonly [typeof HelpCommand, typeof VersionCommand, typeof UpCommand, typeof StatusCommand, typeof StopCommand, typeof RestartCommand, typeof UpgradeCommand, typeof ExportRunCommand, typeof BackupCommand]>;
73
129
  export type CliCommand = typeof CliCommand.Type;
130
+ /** Returns the settings of a `usine up` without flags: those of the environment, or the defaults. */
131
+ export declare const environmentUp: (environment: CliEnvironment) => Effect.Effect<UpCommand, CliUsageError, never>;
74
132
  /** Parses process arguments and the environment into one validated CLI command. */
75
- export declare const parseCli: (args: readonly string[], environment: CliEnvironment) => Effect.Effect<BackupCommand | ExportRunCommand | HelpCommand | UpCommand | VersionCommand, CliUsageError, never>;
76
- /** Directories the OS may clear: `os.tmpdir()`, `$TMPDIR`, and the usual temp locations. */
133
+ export declare const parseCli: (args: readonly string[], environment: CliEnvironment) => Effect.Effect<BackupCommand | ExportRunCommand | HelpCommand | RestartCommand | StatusCommand | StopCommand | UpCommand | UpgradeCommand | VersionCommand, CliUsageError, never>;
134
+ /**
135
+ * Returns the directories the OS may clear: `os.tmpdir()`, `$TMPDIR`, and common temp locations.
136
+ */
77
137
  export declare const volatileRoots: (environmentTmpdir: Option.Option<string>) => ReadonlyArray<string>;
78
- /** Returns the volatile root the directory sits under, if any. Paths are compared as given, with symlinks unresolved. */
138
+ /** Returns the volatile root that contains `directory`, if any, without resolving symlinks. */
79
139
  export declare const volatileRoot: (directory: string, roots: ReadonlyArray<string>) => Option.Option<string>;
80
- /** Reads the version of this installed server from its package.json. */
81
140
  export declare const packageVersion: () => Effect.Effect<string, CliVersionError, FileSystem.FileSystem>;
82
- /** Maps a bind failure to the CLI's startup error, so an address already in use is reported as such. */
141
+ /** Returns `PortInUseError` for `EADDRINUSE`, otherwise `ServerStartError`. */
83
142
  export declare const serverStartError: (port: Port, error: ServeError) => PortInUseError | ServerStartError;
84
- /** Opens the setup page in a browser; call it only after the HTTP server has bound. */
143
+ /** Fails with `PortInUseError`, with the listening PID if found. */
144
+ export declare const portInUse: (port: number & import("effect/Brand").Brand<"ServerPort">) => Effect.Effect<never, PortInUseError, ChildProcessSpawner.ChildProcessSpawner>;
145
+ /**
146
+ * Fails with `PortInUseError` if another process is listening on `port`. Call it before `usine up`
147
+ * builds its runtime.
148
+ */
149
+ export declare const refuseTakenPort: (port: number & import("effect/Brand").Brand<"ServerPort">) => Effect.Effect<undefined, PortInUseError | ServerStartError, ChildProcessSpawner.ChildProcessSpawner>;
150
+ /** Opens the setup page in a browser. Call it only after the HTTP server has bound. */
85
151
  export declare const openBrowser: (url: string, timeout?: Duration.Input | undefined) => Effect.Effect<undefined, BrowserOpenError, ChildProcessSpawner.ChildProcessSpawner>;
86
152
  export {};
87
153
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAIA,OAAO,EAAW,QAAQ,EAAE,MAAM,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