@orion-agents/orion-code 0.3.9 → 0.3.10

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/CHANGELOG.md CHANGED
@@ -22,12 +22,25 @@ which is **not** a pass.
22
22
 
23
23
  ## [Unreleased]
24
24
 
25
- ## [0.3.9] — CANDIDATE
25
+ ## [0.3.10] — CANDIDATE
26
+
27
+ > **Status: candidate.** Not merged, tagged or published to npm.
28
+
29
+ ### Added
30
+
31
+ - The local Web host defaults to port **4242** (M42, the Orion Nebula) instead of
32
+ the generic 3080; `DEFAULT_WEB_PORT` is the single source shared by
33
+ cli-options, launch and server.
34
+ - `orion web start [--port N]`: idempotent background-host start (prints the URL
35
+ when already running); start/restart/`--background` share one arg builder.
36
+ - README documents the background-host lifecycle (`start|status|stop|restart`,
37
+ pidfile/log locations) and the launchd foreground-supervision recipe.
26
38
 
27
39
  ## [0.3.9] — CANDIDATE
28
40
 
29
- > **Status: candidate.** Deterministic-bug-fix release + background host lifecycle
30
- > (issue #247 S1/S2). Not merged, tagged or published to npm.
41
+ > **Status: npm-published.** `@orion-agents/orion-code@0.3.9` is available through the npm
42
+ > registry (latest tag); deterministic-bug-fix release + background host lifecycle
43
+ > (issue #247 S1/S2). Published 2026-09-04; git tag/release may lag.
31
44
 
32
45
  ### Added
33
46
 
package/README.md CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  Local-first, goal-driven coding agent for the terminal and browser.
4
4
 
5
- > v0.3.9 candidate — deterministic-bug sweep over the open issue set plus a native
6
- > background-host lifecycle: `orion web --background` with pidfile/log management
7
- > (`orion web status|stop|restart`). Candidate source is not an npm publication,
8
- > Git tag, or merge-ready release.
5
+ > v0.3.10 candidate — the local Web host now defaults to port 4242 (M42, the
6
+ > Orion Nebula) with a first-class lifecycle: `orion web start|status|stop|restart`
7
+ > manage a detached host (pidfile + logs), and `--background` stays supported.
8
+ > Candidate source is not an npm publication, Git tag, or merge-ready release.
9
9
 
10
10
  [中文说明](README.zh-CN.md) ·
11
11
  [v0.3.7 plan](docs/plan/v0.3.7-left-rail-improvement-plan.md) ·
@@ -170,7 +170,7 @@ current development environments. Node 20 is upstream EOL and is no longer a v0.
170
170
  After the immutable `0.3.5` npm receipt exists:
171
171
 
172
172
  ```bash
173
- npm install -g @orion-agents/orion-code@0.3.9
173
+ npm install -g @orion-agents/orion-code@0.3.10
174
174
  orion --version
175
175
  orion doctor
176
176
  ```
@@ -258,6 +258,30 @@ atomic, revision-guarded Context transition. The left dock is 240–480px or a 4
258
258
  Narrow layouts use drawers without overwriting desktop widths. Files, Git and Review are read-only;
259
259
  terminal creation requires an explicit gesture and its ticket/output never enter Workbench SSE.
260
260
 
261
+ #### Background host & lifecycle (v0.3.10)
262
+
263
+ The Web Workbench binds **127.0.0.1 only**; the default port is **4242** (M42, the
264
+ Orion Nebula) so it never collides with common dev-tool ports.
265
+
266
+ ```bash
267
+ orion web # foreground; open http://127.0.0.1:4242
268
+ orion web --background # detached host (pidfile + logs, survives terminal exit)
269
+ orion web start [--port N] # idempotent background start
270
+ orion web status [--port N] # running pid/URL/workspace or stale report
271
+ orion web restart [--port N] # stop + start
272
+ orion web stop [--port N] # graceful SIGTERM stop
273
+ ```
274
+
275
+ The pidfile lives at `~/.orion-code/web-host.<port>.pid` and logs append to
276
+ `~/.orion-code/logs/web-<port>.log`. Backgrounding is a process-lifecycle feature
277
+ only: approval, context-revision and sandbox rules stay fail-closed, and the host
278
+ never binds beyond loopback.
279
+
280
+ For crash-restart and login autostart on macOS, register the **foreground** command
281
+ (`orion web --no-open --port 4242 --cwd <dir>`) in a launchd LaunchAgent
282
+ (`RunAtLoad` + `KeepAlive`) — do not combine it with `--background`, because
283
+ launchd must supervise the host process itself.
284
+
261
285
  #### Host-managed Settings
262
286
 
263
287
  The Settings dialog reads from the active Host rather than treating browser storage as a second
package/README.zh-CN.md CHANGED
@@ -2,9 +2,10 @@
2
2
 
3
3
  面向终端与浏览器、本地优先的目标驱动 Coding Agent。
4
4
 
5
- > v0.3.9 候选版本:对 OPEN issue 集的确定性 bug 清扫 + 原生后台 host 生命周期 ——
6
- > `orion web --background`(pidfile/日志)与 `orion web status|stop|restart` 管理。
7
- > Candidate 源码不代表已创建 npm 发布、Git tag 或达到可合并状态。
5
+ > v0.3.10 候选版本:本地 Web host 默认端口改为 **4242**(M42,猎户座大星云),
6
+ > 并新增一等生命周期管理:`orion web start|status|stop|restart` 管理脱离终端的
7
+ > 后台 host(pidfile + 日志),`--background` 仍可用。Candidate 源码不代表已创建
8
+ > npm 发布、Git tag 或达到可合并状态。
8
9
 
9
10
  [English](README.md) ·
10
11
  [v0.3.7 方案](docs/plan/v0.3.7-left-rail-improvement-plan.md) ·
@@ -101,7 +102,7 @@ Current。Node 20 已结束上游维护,不再属于 v0.3 Runtime 合同。
101
102
  当 npm 已存在不可变的 `0.3.4` 发布凭据后:
102
103
 
103
104
  ```bash
104
- npm install -g @orion-agents/orion-code@0.3.9
105
+ npm install -g @orion-agents/orion-code@0.3.10
105
106
  orion --version
106
107
  orion doctor
107
108
  ```
@@ -185,6 +186,23 @@ Host 时会 abort 并 fail-closed。
185
186
  键盘精细调宽。窄屏自动使用 drawer,且不覆盖桌面宽度偏好。文件、Git 和审阅保持只读;创建终端需要
186
187
  显式 user gesture,短期 ticket 与输出均不进入 Workbench SSE。
187
188
 
189
+ #### 后台运行与管理(v0.3.10)
190
+
191
+ Web Workbench 只绑定 **127.0.0.1**;默认端口为 **4242**(M42,猎户座大星云),避免与常用开发端口冲突。
192
+
193
+ ```bash
194
+ orion web # 前台启动;打开 http://127.0.0.1:4242
195
+ orion web --background # 脱离终端的后台 host(pidfile + 日志)
196
+ orion web start [--port N] # 幂等后台启动
197
+ orion web status [--port N] # 查看运行 pid/URL/workspace
198
+ orion web restart [--port N] # 重启
199
+ orion web stop [--port N] # 优雅停止
200
+ ```
201
+
202
+ pidfile 位于 `~/.orion-code/web-host.<port>.pid`,日志追加到 `~/.orion-code/logs/web-<port>.log`。后台化只涉及进程生命周期:审批/上下文版本/沙箱规则保持 fail-closed,host 绝不绑定局域网。
203
+
204
+ macOS 需要崩溃自动重启与开机自启时,用 launchd LaunchAgent 托管**前台**命令(`orion web --no-open --port 4242 --cwd <dir>`,`RunAtLoad`+`KeepAlive`)——不要与 `--background` 混用,launchd 必须直接监管 host 进程。
205
+
188
206
  #### Host 管理的 Settings
189
207
 
190
208
  Settings dialog 从当前 Host 读取设置,不把浏览器存储当成第二配置真源。主题和减少动效会跨刷新、端口
package/dist/cli.js CHANGED
@@ -58,10 +58,20 @@ function showWebHelp() {
58
58
  console.log('Usage: orion web [--port <number>] [--no-open] [--cwd <directory>] [--background]');
59
59
  console.log('Starts the local-only Web Workbench on 127.0.0.1.');
60
60
  console.log(' --background run detached in the background (pidfile + logs under ~/.orion-code)');
61
+ console.log('orion web start [--port <number>] [--cwd <directory>] [--no-open]');
61
62
  console.log('orion web status [--port <number>]');
62
63
  console.log('orion web stop [--port <number>]');
63
64
  console.log('orion web restart [--port <number>]');
64
- console.log(' Manage a background host started with --background.');
65
+ console.log(' Manage a background host started with --background (start starts one).');
66
+ }
67
+ function webBackgroundArgs(options) {
68
+ return [
69
+ ...(options.open ? [] : ['--no-open']),
70
+ '--port',
71
+ String(options.port),
72
+ '--cwd',
73
+ options.cwd,
74
+ ];
65
75
  }
66
76
  async function manageBackgroundHost(command, args) {
67
77
  const options = (0, cli_options_1.parseWebCliOptions)(args);
@@ -157,6 +167,20 @@ async function main() {
157
167
  return;
158
168
  }
159
169
  const rest = args.slice(1);
170
+ if (rest[0] === 'start') {
171
+ const startOptions = (0, cli_options_1.parseWebCliOptions)(rest.slice(1));
172
+ const current = (0, host_daemon_1.hostDaemonStatus)(startOptions.port);
173
+ if (current.state === 'running') {
174
+ console.log(`orion web is already running: ${current.pidfile.url} (pid ${current.pidfile.pid})`);
175
+ return;
176
+ }
177
+ await (0, web_1.runOrionWeb)({
178
+ ...startOptions,
179
+ background: true,
180
+ backgroundArgs: webBackgroundArgs(startOptions),
181
+ });
182
+ return;
183
+ }
160
184
  if (rest[0] === 'status' || rest[0] === 'stop') {
161
185
  await manageBackgroundHost(rest[0], rest.slice(1));
162
186
  return;
@@ -167,25 +191,12 @@ async function main() {
167
191
  await (0, web_1.runOrionWeb)({
168
192
  ...restartOptions,
169
193
  background: true,
170
- backgroundArgs: [
171
- ...(restartOptions.open ? [] : ['--no-open']),
172
- '--port',
173
- String(restartOptions.port),
174
- '--cwd',
175
- restartOptions.cwd,
176
- ],
194
+ backgroundArgs: webBackgroundArgs(restartOptions),
177
195
  });
178
196
  return;
179
197
  }
180
198
  const options = (0, cli_options_1.parseWebCliOptions)(rest);
181
- const backgroundArgs = [
182
- ...(options.open ? [] : ['--no-open']),
183
- '--port',
184
- String(options.port),
185
- '--cwd',
186
- options.cwd,
187
- ];
188
- await (0, web_1.runOrionWeb)({ ...options, backgroundArgs });
199
+ await (0, web_1.runOrionWeb)({ ...options, backgroundArgs: webBackgroundArgs(options) });
189
200
  return;
190
201
  }
191
202
  if (args[0] === 'migrate') {
@@ -2,7 +2,11 @@
2
2
  * CLI option parsing for `orion web` (extracted from the CLI entry so the
3
3
  * grammar has a unit-testable surface — issue #218 regression coverage).
4
4
  */
5
- export declare const DEFAULT_WEB_PORT = 3080;
5
+ /**
6
+ * M42 (Orion Nebula) — the local Web Workbench host binds this by default so
7
+ * `orion web` never collides with common dev-tool ports.
8
+ */
9
+ export declare const DEFAULT_WEB_PORT = 4242;
6
10
  export interface WebCliOptions {
7
11
  readonly port: number;
8
12
  readonly open: boolean;
@@ -6,7 +6,11 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.DEFAULT_WEB_PORT = void 0;
8
8
  exports.parseWebCliOptions = parseWebCliOptions;
9
- exports.DEFAULT_WEB_PORT = 3080;
9
+ /**
10
+ * M42 (Orion Nebula) — the local Web Workbench host binds this by default so
11
+ * `orion web` never collides with common dev-tool ports.
12
+ */
13
+ exports.DEFAULT_WEB_PORT = 4242;
10
14
  function parseWebCliOptions(args) {
11
15
  let port = exports.DEFAULT_WEB_PORT;
12
16
  let open = true;
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * The pidfile shape is intentionally tiny and human-readable:
11
11
  *
12
- * { "pid": 12345, "port": 3080, "url": "http://127.0.0.1:3080",
12
+ * { "pid": 12345, "port": 4242, "url": "http://127.0.0.1:4242",
13
13
  * "startedAt": 1725000000000, "workspace": "/abs/path" }
14
14
  */
15
15
  import { type ChildProcess } from 'child_process';
@@ -22,7 +22,7 @@ exports.stopBackgroundHost = stopBackgroundHost;
22
22
  *
23
23
  * The pidfile shape is intentionally tiny and human-readable:
24
24
  *
25
- * { "pid": 12345, "port": 3080, "url": "http://127.0.0.1:3080",
25
+ * { "pid": 12345, "port": 4242, "url": "http://127.0.0.1:4242",
26
26
  * "startedAt": 1725000000000, "workspace": "/abs/path" }
27
27
  */
28
28
  const child_process_1 = require("child_process");
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runOrionWeb = runOrionWeb;
4
+ const cli_options_1 = require("./cli-options");
4
5
  const child_process_1 = require("child_process");
5
6
  const server_1 = require("./server");
6
7
  const host_daemon_1 = require("./host-daemon");
@@ -8,7 +9,7 @@ async function runOrionWeb(options) {
8
9
  const stdout = options.stdout ?? process.stdout;
9
10
  const stderr = options.stderr ?? process.stderr;
10
11
  const isDaemonChild = process.env[host_daemon_1.HOST_DAEMON_CHILD_ENV] === '1';
11
- const port = options.port ?? 3080;
12
+ const port = options.port ?? cli_options_1.DEFAULT_WEB_PORT;
12
13
  if (options.background && !isDaemonChild) {
13
14
  // Parent side: launch detached and wait for its pidfile, then print the URL.
14
15
  const { pidfile } = await (0, host_daemon_1.spawnBackgroundHost)({
@@ -9,12 +9,13 @@ const version_1 = require("../product/version");
9
9
  const redaction_1 = require("../services/redaction");
10
10
  const protocol_1 = require("./protocol");
11
11
  const errors_1 = require("./errors");
12
+ const cli_options_1 = require("./cli-options");
12
13
  const terminal_server_1 = require("./terminal-server");
13
14
  const workbench_controller_1 = require("./workbench-controller");
14
15
  const HOST = '127.0.0.1';
15
16
  const API_PREFIX = '/api/v1';
16
17
  async function startOrionWebServer(options) {
17
- const requestedPort = options.port ?? 3080;
18
+ const requestedPort = options.port ?? cli_options_1.DEFAULT_WEB_PORT;
18
19
  if (!Number.isSafeInteger(requestedPort) || requestedPort < 0 || requestedPort > 65535) {
19
20
  throw new Error('Web port must be an integer from 0 through 65535.');
20
21
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@orion-agents/orion-code",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@orion-agents/orion-code",
9
- "version": "0.3.9",
9
+ "version": "0.3.10",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@clack/prompts": "^0.7.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-agents/orion-code",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "description": "Orion Code - local-first goal-driven coding agent for terminal and Web.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",