feat(FN-4313): complete Step 3-6 — orchestrator primary engine resolution

Fusion-Task-Id: FN-4313
Fusion-Task-Lineage: 36b8aad3-20f4-475b-9b0f-63e5458d1b91
This commit is contained in:
Fusion
2026-05-13 22:35:03 -07:00
committed by gsxdsm
parent 8e2d4c962b
commit 9db9cfea07
8 changed files with 209 additions and 60 deletions

View File

@@ -796,10 +796,11 @@ Key server capabilities:
- Intentional startup/banner text in `fn dashboard` and `fn serve` remains direct plain output for readability and backward-compatible scripting behavior.
### Headless Node Mode (`fn serve` / `fn daemon`)
- Headless runtimes now auto-register the current working directory as a project when it is missing from central registry metadata, then continue normal engine startup.
- Headless runtimes auto-register the current working directory as a project when it is missing from central registry metadata, then continue normal engine startup.
- First-run auto-bootstrap logs one line: `[serve] Auto-registered project "<name>" at <cwd>` (or `[daemon] ...`).
- This enables first-run startup in CI/Docker/cron without requiring a prior `fn init` or `fn project add`.
- Pass `--no-auto-register` to either command to preserve legacy strict behavior.
- Primary engine binding order is: `--project <id|name>` → central `defaultProjectId` → cwd project (if registered/started) → first started engine in registry iteration order.
- This enables startup from arbitrary launch directories (systemd, Docker, parent directories, symlinked paths) without requiring cwd to be a registered project.
- `--no-auto-register` still disables cwd registration, but startup only exits when zero engines start across the registry.
### Real-time channels
- **SSE**: `/api/events` (`sse.ts`)