@arcships/morula-runtime 0.1.0-alpha.4 → 0.1.0-alpha.6

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 CHANGED
@@ -55,6 +55,24 @@ morula-runtime daemon status # daemon 运行状态
55
55
 
56
56
  命令输出为 JSON(stdout);错误也是 JSON(stderr)。
57
57
 
58
+ ## portal 多环境路由
59
+
60
+ 一份 portal(固定端口 23491)可服务本机**全部环境**的 daemon 实例,不再与单一配置目录绑定
61
+ (设计契约见 `docs/features/portal-multi-env-routing.md`,背景见 `docs/research/runtime-dev-prod-coexist.md`):
62
+
63
+ - portal 扫描本机候选配置目录(`~/.morula-cli` + `~/.morula-cli-*`,可用 `MORULA_PORTAL_CONFIG_DIRS`
64
+ 逗号分隔追加自定义目录),读各自 `config.yaml` 的 `currentContext` 建「归一化 API base URL → 配置目录」索引;
65
+ - `/portal/status`、`/portal/start`、`/portal/stop` 支持可选 query `server=<服务端 API base URL>`:
66
+ token 校验、pid 读写、spawn 的 `MORULA_CONFIG_DIR` 全部作用于**目标环境**实例;
67
+ 不传 `server` = 旧行为(portal 自身配置目录,向后兼容);
68
+ - 未索引的目标 → `404 UNKNOWN_ENV`(fail closed,不向该地址发任何请求);
69
+ 目标环境未 `auth login` → `409 ENV_NOT_LOGGED_IN`(hint 里给出
70
+ `MORULA_CONFIG_DIR=<目录> morula-runtime auth login`);
71
+ - status 响应带 `envRouting: true` 与自身 `context` / `baseUrl` 归属字段,供前端识别。
72
+
73
+ 安全边界不变:只监听回环、只暴露 status/start/stop、token 由目标环境服务端签发并校验。
74
+ 升级 runtime 后需重启 portal(launchd 场景:`morula-runtime daemon portal --autostart off` 后重新 `--autostart on`)才生效。
75
+
58
76
  ## 给智能体 / 脚本使用
59
77
 
60
78
  本 CLI 按「可被程序可靠调用」设计,几点值得利用: