Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

feat(ok): remove ok ui command and sibling UI spawn machinery (#3421)

omar-inkeep3dd743971dab
diff --git a/.changeset/remove-ok-ui-command.md b/.changeset/remove-ok-ui-command.md
new file mode 100644
index 000000000..08aa741f8
--- /dev/null
+++ b/.changeset/remove-ok-ui-command.md
@@ -0,0 +1,12 @@
+---
+'@inkeep/open-knowledge': minor
+---
+
+Remove the deprecated `ok ui` command and the sibling UI spawn machinery. Plain `ok start` has served the editor UI, API, and MCP on one port since the single-listener flip, and the Desktop attaches via server.lock v2 — the two-process sibling model is gone.
+
+- `ok ui` no longer exists. If you were running it directly, run `ok start` instead; if a tool spawned it for you (an old `.claude/launch.json` entry), re-run `ok init` or delete the stale entry — current OK never scaffolds one.
+- `ok start` drops `--ui-port` (the worktree-preview sibling recipe) and no longer auto-spawns a UI sibling in any mode. `--only ui --server-url` (the explicit split-mode proxy) still works but now prints a deprecation notice; it will be removed together with `ui.lock` in a later release.
+- The clone/open flow that previously spawned `ok ui` next to a headless server now resolves the redirect from `server.lock` directly. A server started with `--only server` reports "no UI mounted — restart with plain `ok start`" instead of spawning a sibling.
+- Operator and agent hints that pointed at `ok ui` (404 pages, MCP preview messages, CLI errors, config-migration redirects) now point at `ok start`.
+
+`ui.lock` is still written and read for compatibility; it retires in a follow-up release.
diff --git a/docs/content/deploy/remote-access.mdx b/docs/content/deploy/remote-access.mdx
index b5ffc4e7a..e1ef01491 100644
--- a/docs/content/deploy/remote-access.mdx
+++ b/docs/content/deploy/remote-access.mdx
@@ -220,7 +220,7 @@ https://<your-tunnel-url>/
Open it in any browser that can reach the tunnel to browse and edit
the knowledge base. The UI and the MCP endpoint share the one URL (`/` is the editor,
-`/mcp` is for agents); there is no separate `ok ui` port in remote mode.
+`/mcp` is for agents); there is no separate UI port in remote mode.
Editing is live: changes sync in real time between every connected browser and agent.
A few behaviors to know:
diff --git a/docs/content/reference/what-open-knowledge-writes.mdx b/docs/content/reference/what-open-knowledge-writes.mdx
index 198887bc4..8bd28dee8 100644
--- a/docs/content/reference/what-open-knowledge-writes.mdx
+++ b/docs/content/reference/what-open-knowledge-writes.mdx
@@ -105,7 +105,7 @@ The app runs a collaboration server for the open project. It writes runtime stat
| Path | What it is | Scope |
| --- | --- | --- |
-| `.ok/local/server.lock` (and `.ok/local/ui.lock` on the legacy `--ui-port` path) | Advertise the running server's URL; `ok start` now serves the UI from the same server, so `ui.lock` is written only by the deprecated sibling path | In-project, gitignored |
+| `.ok/local/server.lock` (and `.ok/local/ui.lock`, a compatibility advertisement) | Advertise the running server's URL; `ui.lock` is kept for older readers and the deprecated `--only ui` split mode, and retires in a future release | In-project, gitignored |
| `.ok/local/principal.json` | Your local identity (id, email) for edit attribution | In-project, gitignored |
| `.ok/local/sync-state.json`, `.ok/local/conflicts.json` | GitHub-sync engine state | In-project, gitignored |
| `.ok/local/state.json`, `.ok/local/last-spawn-error.log` | State-schema manifest and the UI sibling's error log | In-project, gitignored |
@@ -219,7 +219,7 @@ On Windows, Claude Desktop and OpenCode configs live under `%APPDATA%\Claude\` a
| Path | What it is | Scope |
| --- | --- | --- |
-| `.ok/local/server.lock` (and `.ok/local/ui.lock` on the legacy `--ui-port` path) | Advertise the running server's URL; `ok start` now serves the UI from the same server, so `ui.lock` is written only by the deprecated sibling path | In-project, gitignored |
+| `.ok/local/server.lock` (and `.ok/local/ui.lock`, a compatibility advertisement) | Advertise the running server's URL; `ui.lock` is kept for older readers and the deprecated `--only ui` split mode, and retires in a future release | In-project, gitignored |
| `.ok/local/principal.json` | Your local identity (id, email) for edit attribution | In-project, gitignored |
| `.ok/local/sync-state.json`, `.ok/local/conflicts.json` | GitHub-sync engine state | In-project, gitignored |
| `.ok/local/state.json`, `.ok/local/last-spawn-error.log` | State-schema manifest and the UI sibling's error log | In-project, gitignored |
diff --git a/packages/app/scripts/perf-prod.sh b/packages/app/scripts/perf-prod.sh
index 06bef6b4c..791f22b52 100755
--- a/packages/app/scripts/perf-prod.sh
+++ b/packages/app/scripts/perf-prod.sh
@@ -20,19 +20,14 @@
#
# What it does (precedent #22 shell-script conventions):
# 1. Runs `pnpm run build` from repo root (turbo-cached; no-op when clean).
-# 2. Starts TWO CLI processes on kernel-assigned ports:
-# a. `open-knowledge start --port 0` — collab server (Hocuspocus +
-# /api/*). Polls `.ok/server.lock` for bound port.
-# b. `open-knowledge ui --port 0` — React asset server + /api/config
-# proxy. Reads server.lock to derive collab URL for the SPA.
-# Polls `.ok/ui.lock` for bound port.
-# Post-2026-04-16 CLI split: `ok start` is collab-only (no static
-# assets), `ok ui` is the sole server of the React bundle. Playwright
-# must navigate against the UI port, NOT the collab port.
-# 3. Runs `pnpm run perf:profile --scenario=<name> --target=http://localhost:<ui-port> --headless`
+# 2. Starts ONE CLI process on a kernel-assigned port:
+# `open-knowledge start --port 0` — the project server (React shell +
+# Hocuspocus + /api/* on one listener). Polls `.ok/local/server.lock`
+# for the bound port. Playwright navigates against that same port.
+# 3. Runs `pnpm run perf:profile --scenario=<name> --target=http://localhost:<port> --headless`
# N times. Results land at `packages/app/tests/perf/results/<scenario>.<ts>.json`.
-# 4. Sends SIGTERM to both processes; CLI's CC8 shutdown ordering releases
-# both locks cleanly. Waits up to 5s for both locks to disappear.
+# 4. Sends SIGTERM; the CLI's shutdown ordering releases the lock cleanly.
+# Waits up to 5s for the lock to disappear.
# 5. Parses the N most recent result files, extracts the scenario's
# primary metric, reports individual values + median.
#
@@ -90,8 +85,7 @@ require_jq
REPO_ROOT="$(resolve_repo_root)"
CLI_BIN="$REPO_ROOT/packages/cli/dist/cli.mjs"
-SERVER_LOCK="$REPO_ROOT/.ok/server.lock"
-UI_LOCK="$REPO_ROOT/.ok/ui.lock"
+SERVER_LOCK="$REPO_ROOT/.ok/local/server.lock"
RESULTS_DIR="$REPO_ROOT/packages/app/tests/perf/results"
# ── 1. Build (turbo-cached) ──────────────────────────────────────────────────
@@ -109,22 +103,15 @@ if [[ ! -x "$CLI_BIN" && ! -f "$CLI_BIN" ]]; then
exit 2
fi
-# ── 2. Start both CLI processes in background ───────────────────────────────
+# ── 2. Start the CLI in background ──────────────────────────────────────────
#
-# Post-2026-04-16 CLI split: `ok start` is the collab server (Hocuspocus +
-# /api/*), `ok ui` is a sibling process that serves the built React bundle
-# from packages/app/dist + proxies /api/config pointing at the start lock.
-# Neither is sufficient alone — the app needs ui's static assets to load the
-# SPA, and ui needs start's server.lock to bootstrap HocuspocusProvider.
-# Playwright must navigate against the UI port, NOT the collab port.
-#
-# Start `ok start` first so its server.lock exists before `ok ui` runs its
-# /api/config derivation. A silently-failing ui (no collab target) would
-# produce a React app that paints but never hydrates content.
+# One listener, one origin: `ok start` serves the React shell, /api/*, and
+# the collab WebSocket on a single kernel-assigned port, advertised via
+# `.ok/local/server.lock`. Playwright navigates against that port.
# Remove stale locks from crashed prior runs. The CLI has stale-PID recovery
# but starting clean is simpler; skip only when the lock references a live pid.
-for lock in "$SERVER_LOCK" "$UI_LOCK"; do
+for lock in "$SERVER_LOCK"; do
if [[ -f "$lock" ]]; then
STALE_PID="$(jq -r '.pid // "0"' "$lock" 2>/dev/null || echo "0")"
if [[ "$STALE_PID" != "0" ]] && ! kill -0 "$STALE_PID" 2>/dev/null; then
@@ -135,16 +122,13 @@ for lock in "$SERVER_LOCK" "$UI_LOCK"; do
done
SERVER_LOG="$(mktemp -t perf-prod-server.XXXXXX.log)"
-UI_LOG="$(mktemp -t perf-prod-ui.XXXXXX.log)"
# Pre-flight WORKAROUND for the totalist/sirv broken-symlink crash.
#
-# `ok ui` serves its content tree via `sirv` → `[email protected]`, which
+# The server serves its content tree via `sirv` → `[email protected]`, which
# does synchronous statSync on every entry and propagates ENOENT. A
-# single broken symlink anywhere under the walked tree crashes the UI
-# on startup before it binds a port — leaving an orphan `ui.lock` with
-# `port: 0` and the misleading error "UI did not bind within 2s; run
-# `ok clean`". `/review-local`'s plugin bundle at
+# single broken symlink anywhere under the walked tree crashes the
+# static-serve path before it binds a port. `/review-local`'s plugin bundle at
# `tmp/ship/pr-review-plugin/skills/` routinely creates broken symlinks
# (relative paths like `../../../plugins/eng/skills/<name>` that assume
# a non-monorepo layout).
@@ -166,7 +150,7 @@ if [[ -d "$REPO_ROOT/tmp" ]]; then
fi
done < <(find "$REPO_ROOT/tmp" -type l -print0 2>/dev/null)
if (( ${#BROKEN_LINKS[@]} > 0 )); then
- echo "[perf-prod] Removing ${#BROKEN_LINKS[@]} broken symlink(s) under tmp/ (would crash ok ui):"
+ echo "[perf-prod] Removing ${#BROKEN_LINKS[@]} broken symlink(s) under tmp/ (would crash the static serve):"
for link in "${BROKEN_LINKS[@]}"; do
echo " $link"
rm -f "$link"
@@ -174,52 +158,37 @@ if [[ -d "$REPO_ROOT/tmp" ]]; then
fi
fi
-echo "[perf-prod] Starting open-knowledge (collab server) on kernel-assigned port…"
+echo "[perf-prod] Starting open-knowledge (project server) on kernel-assigned port…"
node "$CLI_BIN" start --port 0 >"$SERVER_LOG" 2>&1 &
SERVER_PID=$!
cleanup() {
local ec=$?
- for proc in "UI:$UI_PID" "SERVER:$SERVER_PID"; do
- local label="${proc%%:*}"
- local pid="${proc##*:}"
- [[ -z "$pid" || "$pid" == "$proc" ]] && continue
- if kill -0 "$pid" 2>/dev/null; then
- echo "[perf-prod] Stopping $label (pid $pid)…"
- kill -TERM "$pid" 2>/dev/null || true
- fi
- done
- # Wait up to 5s for both to exit + locks to release. Termination order
- # doesn't matter — each owns its own lock and releases it on SIGTERM per
- # the CLI's CC8 shutdown protocol.
+ if [[ -n "${SERVER_PID:-}" ]] && kill -0 "$SERVER_PID" 2>/dev/null; then
+ echo "[perf-prod] Stopping server (pid $SERVER_PID)…"
+ kill -TERM "$SERVER_PID" 2>/dev/null || true
+ fi
+ # Wait up to 5s for the process to exit + the lock to release per the
+ # CLI's shutdown protocol.
for _ in 1 2 3 4 5 6 7 8 9 10; do
- local alive=0
- [[ -n "${SERVER_PID:-}" ]] && kill -0 "$SERVER_PID" 2>/dev/null && alive=$((alive + 1))
- [[ -n "${UI_PID:-}" ]] && kill -0 "$UI_PID" 2>/dev/null && alive=$((alive + 1))
- if (( alive == 0 )) && [[ ! -f "$SERVER_LOCK" && ! -f "$UI_LOCK" ]]; then break; fi
+ if ! kill -0 "${SERVER_PID:-0}" 2>/dev/null && [[ ! -f "$SERVER_LOCK" ]]; then break; fi
sleep 0.5
done
- # Force-kill any remaining processes.
- for pid in "${UI_PID:-}" "${SERVER_PID:-}"; do
- [[ -z "$pid" ]] && continue
- if kill -0 "$pid" 2>/dev/null; then
- echo "[perf-prod] WARN: pid $pid did not exit on SIGTERM; sending SIGKILL" >&2
- kill -KILL "$pid" 2>/dev/null || true
- fi
- done
+ if [[ -n "${SERVER_PID:-}" ]] && kill -0 "$SERVER_PID" 2>/dev/null; then
+ echo "[perf-prod] WARN: pid $SERVER_PID did not exit on SIGTERM; sending SIGKILL" >&2
+ kill -KILL "$SERVER_PID" 2>/dev/null || true
+ fi
if [[ $ec -ne 0 ]]; then
- echo "[perf-prod] Script exited non-zero ($ec). Logs:" >&2
+ echo "[perf-prod] Script exited non-zero ($ec). Log:" >&2
echo " server: $SERVER_LOG" >&2
- echo " ui: $UI_LOG" >&2
else
- rm -f "$SERVER_LOG" "$UI_LOG" 2>/dev/null || true
+ rm -f "$SERVER_LOG" 2>/dev/null || true
fi
exit $ec
}
-UI_PID=""
trap cleanup EXIT INT TERM
-# ── 3. Wait for server lock, then start ui, then wait for ui lock ────────────
+# ── 3. Wait for the server lock ──────────────────────────────────────────────
wait_for_lock() {
local lock="$1"
@@ -252,24 +221,13 @@ wait_for_lock() {
}
echo "[perf-prod] Waiting for $SERVER_LOCK with a bound port…"
-COLLAB_PORT="$(wait_for_lock "$SERVER_LOCK" "$SERVER_PID" "collab server" "$SERVER_LOG")" || exit 3
-
-# Now start the UI server. It reads server.lock (already populated) to derive
-# /api/config's collabUrl. Use port 0 for kernel-assigned; respects
-# resolveUiLockCollision (US-005 lock handling).
-echo "[perf-prod] Starting open-knowledge ui (React asset server) on kernel-assigned port…"
-node "$CLI_BIN" ui --port 0 >"$UI_LOG" 2>&1 &
-UI_PID=$!
-
-echo "[perf-prod] Waiting for $UI_LOCK with a bound port…"
-PORT="$(wait_for_lock "$UI_LOCK" "$UI_PID" "ui server" "$UI_LOG")" || exit 3
+PORT="$(wait_for_lock "$SERVER_LOCK" "$SERVER_PID" "server" "$SERVER_LOG")" || exit 3
# ── 4. Run perf:profile N times ──────────────────────────────────────────────
APP_DIR="$REPO_ROOT/packages/app"
cd "$APP_DIR"
-run_start_ts="$(epoch_ms)"
run_failures=0
for i in $(seq 1 "$RUNS"); do
echo "[perf-prod] Run $i/$RUNS — scenario=$SCENARIO target=http://localhost:$PORT"
@@ -317,9 +275,9 @@ case "$SCENARIO" in
*) METRIC="" ;;
esac
-# Find the N most-recent result files for this scenario that were
-# modified AFTER run_start_ts (the script's launch epoch). Excludes
-# pre-existing results from older measurement sessions.
+# Take the N most-recent result files for this scenario (mtime order). If an
+# older measurement session left more than N files, only the freshest N — the
+# ones this run just produced — feed the median.
cd "$RESULTS_DIR"
# shellcheck disable=SC2012 # ls with -t is intentional; file names have no spaces/newlines.
latest_files="$(ls -t "$SCENARIO".*.json 2>/dev/null | head -n "$RUNS" || true)"
diff --git a/packages/app/src/components/ConnectingBanner.test.ts b/packages/app/src/components/ConnectingBanner.test.ts
index 752de33eb..f9d52e902 100644
--- a/packages/app/src/components/ConnectingBanner.test.ts
+++ b/packages/app/src/components/ConnectingBanner.test.ts
@@ -66,13 +66,13 @@ describe('describeError', () => {
test('null-collab kind names server.lock as the culprit', () => {
expect(describeError({ kind: 'null-collab' })).toBe(
- 'ok ui responded but server.lock has no port yet',
+ 'the server responded but server.lock has no port yet',
);
});
- test('network error points at missing ok ui', () => {
+ test('network error points at missing ok start', () => {
expect(describeError({ kind: 'error', code: 'network' })).toBe(
- 'network error (is `ok ui` running?)',
+ 'network error (is `ok start` running?)',
);
});
diff --git a/packages/app/src/components/ConnectingBanner.tsx b/packages/app/src/components/ConnectingBanner.tsx
index 4706388c1..a91d03e51 100644
--- a/packages/app/src/components/ConnectingBanner.tsx
+++ b/packages/app/src/components/ConnectingBanner.tsx
@@ -70,8 +70,8 @@ type CollabError =
/**
* Is the terminal failure specifically "this folder has a UI but no collab
- * server" (the worktree case)? `null-collab` is exactly that signal — `ok ui`
- * responded, the lock has no port. A transient boot-race `null-collab` clears
+ * server" (the worktree case)? `null-collab` is exactly that signal — the
+ * config endpoint responded, the lock has no port. A transient boot-race `null-collab` clears
* well inside the ~30s grace+retry window, so reaching terminal with it means
* the folder genuinely has no collab server. Pure + exported so the message
* branch is unit-testable without a DOM (matches `computeBannerMode`).
@@ -82,8 +82,8 @@ export function isNoCollabServerError(err: CollabError): boolean {
export function describeError(err: CollabError): string {
if (err === null) return t`no response`;
- if (err.kind === 'null-collab') return t`ok ui responded but server.lock has no port yet`;
- if (err.code === 'network') return t`network error (is \`ok ui\` running?)`;
+ if (err.kind === 'null-collab') return t`the server responded but server.lock has no port yet`;
+ if (err.code === 'network') return t`network error (is \`ok start\` running?)`;
if (err.code === 'invalid-body') return t`/api/config returned a malformed body`;
const code = err.code;
return t`/api/config returned HTTP ${code}`;
diff --git a/packages/app/src/lib/use-collab-url.ts b/packages/app/src/lib/use-collab-url.ts
index faa37fbf0..42d70a104 100644
--- a/packages/app/src/lib/use-collab-url.ts
+++ b/packages/app/src/lib/use-collab-url.ts
@@ -165,7 +165,7 @@ export function runCollabUrlPoll(deps: CollabPollDeps): CollabPollHandle {
} else if (result.status === 'ok') {
if (!nullCollabLogged) {
nullCollabLogged = true;
- log.info('[collab-url] ok ui responded but server.lock has no port yet — retrying');
+ log.info('[collab-url] server responded but server.lock has no port yet — retrying');
}
lastError = { kind: 'null-collab' };
} else if (result.status === 'error') {
diff --git a/packages/app/src/locales/ar/messages.json b/packages/app/src/locales/ar/messages.json
index 0bd8d2b4a..75ccde2f9 100644
--- a/packages/app/src/locales/ar/messages.json
+++ b/packages/app/src/locales/ar/messages.json
@@ -208,6 +208,7 @@
"2GT3Hf": ["عام"],
"2H43L8": ["تُخفى الأسرار كمفاتيح API والرموز تلقائيًا."],
"2IYGkU": ["يحتوي هذا المستند على تغييرات غير مدفوعة. سيرى المستلمون آخر نسخة مدفوعة."],
+ "2L8aeZ": ["خطأ في الشبكة (هل `ok start` يعمل؟)"],
"2M0JF6": ["التحديث التلقائي"],
"2O5Z0r": ["إخفاء ", ["appName"]],
"2QM24L": ["كل الوسوم"],
@@ -2214,7 +2215,6 @@
"TDeOpa": ["تراجع عن تعديلاتك أنت أو أعدها، مع إبقاء تعديلات المتعاونين والوكلاء كما هي."],
"TEEPPF": ["سيستبدل مدخل OpenKnowledge الحالي"],
"TEJiKw": ["تحقق OpenKnowledge من ", ["subject"]],
- "TJnkyf": ["استجاب ok ui لكن server.lock لا يحمل منفذًا بعد"],
"TKQ7K-": ["تثبيت"],
"TLIO3j": ["بدّل التنسيق المائل."],
"TMLAx2": ["مطلوب"],
@@ -2889,7 +2889,6 @@
"akmOT9": ["تحرير هذا التعليق"],
"anmUZq": ["ينقصه ميزة"],
"aoT2xX": ["هذا التعليق على الخاصية بأكملها"],
- "aoa6xA": ["خطأ في الشبكة (هل `ok ui` يعمل؟)"],
"arUUsK": ["تحديثات المنتج"],
"ax9kie": ["لم تُحمَّل إعدادات معاينة الروابط بعد — أعد المحاولة بعد قليل"],
"axQ1h6": ["هل تودّ إضافة شيء؟ (اختياري)"],
@@ -4409,6 +4408,7 @@
"txUHO8": [["localizedMessage"], " في السطر ", ["displayLine"]],
"tzGWeg": ["يجري التحضير لإلغاء تثبيت OpenKnowledge"],
"tzZ6ha": ["الاتصال بخادم GitHub Enterprise"],
+ "tz_FDV": ["استجاب الخادم لكن server.lock لا يحتوي على منفذ بعد"],
"u-9fWA": ["راجع <0>Architecture</0> للاطلاع على نظرة عامة على النظام."],
"u3BOHd": [
[
diff --git a/packages/app/src/locales/ar/messages.po b/packages/app/src/locales/ar/messages.po
index 1bdb9de57..db89b22f7 100644
--- a/packages/app/src/locales/ar/messages.po
+++ b/packages/app/src/locales/ar/messages.po
@@ -7498,8 +7498,8 @@ msgid "Network error — please try again"
msgstr "خطأ في الشبكة — يرجى المحاولة مرة أخرى"
#: src/components/ConnectingBanner.tsx
-msgid "network error (is `ok ui` running?)"
-msgstr "خطأ في الشبكة (هل `ok ui` يعمل؟)"
+msgid "network error (is `ok start` running?)"
+msgstr "خطأ في الشبكة (هل `ok start` يعمل؟)"
#: src/components/FileTree.tsx
msgid "Network error during cleanup"
@@ -8150,10 +8150,6 @@ msgstr "OK Desktop"
msgid "OK last set this folder to {0} — something outside OK changed it since. The state shown is what's on disk now; your next Symlink/Unlink wins."
msgstr "ضبط OK هذا المجلد آخر مرة على {0} — وقد غيّره شيء خارج OK منذ ذلك الحين. الحالة المعروضة هي ما على القرص الآن؛ وعملية الربط أو فك الربط التالية لديك هي التي تسود."
-#: src/components/ConnectingBanner.tsx
-msgid "ok ui responded but server.lock has no port yet"
-msgstr "استجاب ok ui لكن server.lock لا يحمل منفذًا بعد"
-
#: src/components/settings/LinkPreviewsSection.tsx
msgid "On — hovering an external link sends its URL to the destination site to fetch a preview."
msgstr "مفعّل — تمرير المؤشر فوق رابط خارجي يرسل رابطه إلى الموقع الوجهة لجلب معاينة."
@@ -12111,6 +12107,10 @@ msgstr "دليل النسخة الأصلية للمستودع"
msgid "The schema file does not exist or failed to load — adding a field creates it."
msgstr "ملف المخطط غير موجود أو فشل تحميله — إضافة حقل تنشئه."
+#: src/components/ConnectingBanner.tsx
+msgid "the server responded but server.lock has no port yet"
+msgstr "استجاب الخادم لكن server.lock لا يحتوي على منفذ بعد"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "مجلد المهارة نفسه — المصدر الذي تنسخ منه المواقع الأخرى أو ترتبط به"
diff --git a/packages/app/src/locales/bn/messages.json b/packages/app/src/locales/bn/messages.json
index d78ae4c33..1978aa7ef 100644
--- a/packages/app/src/locales/bn/messages.json
+++ b/packages/app/src/locales/bn/messages.json
@@ -185,6 +185,7 @@
"2GT3Hf": ["বৈশ্বিক"],
"2H43L8": ["API কী ও টোকেনের মতো গোপন তথ্য নিজে থেকেই সরিয়ে ফেলা হয়।"],
"2IYGkU": ["এই নথিতে না-পাঠানো পরিবর্তন আছে। প্রাপকরা সর্বশেষ পাঠানো সংস্করণটি দেখবেন।"],
+ "2L8aeZ": ["নেটওয়ার্ক ত্রুটি (`ok start` কি চলছে?)"],
"2M0JF6": ["স্বয়ংক্রিয় হালনাগাদ"],
"2O5Z0r": [["appName"], " লুকান"],
"2QM24L": ["সব ট্যাগ"],
@@ -1930,7 +1931,6 @@
],
"TEEPPF": ["বিদ্যমান OpenKnowledge এন্ট্রির জায়গা নেবে"],
"TEJiKw": ["OpenKnowledge ", ["subject"], " পরীক্ষা করেছে"],
- "TJnkyf": ["ok ui সাড়া দিয়েছে কিন্তু server.lock-এ এখনও কোনো পোর্ট নেই"],
"TKQ7K-": ["ইনস্টল করুন"],
"TLIO3j": ["তির্যক বিন্যাস চালু বা বন্ধ করুন।"],
"TMLAx2": ["আবশ্যক"],
@@ -2510,7 +2510,6 @@
"akmOT9": ["এই মন্তব্যটি সম্পাদনা করুন"],
"anmUZq": ["একটি বৈশিষ্ট্য অনুপস্থিত"],
"aoT2xX": ["এই মন্তব্যটি পুরো প্রপার্টির উপর"],
- "aoa6xA": ["নেটওয়ার্ক ত্রুটি (`ok ui` কি চলছে?)"],
"arUUsK": ["পণ্যের হালনাগাদ"],
"ax9kie": ["লিংক প্রাকদর্শনের সেটিং এখনও লোড হয়নি — একটু পরে আবার চেষ্টা করুন"],
"axQ1h6": ["আর কিছু যোগ করতে চান? (ঐচ্ছিক)"],
@@ -3804,6 +3803,7 @@
"txUHO8": [["displayLine"], " নম্বর লাইনে ", ["localizedMessage"]],
"tzGWeg": ["OpenKnowledge সরানোর প্রস্তুতি নেওয়া হচ্ছে"],
"tzZ6ha": ["GitHub Enterprise Server-এর সঙ্গে যুক্ত করুন"],
+ "tz_FDV": ["সার্ভার সাড়া দিয়েছে কিন্তু server.lock-এ এখনো কোনো পোর্ট নেই"],
"u-9fWA": ["সিস্টেমের সংক্ষিপ্তসারের জন্য <0>Architecture</0> দেখুন।"],
"u3BOHd": [["fileCount", "plural", { "one": ["#", " ফাইল"], "other": ["#", " ফাইল"] }]],
"u3YnKw": ["শেয়ার URL তৈরি করা যায়নি।"],
diff --git a/packages/app/src/locales/bn/messages.po b/packages/app/src/locales/bn/messages.po
index 2581b9e98..1905ea92d 100644
--- a/packages/app/src/locales/bn/messages.po
+++ b/packages/app/src/locales/bn/messages.po
@@ -7494,8 +7494,8 @@ msgid "Network error — please try again"
msgstr "নেটওয়ার্ক ত্রুটি — অনুগ্রহ করে আবার চেষ্টা করুন"
#: src/components/ConnectingBanner.tsx
-msgid "network error (is `ok ui` running?)"
-msgstr "নেটওয়ার্ক ত্রুটি (`ok ui` কি চলছে?)"
+msgid "network error (is `ok start` running?)"
+msgstr "নেটওয়ার্ক ত্রুটি (`ok start` কি চলছে?)"
#: src/components/FileTree.tsx
msgid "Network error during cleanup"
@@ -8146,10 +8146,6 @@ msgstr "OK Desktop"
msgid "OK last set this folder to {0} — something outside OK changed it since. The state shown is what's on disk now; your next Symlink/Unlink wins."
msgstr "OK শেষবার এই ফোল্ডারটি {0}-এ নির্ধারণ করেছিল — এরপর OK-এর বাইরের কিছু সেটি বদলে দিয়েছে। দেখানো অবস্থাটি এখন ডিস্কে যা আছে তাই; আপনার পরবর্তী Symlink/Unlink কার্যকর হবে।"
-#: src/components/ConnectingBanner.tsx
-msgid "ok ui responded but server.lock has no port yet"
-msgstr "ok ui সাড়া দিয়েছে কিন্তু server.lock-এ এখনও কোনো পোর্ট নেই"
-
#: src/components/settings/LinkPreviewsSection.tsx
msgid "On — hovering an external link sends its URL to the destination site to fetch a preview."
msgstr "চালু — কোনো বাইরের লিংকের উপর মাউস নিলে প্রাকদর্শন আনতে তার URL গন্তব্য সাইটে পাঠানো হয়।"
@@ -12107,6 +12103,10 @@ msgstr "রিপোজিটরির মূল ক্লোন ডিরেক
msgid "The schema file does not exist or failed to load — adding a field creates it."
msgstr "স্কিমা ফাইলটি নেই বা লোড করা যায়নি — একটি ফিল্ড যোগ করলে সেটি তৈরি হয়।"
+#: src/components/ConnectingBanner.tsx
+msgid "the server responded but server.lock has no port yet"
+msgstr "সার্ভার সাড়া দিয়েছে কিন্তু server.lock-এ এখনো কোনো পোর্ট নেই"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "স্কিলের নিজের ফোল্ডার — যে উৎস থেকে অন্য জায়গাগুলো অনুলিপি করে বা লিংক করে"
diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.json
index f17474b8b..46418a817 100644
--- a/packages/app/src/locales/en/messages.json
+++ b/packages/app/src/locales/en/messages.json
@@ -189,6 +189,7 @@
"2GT3Hf": ["Global"],
"2H43L8": ["Secrets like API keys and tokens are redacted automatically."],
"2IYGkU": ["This doc has unpushed changes. Recipients will see the last pushed version."],
+ "2L8aeZ": ["network error (is `ok start` running?)"],
"2M0JF6": ["Auto-update"],
"2O5Z0r": ["Hide ", ["appName"]],
"2QM24L": ["All tags"],
@@ -1975,7 +1976,6 @@
],
"TEEPPF": ["Will replace existing OpenKnowledge entry"],
"TEJiKw": ["OpenKnowledge checked ", ["subject"]],
- "TJnkyf": ["ok ui responded but server.lock has no port yet"],
"TKQ7K-": ["Install"],
"TLIO3j": ["Toggle italic formatting."],
"TMLAx2": ["Required"],
@@ -2562,7 +2562,6 @@
"akmOT9": ["Edit this comment"],
"anmUZq": ["Missing a feature"],
"aoT2xX": ["This comment is on the whole property"],
- "aoa6xA": ["network error (is `ok ui` running?)"],
"arUUsK": ["Product updates"],
"ax9kie": ["Link preview settings not yet loaded — try again in a moment"],
"axQ1h6": ["Anything you'd like to add? (optional)"],
@@ -3935,6 +3934,7 @@
"txUHO8": [["localizedMessage"], " at line ", ["displayLine"]],
"tzGWeg": ["Preparing to uninstall OpenKnowledge"],
"tzZ6ha": ["Connect to GitHub Enterprise Server"],
+ "tz_FDV": ["the server responded but server.lock has no port yet"],
"u-9fWA": ["See <0>Architecture</0> for the system overview."],
"u3BOHd": [["fileCount", "plural", { "one": ["#", " file"], "other": ["#", " files"] }]],
"u3YnKw": ["Could not construct share URL."],
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index d0d98ee62..2d2f09a31 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -7498,8 +7498,8 @@ msgid "Network error — please try again"
msgstr "Network error — please try again"
#: src/components/ConnectingBanner.tsx
-msgid "network error (is `ok ui` running?)"
-msgstr "network error (is `ok ui` running?)"
+msgid "network error (is `ok start` running?)"
+msgstr "network error (is `ok start` running?)"
#: src/components/FileTree.tsx
msgid "Network error during cleanup"
@@ -8150,10 +8150,6 @@ msgstr "OK Desktop"
msgid "OK last set this folder to {0} — something outside OK changed it since. The state shown is what's on disk now; your next Symlink/Unlink wins."
msgstr "OK last set this folder to {0} — something outside OK changed it since. The state shown is what's on disk now; your next Symlink/Unlink wins."
-#: src/components/ConnectingBanner.tsx
-msgid "ok ui responded but server.lock has no port yet"
-msgstr "ok ui responded but server.lock has no port yet"
-
#: src/components/settings/LinkPreviewsSection.tsx
msgid "On — hovering an external link sends its URL to the destination site to fetch a preview."
msgstr "On — hovering an external link sends its URL to the destination site to fetch a preview."
@@ -12111,6 +12107,10 @@ msgstr "The repository's original clone directory"
msgid "The schema file does not exist or failed to load — adding a field creates it."
msgstr "The schema file does not exist or failed to load — adding a field creates it."
+#: src/components/ConnectingBanner.tsx
+msgid "the server responded but server.lock has no port yet"
+msgstr "the server responded but server.lock has no port yet"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "The skill's own folder — the source other locations copy or link from"
diff --git a/packages/app/src/locales/es/messages.json b/packages/app/src/locales/es/messages.json
index c3979b39f..4ead5d4ed 100644
--- a/packages/app/src/locales/es/messages.json
+++ b/packages/app/src/locales/es/messages.json
@@ -213,6 +213,7 @@
"2IYGkU": [
"Este documento tiene cambios sin subir. Quien lo reciba verá la última versión subida."
],
+ "2L8aeZ": ["error de red (¿está `ok start` en ejecución?)"],
"2M0JF6": ["Actualización automática"],
"2O5Z0r": ["Ocultar ", ["appName"]],
"2QM24L": ["Todas las etiquetas"],
@@ -2251,7 +2252,6 @@
],
"TEEPPF": ["Sustituirá la entrada existente de OpenKnowledge"],
"TEJiKw": ["OpenKnowledge revisó ", ["subject"]],
- "TJnkyf": ["ok ui respondió, pero server.lock todavía no tiene puerto"],
"TKQ7K-": ["Instalar"],
"TLIO3j": ["Activa o desactiva la cursiva."],
"TMLAx2": ["Obligatorio"],
@@ -2944,7 +2944,6 @@
"akmOT9": ["Editar este comentario"],
"anmUZq": ["Faltaba una función"],
"aoT2xX": ["Este comentario es sobre toda la propiedad"],
- "aoa6xA": ["error de red (¿está `ok ui` en marcha?)"],
"arUUsK": ["Novedades del producto"],
"ax9kie": [
"Los ajustes de vista previa de enlaces aún no se han cargado; inténtalo de nuevo en un momento"
@@ -4510,6 +4509,7 @@
"txUHO8": [["localizedMessage"], " en la línea ", ["displayLine"]],
"tzGWeg": ["Preparando la desinstalación de OpenKnowledge"],
"tzZ6ha": ["Conectar con GitHub Enterprise Server"],
+ "tz_FDV": ["el servidor respondió pero server.lock aún no tiene puerto"],
"u-9fWA": ["Consulta <0>Arquitectura</0> para ver una visión general del sistema."],
"u3BOHd": [
[
diff --git a/packages/app/src/locales/es/messages.po b/packages/app/src/locales/es/messages.po
index e0579d722..8666452f2 100644
--- a/packages/app/src/locales/es/messages.po
+++ b/packages/app/src/locales/es/messages.po
@@ -7498,8 +7498,8 @@ msgid "Network error — please try again"
msgstr "Error de red: inténtalo de nuevo"
#: src/components/ConnectingBanner.tsx
-msgid "network error (is `ok ui` running?)"
-msgstr "error de red (¿está `ok ui` en marcha?)"
+msgid "network error (is `ok start` running?)"
+msgstr "error de red (¿está `ok start` en ejecución?)"
#: src/components/FileTree.tsx
msgid "Network error during cleanup"
@@ -8150,10 +8150,6 @@ msgstr "OK Desktop"
msgid "OK last set this folder to {0} — something outside OK changed it since. The state shown is what's on disk now; your next Symlink/Unlink wins."
msgstr "La última vez OK dejó esta carpeta en {0}; algo ajeno a OK lo ha cambiado desde entonces. El estado que se muestra es el que hay ahora en el disco; tu próximo Enlazar/Desenlazar manda."
-#: src/components/ConnectingBanner.tsx
-msgid "ok ui responded but server.lock has no port yet"
-msgstr "ok ui respondió, pero server.lock todavía no tiene puerto"
-
#: src/components/settings/LinkPreviewsSection.tsx
msgid "On — hovering an external link sends its URL to the destination site to fetch a preview."
msgstr "Activada: al pasar el cursor por un enlace externo se envía su URL al sitio de destino para obtener una vista previa."
@@ -12111,6 +12107,10 @@ msgstr "El directorio del clon original del repositorio"
msgid "The schema file does not exist or failed to load — adding a field creates it."
msgstr "El archivo de esquema no existe o no se pudo cargar; al añadir un campo se crea."
+#: src/components/ConnectingBanner.tsx
+msgid "the server responded but server.lock has no port yet"
+msgstr "el servidor respondió pero server.lock aún no tiene puerto"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "La carpeta propia de la habilidad: el origen del que copian o al que enlazan las demás ubicaciones"
diff --git a/packages/app/src/locales/fr/messages.json b/packages/app/src/locales/fr/messages.json
index 60f4c8acc..d794ba1df 100644
--- a/packages/app/src/locales/fr/messages.json
+++ b/packages/app/src/locales/fr/messages.json
@@ -225,6 +225,7 @@
"2IYGkU": [
"Ce document a des modifications non poussées. Les destinataires verront la dernière version poussée."
],
+ "2L8aeZ": ["erreur réseau (`ok start` est-il en cours d'exécution ?)"],
"2M0JF6": ["Mise à jour automatique"],
"2O5Z0r": ["Masquer ", ["appName"]],
"2QM24L": ["Toutes les étiquettes"],
@@ -2284,7 +2285,6 @@
],
"TEEPPF": ["Remplacera l'entrée OpenKnowledge existante"],
"TEJiKw": ["OpenKnowledge a vérifié ", ["subject"]],
- "TJnkyf": ["ok ui a répondu mais server.lock n'a pas encore de port"],
"TKQ7K-": ["Installer"],
"TLIO3j": ["Bascule la mise en forme italique."],
"TMLAx2": ["Obligatoire"],
@@ -2982,7 +2982,6 @@
"akmOT9": ["Modifier ce commentaire"],
"anmUZq": ["Une fonctionnalité manquante"],
"aoT2xX": ["Ce commentaire porte sur toute la propriété"],
- "aoa6xA": ["erreur réseau (`ok ui` est-il en cours d'exécution ?)"],
"arUUsK": ["Nouveautés du produit"],
"ax9kie": [
"Les paramètres d'aperçu des liens ne sont pas encore chargés — réessayez dans un instant"
@@ -4568,6 +4567,7 @@
"txUHO8": [["localizedMessage"], " à la ligne ", ["displayLine"]],
"tzGWeg": ["Préparation de la désinstallation d'OpenKnowledge"],
"tzZ6ha": ["Se connecter à GitHub Enterprise Server"],
+ "tz_FDV": ["le serveur a répondu mais server.lock n'a pas encore de port"],
"u-9fWA": ["Voir <0>Architecture</0> pour la vue d'ensemble du système."],
"u3BOHd": [
[
diff --git a/packages/app/src/locales/fr/messages.po b/packages/app/src/locales/fr/messages.po
index fdb4eeefd..07cfce974 100644
--- a/packages/app/src/locales/fr/messages.po
+++ b/packages/app/src/locales/fr/messages.po
@@ -7498,8 +7498,8 @@ msgid "Network error — please try again"
msgstr "Erreur réseau — veuillez réessayer"
#: src/components/ConnectingBanner.tsx
-msgid "network error (is `ok ui` running?)"
-msgstr "erreur réseau (`ok ui` est-il en cours d'exécution ?)"
+msgid "network error (is `ok start` running?)"
+msgstr "erreur réseau (`ok start` est-il en cours d'exécution ?)"
#: src/components/FileTree.tsx
msgid "Network error during cleanup"
@@ -8150,10 +8150,6 @@ msgstr "OK Desktop"
msgid "OK last set this folder to {0} — something outside OK changed it since. The state shown is what's on disk now; your next Symlink/Unlink wins."
msgstr "OK avait réglé ce dossier sur {0} — quelque chose en dehors d'OK l'a modifié depuis. L'état affiché est celui du disque maintenant ; votre prochain Lien symbolique/Dissocier l'emportera."
-#: src/components/ConnectingBanner.tsx
-msgid "ok ui responded but server.lock has no port yet"
-msgstr "ok ui a répondu mais server.lock n'a pas encore de port"
-
#: src/components/settings/LinkPreviewsSection.tsx
msgid "On — hovering an external link sends its URL to the destination site to fetch a preview."
msgstr "Activé — survoler un lien externe envoie son URL au site de destination pour récupérer un aperçu."
@@ -12111,6 +12107,10 @@ msgstr "Le répertoire du clone d'origine du dépôt"
msgid "The schema file does not exist or failed to load — adding a field creates it."
msgstr "Le fichier de schéma n'existe pas ou n'a pas pu être chargé — ajouter un champ le crée."
+#: src/components/ConnectingBanner.tsx
+msgid "the server responded but server.lock has no port yet"
+msgstr "le serveur a répondu mais server.lock n'a pas encore de port"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "Le dossier propre à la compétence — la source depuis laquelle les autres emplacements copient ou pointent"
diff --git a/packages/app/src/locales/hi/messages.json b/packages/app/src/locales/hi/messages.json
index b2eeaa335..d9567e868 100644
--- a/packages/app/src/locales/hi/messages.json
+++ b/packages/app/src/locales/hi/messages.json
@@ -187,6 +187,7 @@
"2GT3Hf": ["वैश्विक"],
"2H43L8": ["API कुंजी और टोकन जैसी गोपनीय जानकारी अपने आप हटा दी जाती है।"],
"2IYGkU": ["इस दस्तावेज़ में बिना भेजे बदलाव हैं। पाने वालों को आख़िरी बार भेजा गया संस्करण दिखेगा।"],
+ "2L8aeZ": ["नेटवर्क त्रुटि (क्या `ok start` चल रहा है?)"],
"2M0JF6": ["स्वत: अपडेट"],
"2O5Z0r": [["appName"], " छिपाएँ"],
"2QM24L": ["सभी टैग"],
@@ -1914,7 +1915,6 @@
"TDeOpa": ["अपने ही संपादन पूर्ववत या फिर से करें, सहयोगियों और एजेंट के संपादन अपनी जगह छोड़ते हुए।"],
"TEEPPF": ["मौजूदा OpenKnowledge प्रविष्टि की जगह ले लेगा"],
"TEJiKw": ["OpenKnowledge ने ", ["subject"], " की जाँच की"],
- "TJnkyf": ["ok ui ने उत्तर दिया पर server.lock में अभी कोई पोर्ट नहीं है"],
"TKQ7K-": ["इंस्टॉल करें"],
"TLIO3j": ["तिरछी फ़ॉर्मैटिंग चालू या बंद करें।"],
"TMLAx2": ["आवश्यक"],
@@ -2490,7 +2490,6 @@
"akmOT9": ["यह टिप्पणी संपादित करें"],
"anmUZq": ["एक सुविधा अनुपस्थित"],
"aoT2xX": ["यह टिप्पणी पूरी प्रॉपर्टी पर है"],
- "aoa6xA": ["नेटवर्क त्रुटि (क्या `ok ui` चल रहा है?)"],
"arUUsK": ["उत्पाद अपडेट"],
"ax9kie": ["लिंक पूर्वावलोकन सेटिंग अभी लोड नहीं हुई — कुछ देर बाद फिर कोशिश करें"],
"axQ1h6": ["कुछ और जोड़ना चाहेंगे? (वैकल्पिक)"],
@@ -3792,6 +3791,7 @@
"txUHO8": [["displayLine"], " पंक्ति पर ", ["localizedMessage"]],
"tzGWeg": ["OpenKnowledge हटाने की तैयारी"],
"tzZ6ha": ["GitHub Enterprise Server से जोड़ें"],
+ "tz_FDV": ["सर्वर ने जवाब दिया लेकिन server.lock में अभी कोई पोर्ट नहीं है"],
"u-9fWA": ["सिस्टम के सिंहावलोकन के लिए <0>Architecture</0> देखें।"],
"u3BOHd": [["fileCount", "plural", { "one": ["#", " फ़ाइल"], "other": ["#", " फ़ाइलें"] }]],
"u3YnKw": ["साझा URL नहीं बनाया जा सका।"],
diff --git a/packages/app/src/locales/hi/messages.po b/packages/app/src/locales/hi/messages.po
index f0b2d0514..057744a02 100644
--- a/packages/app/src/locales/hi/messages.po
+++ b/packages/app/src/locales/hi/messages.po
@@ -7494,8 +7494,8 @@ msgid "Network error — please try again"
msgstr "नेटवर्क त्रुटि — कृपया फिर कोशिश करें"
#: src/components/ConnectingBanner.tsx
-msgid "network error (is `ok ui` running?)"
-msgstr "नेटवर्क त्रुटि (क्या `ok ui` चल रहा है?)"
+msgid "network error (is `ok start` running?)"
+msgstr "नेटवर्क त्रुटि (क्या `ok start` चल रहा है?)"
#: src/components/FileTree.tsx
msgid "Network error during cleanup"
@@ -8146,10 +8146,6 @@ msgstr "OK Desktop"
msgid "OK last set this folder to {0} — something outside OK changed it since. The state shown is what's on disk now; your next Symlink/Unlink wins."
msgstr "OK ने पिछली बार इस फ़ोल्डर को {0} पर सेट किया था — उसके बाद OK के बाहर किसी चीज़ ने इसे बदल दिया। दिखाई गई स्थिति वही है जो अभी डिस्क पर है; आपका अगला Symlink/Unlink प्रभावी होगा।"
-#: src/components/ConnectingBanner.tsx
-msgid "ok ui responded but server.lock has no port yet"
-msgstr "ok ui ने उत्तर दिया पर server.lock में अभी कोई पोर्ट नहीं है"
-
#: src/components/settings/LinkPreviewsSection.tsx
msgid "On — hovering an external link sends its URL to the destination site to fetch a preview."
msgstr "चालू — किसी बाहरी लिंक पर माउस ले जाने पर पूर्वावलोकन लाने के लिए उसका URL गंतव्य साइट को भेजा जाता है।"
@@ -12107,6 +12103,10 @@ msgstr "रिपॉज़िटरी की मूल क्लोन डा
msgid "The schema file does not exist or failed to load — adding a field creates it."
msgstr "स्कीमा फ़ाइल मौजूद नहीं है या लोड नहीं हो सकी — कोई फ़ील्ड जोड़ने पर वह बन जाती है।"
+#: src/components/ConnectingBanner.tsx
+msgid "the server responded but server.lock has no port yet"
+msgstr "सर्वर ने जवाब दिया लेकिन server.lock में अभी कोई पोर्ट नहीं है"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "स्किल का अपना फ़ोल्डर — वह स्रोत जिससे बाकी स्थान प्रति बनाते या लिंक करते हैं"
diff --git a/packages/app/src/locales/id/messages.json b/packages/app/src/locales/id/messages.json
index b0be4f56e..edf07b5b5 100644
--- a/packages/app/src/locales/id/messages.json
+++ b/packages/app/src/locales/id/messages.json
@@ -189,6 +189,7 @@
"2IYGkU": [
"Dokumen ini punya perubahan yang belum dikirim. Penerima akan melihat versi terakhir yang dikirim."
],
+ "2L8aeZ": ["kesalahan jaringan (apakah `ok start` sedang berjalan?)"],
"2M0JF6": ["Pembaruan otomatis"],
"2O5Z0r": ["Sembunyikan ", ["appName"]],
"2QM24L": ["Semua tag"],
@@ -1979,7 +1980,6 @@
],
"TEEPPF": ["Akan menggantikan entri OpenKnowledge yang sudah ada"],
"TEJiKw": ["OpenKnowledge memeriksa ", ["subject"]],
- "TJnkyf": ["ok ui merespons tetapi server.lock belum punya port"],
"TKQ7K-": ["Pasang"],
"TLIO3j": ["Menyalakan atau mematikan format miring."],
"TMLAx2": ["Wajib"],
@@ -2586,7 +2586,6 @@
"akmOT9": ["Sunting komentar ini"],
"anmUZq": ["Ada fitur yang kurang"],
"aoT2xX": ["Komentar ini berlaku untuk seluruh properti"],
- "aoa6xA": ["galat jaringan (apakah `ok ui` sedang berjalan?)"],
"arUUsK": ["Kabar terbaru produk"],
"ax9kie": ["Pengaturan pratinjau tautan belum dimuat — coba lagi sebentar"],
"axQ1h6": ["Ada yang ingin Anda tambahkan? (opsional)"],
@@ -3969,6 +3968,7 @@
"txUHO8": [["localizedMessage"], " pada baris ", ["displayLine"]],
"tzGWeg": ["Bersiap mencopot OpenKnowledge"],
"tzZ6ha": ["Hubungkan ke GitHub Enterprise Server"],
+ "tz_FDV": ["server merespons tetapi server.lock belum memiliki port"],
"u-9fWA": ["Lihat <0>Arsitektur</0> untuk ikhtisar sistemnya."],
"u3BOHd": [["fileCount", "plural", { "other": ["#", " berkas"] }]],
"u3YnKw": ["URL berbagi tidak dapat disusun."],
diff --git a/packages/app/src/locales/id/messages.po b/packages/app/src/locales/id/messages.po
index 4222407e5..c8eb33523 100644
--- a/packages/app/src/locales/id/messages.po
+++ b/packages/app/src/locales/id/messages.po
@@ -7494,8 +7494,8 @@ msgid "Network error — please try again"
msgstr "Galat jaringan — silakan coba lagi"
#: src/components/ConnectingBanner.tsx
-msgid "network error (is `ok ui` running?)"
-msgstr "galat jaringan (apakah `ok ui` sedang berjalan?)"
+msgid "network error (is `ok start` running?)"
+msgstr "kesalahan jaringan (apakah `ok start` sedang berjalan?)"
#: src/components/FileTree.tsx
msgid "Network error during cleanup"
@@ -8146,10 +8146,6 @@ msgstr "OK Desktop"
msgid "OK last set this folder to {0} — something outside OK changed it since. The state shown is what's on disk now; your next Symlink/Unlink wins."
msgstr "Terakhir kali OK menyetel folder ini menjadi {0} — sesuatu di luar OK mengubahnya sejak itu. Keadaan yang ditampilkan adalah apa yang ada di disk sekarang; Symlink/Lepas tautan Anda berikutnya yang menang."
-#: src/components/ConnectingBanner.tsx
-msgid "ok ui responded but server.lock has no port yet"
-msgstr "ok ui merespons tetapi server.lock belum punya port"
-
#: src/components/settings/LinkPreviewsSection.tsx
msgid "On — hovering an external link sends its URL to the destination site to fetch a preview."
msgstr "Aktif — mengarahkan kursor ke tautan eksternal mengirim URL-nya ke situs tujuan untuk mengambil pratinjau."
@@ -12107,6 +12103,10 @@ msgstr "Direktori klon asli repositori"
msgid "The schema file does not exist or failed to load — adding a field creates it."
msgstr "Berkas skemanya tidak ada atau gagal dimuat — menambahkan sebuah bidang akan membuatnya."
+#: src/components/ConnectingBanner.tsx
+msgid "the server responded but server.lock has no port yet"
+msgstr "server merespons tetapi server.lock belum memiliki port"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "Folder milik keterampilan itu sendiri — sumber tempat lokasi lain menyalin atau menaut"
diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.json
index 7e4c49977..0d0ea4f99 100644
--- a/packages/app/src/locales/pseudo/messages.json
+++ b/packages/app/src/locales/pseudo/messages.json
@@ -189,6 +189,7 @@
"2GT3Hf": ["Ĝĺōƀàĺ"],
"2H43L8": ["Śēćŕēţś ĺĩķē ÀƤĨ ķēŷś àńď ţōķēńś àŕē ŕēďàćţēď àũţōḿàţĩćàĺĺŷ."],
"2IYGkU": ["Ţĥĩś ďōć ĥàś ũńƥũśĥēď ćĥàńĝēś. Ŕēćĩƥĩēńţś ŵĩĺĺ śēē ţĥē ĺàśţ ƥũśĥēď vēŕśĩōń."],
+ "2L8aeZ": ["ńēţŵōŕķ ēŕŕōŕ (ĩś `ōķ śţàŕţ` ŕũńńĩńĝ?)"],
"2M0JF6": ["Àũţō-ũƥďàţē"],
"2O5Z0r": ["Ĥĩďē ", ["appName"]],
"2QM24L": ["Àĺĺ ţàĝś"],
@@ -1975,7 +1976,6 @@
],
"TEEPPF": ["Ŵĩĺĺ ŕēƥĺàćē ēxĩśţĩńĝ ŌƥēńĶńōŵĺēďĝē ēńţŕŷ"],
"TEJiKw": ["ŌƥēńĶńōŵĺēďĝē ćĥēćķēď ", ["subject"]],
- "TJnkyf": ["ōķ ũĩ ŕēśƥōńďēď ƀũţ śēŕvēŕ.ĺōćķ ĥàś ńō ƥōŕţ ŷēţ"],
"TKQ7K-": ["Ĩńśţàĺĺ"],
"TLIO3j": ["Ţōĝĝĺē ĩţàĺĩć ƒōŕḿàţţĩńĝ."],
"TMLAx2": ["Ŕēǫũĩŕēď"],
@@ -2562,7 +2562,6 @@
"akmOT9": ["Ēďĩţ ţĥĩś ćōḿḿēńţ"],
"anmUZq": ["Ḿĩśśĩńĝ à ƒēàţũŕē"],
"aoT2xX": ["Ţĥĩś ćōḿḿēńţ ĩś ōń ţĥē ŵĥōĺē ƥŕōƥēŕţŷ"],
- "aoa6xA": ["ńēţŵōŕķ ēŕŕōŕ (ĩś `ōķ ũĩ` ŕũńńĩńĝ?)"],
"arUUsK": ["Ƥŕōďũćţ ũƥďàţēś"],
"ax9kie": ["Ĺĩńķ ƥŕēvĩēŵ śēţţĩńĝś ńōţ ŷēţ ĺōàďēď — ţŕŷ àĝàĩń ĩń à ḿōḿēńţ"],
"axQ1h6": ["Àńŷţĥĩńĝ ŷōũ'ď ĺĩķē ţō àďď? (ōƥţĩōńàĺ)"],
@@ -3935,6 +3934,7 @@
"txUHO8": [["localizedMessage"], " àţ ĺĩńē ", ["displayLine"]],
"tzGWeg": ["Ƥŕēƥàŕĩńĝ ţō ũńĩńśţàĺĺ ŌƥēńĶńōŵĺēďĝē"],
"tzZ6ha": ["Ćōńńēćţ ţō ĜĩţĤũƀ Ēńţēŕƥŕĩśē Śēŕvēŕ"],
+ "tz_FDV": ["ţĥē śēŕvēŕ ŕēśƥōńďēď ƀũţ śēŕvēŕ.ĺōćķ ĥàś ńō ƥōŕţ ŷēţ"],
"u-9fWA": ["Śēē <0>Àŕćĥĩţēćţũŕē</0> ƒōŕ ţĥē śŷśţēḿ ōvēŕvĩēŵ."],
"u3BOHd": [["fileCount", "plural", { "one": ["#", " ƒĩĺē"], "other": ["#", " ƒĩĺēś"] }]],
"u3YnKw": ["Ćōũĺď ńōţ ćōńśţŕũćţ śĥàŕē ŨŔĹ."],
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index a520b7b78..3d244989b 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -7494,7 +7494,7 @@ msgid "Network error — please try again"
msgstr ""
#: src/components/ConnectingBanner.tsx
-msgid "network error (is `ok ui` running?)"
+msgid "network error (is `ok start` running?)"
msgstr ""
#: src/components/FileTree.tsx
@@ -8146,10 +8146,6 @@ msgstr ""
msgid "OK last set this folder to {0} — something outside OK changed it since. The state shown is what's on disk now; your next Symlink/Unlink wins."
msgstr ""
-#: src/components/ConnectingBanner.tsx
-msgid "ok ui responded but server.lock has no port yet"
-msgstr ""
-
#: src/components/settings/LinkPreviewsSection.tsx
msgid "On — hovering an external link sends its URL to the destination site to fetch a preview."
msgstr ""
@@ -12107,6 +12103,10 @@ msgstr ""
msgid "The schema file does not exist or failed to load — adding a field creates it."
msgstr ""
+#: src/components/ConnectingBanner.tsx
+msgid "the server responded but server.lock has no port yet"
+msgstr ""
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr ""
diff --git a/packages/app/src/locales/pt-BR/messages.json b/packages/app/src/locales/pt-BR/messages.json
index 41845af25..264743665 100644
--- a/packages/app/src/locales/pt-BR/messages.json
+++ b/packages/app/src/locales/pt-BR/messages.json
@@ -209,6 +209,7 @@
"2IYGkU": [
"Este documento tem alterações não enviadas. Quem receber vai ver a última versão enviada."
],
+ "2L8aeZ": ["erro de rede (o `ok start` está em execução?)"],
"2M0JF6": ["Atualização automática"],
"2O5Z0r": ["Ocultar ", ["appName"]],
"2QM24L": ["Todas as tags"],
@@ -2227,7 +2228,6 @@
],
"TEEPPF": ["Vai substituir a entrada existente do OpenKnowledge"],
"TEJiKw": ["OpenKnowledge verificou ", ["subject"]],
- "TJnkyf": ["o ok ui respondeu, mas o server.lock ainda não tem porta"],
"TKQ7K-": ["Instalar"],
"TLIO3j": ["Liga ou desliga o itálico."],
"TMLAx2": ["Obrigatório"],
@@ -2887,7 +2887,6 @@
"akmOT9": ["Editar este comentário"],
"anmUZq": ["Faltava um recurso"],
"aoT2xX": ["Este comentário é sobre a propriedade inteira"],
- "aoa6xA": ["erro de rede (o `ok ui` está rodando?)"],
"arUUsK": ["Novidades do produto"],
"ax9kie": [
"As configurações de pré-visualização de links ainda não carregaram — tente de novo em instantes"
@@ -4423,6 +4422,7 @@
"txUHO8": [["localizedMessage"], " na linha ", ["displayLine"]],
"tzGWeg": ["Preparando a desinstalação do OpenKnowledge"],
"tzZ6ha": ["Conectar ao GitHub Enterprise Server"],
+ "tz_FDV": ["o servidor respondeu, mas o server.lock ainda não tem porta"],
"u-9fWA": ["Veja <0>Arquitetura</0> para uma visão geral do sistema."],
"u3BOHd": [
[
diff --git a/packages/app/src/locales/pt-BR/messages.po b/packages/app/src/locales/pt-BR/messages.po
index 484889d04..ca7e0754a 100644
--- a/packages/app/src/locales/pt-BR/messages.po
+++ b/packages/app/src/locales/pt-BR/messages.po
@@ -7494,8 +7494,8 @@ msgid "Network error — please try again"
msgstr "Erro de rede — tente de novo"
#: src/components/ConnectingBanner.tsx
-msgid "network error (is `ok ui` running?)"
-msgstr "erro de rede (o `ok ui` está rodando?)"
+msgid "network error (is `ok start` running?)"
+msgstr "erro de rede (o `ok start` está em execução?)"
#: src/components/FileTree.tsx
msgid "Network error during cleanup"
@@ -8146,10 +8146,6 @@ msgstr "OK Desktop"
msgid "OK last set this folder to {0} — something outside OK changed it since. The state shown is what's on disk now; your next Symlink/Unlink wins."
msgstr "Da última vez o OK deixou esta pasta como {0} — algo fora do OK mudou isso desde então. O estado exibido é o que está no disco agora; o seu próximo Vincular/Desvincular prevalece."
-#: src/components/ConnectingBanner.tsx
-msgid "ok ui responded but server.lock has no port yet"
-msgstr "o ok ui respondeu, mas o server.lock ainda não tem porta"
-
#: src/components/settings/LinkPreviewsSection.tsx
msgid "On — hovering an external link sends its URL to the destination site to fetch a preview."
msgstr "Ligada — passar o cursor sobre um link externo envia a URL dele ao site de destino para buscar uma pré-visualização."
@@ -12107,6 +12103,10 @@ msgstr "O diretório do clone original do repositório"
msgid "The schema file does not exist or failed to load — adding a field creates it."
msgstr "O arquivo de esquema não existe ou falhou ao carregar — adicionar um campo o cria."
+#: src/components/ConnectingBanner.tsx
+msgid "the server responded but server.lock has no port yet"
+msgstr "o servidor respondeu, mas o server.lock ainda não tem porta"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "A pasta própria da habilidade — a fonte de onde os outros locais copiam ou para onde apontam"
diff --git a/packages/app/src/locales/ur/messages.json b/packages/app/src/locales/ur/messages.json
index 36306a51a..a8b515349 100644
--- a/packages/app/src/locales/ur/messages.json
+++ b/packages/app/src/locales/ur/messages.json
@@ -189,6 +189,7 @@
"2GT3Hf": ["عالمی"],
"2H43L8": ["API کلیدیں اور ٹوکنز جیسے راز خودکار طور پر چھپا دیے جاتے ہیں۔"],
"2IYGkU": ["اس دستاویز میں غیر پُش شدہ تبدیلیاں ہیں۔ وصول کنندگان آخری پُش شدہ ورژن دیکھیں گے۔"],
+ "2L8aeZ": ["نیٹ ورک کی خرابی (کیا `ok start` چل رہا ہے؟)"],
"2M0JF6": ["خودکار اپ ڈیٹ"],
"2O5Z0r": [["appName"], " چھپائیں"],
"2QM24L": ["تمام ٹیگز"],
@@ -2024,7 +2025,6 @@
],
"TEEPPF": ["موجودہ OpenKnowledge اندراج کی جگہ لے لے گا"],
"TEJiKw": ["OpenKnowledge نے ", ["subject"], " کی جانچ کی"],
- "TJnkyf": ["ok ui نے جواب دیا مگر server.lock میں ابھی کوئی پورٹ نہیں"],
"TKQ7K-": ["نصب کریں"],
"TLIO3j": ["ترچھی فارمیٹنگ بدلیں۔"],
"TMLAx2": ["درکار"],
@@ -2625,7 +2625,6 @@
"akmOT9": ["اس تبصرے میں ترمیم کریں"],
"anmUZq": ["ایک خصوصیت غائب ہے"],
"aoT2xX": ["یہ تبصرہ پوری خصوصیت پر ہے"],
- "aoa6xA": ["نیٹ ورک کی خرابی (کیا `ok ui` چل رہا ہے؟)"],
"arUUsK": ["مصنوعات کی اپ ڈیٹس"],
"ax9kie": ["لنک کے پیش منظر کی ترتیبات ابھی لوڈ نہیں ہوئیں — تھوڑی دیر بعد دوبارہ کوشش کریں"],
"axQ1h6": ["کچھ اور شامل کرنا چاہیں گے؟ (اختیاری)"],
@@ -3998,6 +3997,7 @@
"txUHO8": ["سطر ", ["displayLine"], " پر ", ["localizedMessage"]],
"tzGWeg": ["OpenKnowledge کی تنصیب ختم کرنے کی تیاری"],
"tzZ6ha": ["GitHub Enterprise Server سے منسلک ہوں"],
+ "tz_FDV": ["سرور نے جواب دیا مگر server.lock میں ابھی کوئی پورٹ نہیں"],
"u-9fWA": ["نظام کے جائزے کے لیے <0>Architecture</0> دیکھیں۔"],
"u3BOHd": [["fileCount", "plural", { "one": ["#", " فائل"], "other": ["#", " فائلیں"] }]],
"u3YnKw": ["شیئر URL نہیں بنایا جا سکا۔"],
diff --git a/packages/app/src/locales/ur/messages.po b/packages/app/src/locales/ur/messages.po
index 0a9c8e4e7..3440c44d8 100644
--- a/packages/app/src/locales/ur/messages.po
+++ b/packages/app/src/locales/ur/messages.po
@@ -7498,8 +7498,8 @@ msgid "Network error — please try again"
msgstr "نیٹ ورک کی خرابی — براہِ کرم دوبارہ کوشش کریں"
#: src/components/ConnectingBanner.tsx
-msgid "network error (is `ok ui` running?)"
-msgstr "نیٹ ورک کی خرابی (کیا `ok ui` چل رہا ہے؟)"
+msgid "network error (is `ok start` running?)"
+msgstr "نیٹ ورک کی خرابی (کیا `ok start` چل رہا ہے؟)"
#: src/components/FileTree.tsx
msgid "Network error during cleanup"
@@ -8150,10 +8150,6 @@ msgstr "OK Desktop"
msgid "OK last set this folder to {0} — something outside OK changed it since. The state shown is what's on disk now; your next Symlink/Unlink wins."
msgstr "OK نے آخری بار اس فولڈر کو {0} مقرر کیا تھا — اس کے بعد OK سے باہر کسی چیز نے اسے بدل دیا۔ دکھائی گئی حالت وہی ہے جو اب ڈسک پر ہے؛ آپ کا اگلا سِم لنک یا لنک ختم کرنا فیصلہ کن ہو گا۔"
-#: src/components/ConnectingBanner.tsx
-msgid "ok ui responded but server.lock has no port yet"
-msgstr "ok ui نے جواب دیا مگر server.lock میں ابھی کوئی پورٹ نہیں"
-
#: src/components/settings/LinkPreviewsSection.tsx
msgid "On — hovering an external link sends its URL to the destination site to fetch a preview."
msgstr "فعال — بیرونی لنک پر ماؤس لے جانے سے اس کا URL پیش منظر لانے کے لیے منزل کی سائٹ کو بھیجا جاتا ہے۔"
@@ -12111,6 +12107,10 @@ msgstr "ریپازٹری کی اصل کلون ڈائریکٹری"
msgid "The schema file does not exist or failed to load — adding a field creates it."
msgstr "اسکیما فائل موجود نہیں یا لوڈ نہیں ہو سکی — فیلڈ شامل کرنے سے یہ بن جاتی ہے۔"
+#: src/components/ConnectingBanner.tsx
+msgid "the server responded but server.lock has no port yet"
+msgstr "سرور نے جواب دیا مگر server.lock میں ابھی کوئی پورٹ نہیں"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "مہارت کا اپنا فولڈر — وہ ماخذ جس سے دیگر مقامات نقل کرتے یا جڑتے ہیں"
diff --git a/packages/app/src/locales/zh-Hans/messages.json b/packages/app/src/locales/zh-Hans/messages.json
index e08053199..ac4c3a10b 100644
--- a/packages/app/src/locales/zh-Hans/messages.json
+++ b/packages/app/src/locales/zh-Hans/messages.json
@@ -174,6 +174,7 @@
"2GT3Hf": ["全局"],
"2H43L8": ["API 密钥、令牌等机密内容会自动隐去。"],
"2IYGkU": ["这个文档有未推送的改动。接收方看到的会是最后一次推送的版本。"],
+ "2L8aeZ": ["网络错误(`ok start` 在运行吗?)"],
"2M0JF6": ["自动更新"],
"2O5Z0r": ["隐藏 ", ["appName"]],
"2QM24L": ["所有标签"],
@@ -1748,7 +1749,6 @@
"TDeOpa": ["撤销或重做你自己的编辑,协作者和智能体的编辑保持不变。"],
"TEEPPF": ["将替换已有的 OpenKnowledge 条目"],
"TEJiKw": ["OpenKnowledge 检查了 ", ["subject"]],
- "TJnkyf": ["ok ui 有响应,但 server.lock 中还没有端口"],
"TKQ7K-": ["安装"],
"TLIO3j": ["切换斜体格式。"],
"TMLAx2": ["必填"],
@@ -2292,7 +2292,6 @@
"akmOT9": ["编辑这条评论"],
"anmUZq": ["缺少某个功能"],
"aoT2xX": ["这条评论针对的是整个属性"],
- "aoa6xA": ["网络错误(`ok ui` 在运行吗?)"],
"arUUsK": ["产品动态"],
"ax9kie": ["链接预览设置尚未加载——请稍后再试"],
"axQ1h6": ["还有什么想补充的吗?(可选)"],
@@ -3491,6 +3490,7 @@
"txUHO8": ["第 ", ["displayLine"], " 行:", ["localizedMessage"]],
"tzGWeg": ["正在准备卸载 OpenKnowledge"],
"tzZ6ha": ["连接到 GitHub Enterprise Server"],
+ "tz_FDV": ["服务器有响应,但 server.lock 中还没有端口"],
"u-9fWA": ["系统总览见<0>架构</0>。"],
"u3BOHd": [["fileCount", "plural", { "other": ["#", " 个文件"] }]],
"u3YnKw": ["无法构建共享 URL。"],
diff --git a/packages/app/src/locales/zh-Hans/messages.po b/packages/app/src/locales/zh-Hans/messages.po
index c95d44704..bc885e395 100644
--- a/packages/app/src/locales/zh-Hans/messages.po
+++ b/packages/app/src/locales/zh-Hans/messages.po
@@ -7498,8 +7498,8 @@ msgid "Network error — please try again"
msgstr "网络错误——请重试"
#: src/components/ConnectingBanner.tsx
-msgid "network error (is `ok ui` running?)"
-msgstr "网络错误(`ok ui` 在运行吗?)"
+msgid "network error (is `ok start` running?)"
+msgstr "网络错误(`ok start` 在运行吗?)"
#: src/components/FileTree.tsx
msgid "Network error during cleanup"
@@ -8150,10 +8150,6 @@ msgstr "OK 桌面版"
msgid "OK last set this folder to {0} — something outside OK changed it since. The state shown is what's on disk now; your next Symlink/Unlink wins."
msgstr "OK 上次把这个文件夹设为 {0}——此后 OK 之外的操作改动过它。显示的是磁盘上现在的状态;你下一次的「符号链接/取消链接」会覆盖它。"
-#: src/components/ConnectingBanner.tsx
-msgid "ok ui responded but server.lock has no port yet"
-msgstr "ok ui 有响应,但 server.lock 中还没有端口"
-
#: src/components/settings/LinkPreviewsSection.tsx
msgid "On — hovering an external link sends its URL to the destination site to fetch a preview."
msgstr "开启——把鼠标悬停在外部链接上时,会把它的 URL 发送到目标站点以获取预览。"
@@ -12111,6 +12107,10 @@ msgstr "仓库的原始克隆目录"
msgid "The schema file does not exist or failed to load — adding a field creates it."
msgstr "架构文件不存在或加载失败——添加字段会自动创建它。"
+#: src/components/ConnectingBanner.tsx
+msgid "the server responded but server.lock has no port yet"
+msgstr "服务器有响应,但 server.lock 中还没有端口"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "技能自己的文件夹——其他位置从这里复制或链接"
diff --git a/packages/app/src/locales/zh-Hant/messages.json b/packages/app/src/locales/zh-Hant/messages.json
index b1e8436d4..2c5d2d793 100644
--- a/packages/app/src/locales/zh-Hant/messages.json
+++ b/packages/app/src/locales/zh-Hant/messages.json
@@ -176,6 +176,7 @@
"2GT3Hf": ["全域"],
"2H43L8": ["API 金鑰、權杖之類的機密內容會自動遮蔽。"],
"2IYGkU": ["這份文件有尚未推送的變更。收到的人看到的會是最後一次推送的版本。"],
+ "2L8aeZ": ["網路錯誤(`ok start` 有在執行嗎?)"],
"2M0JF6": ["自動更新"],
"2O5Z0r": ["隱藏 ", ["appName"]],
"2QM24L": ["所有標籤"],
@@ -1768,7 +1769,6 @@
"TDeOpa": ["復原或重做你自己的編輯,協作者和代理的編輯維持不變。"],
"TEEPPF": ["會取代既有的 OpenKnowledge 項目"],
"TEJiKw": ["OpenKnowledge 檢查了 ", ["subject"]],
- "TJnkyf": ["ok ui 有回應,但 server.lock 裡還沒有連接埠"],
"TKQ7K-": ["安裝"],
"TLIO3j": ["切換斜體格式。"],
"TMLAx2": ["必填"],
@@ -2312,7 +2312,6 @@
"akmOT9": ["編輯這則註解"],
"anmUZq": ["缺少某個功能"],
"aoT2xX": ["這則註解是針對整個屬性的"],
- "aoa6xA": ["網路錯誤(`ok ui` 有在執行嗎?)"],
"arUUsK": ["產品動態"],
"ax9kie": ["連結預覽設定尚未載入——請稍候再試"],
"axQ1h6": ["還有什麼想補充的嗎?(選填)"],
@@ -3517,6 +3516,7 @@
"txUHO8": ["第 ", ["displayLine"], " 行:", ["localizedMessage"]],
"tzGWeg": ["正在準備解除安裝 OpenKnowledge"],
"tzZ6ha": ["連接到 GitHub Enterprise Server"],
+ "tz_FDV": ["伺服器有回應,但 server.lock 裡還沒有連接埠"],
"u-9fWA": ["系統總覽見<0>架構</0>。"],
"u3BOHd": [["fileCount", "plural", { "other": ["#", " 個檔案"] }]],
"u3YnKw": ["無法組出分享 URL。"],
diff --git a/packages/app/src/locales/zh-Hant/messages.po b/packages/app/src/locales/zh-Hant/messages.po
index 83b055bf0..70dfd590a 100644
--- a/packages/app/src/locales/zh-Hant/messages.po
+++ b/packages/app/src/locales/zh-Hant/messages.po
@@ -7498,8 +7498,8 @@ msgid "Network error — please try again"
msgstr "網路錯誤——請再試一次"
#: src/components/ConnectingBanner.tsx
-msgid "network error (is `ok ui` running?)"
-msgstr "網路錯誤(`ok ui` 有在執行嗎?)"
+msgid "network error (is `ok start` running?)"
+msgstr "網路錯誤(`ok start` 有在執行嗎?)"
#: src/components/FileTree.tsx
msgid "Network error during cleanup"
@@ -8150,10 +8150,6 @@ msgstr "OK 桌面版"
msgid "OK last set this folder to {0} — something outside OK changed it since. The state shown is what's on disk now; your next Symlink/Unlink wins."
msgstr "OK 上次把這個資料夾設為 {0}——之後 OK 以外的東西改動過它。顯示的是磁碟上現在的狀態;你下一次的「符號連結/取消連結」會覆蓋它。"
-#: src/components/ConnectingBanner.tsx
-msgid "ok ui responded but server.lock has no port yet"
-msgstr "ok ui 有回應,但 server.lock 裡還沒有連接埠"
-
#: src/components/settings/LinkPreviewsSection.tsx
msgid "On — hovering an external link sends its URL to the destination site to fetch a preview."
msgstr "開啟——把游標停在外部連結上時,會把它的 URL 送到目標網站以取得預覽。"
@@ -12111,6 +12107,10 @@ msgstr "儲存庫的原始複製目錄"
msgid "The schema file does not exist or failed to load — adding a field creates it."
msgstr "結構描述檔案不存在或載入失敗——新增欄位就會建立它。"
+#: src/components/ConnectingBanner.tsx
+msgid "the server responded but server.lock has no port yet"
+msgstr "伺服器有回應,但 server.lock 裡還沒有連接埠"
+
#: src/components/SkillInstallMenu.tsx
msgid "The skill's own folder — the source other locations copy or link from"
msgstr "技能自己的資料夾——其他位置從這裡複製或連結"
diff --git a/packages/app/tests/integration/conflict-aware-write-surfaces.test.ts b/packages/app/tests/integration/conflict-aware-write-surfaces.test.ts
index 7ab3933e8..c7d2a48cb 100644
--- a/packages/app/tests/integration/conflict-aware-write-surfaces.test.ts
+++ b/packages/app/tests/integration/conflict-aware-write-surfaces.test.ts
@@ -731,7 +731,6 @@ describeBoot('FR14: boot-time lifecycle restoration from conflicts.json', () =>
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
cleanups.push(() => booted.destroy());
diff --git a/packages/app/tests/integration/idle-shutdown-multi-client.test.ts b/packages/app/tests/integration/idle-shutdown-multi-client.test.ts
index 54da3d709..3439ef4ea 100644
--- a/packages/app/tests/integration/idle-shutdown-multi-client.test.ts
+++ b/packages/app/tests/integration/idle-shutdown-multi-client.test.ts
@@ -54,7 +54,6 @@ beforeAll(async () => {
quiet: true,
gitEnabled: false,
skipAutoInit: true,
- attachUiSibling: false,
idleShutdownMs: IDLE_SHUTDOWN_MS,
});
lockPath = resolve(contentDir, OK_DIR, LOCAL_DIR, 'server.lock');
diff --git a/packages/app/tests/integration/worktree-boot.test.ts b/packages/app/tests/integration/worktree-boot.test.ts
index beeaaac8e..a417c3909 100644
--- a/packages/app/tests/integration/worktree-boot.test.ts
+++ b/packages/app/tests/integration/worktree-boot.test.ts
@@ -42,7 +42,6 @@ describe('bootServer in a linked git worktree (FR2)', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
// Shadow init is async — runs inside `ready` (createServer's initAsync).
@@ -75,7 +74,6 @@ describe('bootServer pre-listen check in a linked worktree (FR3)', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
} catch (err) {
caught = err;
@@ -104,7 +102,6 @@ describe('bootServer pre-listen check in a linked worktree (FR3)', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
} catch (err) {
caught = err;
@@ -136,7 +133,6 @@ describe('bootServer pre-listen check in a linked worktree (FR3)', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
const bootWarnings = warnSpy.mock.calls
.map((call) => String(call[1] ?? ''))
@@ -189,7 +185,6 @@ describe('bootServer ok.boot span attributes against a real linked worktree', ()
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
const spans = exporter?.getFinishedSpans() ?? [];
@@ -256,7 +251,6 @@ describe('bootServer pre-listen check on main worktree (FR3)', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
} catch (err) {
caught = err;
@@ -287,7 +281,6 @@ describe('bootServer pre-listen check on main worktree (FR3)', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
} catch (err) {
caught = err;
diff --git a/packages/app/tests/integration/worktree-cleanup-and-stale-pointer.test.ts b/packages/app/tests/integration/worktree-cleanup-and-stale-pointer.test.ts
index 6c67c7c2f..4b9c4fd88 100644
--- a/packages/app/tests/integration/worktree-cleanup-and-stale-pointer.test.ts
+++ b/packages/app/tests/integration/worktree-cleanup-and-stale-pointer.test.ts
@@ -44,7 +44,6 @@ describe('git worktree remove cleans up the per-worktree shadow (FR6)', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
await booted.ready;
expect(existsSync(shadowHead)).toBe(true);
@@ -94,7 +93,6 @@ describe('MalformedGitPointerError at boot when .git pointer is stale (FR7)', ()
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
} catch (err) {
caught = err;
@@ -119,7 +117,6 @@ describe('MalformedGitPointerError at boot when .git pointer is stale (FR7)', ()
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
await booted.ready;
@@ -152,7 +149,6 @@ describe('MalformedGitPointerError at boot when .git pointer is stale (FR7)', ()
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
} catch (err) {
firstAttemptError = err;
@@ -180,7 +176,6 @@ describe('MalformedGitPointerError at boot when .git pointer is stale (FR7)', ()
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
await booted.ready;
diff --git a/packages/app/tests/integration/worktree-concurrent.test.ts b/packages/app/tests/integration/worktree-concurrent.test.ts
index 2ecaae989..2fa613bfa 100644
--- a/packages/app/tests/integration/worktree-concurrent.test.ts
+++ b/packages/app/tests/integration/worktree-concurrent.test.ts
@@ -46,7 +46,6 @@ describe('Two linked worktrees boot in parallel with isolated state (D13)', () =
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
}),
bootServer({
host: '127.0.0.1',
@@ -56,7 +55,6 @@ describe('Two linked worktrees boot in parallel with isolated state (D13)', () =
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
}),
]);
diff --git a/packages/app/tests/integration/worktree-init.test.ts b/packages/app/tests/integration/worktree-init.test.ts
index cd778555e..225af8d3c 100644
--- a/packages/app/tests/integration/worktree-init.test.ts
+++ b/packages/app/tests/integration/worktree-init.test.ts
@@ -71,7 +71,6 @@ describe('initContent in a linked worktree (FR4 / D7)', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
await booted.ready;
diff --git a/packages/cli/src/cli.test.ts b/packages/cli/src/cli.test.ts
index 8163f394a..61d5f5aa7 100644
--- a/packages/cli/src/cli.test.ts
+++ b/packages/cli/src/cli.test.ts
@@ -40,6 +40,32 @@ describe('CLI argv parsing', () => {
}, 30_000);
});
+describe('ok ui tombstone', () => {
+ test('`ok ui` prints the removal pointer and exits non-zero (not the default-command arity error)', () => {
+ const result = Bun.spawnSync({
+ cmd: [
+ 'node',
+ '--import',
+ 'tsx',
+ '--conditions=development',
+ '-e',
+ `
+ process.argv = [process.execPath, process.cwd() + '/src/cli.ts', 'ui', '--port', '39847'];
+ await import('./src/cli.ts');
+ `,
+ ],
+ cwd: CLI_PACKAGE_ROOT,
+ env: { ...process.env, NO_COLOR: '1' },
+ });
+
+ const stderr = result.stderr.toString();
+ expect(result.exitCode).toBe(1);
+ expect(stderr).toContain('`ok ui` was removed');
+ expect(stderr).toContain('ok start');
+ expect(stderr).not.toContain('too many arguments');
+ }, 30_000);
+});
+
describe('CLI --version notice', () => {
test('--version emits the version plus the GPL copyright / free-software / no-warranty trio', () => {
// Exercises the wired surface — `.version(buildVersionNotice(...))` in cli.ts
diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts
index dd2081fc4..b7bea6998 100644
--- a/packages/cli/src/cli.ts
+++ b/packages/cli/src/cli.ts
@@ -69,7 +69,6 @@ import { runStartCommand, startCommand } from './commands/start.ts';
import { statusCommand } from './commands/status.ts';
import { stopCommand } from './commands/stop.ts';
import { syncCommand } from './commands/sync.ts';
-import { uiCommand } from './commands/ui.ts';
import { uninstallCommand } from './commands/uninstall.ts';
import { PACKAGE_VERSION } from './constants.ts';
import { loadConfig } from './index.ts';
@@ -256,10 +255,23 @@ program.addCommand(lintCommand(() => resolvedConfig));
// the running project server; CLI sibling of the `audit` MCP tool
program.addCommand(auditCommand(() => resolvedConfig));
-// ui command — deprecated sibling UI server; kept functional for the Desktop
-// version-skew window (plain `ok start` now serves the UI itself).
-const ui = uiCommand(() => resolvedConfig);
-program.addCommand(ui);
+// ui command tombstone — `ok ui` (the sibling UI server) was removed; the
+// project server serves the editor itself. Without this stub the argv falls
+// through to the default command's arity error ("too many arguments"), which
+// tells a user with the old command in muscle memory (or a stale script)
+// nothing actionable. Hidden from --help; drop at the removed-command horizon.
+const uiTombstone = new Command('ui')
+ .description('Removed: the editor UI is served by `ok start`')
+ .allowUnknownOption()
+ .allowExcessArguments()
+ .argument('[args...]')
+ .action(() => {
+ console.error(
+ '`ok ui` was removed — the editor UI is served by the project server. Run `ok start` instead.',
+ );
+ process.exit(1);
+ });
+program.addCommand(uiTombstone, { hidden: true });
// open command — open a doc in the OK Desktop app (folders open in the
// browser). The action for the no-preview-browser rung of the skill's
diff --git a/packages/cli/src/commands/open.ts b/packages/cli/src/commands/open.ts
index abdc7e5dc..3c070ec65 100644
--- a/packages/cli/src/commands/open.ts
+++ b/packages/cli/src/commands/open.ts
@@ -118,7 +118,7 @@ function isUnsafeName(name: string): boolean {
function noTargetError(deps: OpenDeps): number {
deps.error(
'No OpenKnowledge desktop app found and no UI is running. ' +
- 'Install OK Desktop, or start a UI with `ok ui`, then retry.',
+ 'Install OK Desktop, or run `ok start` to serve the editor, then retry.',
);
return 1;
}
diff --git a/packages/cli/src/commands/self-spawn.ts b/packages/cli/src/commands/self-spawn.ts
index 017ef0aa2..58d33a262 100644
--- a/packages/cli/src/commands/self-spawn.ts
+++ b/packages/cli/src/commands/self-spawn.ts
@@ -14,7 +14,6 @@
*
* Call sites:
* - `ok mcp` spawning `ok start` (MCP-mediated auto-start)
- * - `ok start` spawning `ok ui` (sibling UI at startup)
*
* Packaged-Electron Dock-tile redirect: when the current process is the
* packaged macOS app's Electron main binary, a detached spawn of
@@ -88,7 +87,7 @@ export interface ResolveSelfSpawnDeps {
/**
* Returns the `(command, prefixArgs)` pair that re-invokes the current CLI.
- * The caller appends subcommand-specific args (e.g. `['start']`, `['ui']`).
+ * The caller appends subcommand-specific args (e.g. `['start']`).
*/
export function resolveSelfSpawn(deps: ResolveSelfSpawnDeps = {}): {
command: string;
@@ -117,7 +116,7 @@ export function resolveSelfSpawn(deps: ResolveSelfSpawnDeps = {}): {
// `repair-mcp-configs.ts` / `repair-launch-json.ts`) so the engine-aware
// sort in npm's `npm-pick-manifest` can't silently route the sibling
// process to a years-stale release. `-y` suppresses the install-confirm
- // prompt under the non-TTY spawn paths (MCP shim, `spawnOkUi`). The
+ // prompt under the non-TTY spawn paths (MCP shim). The
// cross-version-pairing surface that re-exec was fixing still applies —
// pinning only closes the silent-downgrade half, the registry round-trip
// remains.
diff --git a/packages/cli/src/commands/start.test.ts b/packages/cli/src/commands/start.test.ts
index 35670bc66..350df5971 100644
--- a/packages/cli/src/commands/start.test.ts
+++ b/packages/cli/src/commands/start.test.ts
@@ -1,14 +1,13 @@
import type { spawn as NativeSpawn } from 'node:child_process';
-import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
+import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
import { mkdtemp, rm } from 'node:fs/promises';
import { request as httpRequest } from 'node:http';
-import { hostname, tmpdir } from 'node:os';
+import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { setTimeout as wait } from 'node:timers/promises';
import {
applyConfigOverlay,
idleShutdownToMs,
- LOCAL_DIR,
requiresExternalConsent,
resolveEnvConfigLayer,
resolveServerRuntimeConfig,
@@ -16,14 +15,9 @@ import {
import { type Config, ConfigSchema } from '@inkeep/open-knowledge-server';
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
import {
- awaitUiSiblingPort,
type BootedStartServer,
bootStartServer,
- buildIdleShutdownHandler,
coerceRemoteBindHost,
- computeConnectExitCode,
- connectUiSibling,
- decideUiSpawn,
deriveServerProcessTitle,
expandRemoteAlias,
formatServerReuseNotice,
@@ -41,18 +35,13 @@ import {
resolveStartConsoleLevel,
resolveStartShellDir,
scopeRemoteAliasConsentToBind,
- shouldConnectToExistingServer,
shouldOpenBrowser,
shouldWarnHostOverridesMultiBind,
- spawnOkUi,
startCommand,
- teardownUiSibling,
tryDescribeLockCollision,
- type UiSpawnDecision,
withEphemeralTempDirReap,
withIdleShutdownProcessExit,
} from './start.ts';
-import { closeHttpServers, startUiServer, type UiServerHandle } from './ui.ts';
describe('resolveHost', () => {
test('returns --host flag when --bind is absent (second priority, after --bind)', () => {
@@ -310,424 +299,6 @@ describe('deriveServerProcessTitle', () => {
});
});
-describe('decideUiSpawn', () => {
- test('absent lock → spawn(absent)', () => {
- const result = decideUiSpawn({ uiLock: null, isAlive: () => true });
- expect(result).toEqual<UiSpawnDecision>({ action: 'spawn', reason: 'absent' });
- });
-
- test('lock with dead pid → spawn(stale)', () => {
- const result = decideUiSpawn({
- uiLock: { pid: 999999, port: 3000 },
- isAlive: () => false,
- });
- expect(result).toEqual<UiSpawnDecision>({
- action: 'spawn',
- reason: 'stale',
- stalePid: 999999,
- });
- });
-
- test('lock with live pid → skip(alive)', () => {
- const result = decideUiSpawn({
- uiLock: { pid: 4242, port: 3001 },
- isAlive: (pid) => pid === 4242,
- });
- expect(result).toEqual<UiSpawnDecision>({
- action: 'skip',
- reason: 'alive',
- pid: 4242,
- port: 3001,
- });
- });
-
- test('isAlive probe receives the lock pid', () => {
- const seen: number[] = [];
- decideUiSpawn({
- uiLock: { pid: 7777, port: 3000 },
- isAlive: (pid) => {
- seen.push(pid);
- return true;
- },
- });
- expect(seen).toEqual([7777]);
- });
-});
-
-describe('buildIdleShutdownHandler', () => {
- test('SIGTERMs UI sibling; if it exits within grace, awaits destroy', async () => {
- const events: string[] = [];
- // Simulate a well-behaved UI: stays alive initially, exits after SIGTERM.
- let alive = true;
- const onShutdown = buildIdleShutdownHandler({
- readUiLock: () => ({ pid: 1234, port: 3000 }),
- spawnedUiPid: () => 1234,
- isAlive: () => alive,
- killPid: (pid, sig) => {
- events.push(`kill:${pid}:${sig}`);
- if (sig === 'SIGTERM') alive = false;
- },
- destroy: async () => {
- events.push('destroy');
- },
- sigtermGraceMs: 100,
- sigtermPollIntervalMs: 5,
- sleep: async () => {},
- });
- await onShutdown();
- expect(events).toEqual(['kill:1234:SIGTERM', 'destroy']);
- });
-
- test('escalates to SIGKILL when SIGTERM grace expires', async () => {
- const events: string[] = [];
- // Simulate a wedged UI: stays alive through SIGTERM, never exits.
- const warned: object[] = [];
- const onShutdown = buildIdleShutdownHandler({
- readUiLock: () => ({ pid: 1234, port: 3000 }),
- spawnedUiPid: () => 1234,
- isAlive: () => true,
- killPid: (pid, sig) => {
- events.push(`kill:${pid}:${sig}`);
- },
- destroy: async () => {
- events.push('destroy');
- },
- sigtermGraceMs: 20,
- sigtermPollIntervalMs: 5,
- sleep: async () => {},
- log: {
- info: () => {},
- warn: (obj) => warned.push(obj),
- error: () => {},
- },
- });
- await onShutdown();
- expect(events).toEqual(['kill:1234:SIGTERM', 'kill:1234:SIGKILL', 'destroy']);
- expect(warned.find((w) => (w as { pid?: number }).pid === 1234)).toBeDefined();
- });
-
- test('skips kill when UI lock absent', async () => {
- const events: string[] = [];
- const onShutdown = buildIdleShutdownHandler({
- readUiLock: () => null,
- spawnedUiPid: () => 1234,
- isAlive: () => true,
- killPid: (pid, sig) => events.push(`kill:${pid}:${sig}`),
- destroy: async () => {
- events.push('destroy');
- },
- });
- await onShutdown();
- expect(events).toEqual(['destroy']);
- });
-
- test('skips kill when UI process is dead (stale lock)', async () => {
- const events: string[] = [];
- const onShutdown = buildIdleShutdownHandler({
- readUiLock: () => ({ pid: 4242, port: 3000 }),
- spawnedUiPid: () => 4242,
- isAlive: () => false,
- killPid: (pid, sig) => events.push(`kill:${pid}:${sig}`),
- destroy: async () => {
- events.push('destroy');
- },
- });
- await onShutdown();
- expect(events).toEqual(['destroy']);
- });
-
- test('still calls destroy when killPid throws', async () => {
- const events: string[] = [];
- const warned: object[] = [];
- const onShutdown = buildIdleShutdownHandler({
- readUiLock: () => ({ pid: 4242, port: 3000 }),
- spawnedUiPid: () => 4242,
- isAlive: () => true,
- killPid: () => {
- throw new Error('EPERM');
- },
- destroy: async () => {
- events.push('destroy');
- },
- log: {
- info: () => {},
- warn: (obj) => warned.push(obj),
- error: () => {},
- },
- });
- await onShutdown();
- expect(events).toEqual(['destroy']);
- expect(warned[0]).toMatchObject({ pid: 4242 });
- });
-
- test('still calls destroy when readUiLock throws', async () => {
- const events: string[] = [];
- const onShutdown = buildIdleShutdownHandler({
- readUiLock: () => {
- throw new Error('lock read failed');
- },
- spawnedUiPid: () => null,
- isAlive: () => true,
- killPid: () => {},
- destroy: async () => {
- events.push('destroy');
- },
- log: { info: () => {}, warn: () => {}, error: () => {} },
- });
- await onShutdown();
- expect(events).toEqual(['destroy']);
- });
-
- test('leaves a live ui.lock holder alone when this process spawned no sibling', async () => {
- // The incident shape: a stale server goes WS-idle while a desktop-spawned
- // server (which advertises ITS OWN pid in ui.lock while serving the React
- // shell) is live with active clients. The stale server must not kill it.
- const events: string[] = [];
- const infos: object[] = [];
- const onShutdown = buildIdleShutdownHandler({
- readUiLock: () => ({ pid: 52425, port: 64430 }),
- spawnedUiPid: () => null,
- isAlive: () => true,
- killPid: (pid, sig) => events.push(`kill:${pid}:${sig}`),
- destroy: async () => {
- events.push('destroy');
- },
- log: {
- info: (obj) => infos.push(obj),
- warn: () => {},
- error: () => {},
- },
- });
- await onShutdown();
- expect(events).toEqual(['destroy']);
- expect(infos.find((entry) => (entry as { pid?: number }).pid === 52425)).toBeDefined();
- });
-
- test('leaves a live ui.lock holder alone when it is not the spawned sibling', async () => {
- // Our spawned sibling died and another process now holds the lock (or the
- // lock was rewritten by a newer session). Not ours — leave it alone.
- const events: string[] = [];
- const onShutdown = buildIdleShutdownHandler({
- readUiLock: () => ({ pid: 9999, port: 3000 }),
- spawnedUiPid: () => 1234,
- isAlive: () => true,
- killPid: (pid, sig) => events.push(`kill:${pid}:${sig}`),
- destroy: async () => {
- events.push('destroy');
- },
- log: { info: () => {}, warn: () => {}, error: () => {} },
- });
- await onShutdown();
- expect(events).toEqual(['destroy']);
- });
-});
-
-describe('teardownUiSibling (signal-driven ok start teardown)', () => {
- test('SIGTERMs the owned sibling and returns once it exits within grace', async () => {
- const events: string[] = [];
- let alive = true;
- await teardownUiSibling({
- readUiLock: () => ({ pid: 1234, port: 3000 }),
- spawnedUiPid: () => 1234,
- isAlive: () => alive,
- killPid: (pid, sig) => {
- events.push(`kill:${pid}:${sig}`);
- if (sig === 'SIGTERM') alive = false;
- },
- sigtermGraceMs: 100,
- sigtermPollIntervalMs: 5,
- sleep: async () => {},
- reason: 'shutdown',
- });
- expect(events).toEqual(['kill:1234:SIGTERM']);
- });
-
- test('escalates to SIGKILL when the owned sibling ignores SIGTERM', async () => {
- const events: string[] = [];
- await teardownUiSibling({
- readUiLock: () => ({ pid: 1234, port: 3000 }),
- spawnedUiPid: () => 1234,
- isAlive: () => true,
- killPid: (pid, sig) => events.push(`kill:${pid}:${sig}`),
- sigtermGraceMs: 20,
- sigtermPollIntervalMs: 5,
- sleep: async () => {},
- reason: 'shutdown',
- });
- expect(events).toEqual(['kill:1234:SIGTERM', 'kill:1234:SIGKILL']);
- });
-
- // The regression guard: on the signal path too, a live ui.lock holder that is
- // NOT the pid we spawned must be left untouched. This is the exact incident
- // (a stale/idle server SIGTERMing a live desktop-spawned or other-session
- // server that merely holds ui.lock) the spawnedUiPid guard exists to prevent.
- test('leaves a live ui.lock holder alone when it is not the spawned sibling', async () => {
- const events: string[] = [];
- const infos: object[] = [];
- await teardownUiSibling({
- readUiLock: () => ({ pid: 9999, port: 3000 }),
- spawnedUiPid: () => 1234,
- isAlive: () => true,
- killPid: (pid, sig) => events.push(`kill:${pid}:${sig}`),
- log: { info: (obj) => infos.push(obj), warn: () => {}, error: () => {} },
- reason: 'shutdown',
- });
- expect(events).toEqual([]);
- expect(infos.find((entry) => (entry as { pid?: number }).pid === 9999)).toBeDefined();
- });
-
- // Defense-in-depth: even if a null ownPid reaches teardownUiSibling (the
- // signal handler's `!== null` guard means it normally can't), a live lock
- // holder routes through the ownership-guard "leave it alone" branch — a null
- // ownPid never equals a real pid — so nothing is killed.
- test('leaves a live lock holder alone when ownPid is null (routes through the ownership guard)', async () => {
- const events: string[] = [];
- await teardownUiSibling({
- readUiLock: () => ({ pid: 52425, port: 64430 }),
- spawnedUiPid: () => null,
- isAlive: () => true,
- killPid: (pid, sig) => events.push(`kill:${pid}:${sig}`),
- log: { info: () => {}, warn: () => {}, error: () => {} },
- reason: 'shutdown',
- });
- expect(events).toEqual([]);
- });
-});
-
-describe('spawnOkUi', () => {
- let tmpDir: string;
- let lockDir: string;
-
- beforeEach(async () => {
- tmpDir = await mkdtemp(resolve(tmpdir(), 'ok-start-spawnui-'));
- lockDir = resolve(tmpDir, '.ok', LOCAL_DIR);
- });
- afterEach(async () => {
- await rm(tmpDir, { recursive: true, force: true });
- });
-
- test('creates lockDir if missing and opens last-spawn-error.log', () => {
- const calls: Array<{ cmd: string; args: readonly string[]; opts: object }> = [];
- spawnOkUi({
- lockDir,
- cwd: tmpDir,
- // biome-ignore lint/suspicious/noExplicitAny: minimal mock matches ChildProcess shape
- spawn: ((cmd: string, args: readonly string[], opts: any) => {
- calls.push({ cmd, args, opts });
- return { unref: () => {}, on: () => {}, kill: () => {} } as unknown as ReturnType<
- typeof spawnOkUi
- >;
- }) as never,
- });
-
- expect(existsSync(lockDir)).toBe(true);
- expect(existsSync(join(lockDir, 'last-spawn-error.log'))).toBe(true);
- expect(calls.length).toBe(1);
- // Re-exec via the current CLI binary (not npx) — see self-spawn.ts.
- expect(calls[0]?.cmd).toBe(process.execPath);
- const callArgs = calls[0]?.args ?? [];
- expect(callArgs[callArgs.length - 1]).toBe('ui');
- });
-
- test('passes detached + ignore stdio + cwd to spawn', () => {
- const calls: Array<{ opts: { detached?: boolean; cwd?: string; stdio?: unknown[] } }> = [];
- spawnOkUi({
- lockDir,
- cwd: tmpDir,
- spawn: ((_cmd: string, _args: readonly string[], opts: object) => {
- calls.push({ opts: opts as never });
- return { unref: () => {}, on: () => {}, kill: () => {} } as unknown as ReturnType<
- typeof spawnOkUi
- >;
- }) as never,
- });
-
- const opts = calls[0]?.opts;
- expect(opts?.detached).toBe(true);
- expect(opts?.cwd).toBe(tmpDir);
- expect(Array.isArray(opts?.stdio)).toBe(true);
- expect(opts?.stdio?.[0]).toBe('ignore');
- expect(opts?.stdio?.[1]).toBe('ignore');
- // The third stdio entry is a numeric file descriptor.
- expect(typeof opts?.stdio?.[2]).toBe('number');
- });
-
- test('honors custom args (e.g. testable arg list)', () => {
- const calls: Array<{ args: readonly string[] }> = [];
- spawnOkUi({
- lockDir,
- cwd: tmpDir,
- args: ['ui', '--port', '9999'],
- spawn: ((_cmd: string, args: readonly string[]) => {
- calls.push({ args });
- return { unref: () => {}, on: () => {}, kill: () => {} } as unknown as ReturnType<
- typeof spawnOkUi
- >;
- }) as never,
- });
- // Re-exec mode (self-spawn.ts): args[0] is the CLI entry script, followed
- // by the subcommand args in order.
- expect(calls[0]?.args.slice(-3)).toEqual(['ui', '--port', '9999']);
- });
-
- test('strips PORT env from the spawned child (QA-007 — prevents same-port bind race)', () => {
- const originalPort = process.env.PORT;
- try {
- process.env.PORT = '51234';
- const calls: Array<{ env: NodeJS.ProcessEnv | undefined }> = [];
- spawnOkUi({
- lockDir,
- cwd: tmpDir,
- spawn: ((_cmd: string, _args: readonly string[], options: { env?: NodeJS.ProcessEnv }) => {
- calls.push({ env: options.env });
- return {
- unref: () => {},
- on: () => {},
- kill: () => {},
- } as unknown as ReturnType<typeof spawnOkUi>;
- }) as never,
- });
-
- const childEnv = calls[0]?.env;
- expect(childEnv).toBeDefined();
- // PORT must be stripped so the child does NOT inherit the parent's
- // bind port — otherwise both processes race to bind the same port.
- expect(childEnv?.PORT).toBeUndefined();
- // Other env vars propagate normally so the child can locate npx,
- // node, HOME, etc.
- expect(typeof childEnv?.PATH).toBe('string');
- // Explicit `'1'` keeps Electron's CLI bin in Node mode under the
- // packaged-app spawn path; silent reversion would re-introduce the
- // Dock-tile leak.
- expect(childEnv?.ELECTRON_RUN_AS_NODE).toBe('1');
- } finally {
- if (originalPort === undefined) {
- delete process.env.PORT;
- } else {
- process.env.PORT = originalPort;
- }
- }
- });
-
- test('truncates last-spawn-error.log on each invocation', () => {
- const errorLog = join(lockDir, 'last-spawn-error.log');
- mkdirSync(lockDir, { recursive: true });
- writeFileSync(errorLog, 'previous run error\n', 'utf-8');
- expect(readFileSync(errorLog, 'utf-8')).toBe('previous run error\n');
-
- spawnOkUi({
- lockDir,
- cwd: tmpDir,
- spawn: ((_cmd: string, _args: readonly string[]) =>
- ({ unref: () => {}, on: () => {}, kill: () => {} }) as unknown as ReturnType<
- typeof spawnOkUi
- >) as never,
- });
-
- expect(readFileSync(errorLog, 'utf-8')).toBe('');
- });
-});
-
// ----------------------------------------------------------------------------
// bootStartServer (integration)
// ----------------------------------------------------------------------------
@@ -775,45 +346,18 @@ function fetchText(
});
}
-describe('resolveCollabPort (collab vs UI-sibling port suppression)', () => {
+describe('resolveCollabPort (env PORT suppression)', () => {
test('explicit --port always wins', () => {
- expect(resolveCollabPort(5000, 6000, 39848)).toBe(5000);
- expect(resolveCollabPort(5000, undefined, undefined)).toBe(5000);
- });
- test('with --ui-port set, env PORT is suppressed (collab kernel-allocates)', () => {
- expect(resolveCollabPort(undefined, 39848, 39848)).toBeUndefined();
- expect(resolveCollabPort(undefined, 6000, 39848)).toBeUndefined();
- });
- test('without --ui-port, env PORT flows through to the collab server', () => {
- expect(resolveCollabPort(undefined, 6000, undefined)).toBe(6000);
- });
- test('nothing set → undefined (kernel-allocated)', () => {
- expect(resolveCollabPort(undefined, undefined, undefined)).toBeUndefined();
- });
- test('with remote enabled, platform-injected env PORT is suppressed (tunnel targets remote.port)', () => {
- expect(resolveCollabPort(undefined, 6000, undefined, true)).toBeUndefined();
- });
- test('with remote enabled, explicit --port still wins (deliberate override)', () => {
- expect(resolveCollabPort(5000, 6000, undefined, true)).toBe(5000);
+ expect(resolveCollabPort(4111, 5555, true)).toBe(4111);
+ expect(resolveCollabPort(4111, 5555, false)).toBe(4111);
});
- test('with remote enabled and nothing else set → undefined (caller falls back to remote.port)', () => {
- expect(resolveCollabPort(undefined, undefined, undefined, true)).toBeUndefined();
- });
-});
-describe('shouldConnectToExistingServer (main-checkout connect guard)', () => {
- test('true only when --ui-port set AND a live server.lock exists', () => {
- expect(shouldConnectToExistingServer(39848, { port: 49530 })).toBe(true);
- });
- test('false without --ui-port (plain terminal `ok start` keeps boot/exit-1)', () => {
- expect(shouldConnectToExistingServer(undefined, { port: 49530 })).toBe(false);
+ test('env PORT flows through for a plain local start', () => {
+ expect(resolveCollabPort(undefined, 5555, false)).toBe(5555);
});
- test('false when no live server (fresh worktree → boot)', () => {
- expect(shouldConnectToExistingServer(39848, null)).toBe(false);
- expect(shouldConnectToExistingServer(39848, { port: 0 })).toBe(false);
- });
- test('false for a draining server (teardown in progress — boot path waits it out)', () => {
- expect(shouldConnectToExistingServer(39848, { port: 49530, draining: true })).toBe(false);
+
+ test('remote mode drops env PORT (PaaS edge-proxy injection)', () => {
+ expect(resolveCollabPort(undefined, 5555, true)).toBeUndefined();
});
});
@@ -895,24 +439,6 @@ describe('withIdleShutdownProcessExit (idle-path zombie prevention)', () => {
});
});
-describe('computeConnectExitCode (connect-sibling exit mapping)', () => {
- test('clean numeric exit passes through', () => {
- expect(computeConnectExitCode(0, null, false)).toBe(0);
- expect(computeConnectExitCode(3, null, false)).toBe(3);
- });
- test('forwarded teardown (intentional signal) → 0', () => {
- expect(computeConnectExitCode(null, 'SIGTERM', true)).toBe(0);
- expect(computeConnectExitCode(null, 'SIGINT', true)).toBe(0);
- });
- test('unexpected signal death (external kill) → 1', () => {
- expect(computeConnectExitCode(null, 'SIGKILL', false)).toBe(1);
- expect(computeConnectExitCode(null, 'SIGTERM', false)).toBe(1);
- });
- test('null code with no signal → 0 (defensive)', () => {
- expect(computeConnectExitCode(null, null, false)).toBe(0);
- });
-});
-
describe('isServerLockCollision (D1/C3 gate)', () => {
class FakeServerLockErr extends Error {}
const fakeModule = {
@@ -932,99 +458,6 @@ describe('isServerLockCollision (D1/C3 gate)', () => {
});
});
-describe('connectUiSibling (D1/C3 connect fallback)', () => {
- // A minimal ChildProcess stand-in. `exit` fires `(code, signal)` and `error`
- // fires `(err)` asynchronously so the awaited promise resolves. Exactly one of
- // `code`/`signal`/`error` shapes the outcome under test.
- function fakeChild(
- opts: { code?: number | null; signal?: NodeJS.Signals | null; error?: Error } = {},
- ) {
- return {
- on(ev: string, cb: (...args: unknown[]) => void) {
- if (ev === 'exit' && opts.error === undefined) {
- queueMicrotask(() => cb(opts.code ?? null, opts.signal ?? null));
- }
- if (ev === 'error' && opts.error !== undefined) {
- queueMicrotask(() => cb(opts.error));
- }
- return this;
- },
- kill() {},
- unref() {},
- };
- }
-
- test('spawns `ok ui --port <P>` foreground (stdio inherit, ELECTRON_RUN_AS_NODE, PORT stripped)', async () => {
- const calls: Array<{
- cmd: string;
- args: readonly string[];
- opts: { stdio?: unknown; cwd?: string; env?: NodeJS.ProcessEnv };
- }> = [];
- const fakeSpawn = ((cmd: string, args: readonly string[], opts: object) => {
- calls.push({ cmd, args, opts: opts as never });
- return fakeChild({ code: 0 });
- }) as never;
-
- const prevPort = process.env.PORT;
- process.env.PORT = '51234';
- try {
- await connectUiSibling({ cwd: '/tmp/wt', uiPort: 39848, spawn: fakeSpawn });
- } finally {
- if (prevPort === undefined) delete process.env.PORT;
- else process.env.PORT = prevPort;
- }
-
- expect(calls.length).toBe(1);
- // Re-exec via the current CLI binary (self-spawn.ts), same as spawnOkUi.
- expect(calls[0]?.cmd).toBe(process.execPath);
- expect(calls[0]?.args.slice(-3)).toEqual(['ui', '--port', '39848']);
- // Foreground-tied: stdio inherited (NOT detached) so the pane keeps watching
- // this `ok start` process while the child serves/proxies the UI.
- expect(calls[0]?.opts.stdio).toBe('inherit');
- expect(calls[0]?.opts.cwd).toBe('/tmp/wt');
- expect(calls[0]?.opts.env?.ELECTRON_RUN_AS_NODE).toBe('1');
- // PORT stripped so the child resolves its port from `--port`, not the env.
- expect(calls[0]?.opts.env?.PORT).toBeUndefined();
- });
-
- test('propagates a clean numeric child exit code to process.exitCode', async () => {
- const prev = process.exitCode;
- try {
- const fakeSpawn = (() => fakeChild({ code: 3 })) as never;
- await connectUiSibling({ cwd: '/tmp/wt', uiPort: 5173, spawn: fakeSpawn });
- expect(process.exitCode).toBe(3);
- } finally {
- process.exitCode = prev;
- }
- });
-
- test('maps an UNEXPECTED signal death (no forwarded teardown) to exit 1', async () => {
- const prev = process.exitCode;
- process.exitCode = 0;
- try {
- // No SIGINT/SIGTERM forwarded → forwardedShutdown stays false → an external
- // SIGKILL (code null, signal set) surfaces as failure rather than success.
- const fakeSpawn = (() => fakeChild({ code: null, signal: 'SIGKILL' })) as never;
- await connectUiSibling({ cwd: '/tmp/wt', uiPort: 5173, spawn: fakeSpawn });
- expect(process.exitCode).toBe(1);
- } finally {
- process.exitCode = prev;
- }
- });
-
- test('maps a spawn `error` event to exit 1', async () => {
- const prev = process.exitCode;
- process.exitCode = 0;
- try {
- const fakeSpawn = (() => fakeChild({ error: new Error('ENOENT') })) as never;
- await connectUiSibling({ cwd: '/tmp/wt', uiPort: 5173, spawn: fakeSpawn });
- expect(process.exitCode).toBe(1);
- } finally {
- process.exitCode = prev;
- }
- });
-});
-
describe('bootStartServer (integration)', () => {
let tmpDir: string;
let booted: BootedStartServer | null = null;
@@ -1071,7 +504,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
// PinoLogger is silent in NODE_ENV=test by default; no override needed.
});
const res = await fetchText(booted.port, '/');
@@ -1082,7 +514,7 @@ describe('bootStartServer (integration)', () => {
expect(body.type).toBe('urn:ok:error:not-found');
expect(body.title).toBe('Not found.');
expect(body.status).toBe(404);
- expect(body.detail).toContain('React UI is served by `ok ui`');
+ expect(body.detail).toContain('This server is running without the web UI');
expect(body.detail).toContain('/');
});
@@ -1098,7 +530,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
idleThresholdMs: null,
});
expect(booted.port).toBeGreaterThan(0);
@@ -1114,7 +545,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
// PinoLogger is silent in NODE_ENV=test by default; no override needed.
});
const res = await fetchText(booted.port, '/assets/main-abcdef.js');
@@ -1123,7 +553,7 @@ describe('bootStartServer (integration)', () => {
const body = JSON.parse(res.body);
expect(body.type).toBe('urn:ok:error:not-found');
expect(body.title).toBe('Not found.');
- expect(body.detail).toContain('React UI is served by `ok ui`');
+ expect(body.detail).toContain('This server is running without the web UI');
expect(body.detail).toContain('/assets/main-abcdef.js');
});
@@ -1133,7 +563,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
// PinoLogger is silent in NODE_ENV=test by default; no override needed.
});
await booted.ready;
@@ -1141,7 +570,7 @@ describe('bootStartServer (integration)', () => {
// /api/document is the canonical health-check endpoint exposed by the API
// extension. The exact response body depends on persistence's docName
// semantics, but importantly the response MUST NOT be the
- // 'React UI is served by `ok ui`' pointer — that would mean the request
+ // 'This server is running without the web UI' pointer — that would mean the request
// fell through to the catch-all branch instead of hitting the API hook.
const res = await fetchText(booted.port, '/api/document?docName=integration-test-doc');
if (res.body.length > 0 && res.headers['content-type']?.toString().includes('json')) {
@@ -1153,7 +582,7 @@ describe('bootStartServer (integration)', () => {
}
})();
if (parsed && typeof parsed.error === 'string') {
- expect(parsed.error).not.toContain('React UI is served by `ok ui`');
+ expect(parsed.error).not.toContain('This server is running without the web UI');
}
}
// Status is whatever the API extension chose — we accept 200, 404, or any
@@ -1168,7 +597,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
// PinoLogger is silent in NODE_ENV=test by default; no override needed.
});
await booted.ready;
@@ -1185,142 +613,12 @@ describe('bootStartServer (integration)', () => {
expect(body.detail).toContain('/api/totally-nonexistent-xyz');
});
- test('auto-spawn ok ui when ui.lock absent — invokes spawn with correct args', async () => {
- const spawnCalls: Array<{ cmd: string; args: readonly string[] }> = [];
- const fakeSpawn: typeof NativeSpawn = ((cmd: string, args: readonly string[]) => {
- spawnCalls.push({ cmd, args });
- return {
- unref: () => {},
- on: () => {},
- kill: () => {},
- } as unknown as ReturnType<typeof NativeSpawn>;
- }) as never;
-
- booted = await bootStartServer({
- config: makeTestConfig(),
- cwd: tmpDir,
- host: TEST_HOST,
- skipAutoInit: true,
- // Note: skipUiAutoSpawn is intentionally false — we WANT the spawn to fire.
- spawn: fakeSpawn,
- // PinoLogger is silent in NODE_ENV=test by default; no override needed.
- });
-
- expect(spawnCalls.length).toBe(1);
- // Re-exec via the current CLI binary (not npx) — see self-spawn.ts.
- expect(spawnCalls[0]?.cmd).toBe(process.execPath);
- const spawnCallArgs = spawnCalls[0]?.args ?? [];
- expect(spawnCallArgs[spawnCallArgs.length - 1]).toBe('ui');
- expect(booted.uiSpawnDecision).toEqual({ action: 'spawn', reason: 'absent' });
- });
-
- test('threads uiPort into the ok ui sibling spawn args (worktree-preview core)', async () => {
- // The whole worktree-preview feature hinges on this: `--ui-port` must reach
- // the auto-spawned `ok ui` as `['ui', '--port', '<P>']`, else the pane
- // watches a port nobody is serving on.
- const spawnCalls: Array<{ args: readonly string[] }> = [];
- const fakeSpawn: typeof NativeSpawn = ((_cmd: string, args: readonly string[]) => {
- spawnCalls.push({ args });
- return {
- unref: () => {},
- on: () => {},
- kill: () => {},
- } as unknown as ReturnType<typeof NativeSpawn>;
- }) as never;
-
- booted = await bootStartServer({
- config: makeTestConfig(),
- cwd: tmpDir,
- host: TEST_HOST,
- skipAutoInit: true,
- uiPort: 39848,
- spawn: fakeSpawn,
- });
-
- expect(spawnCalls.length).toBe(1);
- expect(spawnCalls[0]?.args.slice(-3)).toEqual(['ui', '--port', '39848']);
- });
-
- test('skip auto-spawn when ui.lock alive (idempotent re-acquire path)', async () => {
- // Pre-populate ui.lock with the test process' own pid (which is alive).
- // process-lock treats same-pid as idempotent, so this simulates a
- // pre-existing live UI sibling without actually spawning one.
- const lockDir = join(tmpDir, '.ok', LOCAL_DIR);
- mkdirSync(lockDir, { recursive: true });
- writeFileSync(
- join(lockDir, 'ui.lock'),
- JSON.stringify({
- pid: process.pid,
- hostname: hostname(),
- port: 9876,
- startedAt: new Date().toISOString(),
- worktreeRoot: tmpDir,
- }),
- );
-
- const spawnCalls: Array<{ cmd: string }> = [];
- const fakeSpawn: typeof NativeSpawn = ((cmd: string) => {
- spawnCalls.push({ cmd });
- return {
- unref: () => {},
- on: () => {},
- kill: () => {},
- } as unknown as ReturnType<typeof NativeSpawn>;
- }) as never;
-
- booted = await bootStartServer({
- config: makeTestConfig(),
- cwd: tmpDir,
- host: TEST_HOST,
- skipAutoInit: true,
- spawn: fakeSpawn,
- // PinoLogger is silent in NODE_ENV=test by default; no override needed.
- });
-
- expect(spawnCalls.length).toBe(0);
- expect(booted.uiSpawnDecision).toEqual({
- action: 'skip',
- reason: 'alive',
- pid: process.pid,
- port: 9876,
- });
- });
-
- test('skipUiAutoSpawn=true bypasses spawn even when ui.lock is absent', async () => {
- const spawnCalls: Array<{ cmd: string }> = [];
- const fakeSpawn: typeof NativeSpawn = ((cmd: string) => {
- spawnCalls.push({ cmd });
- return {
- unref: () => {},
- on: () => {},
- kill: () => {},
- } as unknown as ReturnType<typeof NativeSpawn>;
- }) as never;
-
- booted = await bootStartServer({
- config: makeTestConfig(),
- cwd: tmpDir,
- host: TEST_HOST,
- skipAutoInit: true,
- skipUiAutoSpawn: true,
- spawn: fakeSpawn,
- // PinoLogger is silent in NODE_ENV=test by default; no override needed.
- });
-
- expect(spawnCalls.length).toBe(0);
- // Decision is still 'spawn(absent)' — the gate is only on the ACTION,
- // not the decision. This lets the booted handle still report what would
- // have been done (useful for tests + potentially for `ok status`).
- expect(booted.uiSpawnDecision).toEqual({ action: 'spawn', reason: 'absent' });
- });
-
test('destroy() is idempotent — second call is a no-op', async () => {
booted = await bootStartServer({
config: makeTestConfig(),
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
// PinoLogger is silent in NODE_ENV=test by default; no override needed.
});
await booted.destroy();
@@ -1335,7 +633,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
// PinoLogger is silent in NODE_ENV=test by default; no override needed.
});
expect(booted.port).toBeGreaterThan(0);
@@ -1356,7 +653,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
});
const ws = new WebSocket(`ws://127.0.0.1:${booted.port}/collab/keepalive?pid=${process.pid}`);
@@ -1391,7 +687,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
repairMcpConfigsFn: (opts) => {
captured.push(opts as { projectDir: string });
},
@@ -1408,7 +703,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
repairMcpConfigsFn: () => {
throw new Error('synthetic repair failure');
},
@@ -1423,7 +717,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
repairLaunchJsonFn: (opts) => {
captured.push(opts as { projectDir: string });
},
@@ -1439,7 +732,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
repairLaunchJsonFn: () => {
throw new Error('synthetic launch-json repair failure');
},
@@ -1454,7 +746,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
repairSkillsFn: async (opts) => {
captured.push(opts as { projectDir: string; reclaimDisableEnv: string | null });
},
@@ -1469,7 +760,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
repairSkillsFn: () => {
throw new Error('synthetic skill repair failure');
},
@@ -1489,7 +779,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
repairMcpConfigsFn: (opts) => {
mcpCaptures.push(opts as { reclaimDisableEnv: string | null });
},
@@ -1520,7 +809,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
repairMcpConfigsFn: (opts) => {
captured.push(opts as { reclaimDisableEnv: string | null });
},
@@ -1554,7 +842,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
});
const res = await fetchText(booted.port, '/specs/nested/mockup.png');
@@ -1567,7 +854,7 @@ describe('bootStartServer (integration)', () => {
test('serveContentAssets: false — content paths return the SPA-pointer 404', async () => {
// Explicit opt-out: no /<contentDir-relative> middleware, so the request
- // falls through to the "React UI is served by `ok ui`" pointer.
+ // falls through to the "This server is running without the web UI" pointer.
writeFileSync(join(tmpDir, 'fixture-asset.png'), 'fake-png-bytes', 'utf-8');
booted = await bootStartServer({
@@ -1575,17 +862,16 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
serveContentAssets: false,
});
const res = await fetchText(booted.port, '/fixture-asset.png');
expect(res.status).toBe(404);
const body = JSON.parse(res.body);
- expect(body.detail).toContain('React UI is served by `ok ui`');
+ expect(body.detail).toContain('This server is running without the web UI');
});
- test('reactShellDistDir — server serves the shell on /, auto-suppresses ok ui sibling', async () => {
+ test('reactShellDistDir — server serves the shell on /', async () => {
// Build a synthetic React-shell dist: just an index.html that sirv
// (with single: true) serves on / and as the SPA fallback for unknown
// routes.
@@ -1611,7 +897,7 @@ describe('bootStartServer (integration)', () => {
skipAutoInit: true,
// Intentionally NOT skipping UI auto-spawn — the point of this test
// is that --react-shell-dist-dir suppresses the sibling spawn
- // automatically, regardless of skipUiAutoSpawn.
+ // automatically.
spawn: fakeSpawn,
reactShellDistDir: shellDir,
});
@@ -1657,7 +943,6 @@ describe('bootStartServer (integration)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
serveContentAssets: true,
reactShellDistDir: shellDir,
});
@@ -1719,7 +1004,6 @@ describe('bootStartServer — no auto git-init from ok start (US-004)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: false,
- skipUiAutoSpawn: true,
});
// ok start never runs git init — .git/HEAD must not exist
@@ -1735,7 +1019,6 @@ describe('bootStartServer — no auto git-init from ok start (US-004)', () => {
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: false,
- skipUiAutoSpawn: true,
});
// The shadow-repo init runs in async boot (`initAsync`); `degraded` is only
// stable after `ready` resolves. Await it while PATH is still narrowed so
@@ -1784,7 +1067,6 @@ describe('bootStartServer — rejects with init-required when .ok/config.yml is
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: false,
- skipUiAutoSpawn: true,
}),
).rejects.toBeInstanceOf(OkDirMissingError);
});
@@ -1796,7 +1078,6 @@ describe('bootStartServer — rejects with init-required when .ok/config.yml is
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: false,
- skipUiAutoSpawn: true,
}),
).rejects.toThrow('ok init');
@@ -1811,7 +1092,6 @@ describe('bootStartServer — rejects with init-required when .ok/config.yml is
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: false,
- skipUiAutoSpawn: true,
}),
).rejects.toBeInstanceOf(OkDirMissingError);
expect(existsSync(join(tmpDir, '.ok', 'config.yml'))).toBe(false);
@@ -1828,7 +1108,6 @@ describe('bootStartServer — rejects with init-required when .ok/config.yml is
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: false,
- skipUiAutoSpawn: true,
}),
).rejects.toBeInstanceOf(OkDirMissingError);
expect(existsSync(join(tmpDir, '.ok', 'config.yml'))).toBe(false);
@@ -1849,7 +1128,6 @@ describe('bootStartServer — rejects with init-required when .ok/config.yml is
cwd: tmpDir,
host: TEST_HOST,
skipAutoInit: true,
- skipUiAutoSpawn: true,
});
expect(booted.port).toBeGreaterThan(0);
} finally {
@@ -1858,297 +1136,6 @@ describe('bootStartServer — rejects with init-required when .ok/config.yml is
});
});
-// ----------------------------------------------------------------------------
-// awaitUiSiblingPort — pure poll helper
-// ----------------------------------------------------------------------------
-
-describe('awaitUiSiblingPort', () => {
- test('returns the bound port immediately when ui.lock has port > 0 on first read', async () => {
- const port = await awaitUiSiblingPort({
- readUiLock: () => ({ port: 51887 }),
- // `now` stays constant — the first read returns a good value so the
- // loop exits before the deadline is re-checked.
- now: () => 0,
- sleep: async () => {},
- timeoutMs: 3000,
- pollIntervalMs: 50,
- });
- expect(port).toBe(51887);
- });
-
- test('returns null when the lock never populates before the timeout', async () => {
- let t = 0;
- const port = await awaitUiSiblingPort({
- readUiLock: () => null,
- now: () => t,
- // Virtual clock: every sleep advances `t` by exactly its duration, so
- // the poll deterministically hits the deadline in a bounded number of
- // iterations without any real wall-clock wait.
- sleep: async (ms) => {
- t += ms;
- },
- timeoutMs: 200,
- pollIntervalMs: 50,
- });
- expect(port).toBeNull();
- });
-
- test('skips port=0 sentinel (child is binding) and returns once port > 0', async () => {
- let t = 0;
- let reads = 0;
- const port = await awaitUiSiblingPort({
- readUiLock: () => {
- reads++;
- if (reads === 1) return null; // lock not written yet
- if (reads === 2) return { port: 0 }; // acquired, not bound
- return { port: 9999 }; // bound
- },
- now: () => t,
- sleep: async (ms) => {
- t += ms;
- },
- timeoutMs: 1000,
- pollIntervalMs: 50,
- });
- expect(port).toBe(9999);
- expect(reads).toBeGreaterThanOrEqual(3);
- });
-
- test('reads once more after the loop exits, catching a lock that lands in the grace window', async () => {
- let t = 0;
- let reads = 0;
- const port = await awaitUiSiblingPort({
- readUiLock: () => {
- reads++;
- // First two reads in-loop return null; after the deadline check
- // exits the loop the post-loop read sees the populated lock.
- return reads >= 3 ? { port: 4444 } : null;
- },
- now: () => t,
- sleep: async (ms) => {
- t += ms;
- },
- // Loop runs ~twice (50ms sleeps vs 100ms budget), then falls through
- // to the final read which returns the populated lock.
- timeoutMs: 100,
- pollIntervalMs: 50,
- });
- expect(port).toBe(4444);
- });
-});
-
-// ----------------------------------------------------------------------------
-// Regression: "unable to get any documents to load" on packaged CLI
-// ----------------------------------------------------------------------------
-//
-// running
-// $ bun run packages/cli/dist/cli.mjs start
-// produced a banner pointing the user at http://localhost:3000, but
-// nothing listened there. Documents never loaded because the React app
-// never loaded.
-//
-// Empirical repro:
-// 1. ok start auto-spawns ok ui via `spawnOkUi`, which strips PORT from
-// the child env. The child resolves its bind port via
-// `resolveRequestedPort` → undefined flag + undefined env → 0 (
-// default, kernel-allocated).
-// 2. Kernel assigns a free port to ok ui (e.g. 54281) and writes it to
-// `<contentDir>/.ok/local/ui.lock`.
-// 3. Meanwhile ok start's banner had hardcoded port 3000 on the spawn
-// branch — leftover from before changed ok ui's default to 0.
-// 4. Banner prints http://localhost:3000; user follows it; ECONNREFUSED.
-//
-// Fix: bootStartServer now polls `ui.lock` after spawn and exposes
-// `resolvedUiPort` on `BootedStartServer`. The banner uses that instead
-// of a hardcoded default, so the printed URL always reaches the port the
-// child actually bound (or falls back to the API URL on timeout).
-//
-// The `bun run dev` path is unaffected because the Vite plugin serves
-// everything same-origin on one port — no banner mismatch possible.
-
-describe('bootStartServer — resolvedUiPort tracks the port ok ui actually binds', () => {
- let tmpDir: string;
- let booted: BootedStartServer | null = null;
- let uiHandle: UiServerHandle | null = null;
- let originalHome: string | undefined;
-
- beforeEach(async () => {
- tmpDir = await mkdtemp(resolve(tmpdir(), 'ok-start-banner-'));
- // skipAutoInit suppresses initContent across these tests; pre-listen
- // check requires .ok/config.yml on disk.
- const okDir = resolve(tmpDir, '.ok');
- mkdirSync(okDir, { recursive: true });
- writeFileSync(resolve(okDir, 'config.yml'), '', 'utf-8');
- writeFileSync(resolve(okDir, '.gitignore'), '', 'utf-8');
- // Isolate HOME so the MCP repair sweep targets an empty tempdir.
- originalHome = process.env.HOME;
- process.env.HOME = tmpDir;
- booted = null;
- uiHandle = null;
- });
-
- afterEach(async () => {
- if (booted) {
- try {
- await booted.destroy();
- } catch {
- // idempotent
- }
- booted = null;
- }
- if (uiHandle) {
- uiHandle.release();
- await closeHttpServers(uiHandle.httpServers);
- uiHandle = null;
- }
- if (originalHome === undefined) {
- delete process.env.HOME;
- } else {
- process.env.HOME = originalHome;
- }
- await rm(tmpDir, { recursive: true, force: true });
- });
-
- test('auto-spawn path: resolvedUiPort matches the in-process ok ui that the fake spawn brought up', async () => {
- // Simulate the production detached-spawn flow hermetically: the `spawn`
- // hook, instead of execing a real `ok ui` subprocess, fires up ok ui
- // IN-PROCESS against the same lockDir. The in-process UI writes ui.lock
- // with a kernel-assigned port (default), so bootStartServer's new
- // `awaitUiSiblingPort` poll sees a real port appear.
- const cfg = ConfigSchema.parse({});
- const fakeSpawn: typeof NativeSpawn = ((_cmd: string, args: readonly string[]) => {
- const lastArg = args[args.length - 1];
- if (lastArg === 'ui') {
- // Fire-and-forget — production spawn also returns immediately and
- // the child binds asynchronously. We record the handle so afterEach
- // can tear it down.
- void startUiServer({
- config: cfg,
- cwd: tmpDir,
- port: 0,
- host: '127.0.0.1',
- safetyNetMs: 0,
- }).then((handle) => {
- uiHandle = handle;
- });
- }
- return {
- unref: () => {},
- on: () => {},
- kill: () => {},
- } as unknown as ReturnType<typeof NativeSpawn>;
- }) as never;
-
- booted = await bootStartServer({
- config: makeTestConfig(),
- cwd: tmpDir,
- host: TEST_HOST,
- skipAutoInit: true,
- spawn: fakeSpawn,
- // Generous timeout in case the CI event loop is under load — typical
- // in-process bind is <50 ms.
- uiBindTimeoutMs: 10_000,
- });
-
- expect(booted.uiSpawnDecision).toEqual({ action: 'spawn', reason: 'absent' });
- expect(booted.resolvedUiPort).not.toBeNull();
- expect(booted.resolvedUiPort).not.toBe(3000);
- // Wait for the fire-and-forget in-process UI handle to settle so
- // afterEach can tear it down; also lets us cross-check ports. The
- // explicit deadline produces a specific failure message if the handle
- // never populates, instead of relying on Bun's generic test timeout.
- const handleDeadline = Date.now() + 5_000;
- while (uiHandle === null) {
- if (Date.now() > handleDeadline) {
- throw new Error('in-process UI handle never settled within 5s');
- }
- await wait(10);
- }
- expect(booted.resolvedUiPort).toBe(uiHandle.port);
-
- // End-to-end proof: the port bootStartServer reports as `resolvedUiPort`
- // is a working UI — /api/config returns the shape the React app boots
- // from. This is the invariant the banner URL depends on.
- const configRes = await fetch(`http://127.0.0.1:${booted.resolvedUiPort}/api/config`);
- expect(configRes.status).toBe(200);
- const configBody = (await configRes.json()) as { port: number };
- expect(configBody.port).toBe(booted.resolvedUiPort);
- });
-
- test('skip path: resolvedUiPort reflects the pre-existing ok ui lock port', async () => {
- // Pre-populate ui.lock with a live pid (this process) + a non-zero port.
- // decideUiSpawn returns {action: 'skip', ...} and bootStartServer
- // short-circuits the poll, using the lock's port directly.
- const lockDir = join(tmpDir, '.ok', LOCAL_DIR);
- mkdirSync(lockDir, { recursive: true });
- writeFileSync(
- join(lockDir, 'ui.lock'),
- JSON.stringify({
- pid: process.pid,
- hostname: hostname(),
- port: 57890,
- startedAt: new Date().toISOString(),
- worktreeRoot: tmpDir,
- }),
- );
-
- booted = await bootStartServer({
- config: makeTestConfig(),
- cwd: tmpDir,
- host: TEST_HOST,
- skipAutoInit: true,
- });
-
- expect(booted.uiSpawnDecision).toEqual({
- action: 'skip',
- reason: 'alive',
- pid: process.pid,
- port: 57890,
- });
- expect(booted.resolvedUiPort).toBe(57890);
- });
-
- test('spawn-skipped path: resolvedUiPort is null when skipUiAutoSpawn=true and no prior sibling', async () => {
- booted = await bootStartServer({
- config: makeTestConfig(),
- cwd: tmpDir,
- host: TEST_HOST,
- skipAutoInit: true,
- skipUiAutoSpawn: true,
- });
-
- // Decision is still 'spawn(absent)' — the gate is only on the ACTION —
- // but no UI was actually started, so there's no port to report.
- expect(booted.uiSpawnDecision).toEqual({ action: 'spawn', reason: 'absent' });
- expect(booted.resolvedUiPort).toBeNull();
- });
-
- test('timeout path: resolvedUiPort is null when the spawned UI never binds in time', async () => {
- // The fake spawn never starts an in-process UI, so ui.lock never gains
- // a port. bootStartServer's poll should give up cleanly and report null
- // — the banner falls back to the API URL.
- const silentSpawn: typeof NativeSpawn = ((_cmd: string, _args: readonly string[]) => {
- return {
- unref: () => {},
- on: () => {},
- kill: () => {},
- } as unknown as ReturnType<typeof NativeSpawn>;
- }) as never;
-
- booted = await bootStartServer({
- config: makeTestConfig(),
- cwd: tmpDir,
- host: TEST_HOST,
- skipAutoInit: true,
- spawn: silentSpawn,
- uiBindTimeoutMs: 200,
- });
-
- expect(booted.uiSpawnDecision).toEqual({ action: 'spawn', reason: 'absent' });
- expect(booted.resolvedUiPort).toBeNull();
- });
-});
-
// startCommand --mode flag.
// These exercise the Commander wiring at the public CLI surface — the
// validator (parseStartMode), the --mode=app + --open mutual-exclusion
@@ -2443,8 +1430,6 @@ describe('resolveStartShellDir (the Wave 3 default-flip decision)', () => {
resolveStartShellDir({
explicitDir: undefined,
only: undefined,
- uiPortSet: false,
- remoteEnabled: false,
findBundledDir: bundled,
}),
).toEqual({ dir: '/bundled/dist', missingBundle: false });
@@ -2455,8 +1440,6 @@ describe('resolveStartShellDir (the Wave 3 default-flip decision)', () => {
resolveStartShellDir({
explicitDir: '/explicit',
only: undefined,
- uiPortSet: true,
- remoteEnabled: false,
findBundledDir: noBundle,
}).dir,
).toBe('/explicit');
@@ -2467,44 +1450,16 @@ describe('resolveStartShellDir (the Wave 3 default-flip decision)', () => {
resolveStartShellDir({
explicitDir: undefined,
only: 'server',
- uiPortSet: false,
- remoteEnabled: false,
- findBundledDir: bundled,
- }),
- ).toEqual({ dir: undefined, missingBundle: false });
- });
-
- test('--ui-port keeps the legacy sibling model (worktree-preview recipe)', () => {
- expect(
- resolveStartShellDir({
- explicitDir: undefined,
- only: undefined,
- uiPortSet: true,
- remoteEnabled: false,
findBundledDir: bundled,
}),
).toEqual({ dir: undefined, missingBundle: false });
});
- test('remote overrides the --ui-port opt-out — one tunnel covers everything', () => {
- expect(
- resolveStartShellDir({
- explicitDir: undefined,
- only: undefined,
- uiPortSet: true,
- remoteEnabled: true,
- findBundledDir: bundled,
- }).dir,
- ).toBe('/bundled/dist');
- });
-
test('missing bundle degrades (API/MCP-only) and is flagged for the warning', () => {
expect(
resolveStartShellDir({
explicitDir: undefined,
only: undefined,
- uiPortSet: false,
- remoteEnabled: false,
findBundledDir: noBundle,
}),
).toEqual({ dir: undefined, missingBundle: true });
@@ -2534,7 +1489,6 @@ describe('shouldOpenBrowser (interactive-loopback default open)', () => {
legacyOpen: false,
host: '127.0.0.1',
isTTY: true,
- remoteEnabled: false,
ephemeral: false,
only: undefined,
servesUi: true,
@@ -2981,4 +1935,15 @@ describe('startCommand — flag-conflict guards (exit 2)', () => {
expect(code).toBe(78);
expect(output).toContain('must be https');
});
+
+ test('--only ui prints the deprecation notice even on the missing --server-url refusal', async () => {
+ // Same contract as the --remote notice: the operator learns the
+ // successor spelling (`ok start`) from the same run that errors, exactly
+ // once, on stderr.
+ const { code, output } = await captureRemoteRefusal(['--only', 'ui']);
+ expect(code).toBe(2);
+ expect(output).toContain("'--only ui' requires '--server-url");
+ expect(output.split('`--only ui` is deprecated').length - 1).toBe(1);
+ expect(output).toContain('ok start');
+ });
});
diff --git a/packages/cli/src/commands/start.ts b/packages/cli/src/commands/start.ts
index faa568afe..536e463e2 100644
--- a/packages/cli/src/commands/start.ts
+++ b/packages/cli/src/commands/start.ts
@@ -7,31 +7,23 @@
* the Desktop attach contract). A second `ok start` against a live server
* reports that URL and exits 0 (spawn-or-reuse) instead of colliding.
*
- * The legacy two-process model (`ok ui` sibling serving the shell and
- * proxying `/api` + `/collab`, advertised via `ui.lock`) survives on two
- * paths only, for the Desktop version-skew window:
- * - `--ui-port` (the worktree-preview recipe) keeps the sibling model.
- * - `ok ui` remains functional as a deprecated fallback.
- * Idle-shutdown SIGTERMs a spawned sibling before releasing our own lock.
- *
- * `--only server` suppresses the UI module entirely; `--only ui` (with
- * `--server-url`) runs just the shell-serving proxy — explicit operator
- * module selection against the same composition, never a separate topology.
+ * The legacy two-process model (an `ok ui` sibling serving the shell and
+ * proxying `/api` + `/collab`, advertised via `ui.lock`) is gone: the `ok ui`
+ * command and the sibling auto-spawn were removed once the Desktop attach
+ * re-point shipped stable. `--only server` suppresses the UI module entirely;
+ * `--only ui` (with `--server-url`) runs just the shell-serving proxy — a
+ * deprecated split-mode that retires together with ui.lock.
*
* The Commander action is a thin wrapper around `bootStartServer` — that
* boot function returns a `BootedStartServer` handle (`{httpServer, destroy,
* port, ready, ...}`) so integration tests can drive the same composed boot
* path the CLI uses, without process-level signal coupling.
*/
-import {
- type ChildProcess,
- type spawn as NativeSpawn,
- spawn as nativeSpawn,
-} from 'node:child_process';
-import { closeSync, existsSync as fsExistsSync, mkdirSync as fsMkdirSync, openSync } from 'node:fs';
+import { spawn as nativeSpawn } from 'node:child_process';
+import { existsSync as fsExistsSync } from 'node:fs';
import { rm } from 'node:fs/promises';
import type { Server as HttpServer } from 'node:http';
-import { basename, join, resolve as pathResolve } from 'node:path';
+import { basename, resolve as pathResolve } from 'node:path';
import { setTimeout as wait } from 'node:timers/promises';
import {
applyConfigOverlay,
@@ -45,9 +37,6 @@ import {
resolveEnvConfigLayer,
resolveServerRuntimeConfig,
type ServerRuntimeConfig,
- DEFAULT_SIGTERM_GRACE_MS as SHARED_DEFAULT_SIGTERM_GRACE_MS,
- DEFAULT_SIGTERM_POLL_MS as SHARED_DEFAULT_SIGTERM_POLL_MS,
- SPAWN_ERROR_LOG,
} from '@inkeep/open-knowledge-core';
import {
type BootedServer,
@@ -68,7 +57,6 @@ import {
launchDesktop,
notFoundMessage,
} from './desktop-dispatch.ts';
-import { resolveSelfSpawn } from './self-spawn.ts';
/** 30 minutes — default threshold. */
const DEFAULT_IDLE_THRESHOLD_MS = 30 * 60 * 1000;
@@ -123,24 +111,16 @@ export function resolveBundledReactShellDir(
*
* - an explicit `--react-shell-dist-dir` always wins;
* - `--only server` opts out of the UI module entirely;
- * - `--ui-port` (the worktree-preview recipe) keeps the legacy sibling model
- * until its retirement — EXCEPT under `--remote`, which always serves the
- * shell on the tunneled port;
* - otherwise the bundled shell is resolved and served by default. A missing
- * bundle (source checkout without an app build) degrades to API/MCP-only —
- * the `ok ui` sibling would be serving the same missing bundle, so falling
- * back to it could never help.
+ * bundle (source checkout without an app build) degrades to API/MCP-only.
*/
export function resolveStartShellDir(input: {
explicitDir: string | undefined;
only: OnlyModule | undefined;
- uiPortSet: boolean;
- remoteEnabled: boolean;
findBundledDir: () => string | undefined;
}): { dir: string | undefined; missingBundle: boolean } {
if (input.explicitDir !== undefined) return { dir: input.explicitDir, missingBundle: false };
if (input.only === 'server') return { dir: undefined, missingBundle: false };
- if (input.uiPortSet && !input.remoteEnabled) return { dir: undefined, missingBundle: false };
const dir = input.findBundledDir();
return { dir, missingBundle: dir === undefined };
}
@@ -401,323 +381,23 @@ export class OkDirMissingError extends Error {
}
}
-export type UiSpawnDecision =
- | { action: 'spawn'; reason: 'absent' }
- | { action: 'spawn'; reason: 'stale'; stalePid: number }
- | { action: 'skip'; reason: 'alive'; pid: number; port: number };
-
-interface DecideUiSpawnInput {
- uiLock: { pid: number; port: number } | null;
- isAlive: (pid: number) => boolean;
-}
-
-/**
- * Pure decision function. The caller feeds the current `ui.lock` contents
- * (or null) and an `isProcessAlive` probe; we return one of three verdicts.
- * No side effects — tests drive it directly without a filesystem.
- */
-export function decideUiSpawn(input: DecideUiSpawnInput): UiSpawnDecision {
- if (!input.uiLock) return { action: 'spawn', reason: 'absent' };
- if (!input.isAlive(input.uiLock.pid)) {
- return { action: 'spawn', reason: 'stale', stalePid: input.uiLock.pid };
- }
- return { action: 'skip', reason: 'alive', pid: input.uiLock.pid, port: input.uiLock.port };
-}
-
-interface SpawnOkUiOptions {
- lockDir: string;
- cwd: string;
- /** Override for tests — defaults to `node:child_process#spawn`. */
- spawn?: typeof NativeSpawn;
- /** Args to pass after the CLI entry — defaults to `['ui']`. */
- args?: string[];
-}
-
-/**
- * Spawn `ok ui` as a detached sibling. Child's stderr is redirected at the
- * kernel layer to `<lockDir>/last-spawn-error.log` — matches the MCP spawn
- * template so the same log consumer can surface failures.
- *
- * Re-execs the current CLI binary rather than shelling out via
- * `npx @inkeep/open-knowledge` to avoid cross-version lockfile-ABI drift and
- * the live-registry-fetch / supply-chain surface. See `self-spawn.ts`.
- *
- * **PORT env hygiene:** the child `ok ui` resolves its bind port via
- * `--port` flag > `PORT` env > default 0 (kernel-allocated) — flag-first,
- * matching `resolveRequestedPort` and the strip note below. When `ok
- * start` itself was invoked with `PORT=<X>` (e.g. operator override), we
- * must NOT inherit that to the child — both processes would try to bind
- * the same port. Stripping `PORT` means the child falls through to its
- * default, which is kernel-allocation — each auto-spawned UI gets a
- * unique port and multi-project concurrency is mechanically true, not just
- * aspirational. If the caller needs a specific UI port, they should invoke
- * `ok ui --port <X>` directly.
- */
-export function spawnOkUi(opts: SpawnOkUiOptions): ChildProcess {
- if (!fsExistsSync(opts.lockDir)) fsMkdirSync(opts.lockDir, { recursive: true });
- const stderrPath = join(opts.lockDir, SPAWN_ERROR_LOG);
- const stderrFd = openSync(stderrPath, 'w');
- const spawnFn = opts.spawn ?? nativeSpawn;
- const { PORT: _strippedPort, ...childEnv } = process.env;
- const self = resolveSelfSpawn();
- try {
- const child = spawnFn(self.command, [...self.prefixArgs, ...(opts.args ?? ['ui'])], {
- detached: true,
- stdio: ['ignore', 'ignore', stderrFd],
- windowsHide: true,
- cwd: opts.cwd,
- env: {
- ...childEnv,
- // Under the packaged .app, `self.command` is the Electron helper
- // binary; without this flag it launches as a full Electron app
- // (Dock-tile leak class). node/bun ignore it. Set explicitly so a
- // future env-scrub can't silently drop the inherited value.
- ELECTRON_RUN_AS_NODE: '1',
- },
- });
- child.unref();
- return child;
- } finally {
- // Child now owns the fd — close our copy so the parent does not keep it open.
- try {
- closeSync(stderrFd);
- } catch {
- // Best-effort: some mocks may not hand back a real fd.
- }
- }
-}
-
/**
* Resolve the collab server's port from the three sources, for `runStartCommand`.
- * An explicit `--port` always wins. Otherwise env `PORT` is dropped in two
- * cases: when `--ui-port` is set (the worktree-preview recipe) it is the UI
- * sibling's intended port, NOT the collab server's — drop it so the brain
- * kernel-allocates and the two can't contend; and when remote access is
- * enabled, because PaaS platforms (Railway, Fly, Render) inject `PORT` for
- * their own edge proxy — honoring it would silently move the server off the
- * stable `remote.port` the tunnel's port mapping targets, leaving the
- * tunnel dialing a dead port. Pure so both suppression rules are tested
- * directly.
+ * An explicit `--port` always wins. Otherwise env `PORT` is dropped when
+ * remote access is enabled, because PaaS platforms (Railway, Fly, Render)
+ * inject `PORT` for their own edge proxy — honoring it would silently move
+ * the server off the stable `remote.port` the tunnel's port mapping targets,
+ * leaving the tunnel dialing a dead port. Pure so the suppression rule is
+ * tested directly.
*/
export function resolveCollabPort(
portFromCli: number | undefined,
portFromEnv: number | undefined,
- requestedUiPort: number | undefined,
remoteEnabled = false,
): number | undefined {
- return portFromCli ?? (requestedUiPort !== undefined || remoteEnabled ? undefined : portFromEnv);
-}
-
-/**
- * Should `ok start` connect to an already-live server instead of booting one?
- * True only on the worktree-preview path (`--ui-port` set) when a live
- * `server.lock` exists for this folder — the main-checkout case, where booting
- * would collide and exit 1. Pure so this safety decision is unit-tested.
- * (`readServerLock` already filters dead/cross-machine locks, so a non-null
- * `liveServer` with `port > 0` is a genuinely-live same-machine server —
- * unless it is `draining`, i.e. seconds from exit. Connecting to a draining
- * server would bind the preview to a dying backend, so fall through to the
- * boot path, whose drain-wait handles the handoff.)
- */
-export function shouldConnectToExistingServer(
- requestedUiPort: number | undefined,
- liveServer: { port: number; draining?: boolean } | null,
-): boolean {
- return (
- requestedUiPort !== undefined &&
- liveServer !== null &&
- liveServer.port > 0 &&
- liveServer.draining !== true
- );
-}
-
-/**
- * Compute `process.exitCode` for the connect-sibling child. A clean numeric exit
- * passes through; a signal death we initiated (a teardown we forwarded) is
- * intentional → 0; an unexpected signal death (external kill) → 1. Pure so both
- * the forwarded-teardown (→0) and external-kill (→1) paths are unit-tested
- * without emitting real process signals.
- */
-export function computeConnectExitCode(
- code: number | null,
- signal: NodeJS.Signals | null,
- forwardedShutdown: boolean,
-): number {
- return code ?? (signal != null && !forwardedShutdown ? 1 : 0);
-}
-
-interface ConnectUiSiblingOptions {
- cwd: string;
- /** Port the preview pane passed — the UI sibling is pinned to it. */
- uiPort: number;
- /** Override for tests — defaults to `node:child_process#spawn`. */
- spawn?: typeof NativeSpawn;
+ return portFromCli ?? (remoteEnabled ? undefined : portFromEnv);
}
-/**
- * Connect fallback. When `ok start --ui-port P` finds the collab
- * server.lock already held by a live process — the main checkout (server
- * always running), or a lost TOCTOU race against a concurrent start — we must
- * NOT exit 1, because `ok start --ui-port P` is run identically in the main
- * checkout and every worktree, and a non-zero exit would break a caller that
- * expects connect-on-collision. Instead we "connect": run `ok ui --port P`
- * in this folder, exactly reproducing what the prior bare-`ok ui` recipe did.
- *
- * On main that `ok ui --port P` hits the existing UI's `ui.lock` and enters
- * proxy mode (P → the live UI's real port) — the same path that served main's
- * preview previously. The collab server it advertises via `/api/config` is the
- * already-running one, so the pane connects immediately.
- *
- * The child is foreground-tied (stdio inherited, NOT detached): the pane
- * watches THIS `ok start` process for liveness, so we stay alive until the
- * child exits and forward SIGINT/SIGTERM so the pane's teardown reaches the
- * `ok ui` proxy. Returns when the child exits; `process.exitCode` is the child's
- * numeric exit code, or 0 for a signal death we initiated (forwarded teardown),
- * or 1 for an unexpected signal death (external kill) — so a genuine `ok ui`
- * failure surfaces while normal pane teardown stays clean.
- *
- * `ok ui` honors `--port` over any inherited `PORT` env (`resolveRequestedPort`
- * checks the flag first); we strip `PORT` from the child env anyway to keep the
- * two spawn sites uniform.
- */
-export async function connectUiSibling(opts: ConnectUiSiblingOptions): Promise<void> {
- const spawnFn = opts.spawn ?? nativeSpawn;
- const self = resolveSelfSpawn();
- // Strip `PORT` from the child env (mirrors spawnOkUi): we pin the UI port via
- // the explicit `--port` flag, and `ok ui` honors `--port` over `PORT` today —
- // stripping `PORT` keeps the two spawn sites uniform and removes any latent
- // dependence on that flag-vs-env precedence never flipping.
- const { PORT: _strippedPort, ...parentEnv } = process.env;
- const child = spawnFn(self.command, [...self.prefixArgs, 'ui', '--port', String(opts.uiPort)], {
- cwd: opts.cwd,
- stdio: 'inherit',
- windowsHide: true,
- env: {
- ...parentEnv,
- // Mirror spawnOkUi: under the packaged .app `self.command` is the
- // Electron helper, which needs this flag to run as plain node rather
- // than launching a full Electron app (Dock-tile leak class).
- ELECTRON_RUN_AS_NODE: '1',
- },
- });
-
- // Track whether WE forwarded a shutdown signal so the exit handler can tell
- // an intentional teardown from an unexpected external kill.
- let forwardedShutdown = false;
- const forward = (signal: NodeJS.Signals): void => {
- forwardedShutdown = true;
- try {
- child.kill(signal);
- } catch {
- // best-effort — child may already be gone.
- }
- };
- const forwardSigint = () => forward('SIGINT');
- const forwardSigterm = () => forward('SIGTERM');
- process.once('SIGINT', forwardSigint);
- process.once('SIGTERM', forwardSigterm);
-
- await new Promise<void>((done) => {
- child.on('exit', (code, signal) => {
- // `code` is null when the child was killed by a signal. A signal death we
- // initiated (pane teardown → we forwarded SIGINT/SIGTERM) is intentional →
- // exit 0. A signal death we did NOT initiate (OOM SIGKILL, a concurrent
- // `ok stop`) is unexpected → surface as failure (1) rather than a silent
- // success. A clean numeric exit code passes through verbatim.
- process.exitCode = computeConnectExitCode(code, signal, forwardedShutdown);
- done();
- });
- child.on('error', (err) => {
- console.error(
- `[start] connect fallback: failed to spawn ok ui — ${err instanceof Error ? err.message : String(err)}`,
- );
- process.exitCode = 1;
- done();
- });
- });
-
- process.removeListener('SIGINT', forwardSigint);
- process.removeListener('SIGTERM', forwardSigterm);
-}
-
-interface AwaitUiSiblingPortInput {
- /** Read the current ui.lock contents. Returns null when absent/stale. */
- readUiLock: () => { port: number } | null;
- /** Virtual clock. Production: `Date.now`. */
- now: () => number;
- /** Sleep between polls. Production: `setTimeout`-based promise. */
- sleep: (ms: number) => Promise<void>;
- /** Abandon the poll after this wall-clock elapses. */
- timeoutMs: number;
- /** Poll interval in ms. */
- pollIntervalMs: number;
-}
-
-/**
- * Poll `ui.lock` until the spawned `ok ui` child finishes binding its port
- * (or the timeout expires). Returns the bound port, or `null` on timeout.
- *
- * The child `ok ui` writes an initial lockfile with `port: 0` when it starts
- * (sentinel for "binding"), then calls `updateUiLockPort` with the real
- * kernel-assigned port once `listen()` resolves. Port > 0 is the signal that
- * the sibling is serving requests.
- *
- * Precedent #13b (implicit time-coupling is a test smell): all time + IO deps
- * are injected so `start.test.ts` can drive the loop with a virtual clock
- * without touching the filesystem.
- */
-export async function awaitUiSiblingPort(deps: AwaitUiSiblingPortInput): Promise<number | null> {
- const deadline = deps.now() + deps.timeoutMs;
- while (deps.now() < deadline) {
- const lock = deps.readUiLock();
- if (lock && lock.port > 0) return lock.port;
- await deps.sleep(deps.pollIntervalMs);
- }
- // One final read after the last sleep so a lock that appeared within the
- // grace window isn't missed solely because we raced the deadline check.
- const lock = deps.readUiLock();
- if (lock && lock.port > 0) return lock.port;
- return null;
-}
-
-interface BuildIdleShutdownHandlerInput {
- readUiLock: () => { pid: number; port: number } | null;
- /**
- * Pid of the `ok ui` child THIS process spawned, or null when it spawned
- * none (sibling reused, auto-spawn skipped, or desktop single-origin mode).
- * The idle handler only ever signals this pid — `ui.lock` is advertisement,
- * not ownership: a desktop-spawned server serving the React shell holds it
- * with its OWN pid, and a stale server blindly killing the lock holder was
- * exactly how a live server (active ACP threads, MCP sessions, keepalive)
- * got SIGTERMed mid-session.
- */
- spawnedUiPid: () => number | null;
- isAlive: (pid: number) => boolean;
- killPid: (pid: number, signal: NodeJS.Signals) => void;
- destroy: () => Promise<void>;
- /** Poll `isAlive(pid)` every this many ms while waiting for SIGTERM to take. */
- sigtermPollIntervalMs?: number;
- /** Abandon SIGTERM and escalate to SIGKILL after this wall-clock elapses. */
- sigtermGraceMs?: number;
- /** Injectable sleep for deterministic tests. */
- sleep?: (ms: number) => Promise<void>;
- log?: {
- info: (obj: object, msg: string) => void;
- warn: (obj: object, msg: string) => void;
- error: (obj: object, msg: string) => void;
- };
-}
-
-/** 10s grace before SIGKILL escalation — long enough for a healthy UI to
- * release its lock + close sockets; short enough that a wedged UI (GC
- * pause, downstream fetch hang) doesn't stall idle-shutdown indefinitely. */
-// Re-export so existing call sites in this file continue to reference the
-// constants without an import-name churn. Sourced from the shared core
-// module so the CLI's idle-shutdown UI-sibling termination and the
-// desktop's `stopAllOwnedServers` use the same numbers.
-const DEFAULT_SIGTERM_GRACE_MS = SHARED_DEFAULT_SIGTERM_GRACE_MS;
-const DEFAULT_SIGTERM_POLL_MS = SHARED_DEFAULT_SIGTERM_POLL_MS;
-
/**
* Wrap an idle-shutdown handler so that, after the server is destroyed, the
* ephemeral session's throwaway temp projectDir is removed. Without this an
@@ -829,84 +509,6 @@ export function withIdleShutdownProcessExit(
};
}
-/**
- * Signal the auto-spawned `ok ui` sibling to exit: SIGTERM, poll its liveness
- * up to `sigtermGraceMs`, then escalate to SIGKILL if it's wedged. Shared by
- * idle-shutdown and the signal-driven `ok start` teardown so BOTH honor the
- * same ownership guard — a live lock holder whose pid is not `spawnedUiPid()`
- * is left alone (see that field's docstring for the incident class this
- * prevents). `reason` prefixes the log lines to identify the calling path
- * (`idle-shutdown` | `shutdown`; defaults to `teardown` when omitted).
- * Best-effort throughout: a failed lookup/kill is logged, never thrown, so the
- * caller's own teardown (destroy / server.lock release) always proceeds.
- */
-export async function teardownUiSibling(
- input: Omit<BuildIdleShutdownHandlerInput, 'destroy'> & { reason?: string },
-): Promise<void> {
- const graceMs = input.sigtermGraceMs ?? DEFAULT_SIGTERM_GRACE_MS;
- const pollMs = input.sigtermPollIntervalMs ?? DEFAULT_SIGTERM_POLL_MS;
- const sleep = input.sleep ?? ((ms: number) => wait(ms));
- const reason = input.reason ?? 'teardown';
-
- try {
- const lock = input.readUiLock();
- const ownPid = input.spawnedUiPid();
- if (lock && input.isAlive(lock.pid) && lock.pid !== ownPid) {
- // The lock holder is alive but is NOT the sibling we spawned — a
- // desktop-spawned server advertising its shell, or another session's
- // UI. It is not ours to kill; it has its own lifecycle (idle-shutdown
- // or the `ok ui` 12h safety net).
- input.log?.info(
- { pid: lock.pid, port: lock.port, spawnedUiPid: ownPid },
- `${reason}: ui.lock holder is not our spawned sibling — leaving it alone`,
- );
- } else if (lock && input.isAlive(lock.pid)) {
- try {
- input.killPid(lock.pid, 'SIGTERM');
- input.log?.info({ pid: lock.pid, port: lock.port }, `${reason}: SIGTERM UI sibling`);
- // Wait up to graceMs for the UI process to exit under SIGTERM.
- const deadline = Date.now() + graceMs;
- while (Date.now() < deadline) {
- if (!input.isAlive(lock.pid)) break;
- await sleep(pollMs);
- }
- if (input.isAlive(lock.pid)) {
- // Grace expired — escalate to SIGKILL. Operators see this at WARN.
- try {
- input.killPid(lock.pid, 'SIGKILL');
- input.log?.warn(
- { pid: lock.pid, graceMs },
- `${reason}: SIGTERM grace expired — escalated to SIGKILL`,
- );
- } catch (err) {
- input.log?.error({ pid: lock.pid, err }, `${reason}: SIGKILL failed`);
- }
- }
- } catch (err) {
- input.log?.warn({ pid: lock.pid, err }, `${reason}: failed to SIGTERM UI sibling`);
- }
- }
- } catch (err) {
- input.log?.warn({ err }, `${reason}: UI lookup failed; proceeding`);
- }
-}
-
-/**
- * The idle-shutdown `onShutdown` closure: tear down the UI sibling (guarded by
- * `spawnedUiPid`), then `destroy()` — which releases `server.lock` as its final
- * step. A thin adapter over `teardownUiSibling`; the escalation logic lives
- * there.
- */
-export function buildIdleShutdownHandler(
- input: BuildIdleShutdownHandlerInput,
-): () => Promise<void> {
- const { destroy, ...teardown } = input;
- return async () => {
- await teardownUiSibling({ ...teardown, reason: 'idle-shutdown' });
- await destroy();
- };
-}
-
interface BootStartServerOptions {
config: Config;
cwd: string;
@@ -925,18 +527,6 @@ interface BootStartServerOptions {
* to discover.
*/
port?: number;
- /**
- * Explicit UI-sibling port. When set, the auto-spawned `ok ui` sibling is
- * pinned to this port (`ok ui --port <uiPort>`) instead of falling through
- * to `DEFAULT_UI_PORT` / kernel-allocation. This is a SEPARATE channel from
- * `PORT` (which `spawnOkUi` strips, to keep the collab server and its UI
- * sibling off the same env-port) so the worktree-preview path can pin the
- * sibling to the port the preview pane passed without that collision.
- * Threaded straight into `spawnOkUi`'s `args` (`['ui','--port',<uiPort>]`)
- * via the existing `opts.args ?? ['ui']` seam — `ok ui` already honors
- * `--port` over the stripped `PORT`, so no `ok ui` change is needed.
- */
- uiPort?: number;
/**
* When `true`, bypasses the init-required guard — `bootStartServer` will not
* throw `OkDirMissingError` even when `.ok/config.yml` is absent. Integration
@@ -945,10 +535,6 @@ interface BootStartServerOptions {
* no-config rejection should omit this or set it to `false`.
*/
skipAutoInit?: boolean;
- /** Skip the auto-spawn-of-ok-ui-sibling step entirely (does not call `spawnOkUi`). */
- skipUiAutoSpawn?: boolean;
- /** Override for `spawnOkUi`'s underlying spawn — passed through to it. */
- spawn?: typeof NativeSpawn;
/** Override idle-shutdown threshold; default 30 min. `null` disables idle
* shutdown entirely (`--idle-shutdown off`). Tests use small values. */
idleThresholdMs?: number | null;
@@ -971,14 +557,6 @@ interface BootStartServerOptions {
* this — the default would take down the test runner.
*/
idleExit?: (code: number) => void;
- /**
- * Max wall-clock to wait for the auto-spawned `ok ui` to bind its port
- * (populated via `updateUiLockPort`). Default 3 000 ms — ample for a
- * subprocess to bind on kernel-allocated port 0 + single-socket loopback.
- * On timeout we fall back to the API URL for the banner so the user still
- * sees something actionable.
- */
- uiBindTimeoutMs?: number;
/**
* Logger override — defaults to `getLogger('start')`. PinoLogger is
* already silent in test mode (`NODE_ENV === 'test'` → level: 'silent'),
@@ -1023,23 +601,20 @@ interface BootStartServerOptions {
* When `true` (the `bootServer` default), the server serves
* content-directory assets (images/video/PDF/file attachments) at their
* `/<contentDir-relative>` paths via `createAssetServeMiddleware` —
- * matching the Vite dev plugin and `ok ui`. On by default so a desktop
- * window that ATTACHES to this server (MCP-autostarted or terminal
- * `ok start` — its renderer fetches assets from the same origin as
- * `/api/*` and `/collab*`) renders inline images; the `ok ui` sibling
- * still serves assets for browser mode. Forwards directly to
+ * matching the Vite dev plugin. On by default so a desktop window that
+ * ATTACHES to this server (MCP-autostarted or terminal `ok start` — its
+ * renderer fetches assets from the same origin as `/api/*` and `/collab*`)
+ * renders inline images. Forwards directly to
* `BootServerOptions.serveContentAssets`.
*/
serveContentAssets?: boolean;
/**
* Absolute path to a bundled React shell directory (Vite's `build.outDir`
* for `@inkeep/open-knowledge-app`). When set, the server serves the
- * shell on `/` (and `/assets/*` etc.) via sirv's SPA fallback, AND the
- * `ok ui` sibling is auto-suppressed (the server is now self-sufficient
- * — no second process required). The desktop passes its bundled shell
- * path so external agent in-app browsers (Claude Desktop, Cursor) can
- * render the UI at the same origin as `/api/*`. Forwards directly to
- * `BootServerOptions.reactShellDistDir`.
+ * shell on `/` (and `/assets/*` etc.) via sirv's SPA fallback. The
+ * desktop passes its bundled shell path so external agent in-app browsers
+ * (Claude Desktop, Cursor) can render the UI at the same origin as
+ * `/api/*`. Forwards directly to `BootServerOptions.reactShellDistDir`.
*/
reactShellDistDir?: string;
/**
@@ -1080,31 +655,6 @@ export interface BootedStartServer {
ready: Promise<void>;
/** Subsystems that failed to initialize — read AFTER `ready` for a stable list. */
degraded: readonly string[];
- /** What we decided about the UI sibling at boot — for tests + status output. */
- uiSpawnDecision: UiSpawnDecision;
- /**
- * Pid of the `ok ui` child THIS process spawned, or null when none was
- * spawned (sibling reused, auto-spawn skipped, or desktop single-origin).
- * The signal-driven teardown in `runStartCommand` passes this to
- * `teardownUiSibling` so it only signals the sibling we own — the same
- * ownership guard the idle-shutdown closure applies via `spawnedUiPid`.
- */
- spawnedUiPid: number | null;
- /**
- * The port `ok ui` is actually serving on, resolved end-to-end:
- * - `action: 'skip'` (sibling already alive) → `uiSpawnDecision.port`
- * - `action: 'spawn'` and the child bound within `uiBindTimeoutMs` →
- * the bound port (read from `ui.lock` after `updateUiLockPort`)
- * - `action: 'spawn'` and the child did not bind in time → `null`
- * - `skipUiAutoSpawn: true` on the spawn branch → `null`
- *
- * The banner in `startCommand` uses this instead of a hardcoded port so
- * `http://localhost:<port>` always reaches the actually-bound UI. `ok ui`
- * binds `DEFAULT_UI_PORT` when free and falls back to kernel-allocation
- * on collision, so the real port is only knowable after the child binds
- * and writes `ui.lock`.
- */
- resolvedUiPort: number | null;
}
/**
@@ -1114,13 +664,12 @@ export interface BootedStartServer {
*
* The HTTP + WebSocket + listen + lock + idle-shutdown plumbing lives in
* `@inkeep/open-knowledge-server`'s `bootServer()`; this wrapper adds
- * CLI-specific concerns (init-required guard, resolveContentDir, UI-sibling
- * spawn via `spawnOkUi`, open-browser-on-first-agent-edit).
+ * CLI-specific concerns (init-required guard, resolveContentDir,
+ * open-browser-on-first-agent-edit).
*/
export async function bootStartServer(opts: BootStartServerOptions): Promise<BootedStartServer> {
const { config, cwd, host } = opts;
const skipAutoInit = opts.skipAutoInit ?? false;
- const skipUiAutoSpawn = opts.skipUiAutoSpawn ?? false;
// Explicit undefined check (not `??`): `null` means "idle shutdown OFF"
// (`--idle-shutdown off`) and must not fall back to the 30-min default.
const idleThresholdMs =
@@ -1128,15 +677,8 @@ export async function bootStartServer(opts: BootStartServerOptions): Promise<Boo
const { existsSync, mkdirSync } = await import('node:fs');
const { basename, dirname } = await import('node:path');
- const {
- bootServer,
- getLogger,
- isProcessAlive,
- readUiLock,
- resolveContentDir,
- resolveLockDir,
- waitForServerLockDrain,
- } = await import('@inkeep/open-knowledge-server');
+ const { bootServer, getLogger, resolveContentDir, resolveLockDir, waitForServerLockDrain } =
+ await import('@inkeep/open-knowledge-server');
const log = opts.log ?? getLogger('start');
@@ -1240,62 +782,6 @@ export async function bootStartServer(opts: BootStartServerOptions): Promise<Boo
log.info({ contentDir }, 'Created content directory');
}
- // Capture uiSpawnDecision from inside the spawnUiSiblingFn callback so we
- // can return it on the BootedStartServer handle for tests + status output.
- let uiSpawnDecision: UiSpawnDecision | null = null;
- // Pid of the `ok ui` child this boot actually spawned — the ONLY pid the
- // idle-shutdown handler may signal. Stays null on reuse/skip paths.
- let spawnedUiPid: number | null = null;
- const spawnUiSiblingFn = async ({
- lockDir: resolvedLockDir,
- }: {
- lockDir: string;
- log: PinoLogger;
- }) => {
- const uiLockBefore = readUiLock(resolvedLockDir);
- uiSpawnDecision = decideUiSpawn({
- uiLock: uiLockBefore,
- isAlive: isProcessAlive,
- });
- if (uiSpawnDecision.action === 'spawn' && !skipUiAutoSpawn) {
- try {
- // Pin the sibling to an explicit `--port` when the caller threaded a
- // UI port (the worktree-preview path passes the preview pane's port).
- // Falls back to the default `['ui']` args otherwise, so terminal
- // `ok start` keeps kernel-allocated sibling ports.
- const uiArgs =
- opts.uiPort !== undefined ? ['ui', '--port', String(opts.uiPort)] : undefined;
- const uiChild = spawnOkUi({
- lockDir: resolvedLockDir,
- cwd,
- spawn: opts.spawn,
- args: uiArgs,
- });
- spawnedUiPid = uiChild.pid ?? null;
- log.info(
- { reason: uiSpawnDecision.reason, uiPort: opts.uiPort },
- '[start] auto-spawned ok ui sibling',
- );
- } catch (err) {
- console.warn(
- `[start] failed to auto-spawn ok ui: ${err instanceof Error ? err.message : String(err)}`,
- );
- }
- } else if (uiSpawnDecision.action === 'skip') {
- log.info(
- { port: uiSpawnDecision.port, pid: uiSpawnDecision.pid },
- `UI already running at port ${uiSpawnDecision.port}`,
- );
- }
- };
-
- // The server serves the React shell whenever it has a dist dir, which is
- // the default for plain `ok start` — so the single-origin composition is
- // the norm and the `ok ui` sibling is auto-suppressed. A sibling is spawned
- // only on the legacy two-process paths that reach here without a shell dir
- // (the `--ui-port` worktree-preview recipe).
- const attachUiSibling = opts.reactShellDistDir === undefined;
-
// Push-permission probe auth wiring — LAZY token store. Keyring init is
// deferred to the first probe call (and time-boxed at 2s with file-backend
// fallback) so `await bootServer(...)` cannot be blocked by a slow native
@@ -1376,23 +862,12 @@ export async function bootStartServer(opts: BootStartServerOptions): Promise<Boo
probeHarnessManagedMcpEntry: (editorId, agentCwd) =>
probeOwnManagedEditorMcpEntry(editorId, agentCwd),
// CLI-specific opt-ins
- attachUiSibling,
idleShutdownMs: idleThresholdMs,
...(opts.serverRuntime !== undefined ? { serverRuntime: opts.serverRuntime } : {}),
...(opts.bind !== undefined ? { bind: opts.bind } : {}),
skipAutoInit: true, // Guard already ran above; no scaffold fn to pass
- ...(attachUiSibling ? { spawnUiSiblingFn } : {}),
idleShutdownHandler: (destroyServer) => {
- const handler = buildIdleShutdownHandler({
- readUiLock: () => readUiLock(booted.lockDir),
- spawnedUiPid: () => spawnedUiPid,
- isAlive: isProcessAlive,
- killPid: (pid, signal) => {
- process.kill(pid, signal);
- },
- destroy: destroyServer,
- log,
- });
+ const handler = destroyServer;
const reaped = ephemeral ? withEphemeralTempDirReap(handler, ephemeralProjectDir) : handler;
// Outermost: the exit fires only after destroy AND the ephemeral temp
// dir reap have both run.
@@ -1401,51 +876,13 @@ export async function bootStartServer(opts: BootStartServerOptions): Promise<Boo
log,
// Content assets serve by default (bootServer default-on). The React
// shell dir is passed through when present — the default for plain
- // `ok start` — so the one-listener composition is the norm; it is absent
- // only on the legacy `--ui-port` sibling path.
+ // `ok start` — so the one-listener composition is the norm.
...(opts.serveContentAssets !== undefined
? { serveContentAssets: opts.serveContentAssets }
: {}),
...(opts.reactShellDistDir ? { reactShellDistDir: opts.reactShellDistDir } : {}),
});
- // Either `attachUiSibling: false` (this server serves the React shell
- // itself, no sibling needed) or bootServer skipped the callback for
- // some other reason. Sentinel-mark as "skip / no sibling" so the
- // `BootedStartServer` handle is type-complete and the banner falls
- // back to `apiUrl` (which IS the React-shell origin in this mode).
- uiSpawnDecision ||= { action: 'skip', reason: 'alive', pid: 0, port: 0 };
-
- // Resolve the port `ok ui` is actually serving on — the banner uses this
- // instead of a hardcoded default. `ok ui` binds `DEFAULT_UI_PORT` when
- // free and falls back to kernel-allocation when busy, so the real port
- // is only knowable after the child finishes binding.
- //
- // The `const` snapshot is required — `uiSpawnDecision` is a `let` captured
- // by `spawnUiSiblingFn`'s closure, which defeats TS narrowing across the
- // await boundary.
- const decisionAtBoot: UiSpawnDecision = uiSpawnDecision;
- let resolvedUiPort: number | null = null;
- if (decisionAtBoot.action === 'skip') {
- // Sibling was already alive — the lock already had its port.
- resolvedUiPort = decisionAtBoot.port > 0 ? decisionAtBoot.port : null;
- } else if (!skipUiAutoSpawn) {
- const uiBindTimeoutMs = opts.uiBindTimeoutMs ?? 3000;
- resolvedUiPort = await awaitUiSiblingPort({
- readUiLock: () => readUiLock(booted.lockDir),
- now: Date.now,
- sleep: (ms) => wait(ms),
- timeoutMs: uiBindTimeoutMs,
- pollIntervalMs: 50,
- });
- if (resolvedUiPort === null) {
- log.warn(
- { timeoutMs: uiBindTimeoutMs },
- '[start] ok ui did not bind within timeout — banner falls back to API URL',
- );
- }
- }
-
return {
httpServer: booted.httpServer,
destroy: booted.destroy,
@@ -1454,9 +891,6 @@ export async function bootStartServer(opts: BootStartServerOptions): Promise<Boo
port: booted.port,
ready: booted.ready,
degraded: booted.degraded,
- uiSpawnDecision,
- spawnedUiPid,
- resolvedUiPort,
};
}
@@ -1465,14 +899,6 @@ type StartMode = 'browser' | 'app';
interface StartCommandOptions {
port?: string | number;
- /**
- * From `--ui-port`: pin the auto-spawned `ok ui` sibling to this exact port
- * (the worktree-preview path passes the preview pane's port). Also flips the
- * live-lock collision behavior to "connect" (serve the UI on this port via
- * `ok ui`) instead of exit-1, so the same committed recipe is safe on both
- * the main checkout and a fresh worktree. Absent → today's behavior.
- */
- uiPort?: string | number;
/** From repeatable `--bind <address>`. First value wins today; >1 rejected at the action layer. */
bind?: string[];
/** From the deprecated `-H, --host` alias of `--bind`. */
@@ -1539,21 +965,6 @@ function parseStartMode(value: string): StartMode {
throw new InvalidArgumentError("--mode must be 'browser' or 'app'");
}
-/**
- * Validator for `--ui-port` — rejects non-numeric / out-of-range values at the
- * parent's arg-parse layer (clean `InvalidArgumentError` exit) rather than
- * letting a bad value flow through as `String(NaN)` into the spawned `ok ui`,
- * which would surface as a confusing child spawn failure. Matters more here
- * than for `--port` because `--ui-port` also gates the connect-vs-exit-1 fork.
- */
-function parseUiPort(value: string): number {
- const port = Number.parseInt(value, 10);
- if (Number.isNaN(port) || port < 1 || port > 65535) {
- throw new InvalidArgumentError('--ui-port must be a port number between 1 and 65535');
- }
- return port;
-}
-
/**
* Decide the stdout log level for an interactive `ok start`. The terminal
* should stay legible — banner + warnings, not a firehose of INFO diagnostics
@@ -1798,15 +1209,8 @@ export async function runStartCommand(config: Config, opts: StartCommandOptions)
const portFromEnv = envLayer.overrides.find((o) => o.envVar === 'PORT')?.value as
| number
| undefined;
- const requestedUiPort = opts.uiPort !== undefined ? Number(opts.uiPort) : undefined;
- // When `--ui-port` is set, the preview pane's `PORT` env is the UI sibling's
- // intended port, NOT the collab server's — honoring it for the collab port
- // would make the brain and its UI sibling fight over the same port. Ignore
- // env `PORT` for the collab in that case so the brain kernel-allocates; an
- // explicit `--port` still wins if the caller really wants a fixed collab
- // port. (Defense-in-depth: the recipe shell chain also unsets `PORT`.)
- // An explicit --port still wins everywhere; in remote mode the config port
- // fills the default slot and env PORT is suppressed (see resolveCollabPort).
+ // An explicit --port wins everywhere; in remote mode the config port fills
+ // the default slot and env PORT is suppressed (see resolveCollabPort).
// A stable port matters in remote mode because the tailscale serve/funnel
// mapping names a fixed target port — a kernel-assigned ephemeral port would
// break the tunnel on every restart.
@@ -1825,38 +1229,18 @@ export async function runStartCommand(config: Config, opts: StartCommandOptions)
);
}
const port =
- resolveCollabPort(portFromCli, portFromEnv, requestedUiPort, remoteEnabled) ??
+ resolveCollabPort(portFromCli, portFromEnv, remoteEnabled) ??
(remoteEnabled ? (remotePort ?? DEFAULT_REMOTE_PORT) : localPort);
- // Fast path: when `--ui-port` is set (the worktree-preview recipe), a
- // live collab server already in this folder means we must NOT boot a second
- // one — that's the main checkout, where `ok start` would collide and exit 1.
- // Short-circuit straight to "connect" (serve the UI on the preview's port
- // via `ok ui`, which reuses / proxies the existing UI) so main behaves
- // exactly as the prior bare-`ok ui` recipe did, with no doomed boot attempt.
- // The post-boot catch below is the TOCTOU backstop for the narrow race where
- // a server appears between this check and bootServer's lock acquisition.
- if (requestedUiPort !== undefined) {
- const { readServerLock, resolveLockDir } = await import('@inkeep/open-knowledge-server');
- const liveServer = readServerLock(resolveLockDir(cwd));
- if (shouldConnectToExistingServer(requestedUiPort, liveServer)) {
- await connectUiSibling({ cwd, uiPort: requestedUiPort });
- return;
- }
- }
-
// The default composition serves the SPA from the server's own port (`/` =
- // UI, `/api`, `/mcp`, `/collab` — one listener, one origin), which also
- // auto-suppresses the `ok ui` sibling. `resolveStartShellDir` holds the
- // decision table (explicit dir wins; `--only server` and the `--ui-port`
- // worktree-preview recipe opt out; remote always serves the shell so one
- // tunnel covers everything). A missing bundle degrades to API/MCP-only with
- // a warning rather than failing the start.
+ // UI, `/api`, `/mcp`, `/collab` — one listener, one origin).
+ // `resolveStartShellDir` holds the decision table (explicit dir wins;
+ // `--only server` opts out; everything else — remote included — serves the
+ // shell by default). A missing bundle degrades to API/MCP-only with a
+ // warning rather than failing the start.
const shell = resolveStartShellDir({
explicitDir: opts.reactShellDistDir,
only: opts.only,
- uiPortSet: requestedUiPort !== undefined,
- remoteEnabled,
findBundledDir: resolveBundledReactShellDir,
});
const reactShellDistDir = shell.dir;
@@ -1878,15 +1262,10 @@ export async function runStartCommand(config: Config, opts: StartCommandOptions)
// Full bind list for the multi-listener bind — already collapsed to the
// coerced loopback host in remote mode (see `bindList` above).
bind: bindList,
- ...(requestedUiPort !== undefined ? { uiPort: requestedUiPort } : {}),
...(opts.serveContentAssets !== undefined
? { serveContentAssets: opts.serveContentAssets }
: {}),
...(reactShellDistDir ? { reactShellDistDir } : {}),
- // No sibling spawn when the UI module is off (`--only server`) or the
- // bundle is missing — a spawned `ok ui` would be serving the same
- // missing bundle, and the warning above already promised API/MCP-only.
- ...(opts.only === 'server' || shell.missingBundle ? { skipUiAutoSpawn: true } : {}),
// Flag > env/file/derived, resolved uniformly: both the flag value and
// the resolver's idleShutdown are duration strings ('off' | '90s' | …) —
// the resolver's covers OK_IDLE_SHUTDOWN, the config leaf, and the
@@ -1942,24 +1321,12 @@ export async function runStartCommand(config: Config, opts: StartCommandOptions)
process.exit(1);
}
- // TOCTOU backstop: the worktree-preview recipe (`--ui-port` set) lost
- // a race — a server appeared between the fast-path check above and
- // bootServer's lock acquisition (the MCP-shim autostart, or a second
- // preview-open). The boot threw a server-lock collision. Don't exit 1 (that
- // breaks the pane); fall back to connect, exactly like the fast path. Gated
- // on `--ui-port` so plain terminal `ok start` keeps its "already running"
- // message below.
- if (requestedUiPort !== undefined && isServerLockCollision(err, serverModule)) {
- await connectUiSibling({ cwd, uiPort: requestedUiPort });
- return;
- }
-
// Spawn-or-reuse: a plain `ok start` that collided with a live server
// reads the holder's advertisement, reports its URL, and exits 0 — a
// second start attaches to the running composition instead of failing.
// Falls through to the tailored/generic error path (exit 1) only when the
// lock can't be resolved to a usable address within the poll window.
- if (requestedUiPort === undefined && isServerLockCollision(err, serverModule)) {
+ if (isServerLockCollision(err, serverModule)) {
const lockDir = serverModule.resolveLockDir(cwd);
// A lock read can throw mid-poll (EMFILE, a JSON rewrite caught in
// flight). Contain it so a transient disk error degrades to the tailored
@@ -2025,34 +1392,6 @@ export async function runStartCommand(config: Config, opts: StartCommandOptions)
for (const line of details) {
console.log(dim(` ${line}`));
}
- // Tear down the detached `ok ui` sibling BEFORE destroy releases
- // server.lock — same order as idle-shutdown. Without this, Ctrl+C left the
- // UI child running until its 12h safety timer, holding its port. Two
- // distinct guards: the outer `!== null` skips the whole block (and its
- // import) when we spawned no sibling; `teardownUiSibling`'s internal
- // `spawnedUiPid` comparison confirms the CURRENT lock holder is still the
- // pid we spawned, so a holder we didn't spawn (desktop shell, another
- // session) is left alone. Wrapped so a failure here never bypasses
- // destroy() — the best-effort teardown contract idle-shutdown also honors.
- if (booted.spawnedUiPid !== null) {
- try {
- const { getLogger, isProcessAlive, readUiLock } = await import(
- '@inkeep/open-knowledge-server'
- );
- await teardownUiSibling({
- readUiLock: () => readUiLock(booted.lockDir),
- spawnedUiPid: () => booted.spawnedUiPid,
- isAlive: isProcessAlive,
- killPid: (pid, sig) => process.kill(pid, sig),
- log: getLogger('start'),
- reason: 'shutdown',
- });
- } catch (err) {
- console.error(
- `${error('ui sibling teardown failed:')} ${err instanceof Error ? (err.stack ?? err.message) : String(err)}`,
- );
- }
- }
try {
await booted.destroy();
} catch (err) {
@@ -2078,20 +1417,15 @@ export async function runStartCommand(config: Config, opts: StartCommandOptions)
const networkUrl =
host === '0.0.0.0' || host === '::' ? `http://0.0.0.0:${booted.port}` : undefined;
- // On the default one-listener path the server serves the shell itself, so
- // `resolvedUiPort` is null and `localUrl` IS `apiUrl` — the editor URL, not
- // a degraded fallback. `resolvedUiPort` is non-null only on the legacy
- // `--ui-port` sibling path, where bootStartServer polls `ui.lock`
- // end-to-end for the port the sibling actually bound.
- const uiPort = booted.resolvedUiPort;
- const localUrl = uiPort !== null && uiPort > 0 ? `http://${urlHost}:${uiPort}` : apiUrl;
+ // One-listener composition: the server serves the shell itself, so the
+ // editor URL IS the API URL.
+ const localUrl = apiUrl;
console.log(
renderBanner({
name: 'open-knowledge',
version: PACKAGE_VERSION,
localUrl,
- apiUrl: localUrl !== apiUrl ? apiUrl : undefined,
networkUrl,
nextSteps: ['Open the Editor URL in your browser to start editing.'],
}),
@@ -2295,11 +1629,6 @@ export function startCommand(getConfig: () => Config): Command {
const cmd = new Command('start')
.description('Start the OpenKnowledge server (UI + API + MCP + collab on one port)')
.option('-p, --port <port>', 'Server port', undefined)
- .option(
- '--ui-port <port>',
- 'Pin the ok ui sibling to <port> and connect (not exit) if a server already runs here — the worktree-preview recipe path',
- parseUiPort,
- )
.option(
'--bind <address>',
'Bind address (repeatable; default 127.0.0.1 — loopback only)',
@@ -2335,10 +1664,7 @@ export function startCommand(getConfig: () => Config): Command {
'--serve-content-assets',
'Serve content assets from this server (now the default; kept for compatibility)',
)
- .option(
- '--react-shell-dist-dir <path>',
- 'Serve React shell from <path> (suppresses ok ui sibling)',
- )
+ .option('--react-shell-dist-dir <path>', 'Serve React shell from <path>')
.option(
'--single-file <path>',
'No-project ephemeral single-file mode: scope the server to one markdown file (git + MCP off)',
@@ -2396,9 +1722,22 @@ export function startCommand(getConfig: () => Config): Command {
}
// `--only ui`: run just the shell-serving proxy against an explicit
- // upstream — the operator split-mode replacement for bare `ok ui`
- // (which discovers its upstream via server.lock instead).
+ // upstream — the operator split-mode replacement for the removed
+ // `ok ui` (which discovered its upstream via server.lock instead).
if (opts.only === 'ui') {
+ // Deprecation notice FIRST, before any refusal below — the operator
+ // should learn the successor spelling from the same run that errors
+ // (mirrors the --remote notice ordering). Stderr so stdout stays
+ // parseable for callers that scrape the "listening on" line. The
+ // split-mode proxy retires together with ui.lock in a later release.
+ {
+ const { warning } = await import('../ui/colors.ts');
+ console.error(
+ warning(
+ '[start] `--only ui` is deprecated — plain `ok start` serves the editor UI, API, and MCP on one port. The split-mode proxy will be removed in a future release.',
+ ),
+ );
+ }
if (opts.serverUrl === undefined) {
process.stderr.write(
"error: '--only ui' requires '--server-url <url>' (where the project server runs)\n",
@@ -2451,7 +1790,6 @@ export function startCommand(getConfig: () => Config): Command {
// can grep for it without crashing.
const ignored: string[] = [];
if (opts.port !== undefined) ignored.push('--port');
- if (opts.uiPort !== undefined) ignored.push('--ui-port');
if (opts.bind !== undefined) ignored.push('--bind');
if (opts.host !== undefined) ignored.push('--host');
if (opts.only !== undefined) ignored.push('--only');
diff --git a/packages/cli/src/commands/ui.ts b/packages/cli/src/commands/ui.ts
index b91f3300a..5c9e3e3db 100644
--- a/packages/cli/src/commands/ui.ts
+++ b/packages/cli/src/commands/ui.ts
@@ -1,13 +1,12 @@
/**
- * `open-knowledge ui` — serves the React editor UI as a sibling to `ok start`.
+ * Sibling UI server — the engine behind `ok start --only ui --server-url`
+ * (the deprecated explicit split-mode, which passes `upstreamUrl` instead of
+ * discovering the upstream via `server.lock`).
*
- * DEPRECATED as a user-facing command: plain `ok start` now serves the shell
- * from the project server on one port. This command remains functional for
- * the Desktop version-skew window (older desktop builds attach through it and
- * `ui.lock`) and as the engine behind `ok start --only ui --server-url` (the
- * explicit split-mode, which passes `upstreamUrl` instead of discovering the
- * upstream via `server.lock`). Do not remove until the Desktop attach
- * re-point has shipped in a stable release.
+ * The `ok ui` command that used to front this engine has been removed: plain
+ * `ok start` serves the shell from the project server on one port, and the
+ * Desktop attaches via server.lock v2. This module retires together with
+ * `--only ui` and `ui.lock` in the follow-up removal wave.
*
* Default port `DEFAULT_UI_PORT` (39847 — quirky, IANA-unassigned, unlikely to
* collide with other dev servers); `PORT` env and `--port` flag override. When the
@@ -51,7 +50,6 @@ import {
type Scheduler,
} from '@inkeep/open-knowledge-core';
import type { Config } from '@inkeep/open-knowledge-server';
-import { Command } from 'commander';
import { emitProblem } from './ui-problem.ts';
import {
type ProxyServerHandle,
@@ -1008,34 +1006,6 @@ export async function runUiCommand(config: Config, opts: RunUiCommandOptions): P
}
}
-export function uiCommand(getConfig: () => Config): Command {
- return new Command('ui')
- .description(
- 'Deprecated: serve the React editor UI as a sibling process (plain `ok start` now serves the UI itself)',
- )
- .option(
- '-p, --port <port>',
- `UI port (default: $PORT env or ${DEFAULT_UI_PORT}, kernel-allocated fallback if busy)`,
- )
- .option(
- '-H, --host <host>',
- 'UI host. Default: two-socket loopback bind (`[::1]` + `127.0.0.1`) so cross-family collisions fail loud. Pass an explicit host (e.g. `127.0.0.1`, `0.0.0.0`) to bind a single socket on that host.',
- )
- .action(async (opts: { port?: string; host?: string }) => {
- // Deprecation notice on stderr — stdout stays parseable for callers
- // that scrape the "listening on" line, and Desktop preview panes that
- // spawn `ok ui` keep working untouched (removal is a later release,
- // after the Desktop attach re-point ships).
- const { warning } = await import('../ui/colors.ts');
- console.error(
- warning(
- '[ui] Deprecated: use `ok start` instead — it now serves the editor UI on one port. `ok ui` remains for older desktop builds and will be removed in a future release.',
- ),
- );
- await runUiCommand(getConfig(), opts);
- });
-}
-
// Exported for tests.
export { resolveRequestedPort };
diff --git a/packages/cli/src/ui/banner.ts b/packages/cli/src/ui/banner.ts
index 199176313..d609d2cc4 100644
--- a/packages/cli/src/ui/banner.ts
+++ b/packages/cli/src/ui/banner.ts
@@ -17,9 +17,8 @@ interface BannerOptions {
networkUrl?: string;
/**
* Secondary URL for the collab/API server. When set, the primary `localUrl`
- * is labeled "Editor:" (pointing at `ok ui`) and this field is rendered as
- * "API:" (pointing at `ok start`). this gives operators
- * the URL they actually want to click.
+ * is labeled "Editor:" and this field is rendered as "API:". This gives
+ * operators the URL they actually want to click.
*/
apiUrl?: string;
/**
diff --git a/packages/cli/tests/e2e/cli-linux-e2e.ts b/packages/cli/tests/e2e/cli-linux-e2e.ts
index a954188ad..3bae90b6d 100644
--- a/packages/cli/tests/e2e/cli-linux-e2e.ts
+++ b/packages/cli/tests/e2e/cli-linux-e2e.ts
@@ -232,8 +232,8 @@ describe(`CLI Linux e2e (${SUT_MODE} SUT)`, () => {
expect(H.server.exitCode, 'server exited during startup').toBeNull();
// Liveness via a TCP connect to the lock port — route-agnostic proof the
- // server is bound. We don't GET `/` (the static SPA is served by the sibling
- // `ok ui`, not the bare `ok start` server); the MCP round-trip below is the
+ // server is bound. We don't GET `/` (this rig may run without a built
+ // React bundle, so `/` can be a 404); the MCP round-trip below is the
// functional proof.
const reachable = await waitFor(() => tcpReachable(port as number), { timeoutMs: 15_000 });
expect(reachable, 'server port never accepted a TCP connection').toBe(true);
diff --git a/packages/core/src/config/removed-keys.ts b/packages/core/src/config/removed-keys.ts
index f9fc2509a..61604e1a0 100644
--- a/packages/core/src/config/removed-keys.ts
+++ b/packages/core/src/config/removed-keys.ts
@@ -140,7 +140,7 @@ export const REMOVED_KEYS: readonly RemovedKey[] = [
{
path: ['preview', 'baseUrl'],
redirect: [
- 'preview URLs now resolve only to the running UI process — start one with `ok ui`.',
+ 'preview URLs now resolve only to the running server — start one with `ok start`.',
MIGRATE_HINT,
].join(' '),
},
diff --git a/packages/core/src/constants/lifecycle.ts b/packages/core/src/constants/lifecycle.ts
index 859688180..dc8226272 100644
--- a/packages/core/src/constants/lifecycle.ts
+++ b/packages/core/src/constants/lifecycle.ts
@@ -22,17 +22,14 @@ export const DEFAULT_SIGTERM_POLL_MS = 200;
/**
* Filename under `<contentDir>/.ok/local/` that detached-subprocess spawn
- * sites redirect the child's stdio to. Three sites currently write here:
+ * sites redirect the child's stdio to. Two sites currently write here:
*
* 1. MCP shim's `resolveMcpHttpUrl` (`packages/cli/src/mcp/shim.ts`) —
* stderr only, so the parent can read it back and include in the
* timeout error when the spawned `ok start` doesn't write `server.lock`
* within `DEFAULT_SPAWN_TIMEOUT_MS`.
- * 2. CLI `spawnOkUi` (`packages/cli/src/commands/start.ts`) — stderr only;
- * the `ok ui` sibling's failure mode surfaces here for the parent's
- * `awaitUiSiblingPort` poll-timeout error.
- * 3. Desktop `spawnDetachedServer` (`packages/desktop/src/main/index.ts`) —
- * stderr only (mirroring the peer sites), used both for diagnostic
+ * 2. Desktop `spawnDetachedServer` (`packages/desktop/src/main/index.ts`) —
+ * stderr only (mirroring the peer site), used both for diagnostic
* capture and for `spawn-lock-timeout` error enrichment.
*
* The shared filename means one tail target for operators and one constant
diff --git a/packages/desktop/src/main/index.ts b/packages/desktop/src/main/index.ts
index b1c86f331..605a7b018 100644
--- a/packages/desktop/src/main/index.ts
+++ b/packages/desktop/src/main/index.ts
@@ -1541,8 +1541,7 @@ function ensureWindowManager() {
// `<projectRoot>/.ok/local/<SPAWN_ERROR_LOG>` so production
// failure modes (port-bind error, dependency load failure,
// bootServer init throw) are diagnosable. The MCP shim
- // (`packages/cli/src/mcp/shim.ts`) and `spawnOkUi`
- // (`packages/cli/src/commands/start.ts`) write to the same
+ // (`packages/cli/src/mcp/shim.ts`) writes to the same
// filename — one tail target for operators. `stdio: 'ignore'`
// would route everything to /dev/null and leave the user
// staring at a 15-second `spawn-lock-timeout` with no
@@ -1591,7 +1590,7 @@ function ensureWindowManager() {
// for the child stays out of the parent .app's MacOS dir on darwin
// packaged builds — see resolve-detached-spawn-args.ts. stdin +
// stdout route to /dev/null and stderr to the SPAWN_ERROR_LOG fd
- // (matches MCP shim + spawnOkUi convention). The child inherits
+ // (matches the MCP shim convention). The child inherits
// the open fd; we close our copy once 'spawn' fires (in the
// finally below) so the parent doesn't keep the file open.
const spawnArgs = resolveDetachedSpawnArgs({
diff --git a/packages/desktop/src/main/resolve-detached-spawn-args.ts b/packages/desktop/src/main/resolve-detached-spawn-args.ts
index 386a55283..5304d91ae 100644
--- a/packages/desktop/src/main/resolve-detached-spawn-args.ts
+++ b/packages/desktop/src/main/resolve-detached-spawn-args.ts
@@ -28,7 +28,7 @@ import { fallbackPaths } from '@inkeep/open-knowledge-server';
* (`resolveHelperBundleBinary`) live in
* `@inkeep/open-knowledge-core/helper-bundle.ts` so the CLI self-spawn
* site (`packages/cli/src/commands/self-spawn.ts`, covering the
- * `ok mcp → ok start` and `ok start → ok ui` auto-spawn paths) shares the
+ * `ok mcp → ok start` auto-spawn path) shares the
* same path-arithmetic source of truth as this resolver. The CLI's
* redirect predicate is colocated with its sole consumer there because
* it encodes a CLI-only heuristic (`.app/Contents/MacOS/` regex + an
diff --git a/packages/desktop/src/utility/server-entry.ts b/packages/desktop/src/utility/server-entry.ts
index 74a08c66a..5d44fe5da 100644
--- a/packages/desktop/src/utility/server-entry.ts
+++ b/packages/desktop/src/utility/server-entry.ts
@@ -3,7 +3,7 @@
*
* Lifecycle:
* 1. Module load: register IPC + signal handlers, start parent-death poll
- * 2. `init` IPC from main → call `bootServer({ ...opts, attachUiSibling: false, idleShutdownMs: null })`
+ * 2. `init` IPC from main → call `bootServer({ ...opts, idleShutdownMs: null })`
* 3. On `bootedServer.ready` → post `{ type: 'ready', port, apiOrigin }` back to main
* 4. On `shutdown` IPC OR SIGTERM/SIGINT OR parent death → drain + exit
*
@@ -347,7 +347,6 @@ export function setupUtility(deps: SetupUtilityDeps): UtilityHandle {
contentDir: prepared.contentDir,
contentRoot: prepared.contentRoot,
config: prepared.config,
- attachUiSibling: false, // No `ok ui` sibling under Electron
idleShutdownMs: null, // BrowserWindow lifecycle owns utility lifetime
skipAutoInit: true,
autoInitFn: undefined,
diff --git a/packages/desktop/tests/utility/server-entry.test.ts b/packages/desktop/tests/utility/server-entry.test.ts
index c102270c8..a01c7d09b 100644
--- a/packages/desktop/tests/utility/server-entry.test.ts
+++ b/packages/desktop/tests/utility/server-entry.test.ts
@@ -134,7 +134,6 @@ describe('setupUtility (IPC handshake + lifecycle)', () => {
// Asserts the opt-outs plus the autoInit decoupling
const callArgs = bootServer.mock.calls[0]?.[0] as Record<string, unknown> | undefined;
- expect(callArgs?.attachUiSibling).toBe(false);
expect(callArgs?.idleShutdownMs).toBe(null);
expect(callArgs?.skipAutoInit).toBe(true);
expect(callArgs?.autoInitFn).toBeUndefined();
diff --git a/packages/server/assets/skills/discovery/SKILL.md b/packages/server/assets/skills/discovery/SKILL.md
index ac2d6c33f..ab3d6c1fe 100644
--- a/packages/server/assets/skills/discovery/SKILL.md
+++ b/packages/server/assets/skills/discovery/SKILL.md
@@ -98,7 +98,7 @@ you genuinely have one; never pop a browser tab on a host that has none.
means navigate your browser — don't just print the URL and stop. This is also
the only way to view it in a browser when the OK Desktop app is installed
(`ok open` prefers the Desktop app). Get the URL from `preview_url` only —
- never hunt for it via `ok ps` / `ok status` / `ok ui` / `ok start` or a guessed
+ never hunt for it via `ok ps` / `ok status` / `ok start` or a guessed
port.
- **No in-app browser** (a pure-stdio CLI) — run
`ok open /abs/path/to/file.md`: it opens the Desktop app when installed, else a
diff --git a/packages/server/assets/skills/project/references/preview.md b/packages/server/assets/skills/project/references/preview.md
index fb386288b..c34c8afdf 100644
--- a/packages/server/assets/skills/project/references/preview.md
+++ b/packages/server/assets/skills/project/references/preview.md
@@ -40,7 +40,7 @@ Decide once; then every "open / show / preview this doc" this session uses that
- **`ok open <name>`** — opens a **doc or folder** in the OK Desktop app. The type is auto-detected (a directory on disk → folder, otherwise a doc), so **`--folder` is not needed** (it stays only as an explicit override for a folder that doesn't exist on disk yet). An action you run, not a URL to print.
- **`ok open <skill-name> --skill [--scope project|global]`** — opens a **skill** in the skill editor (skills are addressed by name + scope, not a content path, so they need the flag).
-- All three deep-link into OK Desktop when a bundle is installed, and fall back to the browser UI (`ok ui`) otherwise. No `ok` on PATH or no shell → `preview_url`, then `open <url>` in the system browser as a last resort, and say so plainly. The system browser is the fallback, never the default.
+- All three deep-link into OK Desktop when a bundle is installed, and fall back to the browser UI (`ok start`) otherwise. No `ok` on PATH or no shell → `preview_url`, then `open <url>` in the system browser as a last resort, and say so plainly. The system browser is the fallback, never the default.
(The same vendors' *desktop apps* with a built-in browser — Cursor, Codex desktop — are NOT here; they navigate their own browser per the in-app branch above. Codex **IDE extension** / **Cloud** are web-search-only → they're on this CLI track too.) **Running inside OpenKnowledge itself — the desktop built-in terminal (`OK_DESKTOP_TERMINAL`) or the in-app agent panel (`OK_HOSTED_AGENT`)? Same track — `ok open <name>` re-targets the surface you're already in** (switches it to the doc/folder; when that surface is a desktop window there's no second window, and no need to raise it since it's already frontmost). Don't resolve preview URLs in that case; `ok open` is the whole answer.
@@ -61,7 +61,7 @@ Warnings fire at most once per session in the fresh-start case.
If you see `"Hocuspocus server is not running"`, run `ok start` and retry.
-OK Electron and `ok ui` share `ui.lock`; when a second UI binds a different port, the OK lock-collision proxy bridges it to the live server transparently. That is exactly why `previewUrl` is route-only — the port behind the proxy is not the agent's to use. **Do not nudge the user to quit OK Electron to free a port** — the proxy handles it, and quitting tears down a UI in active use.
+OK Electron and the project server coordinate through the same lock files; a second UI-serving process yields to the live holder transparently. That is exactly why `previewUrl` is route-only — the underlying port is not the agent's to use. **Do not nudge the user to quit OK Electron to free a port** — the server handles coexistence, and quitting tears down a UI in active use.
**The preview is read-only for the agent — it is the user's view, not a surface you read back.** You cannot click or type to drive edits — the CRDT flow is one-way (agent → MCP → CRDT → preview).
diff --git a/packages/server/src/api-extension.ts b/packages/server/src/api-extension.ts
index a221d93dc..614d70df3 100644
--- a/packages/server/src/api-extension.ts
+++ b/packages/server/src/api-extension.ts
@@ -494,7 +494,6 @@ import { rewriteSkillRefsAcrossScope, type SkillRefRewrite } from './skill-ref-r
import { readSkillInstallStateSnapshot } from './skill-state.ts';
import { handleSpawnCursor } from './spawn-cursor-api.ts';
import { assertRealpathWithinDir } from './symlink-guard.ts';
-import { readUiLock } from './ui-lock.ts';
import { HashingPassThrough, mintTempUploadPath } from './upload-streaming.ts';
/** Does the bundle at `dir` carry a `metadata.pack` marker in its frontmatter? */
@@ -732,6 +731,7 @@ import type { SyncEngine } from './sync-engine.ts';
import { getMeter, withSpan, withSpanSync } from './telemetry.ts';
import { getDocumentHistory, getFolderTimeline } from './timeline-query.ts';
import { recordTimelineCoalesced } from './timeline-telemetry.ts';
+import { resolveUiRedirectPort } from './ui-redirect-port.ts';
import { computeWriteAdvisoryLinks } from './write-advisory-links.ts';
// Lazy-init so the counter registers against a real meter post-initTelemetry
@@ -10370,70 +10370,46 @@ export function createApiExtension(
});
}
+ const SERVER_WITHOUT_UI_ERROR =
+ 'A server is already running for this directory without a web UI (started with `--only server`, or from a build without the bundled editor). Restart it with plain `ok start` from an install that includes the web UI.';
+
/**
- * Spawn a detached OpenKnowledge server at `dir` and poll the server.lock
- * until a real port appears. Used by the clone handler to chain
- * clone → server-start → redirect.
+ * Ensure a live project server at `dir` and return its browser-navigable
+ * port. Resolution goes through `resolveUiRedirectPort` — server.lock
+ * (`ui` capability) first, the still-supported `ui.lock` advertisement
+ * second — so this surface agrees with `resolveUiInfo` on what "no UI"
+ * means through the ui.lock compatibility window.
+ *
+ * Three cases:
+ * 1. a live UI origin resolves → reuse its port.
+ * 2. definitive no-UI (`--only server` holder, no sibling) → error.
+ * 3. Nothing live → spawn `ok start` detached (it serves the shell by
+ * default) and poll for a bound ui-capable port.
*
* NOTE: The CLI's `start` command has no `--content-dir` flag — it derives
* the content dir from cwd + config. So we spawn with `cwd: dir` instead
* of passing a flag.
*/
- /**
- * Ensure both the collab server (`ok start`) and the React UI (`ok ui`) are
- * live for `dir`, and return the UI port — that's the browser-navigable
- * redirect target post-lifecycle-split. `ok start` serves only the collab
- * API/WebSocket and returns 404 at `/` with an `ok ui`-pointing message.
- *
- * Three cases:
- * 1. `ui.lock` is live → reuse its port (UI already running in that dir).
- * 2. `server.lock` live but `ui.lock` absent/stale → spawn `ok ui` alone;
- * `ok start` won't re-spawn its UI sibling when the server-lock is held.
- * 3. Nothing live → spawn `ok start`; it auto-spawns `ok ui` as a sibling
- * (see `start.ts`, "auto-spawned ok ui sibling").
- *
- * Polls `ui.lock` (not `server.lock`) because only `ui.lock.port` hosts the
- * React bundle. Single polling loop covers cases 2 and 3 uniformly.
- */
async function startServerAtDirAndGetPort(
dir: string,
- port?: number,
): Promise<{ port: number } | { error: string }> {
const absDir = resolve(expandTilde(dir));
const lockDir = getLocalDir(absDir);
- // Case 1: UI already live — reuse. (Honors a requested `port` only when a
- // fresh UI is spawned below; an already-live UI keeps its bound port.)
- const existingUi = readUiLock(lockDir);
- if (existingUi && existingUi.port > 0) {
- return { port: existingUi.port };
- }
+ // Cases 1 + 2: something is already live — reuse its port, or refuse on
+ // a definitive no-UI topology.
+ const existing = resolveUiRedirectPort(lockDir);
+ if (existing === 'no-ui') return { error: SERVER_WITHOUT_UI_ERROR };
+ if (existing !== null) return { port: existing };
- // Build the args for a given dispatch command, threading the requested UI
- // port: `ok ui --port P` (connect) or `ok start --ui-port P` (start, which
- // pins its UI sibling to P via the separate `--ui-port` channel — `PORT` is
- // stripped from the sibling env so the collab server and the sibling don't
- // collide). Omitting `port` reproduces the legacy kernel-allocated behavior.
const [cmd, ...baseArgs] = localOpCliArgs;
- const buildArgs = (cliCmd: 'ui' | 'start'): string[] => {
- const portFlag =
- port !== undefined
- ? cliCmd === 'ui'
- ? ['--port', String(port)]
- : ['--ui-port', String(port)]
- : [];
- return [...baseArgs, cliCmd, ...portFlag];
- };
- // Spawn `ok <cliCmd>` detached at `absDir` and poll `ui.lock` for a bound
- // port. Returns the port, or `{ exited }` when the child died before
- // binding (so the caller can decide whether to fall back to connect).
- const spawnAndAwaitUi = async (
- cliCmd: 'ui' | 'start',
- ): Promise<{ port: number } | { error: string; exited: boolean }> => {
+ // Case 3: spawn `ok start` detached at `absDir` (it serves the shell by
+ // default) and poll `server.lock` for a bound ui-capable port.
+ const spawnAndAwaitServer = async (): Promise<{ port: number } | { error: string }> => {
const child = spawn(
cmd,
- buildArgs(cliCmd),
+ [...baseArgs, 'start'],
withHiddenWindowsConsole({
...LOCAL_OP_STDERR_ONLY_OPTIONS,
cwd: absDir,
@@ -10449,7 +10425,7 @@ export function createApiExtension(
child.stderr?.on('data', (chunk: Buffer) => {
stderrChunks.push(chunk);
log.warn(
- { cwd: absDir, cliCmd, msg: chunk.toString('utf-8').trim() },
+ { cwd: absDir, msg: chunk.toString('utf-8').trim() },
'[local-op/clone] child stderr',
);
});
@@ -10463,14 +10439,14 @@ export function createApiExtension(
});
// A failed `spawn` (ENOENT: binary not found, EACCES: not executable)
// emits `error` and NEVER `exit`. Without this handler `earlyExitCode`
- // stays null, the loop polls the full timeout, and the early-exit return
- // — which the TOCTOU connect-fallback keys off via `exited: true` — never
- // fires, so a broken install bypasses the fallback and reads as a timeout.
- // Trip the early-exit path on the next poll tick instead.
+ // stays null, the loop polls the full timeout, and the early-exit
+ // branch — including its lock re-check for a concurrent winner — never
+ // fires, so a broken install reads as a timeout. Trip the early-exit
+ // path on the next poll tick instead.
child.on('error', (err) => {
spawnErrorMessage = err.message;
earlyExitCode = -1;
- log.error({ cwd: absDir, cliCmd, err }, '[local-op/clone] failed to spawn child');
+ log.error({ cwd: absDir, err }, '[local-op/clone] failed to spawn child');
});
// `unref` so the child survives past the parent. Do it after attaching
@@ -10480,10 +10456,9 @@ export function createApiExtension(
const deadline = Date.now() + LOCAL_OP_OPEN_TIMEOUT_MS;
while (Date.now() < deadline) {
await wait(500);
- const uiLock = readUiLock(lockDir);
- if (uiLock && uiLock.port > 0) {
- return { port: uiLock.port };
- }
+ const state = resolveUiRedirectPort(lockDir);
+ if (state === 'no-ui') return { error: SERVER_WITHOUT_UI_ERROR };
+ if (state !== null) return { port: state };
if (earlyExitCode !== null) {
const stderr = Buffer.concat(stderrChunks).toString('utf-8').trim();
// Name the real cause: spawn failure, signal kill, or exit code — so
@@ -10495,49 +10470,28 @@ export function createApiExtension(
: earlyExitSignal
? `killed by ${earlyExitSignal}`
: `code ${earlyExitCode}`;
+ // TOCTOU collision-fallback: the spawn can lose a race to a
+ // concurrent start (the MCP-shim autostart, a second preview-open)
+ // that acquired `server.lock` between our liveness check and the
+ // child's own acquisition; the child exits (typically a
+ // ProcessLockCollisionError) while the winner keeps serving. Key
+ // off the observable signature — child exited AND a live lock now
+ // exists — and redirect to the winner instead of failing the pane.
+ const winner = resolveUiRedirectPort(lockDir);
+ if (winner === 'no-ui') return { error: SERVER_WITHOUT_UI_ERROR };
+ if (winner !== null) return { port: winner };
return {
- error: `\`ok ${cliCmd}\` exited (${cause})${stderr ? ` — ${stderr}` : ''}`,
- exited: true,
+ error: `\`ok start\` exited (${cause})${stderr ? ` — ${stderr}` : ''}`,
};
}
}
const stderr = Buffer.concat(stderrChunks).toString('utf-8').trim();
return {
- error: `UI did not start within the expected time${stderr ? ` — ${stderr}` : ''}`,
- exited: false,
+ error: `Server did not start within the expected time${stderr ? ` — ${stderr}` : ''}`,
};
};
- // Case 2 vs 3: pick which CLI command to spawn based on whether the
- // collab server is already live. `ok ui` alone is correct and necessary
- // when `server.lock` is held (can't re-run `ok start` under a live lock).
- const existingServer = readServerLock(lockDir);
- const cliCmd = existingServer && existingServer.port > 0 ? 'ui' : 'start';
- const result = await spawnAndAwaitUi(cliCmd);
-
- // TOCTOU collision-fallback. A `start` spawn can lose a race to a concurrent
- // server start (the MCP-shim autostart, a second preview-open) that acquired
- // `server.lock` between the `readServerLock` check above and the child's own
- // acquisition; the child then exits (typically a ProcessLockCollisionError).
- // We key off the observable signature rather than the exit reason: if the
- // `start` child exited early AND a live `server.lock` now exists, connect to
- // it via `ok ui`. This also harmlessly covers a non-collision early exit that
- // happens to coincide with a live lock — the right move there is still to
- // connect to the running server. Net: a lost race degrades to "connect",
- // never a failed pane.
- if (cliCmd === 'start' && 'error' in result && result.exited) {
- const nowServer = readServerLock(lockDir);
- if (nowServer && nowServer.port > 0) {
- const connectResult = await spawnAndAwaitUi('ui');
- if ('port' in connectResult) return connectResult;
- // Preserve both legs for diagnostics: why `start` exited AND why the
- // connect fallback then failed.
- return { error: `${result.error}; connect fallback failed: ${connectResult.error}` };
- }
- }
-
- if ('port' in result) return result;
- return { error: result.error };
+ return spawnAndAwaitServer();
}
/**
@@ -20507,11 +20461,11 @@ export function createApiExtension(
},
);
- // `/api/config` — collab-bootstrap payload for the React shell. In the
- // desktop / worktree-as-project-server topology this collab server is what
- // serves the SPA, so the shell fetches `/api/config` here rather than from a
- // separate `ok ui` front. The JSON shape matches `ok ui` (api-config.ts
- // consumes it identically): GET returns `{collabUrl, previewUrl, port}`. GET
+ // `/api/config` — collab-bootstrap payload for the React shell. This server
+ // serves the SPA itself, so the shell fetches `/api/config` from the same
+ // origin (api-config.ts consumes it; the `--only ui` split-mode proxy in
+ // `packages/cli` emits the same shape): GET returns
+ // `{collabUrl, previewUrl, port}`. GET
// stays open like the other read-only bootstrap endpoints
// (document/pages/backlinks) — it carries no PII and only reflects the
// client's own Host back to itself. `lockDir` is the project's
@@ -20528,7 +20482,8 @@ export function createApiExtension(
// Host value is the client's own header reflected back to itself (the
// Origin CORS gate in `onRequest` already refused cross-origin
// browsers); it is not independently vetted here. A genuinely absent
- // Host yields a null collabUrl — a deliberate divergence from `ok ui`'s
+ // Host yields a null collabUrl — a deliberate divergence from the
+ // split-mode UI proxy's
// `?? localhost:${resolvedPort}` fallback: this server has no single
// canonical advertised port to substitute, and the client falls back
// to a same-origin WS URL on a null. Node HTTP/1.1 always populates
diff --git a/packages/server/src/boot-conflict-restore.test.ts b/packages/server/src/boot-conflict-restore.test.ts
index ac9d9658e..ec3d8fd50 100644
--- a/packages/server/src/boot-conflict-restore.test.ts
+++ b/packages/server/src/boot-conflict-restore.test.ts
@@ -135,7 +135,6 @@ describe('bootServer — FR14 lifecycle restoration from conflicts.json', () =>
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
@@ -176,7 +175,6 @@ describe('bootServer — FR14 lifecycle restoration from conflicts.json', () =>
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
@@ -219,7 +217,6 @@ describe('bootServer — FR14 lifecycle restoration from conflicts.json', () =>
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
const restored = calls.find((l) => {
@@ -255,7 +252,6 @@ describe('bootServer — FR14 lifecycle restoration from conflicts.json', () =>
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
@@ -284,7 +280,6 @@ describe('bootServer — FR14 lifecycle restoration from conflicts.json', () =>
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
diff --git a/packages/server/src/boot.test.ts b/packages/server/src/boot.test.ts
index 7759df06a..a0e5aab45 100644
--- a/packages/server/src/boot.test.ts
+++ b/packages/server/src/boot.test.ts
@@ -81,7 +81,6 @@ describe('bootServer — MissingOkConfigError pre-listen check', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
} catch (err) {
caught = err;
@@ -115,7 +114,6 @@ describe('bootServer — MissingOkConfigError pre-listen check', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
} catch (err) {
caught = err;
@@ -152,7 +150,6 @@ describe('bootServer — MissingOkConfigError pre-listen check', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
expect(booted.port).toBeGreaterThan(0);
} finally {
@@ -182,7 +179,6 @@ describe('bootServer — MissingOkConfigError pre-listen check', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
} catch (err) {
caught = err;
@@ -213,7 +209,6 @@ describe('bootServer — MissingOkConfigError pre-listen check', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
const bootWarnings = warnSpy.mock.calls
.map((call) => String(call[1] ?? ''))
@@ -254,7 +249,6 @@ describe('bootServer — runtime state lives at projectDir, not contentDir', ()
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
// Wait for async init (loadPrincipal, state-manifest write) to settle.
@@ -301,7 +295,6 @@ describe('bootServer — tolerance-telemetry writer wired through the real boot
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
await booted.ready;
@@ -345,7 +338,6 @@ describe('bootServer — idle-shutdown runs full destroy', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: 50,
- attachUiSibling: false,
});
try {
@@ -392,7 +384,6 @@ describe('bootServer — reactShellDistDir + ui.lock advertisement', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
reactShellDistDir: shellDistDir,
});
try {
@@ -422,7 +413,6 @@ describe('bootServer — reactShellDistDir + ui.lock advertisement', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
await booted.ready;
@@ -468,7 +458,6 @@ describe('bootServer — reactShellDistDir + ui.lock advertisement', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
reactShellDistDir: shellDistDir,
});
try {
@@ -539,7 +528,6 @@ describe('bootServer — reactShellDistDir + ui.lock advertisement', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
reactShellDistDir: shellDistDir,
});
try {
@@ -583,7 +571,6 @@ describe('bootServer — reactShellDistDir + ui.lock advertisement', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
reactShellDistDir: shellDistDir,
});
await booted1.ready;
@@ -605,7 +592,6 @@ describe('bootServer — reactShellDistDir + ui.lock advertisement', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
reactShellDistDir: shellDistDir,
});
try {
@@ -681,7 +667,6 @@ describe('bootServer — reactShellDistDir end-to-end HTTP shape', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
serveContentAssets: true,
reactShellDistDir: shellDistDir,
});
@@ -802,7 +787,6 @@ describe('bootServer — ok.boot OTel span attributes', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
const spans = exporter?.getFinishedSpans() ?? [];
@@ -852,7 +836,6 @@ describe('bootServer — ok.boot OTel span attributes', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
const spans = exporter?.getFinishedSpans() ?? [];
@@ -882,7 +865,6 @@ describe('bootServer — ok.boot OTel span attributes', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
} catch (err) {
caught = err;
@@ -915,7 +897,6 @@ describe('bootServer — ok.boot OTel span attributes', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
await bootedMain.destroy();
@@ -947,7 +928,6 @@ describe('bootServer — ok.boot OTel span attributes', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
await bootedLinked.destroy();
@@ -991,7 +971,6 @@ describe('bootServer — ok.boot OTel span attributes', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
const bootSpan = (exporter?.getFinishedSpans() ?? []).find((s) => s.name === 'ok.boot');
expect(bootSpan).toBeDefined();
@@ -1023,7 +1002,6 @@ describe('bootServer — ok.boot OTel span attributes', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
expect(booted.port).toBeGreaterThan(0);
const bootSpan = (exporter?.getFinishedSpans() ?? []).find((s) => s.name === 'ok.boot');
@@ -1054,7 +1032,6 @@ describe('bootServer — boot timings recorded end-to-end', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
await booted.ready;
@@ -1166,7 +1143,6 @@ describeEvenOnCI('bootServer — exposure consent interlock', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
await booted.destroy();
} catch (err) {
@@ -1258,7 +1234,6 @@ describeEvenOnCI('bootServer — exposure consent interlock', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
await booted.destroy();
} catch (e) {
@@ -1286,7 +1261,6 @@ describeEvenOnCI('bootServer — multi-address bind', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
expect(booted.port).toBeGreaterThan(0);
@@ -1315,7 +1289,6 @@ describeEvenOnCI('bootServer — multi-address bind', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
try {
const res = await fetch(`http://127.0.0.1:${booted.port}/healthz`);
diff --git a/packages/server/src/boot.ts b/packages/server/src/boot.ts
index 1c5285fe9..8d87bc007 100644
--- a/packages/server/src/boot.ts
+++ b/packages/server/src/boot.ts
@@ -12,11 +12,10 @@
* a single tested orchestrator.
*
* Opt-outs (Electron utility uses these):
- * - `attachUiSibling: false` — suppress UI-sibling spawn flow
* - `idleShutdownMs: null` — disable idle-shutdown entirely
* - `skipAutoInit: true` — skip the pre-createServer scaffold hook
*
- * CLI-specific concerns (`initContent`, `spawnOkUi`, banner, signal handlers)
+ * CLI-specific concerns (`initContent`, banner, signal handlers)
* are NOT part of bootServer — the CLI wrapper layers them on top via
* injected callbacks + post-return orchestration.
*/
@@ -269,15 +268,6 @@ export interface BootServerOptions
* keeps unconditional OK-MCP injection for ACP threads.
*/
probeHarnessManagedMcpEntry?: AcpThreadManagerOptions['probeHarnessManagedMcpEntry'];
- /**
- * If false, UI-sibling callbacks (`spawnUiSiblingFn` / `onSkipUiSpawn`) are
- * NOT invoked regardless of `spawnUiSiblingFn` presence. Default true —
- * preserves CLI back-compat when the flag is omitted.
- *
- * Electron utility sets this to `false`: the BrowserWindow IS the UI
- * surface; there is no `ok ui` sibling to spawn.
- */
- attachUiSibling?: boolean;
/**
* Idle-shutdown threshold in milliseconds. `null` disables idle-shutdown
* entirely (Electron utility sets this to `null` — window lifecycle
@@ -337,17 +327,10 @@ export interface BootServerOptions
* Returns `true` if any scaffolding occurred during this invocation.
*/
autoInitFn?: () => boolean | Promise<boolean>;
- /**
- * CLI-specific UI-sibling spawn orchestration. Called once after the server
- * has bound a port IF `attachUiSibling !== false`. Receives `lockDir` so the
- * CLI's spawn helper can read the current ui.lock + decide whether to spawn.
- */
- spawnUiSiblingFn?: (ctx: { lockDir: string; log: PinoLogger }) => void | Promise<void>;
/**
* Idle-shutdown handler — run when the server has been idle past the
- * threshold. The CLI passes a handler that SIGTERMs the `ok ui` sibling
- * before calling `destroyServer()`; the desktop utility never wires this
- * handler because `idleShutdownMs: null`.
+ * threshold. The desktop utility never wires this handler because
+ * `idleShutdownMs: null`.
*/
idleShutdownHandler?: (destroyServer: () => Promise<void>) => () => Promise<void>;
/** Injectable logger. Defaults to `getLogger('boot')`. */
@@ -568,7 +551,6 @@ export async function bootServer(opts: BootServerOptions): Promise<BootedServer>
async function bootServerInner(opts: BootServerOptions): Promise<BootedServer> {
const skipAutoInit = opts.skipAutoInit ?? false;
- const attachUi = opts.attachUiSibling ?? true;
const log = opts.log ?? getLogger('boot');
// The resolved server.* runtime. The CLI passes its fully-layered
@@ -873,9 +855,8 @@ async function bootServerInner(opts: BootServerOptions): Promise<BootedServer> {
});
// HTTP server — `mountMcpAndApi` installs the `/mcp` + `/api/*` request
- // routing and the `/collab` + `/collab/keepalive` upgrade handler. Static
- // React assets are served separately by `ok ui` (a CLI wrapper concern, not
- // modeled here).
+ // routing and the `/collab` + `/collab/keepalive` upgrade handler; the
+ // React shell mounts below when `reactShellDistDir` is set.
const httpServer = createHttpServer();
// Resource-exhaustion bounds (defense-in-depth): cap headers + full
// request lifetimes so a slow client cannot dribble bytes below the 1 MB
@@ -1086,9 +1067,9 @@ async function bootServerInner(opts: BootServerOptions): Promise<BootedServer> {
};
// Idle-shutdown wiring — suppressed entirely when idleShutdownMs is null.
- // The CLI uses this to tear down both its own server and the `ok ui` sibling
- // after 30 min of zero WS clients; the Electron utility disables it because
- // window-close IS the shutdown trigger.
+ // The CLI uses this to tear the server down after 30 min of zero WS
+ // clients; the Electron utility disables it because window-close IS the
+ // shutdown trigger.
let idleHandle: IdleShutdownHandle | null = null;
if (opts.idleShutdownMs !== null) {
const idleMs = opts.idleShutdownMs ?? DEFAULT_IDLE_THRESHOLD_MS;
@@ -1242,16 +1223,6 @@ async function bootServerInner(opts: BootServerOptions): Promise<BootedServer> {
updateUiLockPort(lockDir, realPort, boundBaseUrl);
}
- // UI-sibling spawn — CLI wrapper injects `spawnUiSiblingFn`; desktop leaves
- // `attachUiSibling: false` and this flow is suppressed.
- if (attachUi && opts.spawnUiSiblingFn) {
- try {
- await opts.spawnUiSiblingFn({ lockDir, log });
- } catch (err) {
- log.warn({ err }, 'spawnUiSiblingFn failed');
- }
- }
-
let destroyed = false;
const withDestroyTimeout = async (name: string, work: () => Promise<void>): Promise<void> => {
let timer: ReturnType<typeof setTimeout> | undefined;
diff --git a/packages/server/src/collab-message-limit.test.ts b/packages/server/src/collab-message-limit.test.ts
index c4a0f5ba5..c9260cbc7 100644
--- a/packages/server/src/collab-message-limit.test.ts
+++ b/packages/server/src/collab-message-limit.test.ts
@@ -21,7 +21,6 @@ async function bootTestServer(): Promise<{ booted: BootedServer; contentDir: str
const booted = await bootServer({
host: '127.0.0.1',
contentDir,
- attachUiSibling: false,
idleShutdownMs: null,
gitEnabled: false,
quiet: true,
diff --git a/packages/server/src/composition-precedence.test.ts b/packages/server/src/composition-precedence.test.ts
index b61f5643b..ac3306b8b 100644
--- a/packages/server/src/composition-precedence.test.ts
+++ b/packages/server/src/composition-precedence.test.ts
@@ -63,12 +63,12 @@ describe('route dispatch and precedence — normal mode (no React shell)', () =>
expect(body.title).toBe('Not found.');
});
- test('unknown non-API path 404s with the ok-ui hint when no shell is mounted', async () => {
+ test('unknown non-API path 404s with the no-UI hint when no shell is mounted', async () => {
const res = await fetch(`http://127.0.0.1:${normal.port}/definitely/not/here`);
expect(res.status).toBe(404);
const body = parseProblem(await res.text());
expect(body.type).toBe('urn:ok:error:not-found');
- expect(body.detail).toContain('ok ui');
+ expect(body.detail).toContain('running without the web UI');
});
test('/mcp is mounted at the exact path only', async () => {
diff --git a/packages/server/src/composition-rig.test-helper.ts b/packages/server/src/composition-rig.test-helper.ts
index ea161eb37..4335fa991 100644
--- a/packages/server/src/composition-rig.test-helper.ts
+++ b/packages/server/src/composition-rig.test-helper.ts
@@ -39,7 +39,6 @@ export async function bootCompositionRig(
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
...overrides,
});
}
diff --git a/packages/server/src/desktop-attach-contract.test.ts b/packages/server/src/desktop-attach-contract.test.ts
index 53398ba89..8f48a7839 100644
--- a/packages/server/src/desktop-attach-contract.test.ts
+++ b/packages/server/src/desktop-attach-contract.test.ts
@@ -15,8 +15,8 @@ import { acquireUiLock, readUiLock, releaseUiLock, updateUiLockPort } from './ui
*
* <projectDir>/.ok/local/ui.lock → http://localhost:<ui.lock.port>
*
- * The contract the readers (preview-url tools, `ok ui` collision resolver,
- * `decideUiSpawn`, the data-server 404 hint) rely on:
+ * The contract the remaining readers (preview-url tools, the `--only ui`
+ * split-mode collision resolver, `off-cwd-resolver`) rely on:
*
* 1. FIELDS — every real lock carries pid, hostname, port, startedAt,
* worktreeRoot, protocolVersion, runtimeVersion. The optional
@@ -29,12 +29,13 @@ import { acquireUiLock, readUiLock, releaseUiLock, updateUiLockPort } from './ui
* it proceeds without owning the lock, leaves the peer's advertisement
* untouched (including on its own destroy), and emits a structured
* yield event.
- * 4. DISCOVERY HINT — a data server not serving the shell points humans
- * at `ui.lock.port` in its 404 body.
+ * 4. DISCOVERY HINT — a data server not serving the shell tells humans in
+ * its 404 body how to get the editor (restart with plain `ok start`).
*
- * Whatever replaces the `ok ui` sibling must keep all four observable
- * behaviors (or migrate every reader in the same release): the preview-pane
- * flow is downstream of `ui.lock`, not of which process serves the shell.
+ * The ui.lock removal wave must keep (or deliberately re-pin) all four
+ * observable behaviors and migrate every remaining reader in the same
+ * release: the preview-pane flow is downstream of `ui.lock` until then, not
+ * of which process serves the shell.
*/
describe('ui.lock — the Desktop attach advertisement', () => {
@@ -148,7 +149,7 @@ describe('ui.lock — the Desktop attach advertisement', () => {
}
}, 30_000);
- test('a data server without the shell points the 404 at ui.lock.port', async () => {
+ test('a data server without the shell 404s with the no-UI restart hint', async () => {
const tmp = await mkdtemp(resolve(tmpdir(), 'ok-attach-hint-'));
try {
const booted = await bootCompositionRig(tmp);
@@ -157,8 +158,8 @@ describe('ui.lock — the Desktop attach advertisement', () => {
const res = await fetch(`http://127.0.0.1:${booted.port}/`);
expect(res.status).toBe(404);
const body = parseProblem(await res.text());
- expect(body.detail).toContain('ok ui');
- expect(body.detail).toContain('ui.lock');
+ expect(body.detail).toContain('running without the web UI');
+ expect(body.detail).toContain('ok start');
expect(existsSync(resolve(tmp, '.ok', 'local', 'ui.lock'))).toBe(false);
} finally {
await booted.destroy();
diff --git a/packages/server/src/git-preflight-boot.test.ts b/packages/server/src/git-preflight-boot.test.ts
index 100f908c6..212583ac5 100644
--- a/packages/server/src/git-preflight-boot.test.ts
+++ b/packages/server/src/git-preflight-boot.test.ts
@@ -133,7 +133,6 @@ describe('bootServer git-preflight', () => {
quiet: true,
gitEnabled: true,
idleShutdownMs: null,
- attachUiSibling: false,
log: logger,
gitPreflight: () => {
throw thrown;
@@ -190,7 +189,6 @@ describe('bootServer git-preflight', () => {
quiet: true,
gitEnabled: true,
idleShutdownMs: null,
- attachUiSibling: false,
log: logger,
gitPreflight: () => {
throw thrown;
@@ -242,7 +240,6 @@ describe('bootServer git-preflight', () => {
quiet: true,
gitEnabled: true,
idleShutdownMs: null,
- attachUiSibling: false,
log: logger,
gitPreflight: () => {
throw unexpected;
@@ -297,7 +294,6 @@ describe('bootServer git-preflight', () => {
quiet: true,
gitEnabled: true,
idleShutdownMs: null,
- attachUiSibling: false,
log: logger,
gitPreflight: () => ok,
});
@@ -346,7 +342,6 @@ describe('bootServer git-preflight', () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
log: logger,
gitPreflight: () => {
preflightCalled = true;
@@ -426,7 +421,6 @@ describe('bootServer git-preflight OTEL emission', () => {
quiet: true,
gitEnabled: true,
idleShutdownMs: null,
- attachUiSibling: false,
log: logger,
gitPreflight: () => {
throw new GitNotAvailableError('linux', makeGuidance());
@@ -464,7 +458,6 @@ describe('bootServer git-preflight OTEL emission', () => {
quiet: true,
gitEnabled: true,
idleShutdownMs: null,
- attachUiSibling: false,
log: logger,
gitPreflight: () => {
throw new GitTooOldError('linux', '2.20.0', '2.31.0', '/usr/bin/git', makeGuidance());
@@ -510,7 +503,6 @@ describe('bootServer git-preflight OTEL emission', () => {
quiet: true,
gitEnabled: true,
idleShutdownMs: null,
- attachUiSibling: false,
log: logger,
gitPreflight: () => ok,
});
diff --git a/packages/server/src/git-preflight-spawn.test.ts b/packages/server/src/git-preflight-spawn.test.ts
index a5f35530f..ba46339e7 100644
--- a/packages/server/src/git-preflight-spawn.test.ts
+++ b/packages/server/src/git-preflight-spawn.test.ts
@@ -111,7 +111,6 @@ describe('bootServer() preflight survives the subprocess boundary (FR6 / US-005)
quiet: true,
gitEnabled: true,
idleShutdownMs: null,
- attachUiSibling: false,
gitPreflight: () => { throw new GitNotAvailableError('linux', guidance); },
});
} catch (err) {
@@ -204,7 +203,6 @@ describe('bootServer() preflight survives the subprocess boundary (FR6 / US-005)
quiet: true,
gitEnabled: true,
idleShutdownMs: null,
- attachUiSibling: false,
gitPreflight: () => {
throw new GitTooOldError('linux', '2.20.0', '2.31.0', '/usr/bin/git', guidance);
},
diff --git a/packages/server/src/keepalive-presence-bootstrap.test.ts b/packages/server/src/keepalive-presence-bootstrap.test.ts
index 4e20437e8..21ee16216 100644
--- a/packages/server/src/keepalive-presence-bootstrap.test.ts
+++ b/packages/server/src/keepalive-presence-bootstrap.test.ts
@@ -59,7 +59,6 @@ async function bootTestServer(): Promise<{ booted: BootedServer; contentDir: str
const booted = await bootServer({
host: '127.0.0.1',
contentDir,
- attachUiSibling: false,
idleShutdownMs: null,
gitEnabled: false,
quiet: true,
diff --git a/packages/server/src/keepalive-presence-cleanup.test.ts b/packages/server/src/keepalive-presence-cleanup.test.ts
index bf70c6b08..67f6ba937 100644
--- a/packages/server/src/keepalive-presence-cleanup.test.ts
+++ b/packages/server/src/keepalive-presence-cleanup.test.ts
@@ -54,7 +54,6 @@ async function bootTestServer(
const booted = await bootServer({
host: '127.0.0.1',
contentDir,
- attachUiSibling: false,
idleShutdownMs: null,
gitEnabled: false,
quiet: true,
diff --git a/packages/server/src/mcp-local-dispatch-parity.test.ts b/packages/server/src/mcp-local-dispatch-parity.test.ts
index 3dd20a13a..6b318e31d 100644
--- a/packages/server/src/mcp-local-dispatch-parity.test.ts
+++ b/packages/server/src/mcp-local-dispatch-parity.test.ts
@@ -94,7 +94,6 @@ beforeAll(async () => {
quiet: true,
gitEnabled: false,
idleShutdownMs: null,
- attachUiSibling: false,
});
await booted.ready;
diff --git a/packages/server/src/mcp-mount.ts b/packages/server/src/mcp-mount.ts
index afc69cc8b..fd05db403 100644
--- a/packages/server/src/mcp-mount.ts
+++ b/packages/server/src/mcp-mount.ts
@@ -116,8 +116,8 @@ export interface MountMcpAndApiOptions {
* the SPA shell only handles routes the content middleware didn't claim).
* Used by OK Electron's utility process so external agent in-app browsers
* can render the bundled React app from the same HTTP port the API runs
- * on. The CLI / test harness leave it undefined — `ok ui` already serves
- * the shell on its own port.
+ * on. The CLI wires it through `bootServer`'s `reactShellDistDir`; test
+ * harnesses leave it undefined.
*/
reactShellMiddleware?: (req: IncomingMessage, res: ServerResponse, next: () => void) => void;
/**
@@ -389,13 +389,12 @@ export function mountMcpAndApi(opts: MountMcpAndApiOptions): MountMcpAndApiHandl
runMiddleware(reactShellMiddleware, 'react-shell', onMiss);
const notFound = (): void => {
if (res.writableEnded || res.headersSent) return;
- // When this server doesn't serve the React shell (CLI / MCP-spawned —
- // content assets mount by default but the UI lives on the `ok ui`
- // sibling), keep the operator hint so a human loading `/` in a browser
- // is pointed at the right port.
+ // When this server doesn't serve the React shell (`--only server` /
+ // API-only profile), keep the operator hint so a human loading `/` in a
+ // browser learns how to get the editor.
const uiHint =
reactShellMiddleware === undefined
- ? 'The React UI is served by `ok ui` (run `ok ui` and check `ui.lock.port`). '
+ ? 'This server is running without the web UI. Restart it with plain `ok start` to serve the editor. '
: '';
errorResponse(res, 404, 'urn:ok:error:not-found', 'Not found.', {
handler: 'mcp-mount',
@@ -412,7 +411,7 @@ export function mountMcpAndApi(opts: MountMcpAndApiOptions): MountMcpAndApiHandl
// already fall through, which is why only fonts/images regressed. Try the
// shell first for this prefix; fall through to the content middleware on a
// miss so user uploads at `<contentDir>/assets/*` still serve. Mirrors
- // `ok ui`'s `/assets/`-first branch in `commands/ui.ts`.
+ // the split-mode UI proxy's `/assets/`-first branch in `commands/ui.ts`.
if (reactShellMiddleware !== undefined && url?.startsWith('/assets/')) {
runShell(() => runContent(notFound));
return;
@@ -426,12 +425,11 @@ export function mountMcpAndApi(opts: MountMcpAndApiOptions): MountMcpAndApiHandl
runContent(() => runShell(notFound));
return;
}
- // Neither middleware wired (CLI / test harness) — catch-all 404. Static
- // React assets are served by `ok ui` (a CLI wrapper concern, not modeled
- // here); every other path lands here.
+ // Neither middleware wired (test harness / degraded API-only boot) —
+ // catch-all 404.
errorResponse(res, 404, 'urn:ok:error:not-found', 'Not found.', {
handler: 'mcp-mount',
- detail: `The React UI is served by \`ok ui\` (run \`ok ui\` and check \`ui.lock.port\`). No handler for ${url ?? '/'}`,
+ detail: `This server is running without the web UI. Restart it with plain \`ok start\` to serve the editor. No handler for ${url ?? '/'}`,
});
};
diff --git a/packages/server/src/mcp/tools/get-preview-url.test.ts b/packages/server/src/mcp/tools/get-preview-url.test.ts
index e710975a0..51c28911e 100644
--- a/packages/server/src/mcp/tools/get-preview-url.test.ts
+++ b/packages/server/src/mcp/tools/get-preview-url.test.ts
@@ -298,14 +298,14 @@ describe('preview_url tool — no UI running', () => {
expect(result.structuredContent?.autoOpen).toBe(true);
});
- test('server alive but no UI: advises ok ui, not ok start', async () => {
+ test('server alive but no UI: transient retry hint, no spawn advice', async () => {
const cwd = mkdtempSync(join(tmpdir(), 'ok-get-preview-url-'));
bindTestServerLock(cwd);
const handler = captureRegistration(cwd);
const result = await handler({ document: 'specs/foo/SPEC' });
expect(result.structuredContent?.running).toBe(false);
expect(result.content[0]?.text).toContain('OK server is running');
- expect(result.content[0]?.text).toContain('`ok ui`');
+ expect(result.content[0]?.text).toContain('Retry in a few seconds');
expect(result.content[0]?.text).not.toContain('`ok start`');
});
@@ -318,8 +318,8 @@ describe('preview_url tool — no UI running', () => {
expect(result.structuredContent?.running).toBe(false);
expect(result.content[0]?.text).toContain('no preview UI is mounted');
expect(result.content[0]?.text).toContain('--only server');
- // Steer to the non-deprecated Wave 3 split-mode command, not `ok ui`.
- expect(result.content[0]?.text).toContain('--only ui --server-url');
+ // Steer to restarting with plain `ok start` (serves the editor).
+ expect(result.content[0]?.text).toContain('Restart it with plain `ok start`');
expect(result.content[0]?.text).not.toContain('`ok ui`');
// The whole point: "retry" would loop forever against a UI-less server.
expect(result.content[0]?.text).not.toContain('Retry');
@@ -426,7 +426,7 @@ describe('preview_url tool — backend demand-ensure', () => {
expect(result.isError).toBeUndefined();
expect(result.structuredContent?.running).toBe(false);
expect(result.content[0]?.text).toContain('OK server is running');
- expect(result.content[0]?.text).toContain('`ok ui`');
+ expect(result.content[0]?.text).toContain('Retry in a few seconds');
// Symmetric with the no-server branch: a hint-selector regression that
// emitted the wrong-state message would advise `ok start` here.
expect(result.content[0]?.text).not.toContain('`ok start`');
diff --git a/packages/server/src/mcp/tools/get-preview-url.ts b/packages/server/src/mcp/tools/get-preview-url.ts
index c69bfd9fb..55a023de6 100644
--- a/packages/server/src/mcp/tools/get-preview-url.ts
+++ b/packages/server/src/mcp/tools/get-preview-url.ts
@@ -19,8 +19,8 @@
* Opening a preview counts as demand for a backend: when the registration
* threads `serverUrl` (the global stdio MCP does), the handler runs the same
* backend-ensure the server-backed tools use — a live `server.lock` resolves
- * immediately; otherwise the resolver auto-spawns `ok start` (which spawns
- * the `ok ui` sibling) under the `OK_MCP_AUTOSTART` gate and spawn timeout.
+ * immediately; otherwise the resolver auto-spawns `ok start` (which serves
+ * the UI itself) under the `OK_MCP_AUTOSTART` gate and spawn timeout.
* Registrations without server authority (no `serverUrl` in deps) answer
* from disk alone, as before.
*
@@ -127,10 +127,10 @@ interface GetPreviewUrlDeps {
}
/**
- * How long to wait for the freshly spawned backend's `ok ui` sibling to bind
- * before reporting no-UI. Mirrors `uiBindTimeoutMs` in `bootStartServer` —
- * the server's own wait for the same sibling — so the two surfaces give up
- * at the same horizon.
+ * How long to wait for a freshly spawned backend's UI advertisement to bind
+ * before reporting no-UI — the window between `server.lock` appearing and the
+ * listener binding its real port (+ the legacy sibling window on locks from
+ * older binaries).
*/
const UI_BIND_WAIT_TIMEOUT_MS = 3000;
const UI_BIND_WAIT_POLL_MS = 100;
@@ -205,27 +205,24 @@ const OutputSchema = outputSchemaWithText({
/**
* Recovery hints for the three distinguishable no-UI states.
*
- * `NO_UI_SERVER_RUNNING_MESSAGE` is the TRANSIENT case: a live pre-v2 / legacy
- * sibling-topology server whose `ok ui` sibling hasn't bound its `ui.lock`
- * yet. "Retry" is the right first move (it's binding), and `ok ui` is the tool
- * that topology uses — advising `ok start` here would be wrong, since under
- * spawn-or-reuse a second `ok start` just reports the running server's URL and
- * exits 0 without adding a UI. (Post-flip note: bare `ok start` no longer
- * collides — it reuses — but that doesn't make it a way to attach a UI.)
+ * `NO_UI_SERVER_RUNNING_MESSAGE` is the TRANSIENT case: a live server whose
+ * UI advertisement hasn't landed yet (lock still binding, or a legacy
+ * sibling-topology holder from an older binary). "Retry" is the right first
+ * move; a second bare `ok start` would just reuse the running server without
+ * adding anything, so the terminal remedy is OK Electron.
*
* `NO_SERVER_MESSAGE` advises `ok start`, which brings up the server serving
* the UI on one port.
*/
const NO_UI_SERVER_RUNNING_MESSAGE =
- 'The OK server is running but no UI has bound for this project yet. Retry in a few seconds, or start one: `ok ui` (terminal) or open the project in OK Electron.';
+ 'The OK server is running but no UI has bound for this project yet. Retry in a few seconds, or open the project in OK Electron.';
// Permanent-state sibling of the message above: the live server advertises NO
// `ui` capability (started `--only server`, or a degraded API-only boot), so a
-// UI will never bind on its own — "retry" would loop forever. Steer to the
-// Wave 3 way to attach a UI to a running server: `ok start --only ui
-// --server-url` (NOT deprecated `ok ui`; NOT bare `ok start`, which would just
-// reuse the headless server without adding a UI).
+// UI will never bind on its own — "retry" would loop forever. The remedy is
+// restarting with plain `ok start` (serves the editor) or OK Electron; bare
+// `ok start` against the live holder would just reuse it, hence "restart".
const NO_UI_NONE_MOUNTED_MESSAGE =
- 'The OK server is running but no preview UI is mounted (e.g. it was started with `--only server`). Add one against it: `ok start --only ui --server-url <server-url>`, or open the project in OK Electron.';
+ 'The OK server is running but no preview UI is mounted (e.g. it was started with `--only server`). Restart it with plain `ok start` to serve the editor, or open the project in OK Electron.';
const NO_SERVER_MESSAGE =
'No OpenKnowledge server is running for this project. Start it with `ok start` (also starts the preview UI), or open the project in OK Electron.';
const AUTOSTART_DISABLED_NOTE = ' Auto-start is disabled (OK_MCP_AUTOSTART=0).';
@@ -443,11 +440,11 @@ export function register(server: ServerInstance, deps: GetPreviewUrlDeps): void
// Demand-ensure: when this registration has server authority, run the
// same backend-ensure the server-backed tools use. A live `server.lock`
// resolves immediately (lock read, no HTTP); otherwise the resolver
- // auto-spawns `ok start` — which spawns the `ok ui` sibling — under the
+ // auto-spawns `ok start` — which serves the UI itself — under the
// `OK_MCP_AUTOSTART` gate and spawn timeout. Runs unconditionally (not
- // just when `ui.lock` is missing) so the orphan-UI state — a surviving
- // pane-spawned `ok ui` whose server idle-shut-down — gets its backend
- // back; the orphan re-attaches via its own `server.lock` polling.
+ // just when the UI advertisement is missing) so an orphaned legacy UI
+ // process whose server idle-shut-down gets its backend back; the orphan
+ // re-attaches via its own `server.lock` polling.
const serverWasLive = isServerLive(lockDir);
let autoStartDisabled = false;
if (deps.serverUrl !== undefined) {
@@ -477,10 +474,10 @@ export function register(server: ServerInstance, deps: GetPreviewUrlDeps): void
let { baseUrl } = resolveUiInfo(ctx);
if (baseUrl === null && !serverWasLive && isServerLive(lockDir)) {
- // The backend came up during this call, so its `ok ui` sibling is
- // still binding — `ui.lock` lags `server.lock` by up to a few
- // seconds. Wait it out instead of reporting a no-UI state that is
- // about to stop being true.
+ // The backend came up during this call, so its UI advertisement is
+ // still binding — the ui-capable origin lags `server.lock`'s
+ // appearance by up to a few seconds. Wait it out instead of
+ // reporting a no-UI state that is about to stop being true.
baseUrl = await awaitUiBaseUrl(ctx, {
timeoutMs: deps.uiBindWait?.timeoutMs ?? UI_BIND_WAIT_TIMEOUT_MS,
pollIntervalMs: deps.uiBindWait?.pollIntervalMs ?? UI_BIND_WAIT_POLL_MS,
diff --git a/packages/server/src/mcp/tools/preview-url.ts b/packages/server/src/mcp/tools/preview-url.ts
index 97dfe34f8..d38d51893 100644
--- a/packages/server/src/mcp/tools/preview-url.ts
+++ b/packages/server/src/mcp/tools/preview-url.ts
@@ -97,8 +97,8 @@ export function encodeSkillRoute(scope: string, name: string): string {
* to attach a browser. Server tracks `__system__` subscribers so the
* hint fires at most once per session in the fresh-start case.
* - `start-ui` — `previewUrl` is null; no UI is running anywhere for this
- * project. Agent advises the user to start one (`ok ui`
- * from a terminal, `ok start`, or open the project in OK Electron).
+ * project. Agent advises the user to start one (`ok start` from a
+ * terminal, or open the project in OK Electron).
*
* Both pin the same `previewUrl` field so a single agent-side branch can
* read either: if non-null → open; if null → tell user to start a UI.
@@ -127,7 +127,7 @@ type PreviewAttachWarning =
};
const START_UI_MESSAGE =
- 'No UI is running for this project. Start one to see the preview: `ok ui` (terminal), `ok start`, or open the project in OK Electron.';
+ 'No UI is running for this project. Start one to see the preview: `ok start` (terminal), or open the project in OK Electron.';
const ATTACH_PREVIEW_ONCE_MESSAGE =
"No browser is attached to the preview. Open it in your host's surface: `preview_url`, then drive your in-app browser (Claude Code Desktop: `preview_start({url})` to open the pane, then `navigate({url})` to move; Cursor: `Navigate`; Codex desktop: `@Browser`); on a stdio CLI with no browser, `ok open <doc>`.";
@@ -247,13 +247,11 @@ export function resolveUiInfo(ctx: PreviewUrlContext): UiInfo {
}
/**
- * Poll `resolveUiInfo` until the UI lock binds (`port > 0`) or the deadline
- * passes. Used by `preview_url` right after a fresh backend spawn: `ok start`
- * spawns its `ok ui` sibling asynchronously, so `ui.lock` lags `server.lock`
- * by up to a few seconds on a cold start (the server's own sibling wait is
- * `uiBindTimeoutMs` in `bootStartServer`). Also rides out the desktop
- * single-origin window where `ui.lock` exists at port 0 until the server
- * binds and calls `updateUiLockPort`.
+ * Poll `resolveUiInfo` until a UI origin binds or the deadline passes. Used
+ * by `preview_url` right after a fresh backend spawn: the locks exist at
+ * port 0 from acquire (pre-listen) until the server binds and stamps the
+ * real port, so the ui-capable origin lags the locks' appearance by up to a
+ * few seconds on a cold start.
*/
export async function awaitUiBaseUrl(
ctx: PreviewUrlContext,
diff --git a/packages/server/src/ui-redirect-port.test.ts b/packages/server/src/ui-redirect-port.test.ts
new file mode 100644
index 000000000..4936ac37b
--- /dev/null
+++ b/packages/server/src/ui-redirect-port.test.ts
@@ -0,0 +1,144 @@
+import { mkdtempSync, rmSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { afterEach, describe, expect, test } from 'vitest';
+import {
+ acquireServerLock,
+ markServerLockDraining,
+ releaseServerLock,
+ updateServerLockPort,
+} from './server-lock.ts';
+import { acquireUiLock, markUiLockDraining, releaseUiLock, updateUiLockPort } from './ui-lock.ts';
+import { resolveUiRedirectPort } from './ui-redirect-port.ts';
+
+describe('resolveUiRedirectPort — clone-redirect two-source chain', () => {
+ const dirs: string[] = [];
+
+ function makeLockDir(): string {
+ const dir = mkdtempSync(join(tmpdir(), 'ok-ui-redirect-'));
+ dirs.push(dir);
+ return dir;
+ }
+
+ afterEach(() => {
+ for (const dir of dirs.splice(0)) {
+ rmSync(dir, { recursive: true, force: true });
+ }
+ });
+
+ test('ui-capable server.lock resolves to the server port (single-listener default)', () => {
+ const lockDir = makeLockDir();
+ acquireServerLock(lockDir, {
+ port: 0,
+ worktreeRoot: lockDir,
+ capabilities: ['http', 'ws', 'ui'],
+ });
+ updateServerLockPort(lockDir, 45001, 'http://127.0.0.1:45001');
+ try {
+ expect(resolveUiRedirectPort(lockDir)).toBe(45001);
+ } finally {
+ releaseServerLock(lockDir);
+ }
+ });
+
+ test('explicit no-ui server.lock + live ui.lock resolves to the sibling port (split-mode pair)', () => {
+ const lockDir = makeLockDir();
+ acquireServerLock(lockDir, {
+ port: 0,
+ worktreeRoot: lockDir,
+ capabilities: ['http', 'ws'],
+ });
+ updateServerLockPort(lockDir, 45002, 'http://127.0.0.1:45002');
+ acquireUiLock(lockDir, { port: 0, worktreeRoot: lockDir });
+ updateUiLockPort(lockDir, 45003, 'http://localhost:45003');
+ try {
+ expect(resolveUiRedirectPort(lockDir)).toBe(45003);
+ } finally {
+ releaseUiLock(lockDir);
+ releaseServerLock(lockDir);
+ }
+ });
+
+ test('explicit no-ui server.lock with no sibling is a definitive no-ui', () => {
+ const lockDir = makeLockDir();
+ acquireServerLock(lockDir, {
+ port: 0,
+ worktreeRoot: lockDir,
+ capabilities: ['http', 'ws'],
+ });
+ updateServerLockPort(lockDir, 45004, 'http://127.0.0.1:45004');
+ try {
+ expect(resolveUiRedirectPort(lockDir)).toBe('no-ui');
+ } finally {
+ releaseServerLock(lockDir);
+ }
+ });
+
+ test('lone ui.lock (split UI against a remote upstream) resolves to the UI port', () => {
+ const lockDir = makeLockDir();
+ acquireUiLock(lockDir, { port: 0, worktreeRoot: lockDir });
+ updateUiLockPort(lockDir, 45005, 'http://localhost:45005');
+ try {
+ expect(resolveUiRedirectPort(lockDir)).toBe(45005);
+ } finally {
+ releaseUiLock(lockDir);
+ }
+ });
+
+ test('server.lock with NO capabilities field is treated as ui-capable (indeterminate → optimistic)', () => {
+ const lockDir = makeLockDir();
+ acquireServerLock(lockDir, { port: 0, worktreeRoot: lockDir });
+ updateServerLockPort(lockDir, 45006, 'http://127.0.0.1:45006');
+ try {
+ expect(resolveUiRedirectPort(lockDir)).toBe(45006);
+ } finally {
+ releaseServerLock(lockDir);
+ }
+ });
+
+ test('unbound (port 0) server.lock does not resolve and does not classify no-ui', () => {
+ const lockDir = makeLockDir();
+ acquireServerLock(lockDir, {
+ port: 0,
+ worktreeRoot: lockDir,
+ capabilities: ['http', 'ws'],
+ });
+ try {
+ expect(resolveUiRedirectPort(lockDir)).toBeNull();
+ } finally {
+ releaseServerLock(lockDir);
+ }
+ });
+
+ test('no locks at all resolves to null', () => {
+ expect(resolveUiRedirectPort(makeLockDir())).toBeNull();
+ });
+
+ test('a DRAINING no-ui server.lock resolves to null, not no-ui (spawn beats erroring on a dying holder)', () => {
+ const lockDir = makeLockDir();
+ acquireServerLock(lockDir, {
+ port: 0,
+ worktreeRoot: lockDir,
+ capabilities: ['http', 'ws'],
+ });
+ updateServerLockPort(lockDir, 45007, 'http://127.0.0.1:45007');
+ markServerLockDraining(lockDir);
+ try {
+ expect(resolveUiRedirectPort(lockDir)).toBeNull();
+ } finally {
+ releaseServerLock(lockDir);
+ }
+ });
+
+ test('a DRAINING ui.lock is not a redirect target — falls through to null', () => {
+ const lockDir = makeLockDir();
+ acquireUiLock(lockDir, { port: 0, worktreeRoot: lockDir });
+ updateUiLockPort(lockDir, 45008, 'http://localhost:45008');
+ markUiLockDraining(lockDir);
+ try {
+ expect(resolveUiRedirectPort(lockDir)).toBeNull();
+ } finally {
+ releaseUiLock(lockDir);
+ }
+ });
+});
diff --git a/packages/server/src/ui-redirect-port.ts b/packages/server/src/ui-redirect-port.ts
new file mode 100644
index 000000000..0380d9de6
--- /dev/null
+++ b/packages/server/src/ui-redirect-port.ts
@@ -0,0 +1,43 @@
+/**
+ * Redirect-target resolution for flows that need a browser-navigable UI port
+ * for a project directory (the clone → open redirect in `api-extension.ts`).
+ * Mirrors `resolveUiInfo` in `mcp/tools/preview-url.ts` — the canonical
+ * two-source chain; the two surfaces must agree on what "no UI" means for as
+ * long as `ui.lock` remains supported:
+ *
+ * 1. a live, non-draining `server.lock` advertising the `ui` capability →
+ * that server's port (single-listener topology);
+ * 2. else a live, non-draining `ui.lock` with a bound port → that port —
+ * the `--only ui --server-url` split-mode proxy, OK Electron's
+ * advertisement, or a legacy sibling from an older binary;
+ * 3. else a live server.lock whose `capabilities` EXPLICITLY omit `ui` →
+ * `'no-ui'` — definitive: no UI is serving and none will bind on its
+ * own;
+ * 4. else `null` — nothing usable is live.
+ *
+ * A server.lock with no `capabilities` field (older writer) is treated as
+ * ui-capable in step 1 — absence is indeterminate, and an optimistic
+ * redirect beats wrongly refusing a healthy server (mirrors
+ * `serverExplicitlyLacksUi` in `mcp/tools/get-preview-url.ts`).
+ *
+ * Step 2 retires with the ui.lock removal wave; until then, dropping it
+ * would report "no UI" against a live split-mode pair while a UI is in
+ * fact serving.
+ */
+
+import { readServerLock } from './server-lock.ts';
+import { readUiLock } from './ui-lock.ts';
+
+export function resolveUiRedirectPort(lockDir: string): number | 'no-ui' | null {
+ const server = readServerLock(lockDir);
+ const serverLive = server !== null && server.port > 0 && server.draining !== true;
+ // Two ways step 1 admits a lock: no `capabilities` field at all (older
+ // writer — indeterminate, be optimistic), or an explicit `ui` entry.
+ if (serverLive && (!Array.isArray(server.capabilities) || server.capabilities.includes('ui'))) {
+ return server.port;
+ }
+ const ui = readUiLock(lockDir);
+ if (ui !== null && ui.port > 0 && ui.draining !== true) return ui.port;
+ if (serverLive) return 'no-ui';
+ return null;
+}