Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
feat(agent): add interactive slash palette
Rahman112c6546d2ae
diff --git a/bin/mso b/bin/msoindex 8b58ddbc..e14f5340 100755--- a/bin/mso+++ b/bin/mso@@ -126,7 +126,7 @@# Docs: https://github.com/rahmanef63/msoset -euo pipefail-VERSION="1.5.2"+VERSION="1.5.3"ROOT="$(cd "$(dirname "$(readlink -f "$0")")/.." && pwd)"die() { echo "mso: $*" >&2; exit 1; }diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex bd3f6a04..fc8146da 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -8,6 +8,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.**Added**+- `agent` add interactive slash palette- `agent` add project-aware slash skills- `agent` persist terminal and MCP sessions- `mcp` render live workflow progress in ChatGPTdiff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex 8e31b112..1dcc81c8 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -20,10 +20,11 @@ What changed:- official `mso-project-deploy` skill documents workflow start → inspect → provider doctor → bounded deployment/DNS operations → runtime/HTTPS verification → finish/cancel;- MSO Agent slash skills are now executable: `/<skill>` selects a trusted global/current-project skill for the next message, `/<skill> <prompt>` runs immediately, `/skill <exact-id>` resolves cross-project ambiguity, and Tab completion only offers skills valid in the current scope; project skills follow the terminal working directory while untrusted instructions remain withheld;- terminal title art now uses a stable two-space gutter so the blue MSO icon is not flush against the terminal edge;+- the first MSO folder-title row now carries the same internal two-space inset as the folder body, and the terminal composer now opens a Hermes-style slash dropdown immediately on `/`, with live filtering, fixed 8-row viewport, ↑/↓ navigation, Enter/Tab selection, Esc dismissal, command metadata, and trusted current-project/global skill recommendations;- `mso update` now short-circuits when source and active runtime already match, avoiding redundant production rebuilds; when a real service update is needed, an interactive terminal waits and prints update milestones until the new runtime is verified instead of immediately returning with only a log hint;-- CLI version for this interaction milestone is **1.5.2**. `docs/INFRASTRUCTURE-PROVIDERS.md`, architecture/install/MCP/ChatGPT connector docs, generated CLI reference and slice catalog are synchronized.+- CLI version for this interaction milestone is **1.5.3**. `docs/INFRASTRUCTURE-PROVIDERS.md`, architecture/install/MCP/ChatGPT connector docs, generated CLI reference and slice catalog are synchronized.-Verification added specifically for this slice covers provider-store symlink/permission/secret behavior, Cloudflare one-record semantics, Hostinger exact RR-set payloads, Owner-only agent/provider routes, exact-payload terminal approval, CLI onboarding/update fixtures, MCP parity/rate limits, and documentation/toolset markers. The final full repository gate passes with **252 test files / 1,912 passing tests** (1 expected fail, 4 skipped), typecheck and dependency audit green, zero value cycles, and zero lint errors (six pre-existing max-lines warnings remain). A targeted Codex Security pass first found two Medium issues in the new infrastructure surface — whole-response buffering before its nominal 1 MiB cap and a stale full-zone Hostinger PUT. Both were fixed; the final infrastructure re-scan completed **1/1 component with 0 findings**. A separate terminal-agent scan found one Medium issue where a truncated approval preview could conceal mutation fields. The terminal now renders the complete canonical tool name + nested input, refuses approval payloads above 32 KiB, removes session-wide mutation grants, and binds the approval SHA-256 to the exact payload that the server independently re-hashes before dispatch; the final terminal-agent re-scan completed **1/1 component with 0 findings**. A parallel-suite-only lifecycle harness race was also removed by holding the fixture lock until the assertion explicitly releases it; the lifecycle file then passed 5 consecutive runs (40/40 checks). The first production handoff also exposed a release-verification false negative: the system unit can spend close to its 90 s `TimeoutStopSec` draining the old npm/Next control group, while the finalizer only waited 40 s for a new MainPID. Production still reached the gated release SHA, and the verifier now uses a bounded 120 s default restart budget (override constrained to 30–300 s) so a valid slow systemd restart is not reported as rollback. Live Dokploy/Cloudflare/Hostinger API success is intentionally not claimed until an owner supplies credentials and `mso provider doctor` checks that provider.+Verification added specifically for this slice covers provider-store symlink/permission/secret behavior, Cloudflare one-record semantics, Hostinger exact RR-set payloads, Owner-only agent/provider routes, exact-payload terminal approval, CLI onboarding/update fixtures, MCP parity/rate limits, and documentation/toolset markers. The final full repository gate passes with **254 test files / 1,918 passing tests** (1 expected fail, 4 skipped), typecheck and dependency audit green, zero value cycles, and zero lint errors (six pre-existing max-lines warnings remain). A targeted Codex Security pass first found two Medium issues in the new infrastructure surface — whole-response buffering before its nominal 1 MiB cap and a stale full-zone Hostinger PUT. Both were fixed; the final infrastructure re-scan completed **1/1 component with 0 findings**. A separate terminal-agent scan found one Medium issue where a truncated approval preview could conceal mutation fields. The terminal now renders the complete canonical tool name + nested input, refuses approval payloads above 32 KiB, removes session-wide mutation grants, and binds the approval SHA-256 to the exact payload that the server independently re-hashes before dispatch; the final terminal-agent re-scan completed **1/1 component with 0 findings**. A parallel-suite-only lifecycle harness race was also removed by holding the fixture lock until the assertion explicitly releases it; the lifecycle file then passed 5 consecutive runs (40/40 checks). The first production handoff also exposed a release-verification false negative: the system unit can spend close to its 90 s `TimeoutStopSec` draining the old npm/Next control group, while the finalizer only waited 40 s for a new MainPID. Production still reached the gated release SHA, and the verifier now uses a bounded 120 s default restart budget (override constrained to 30–300 s) so a valid slow systemd restart is not reported as rollback. Live Dokploy/Cloudflare/Hostinger API success is intentionally not claimed until an owner supplies credentials and `mso provider doctor` checks that provider.## 2026-08-31 — Login-origin diagnosis + `mso doctor --fix` + runtime hardening (SHIPPED)diff --git a/scripts/mso-agent-composer.mjs b/scripts/mso-agent-composer.mjsnew file mode 100644index 00000000..e8ed619b--- /dev/null+++ b/scripts/mso-agent-composer.mjs@@ -0,0 +1,186 @@+import readline from "node:readline";+import process from "node:process";++const CLEAR_LINE = "\x1b[2K";+const CURSOR_UP = (n) => n > 0 ? `\x1b[${n}A` : "";+const CURSOR_DOWN = (n) => n > 0 ? `\x1b[${n}B` : "";+const CURSOR_RIGHT = (n) => n > 0 ? `\x1b[${n}C` : "";+const plain = (value) => String(value ?? "").replace(/\x1b\[[0-9;]*m/g, "");+const chars = (value) => Array.from(String(value ?? ""));+const width = (value) => chars(plain(value)).length;+const clamp = (value, min, max) => Math.min(Math.max(value, min), max);++function fit(value, max) {+ const row = chars(plain(value).replace(/[\r\n\t]+/g, " "));+ if (row.length <= max) return row.join("");+ return max <= 1 ? "…".slice(0, max) : row.slice(0, max - 1).join("") + "…";+}++function pad(value, max) {+ const clean = fit(value, max);+ return clean + " ".repeat(Math.max(0, max - width(clean)));+}++export function inputViewport(value, cursor, maxWidth) {+ const row = chars(value);+ const max = Math.max(1, maxWidth);+ if (row.length <= max) return { display: row.join(""), cursor: clamp(cursor, 0, row.length) };+ const interior = Math.max(1, max - 2);+ let start = clamp(cursor - Math.floor(interior * 0.7), 0, Math.max(0, row.length - interior));+ let end = Math.min(row.length, start + interior);+ if (cursor > end) { end = cursor; start = Math.max(0, end - interior); }+ const prefix = start > 0 ? "…" : "";+ const suffix = end < row.length ? "…" : "";+ return {+ display: `${prefix}${row.slice(start, end).join("")}${suffix}`,+ cursor: width(prefix) + clamp(cursor - start, 0, end - start),+ };+}++export function completionWindow(items, selected, size = 8) {+ const rows = Array.isArray(items) ? items : [];+ if (!rows.length) return { start: 0, items: [] };+ const count = Math.min(Math.max(1, size), rows.length);+ const idx = clamp(selected, 0, rows.length - 1);+ const start = Math.max(0, Math.min(idx - Math.floor(count / 2), rows.length - count));+ return { start, items: rows.slice(start, start + count) };+}++function menuLines(items, selected, columns, C) {+ const { start, items: visible } = completionWindow(items, selected, 8);+ if (!visible.length) return [];+ const panelWidth = Math.max(38, Math.min(100, Number(columns || 100) - 2));+ const label = " commands & skills ";+ const top = `╭─${label}${"─".repeat(Math.max(0, panelWidth - width(label) - 3))}╮`;+ const nameWidth = Math.min(32, Math.max(12, ...visible.map((item) => width(item.text) + 1)));+ const metaWidth = Math.max(0, panelWidth - nameWidth - 7);+ const body = visible.map((item, offset) => {+ const active = start + offset === selected;+ const marker = active ? `${C.blue}${C.bold}›${C.reset}` : " ";+ const name = active ? `${C.blue}${C.bold}${pad(item.text, nameWidth)}${C.reset}` : pad(item.text, nameWidth);+ const meta = metaWidth ? `${C.dim}${fit(item.meta || "", metaWidth)}${C.reset}` : "";+ return `│ ${marker} ${name}${meta ? ` ${meta}` : ""}${" ".repeat(Math.max(0, metaWidth - width(fit(item.meta || "", metaWidth))))} │`;+ });+ const hint = " ↑↓ navigate · Enter/Tab select · Esc close ";+ const bottom = `╰─${fit(hint, panelWidth - 3)}${"─".repeat(Math.max(0, panelWidth - width(fit(hint, panelWidth - 3)) - 3))}╯`;+ return [`${C.blue}${top}${C.reset}`, ...body, `${C.blue}${bottom}${C.reset}`];+}++export class AgentComposer {+ constructor({ input = process.stdin, output = process.stdout, colors }) {+ this.input = input;+ this.output = output;+ this.C = colors;+ this.history = [];+ this.closed = false;+ readline.emitKeypressEvents(this.input);+ }++ async question(prompt, { complete = null, history = true } = {}) {+ if (this.closed) return null;+ const input = this.input, output = this.output, C = this.C;+ return new Promise((resolve) => {+ let value = "", cursor = 0, selected = 0, previousMenuRows = 0;+ let dismissed = false, historyIndex = null, draft = "";+ const wasRaw = Boolean(input.isRaw);++ const matches = () => dismissed || !complete ? [] : complete(value) || [];+ const erase = () => {+ output.write(`\r${CLEAR_LINE}`);+ for (let i = 0; i < previousMenuRows; i++) output.write(`${CURSOR_DOWN(1)}\r${CLEAR_LINE}`);+ if (previousMenuRows) output.write(`${CURSOR_UP(previousMenuRows)}\r`);+ previousMenuRows = 0;+ };+ const render = () => {+ erase();+ const maxInput = Math.max(8, Number(output.columns || 100) - width(prompt) - 2);+ const viewport = inputViewport(value, cursor, maxInput);+ const items = matches();+ selected = items.length ? clamp(selected, 0, items.length - 1) : 0;+ const menu = menuLines(items, selected, output.columns, C);+ output.write(`${prompt}${viewport.display}`);+ for (const row of menu) output.write(`\r\n${row}`);+ previousMenuRows = menu.length;+ if (previousMenuRows) output.write(CURSOR_UP(previousMenuRows));+ output.write(`\r${CURSOR_RIGHT(width(prompt) + viewport.cursor)}`);+ };+ const cleanup = () => {+ input.off("keypress", onKey);+ if (typeof input.setRawMode === "function") input.setRawMode(wasRaw);+ input.pause();+ };+ const finish = (result, echo = true) => {+ erase();+ if (echo) output.write(`${prompt}${value}\r\n`);+ cleanup();+ if (history && result?.trim()) {+ this.history.unshift(result);+ if (this.history.length > 100) this.history.length = 100;+ }+ resolve(result);+ };+ const edit = (next, nextCursor) => {+ value = next; cursor = clamp(nextCursor, 0, chars(value).length);+ selected = 0; dismissed = false; historyIndex = null;+ render();+ };+ const apply = (item) => {+ if (!item?.text) return;+ value = item.text; cursor = chars(value).length; dismissed = true; selected = 0;+ render();+ };+ const historyMove = (dir) => {+ if (!history || !this.history.length) return;+ if (historyIndex === null) { draft = value; historyIndex = dir < 0 ? 0 : null; }+ else historyIndex = dir < 0 ? Math.min(this.history.length - 1, historyIndex + 1) : historyIndex - 1;+ if (historyIndex === null || historyIndex < 0) { historyIndex = null; value = draft; }+ else value = this.history[historyIndex] || "";+ cursor = chars(value).length; dismissed = true; render();+ };+ const onKey = (str, key = {}) => {+ const items = matches();+ if (key.ctrl && key.name === "d" && !value) return finish(null, false);+ if (key.ctrl && key.name === "c") {+ if (value) return edit("", 0);+ erase(); output.write("^C\r\n"); cleanup(); return resolve("");+ }+ if (key.name === "escape") { dismissed = true; selected = 0; return render(); }+ if (items.length && (key.name === "up" || key.name === "down")) {+ selected = (selected + (key.name === "up" ? -1 : 1) + items.length) % items.length;+ return render();+ }+ if (key.name === "tab" && items.length) return apply(items[selected]);+ if (key.name === "return" || key.name === "enter") {+ if (items.length && items[selected]?.text && value !== items[selected].text) return apply(items[selected]);+ return finish(value);+ }+ if (key.name === "up" && !items.length) return historyMove(-1);+ if (key.name === "down" && !items.length) return historyMove(1);+ const row = chars(value);+ if (key.name === "left") { cursor = Math.max(0, cursor - 1); return render(); }+ if (key.name === "right") { cursor = Math.min(row.length, cursor + 1); return render(); }+ if (key.name === "home" || (key.ctrl && key.name === "a")) { cursor = 0; return render(); }+ if (key.name === "end" || (key.ctrl && key.name === "e")) { cursor = row.length; return render(); }+ if (key.name === "backspace" && cursor > 0) return edit([...row.slice(0, cursor - 1), ...row.slice(cursor)].join(""), cursor - 1);+ if (key.name === "delete" && cursor < row.length) return edit([...row.slice(0, cursor), ...row.slice(cursor + 1)].join(""), cursor);+ if (key.ctrl && key.name === "u") return edit(row.slice(cursor).join(""), 0);+ if (key.ctrl && key.name === "k") return edit(row.slice(0, cursor).join(""), cursor);+ if (str && !key.ctrl && !key.meta && !/[\u0000-\u001f\u007f]/u.test(str)) {+ const insert = chars(str);+ return edit([...row.slice(0, cursor), ...insert, ...row.slice(cursor)].join(""), cursor + insert.length);+ }+ };++ input.on("keypress", onKey);+ input.resume();+ if (typeof input.setRawMode === "function") input.setRawMode(true);+ render();+ });+ }++ close() {+ this.closed = true;+ if (typeof this.input.setRawMode === "function" && this.input.isRaw) this.input.setRawMode(false);+ this.input.pause();+ }+}diff --git a/scripts/mso-agent-composer.test.ts b/scripts/mso-agent-composer.test.tsnew file mode 100644index 00000000..1482fc8c--- /dev/null+++ b/scripts/mso-agent-composer.test.ts@@ -0,0 +1,24 @@+import { describe, expect, it } from "vitest";+import { completionWindow, inputViewport } from "./mso-agent-composer.mjs";++describe("MSO Agent interactive composer primitives", () => {+ it("keeps a fixed completion viewport centered near the selected row", () => {+ const rows = Array.from({ length: 20 }, (_, i) => ({ text: `/${i}` }));+ expect(completionWindow(rows, 0, 8)).toMatchObject({ start: 0 });+ expect(completionWindow(rows, 10, 8)).toMatchObject({ start: 6 });+ expect(completionWindow(rows, 19, 8)).toMatchObject({ start: 12 });+ expect(completionWindow(rows, 10, 8).items).toHaveLength(8);+ });++ it("keeps long input on one physical composer line with cursor visibility", () => {+ const source = "abcdefghijklmnopqrstuvwxyz";+ const atEnd = inputViewport(source, source.length, 10);+ expect(Array.from(atEnd.display).length).toBeLessThanOrEqual(10);+ expect(atEnd.display).toContain("…");+ expect(atEnd.cursor).toBeGreaterThan(0);++ const atStart = inputViewport(source, 0, 10);+ expect(Array.from(atStart.display).length).toBeLessThanOrEqual(10);+ expect(atStart.cursor).toBe(0);+ });+});diff --git a/scripts/mso-agent-contract.test.ts b/scripts/mso-agent-contract.test.tsindex d3385ffa..8342f583 100644--- a/scripts/mso-agent-contract.test.ts+++ b/scripts/mso-agent-contract.test.ts@@ -13,10 +13,12 @@ describe("MSO terminal agent contract", () => {expect(src).toContain("── MSO Agent ──");expect(src).toContain("MSO_TITLE_ART");expect(src).toContain("MSO_TITLE_GUTTER");+ expect(src).toContain(" ████████████");expect(src).not.toContain("╭──┘ ╰────────╮");for (const command of ["/model", "/setup", "/providers", "/provider", "/doctor", "/tools", "/skills", "/skill", "/<skill>", "/session", "/sessions", "/resume", "/clear", "/exit"]) expect(src).toContain(command);expect(src).toContain("selected for the next message");- expect(src).toContain("completer:");+ expect(src).toContain("AgentComposer");+ expect(src).toContain("slashCompletionItems");});it("keeps infrastructure secrets out of model messages and binds write/exec approval to the exact full payload", () => {diff --git a/scripts/mso-agent-skills.mjs b/scripts/mso-agent-skills.mjsindex 7b462720..75ca8834 100644--- a/scripts/mso-agent-skills.mjs+++ b/scripts/mso-agent-skills.mjs@@ -118,18 +118,3 @@ export function printSkills(session, C, query = "", cwd = process.cwd()) {if (rows.length > visible.length) console.log(`${C.dim}… ${rows.length - visible.length} more; refine with /skills <query>${C.reset}`);console.log(`${C.dim}Use /<skill> [prompt], or /skill <exact-id> [prompt] for an ambiguous project skill.${C.reset}`);}--export const BUILTIN_SLASH = [- "/help", "/session", "/sessions", "/resume", "/model", "/setup", "/providers", "/provider",- "/doctor", "/tools", "/skills", "/skill", "/clear", "/exit",-];--export function slashCompleter(line, session) {- const text = String(line || "");- const trimmed = text.trimStart();- if (!trimmed.startsWith("/") || /\s/.test(trimmed)) return [[], text];- const dynamic = slashSkillNames(session.state.skills).map((name) => `/${name}`);- const all = [...new Set([...BUILTIN_SLASH, ...dynamic])];- const hits = all.filter((item) => item.startsWith(trimmed)).sort();- return [hits.length ? hits : all, trimmed];-}diff --git a/scripts/mso-agent-slash.mjs b/scripts/mso-agent-slash.mjsnew file mode 100644index 00000000..600e07a0--- /dev/null+++ b/scripts/mso-agent-slash.mjs@@ -0,0 +1,55 @@+import process from "node:process";+import { currentSkillProject, resolveSlashSkill, slashSkillNames } from "./mso-agent-skills.mjs";++export const BUILTIN_SLASH_ITEMS = [+ { text: "/help", meta: "Show commands and shortcuts", kind: "command" },+ { text: "/model", meta: "Connect or change the AI provider", kind: "command" },+ { text: "/session", meta: "Show the current durable session id", kind: "command" },+ { text: "/sessions", meta: "List resumable MSO Agent sessions", kind: "command" },+ { text: "/resume", meta: "Resume an earlier session by id", kind: "command" },+ { text: "/setup", meta: "Run full MSO onboarding", kind: "command" },+ { text: "/providers", meta: "Show infrastructure provider status", kind: "command" },+ { text: "/provider", meta: "Configure Dokploy, Cloudflare, or Hostinger", kind: "command" },+ { text: "/doctor", meta: "Run MSO diagnostics", kind: "command" },+ { text: "/tools", meta: "List available agent tools", kind: "command" },+ { text: "/skills", meta: "Browse and filter available skills", kind: "command" },+ { text: "/skill", meta: "Select a skill by exact catalog id", kind: "command" },+ { text: "/clear", meta: "Clear this session conversation", kind: "command" },+ { text: "/exit", meta: "Exit MSO Agent", kind: "command" },+];++function skillItem(skillsData, name, cwd) {+ const { skill } = resolveSlashSkill(skillsData, name, cwd);+ if (!skill || skill.trust === "untrusted") return null;+ const scope = skill.project?.name ? `skill · ${skill.project.name}` : "skill · global";+ const description = String(skill.description || "").replace(/[\r\n\t]+/g, " ").trim();+ return {+ text: `/${name}`,+ meta: `${scope}${description ? ` — ${description}` : ""}`,+ kind: "skill",+ project: skill.project || null,+ };+}++export function slashCompletionItems(skillsData, input, cwd = process.cwd()) {+ const text = String(input || "").trimStart();+ if (!text.startsWith("/") || /\s/.test(text)) return [];+ const query = text.toLowerCase();+ const current = currentSkillProject(skillsData, cwd);+ const names = slashSkillNames(skillsData, cwd);+ const projectSkills = [];+ const globalSkills = [];+ for (const name of names) {+ const item = skillItem(skillsData, name, cwd);+ if (!item) continue;+ if (current && item.project?.id === current.id) projectSkills.push(item);+ else globalSkills.push(item);+ }+ const builtinNames = new Set(BUILTIN_SLASH_ITEMS.map((item) => item.text));+ const all = [+ ...BUILTIN_SLASH_ITEMS,+ ...projectSkills.filter((item) => !builtinNames.has(item.text)),+ ...globalSkills.filter((item) => !builtinNames.has(item.text)),+ ];+ return all.filter((item) => item.text.toLowerCase().startsWith(query));+}diff --git a/scripts/mso-agent-slash.test.ts b/scripts/mso-agent-slash.test.tsnew file mode 100644index 00000000..c7777759--- /dev/null+++ b/scripts/mso-agent-slash.test.ts@@ -0,0 +1,40 @@+import { describe, expect, it } from "vitest";+import { slashCompletionItems } from "./mso-agent-slash.mjs";++const skills = {+ skills: [+ { id: "global-design", name: "design", trust: "local", description: "global design helper" },+ { id: "root/a/design", name: "design", trust: "local", description: "project design helper", project: { id: "root/a", name: "alpha", path: "/srv/alpha" } },+ { id: "root/a/ship-check", name: "ship-check", trust: "local", description: "ship alpha", project: { id: "root/a", name: "alpha", path: "/srv/alpha" } },+ { id: "unsafe", name: "unsafe", trust: "untrusted", description: "do not inject" },+ ],+};++describe("MSO Agent slash completion catalog", () => {+ it("opens the command catalog from a single slash", () => {+ const rows = slashCompletionItems(skills, "/", "/home/rahman");+ expect(rows[0]).toMatchObject({ text: "/help", kind: "command" });+ expect(rows.map((row) => row.text)).toContain("/design");+ expect(rows.map((row) => row.text)).not.toContain("/unsafe");+ });++ it("filters live as the command token is typed", () => {+ expect(slashCompletionItems(skills, "/sess", "/home/rahman").map((row) => row.text)).toEqual(["/session", "/sessions"]);+ expect(slashCompletionItems(skills, "/skills anything", "/home/rahman")).toEqual([]);+ });++ it("recommends the current-project skill and labels its project", () => {+ const rows = slashCompletionItems(skills, "/ship", "/srv/alpha/src");+ expect(rows).toHaveLength(1);+ expect(rows[0]).toMatchObject({ text: "/ship-check", kind: "skill" });+ expect(rows[0].meta).toContain("alpha");+ });++ it("prefers a current-project skill over the same-name global skill", () => {+ const [row] = slashCompletionItems(skills, "/design", "/srv/alpha");+ expect(row.kind).toBe("skill");+ const project = "project" in row ? row.project as { id?: string } | null : null;+ expect(project?.id).toBe("root/a");+ expect(row.meta).toContain("project design helper");+ });+});diff --git a/scripts/mso-agent-ui.mjs b/scripts/mso-agent-ui.mjsindex 7ba6ae2d..8edb8979 100644--- a/scripts/mso-agent-ui.mjs+++ b/scripts/mso-agent-ui.mjs@@ -13,7 +13,7 @@ C.c = C.cyan;export const MSO_TITLE_GUTTER = " ";export const MSO_TITLE_ART = [- "████████████",+ " ████████████"," ██ ██"," ██ ██ ██ ██ ██████████████████████"," ██ ██ ███╗ ███╗███████╗ ██████╗ ",diff --git a/scripts/mso-agent.mjs b/scripts/mso-agent.mjsindex 92652997..0d27fd2b 100644--- a/scripts/mso-agent.mjs+++ b/scripts/mso-agent.mjs@@ -1,9 +1,10 @@#!/usr/bin/env nodeimport { spawnSync } from "node:child_process";-import readline from "node:readline/promises";import process from "node:process";import { canonicalAgentApproval } from "../lib/agent/approval.mjs";-import { loadSlashSkill, printSkillChoices, printSkills, resolveSlashSkill, slashCompleter } from "./mso-agent-skills.mjs";+import { loadSlashSkill, printSkillChoices, printSkills, resolveSlashSkill } from "./mso-agent-skills.mjs";+import { AgentComposer } from "./mso-agent-composer.mjs";+import { slashCompletionItems } from "./mso-agent-slash.mjs";import {BASE, CLI, C, api, createCliSession, listCliSessions, loadCliSession,printBanner, saveCliSession, state, streamTurn,@@ -22,7 +23,7 @@ async function executeTool(rl, tool, call, agentSession) {console.log(`${C.warn}${C.bold}[${tool.scope.toUpperCase()}] exact tool call${C.reset}`);console.log(approval.display);console.log(`${C.dim}sha256 ${approval.digest} · ${approval.bytes} bytes${C.reset}`);- const answer = (await rl.question(" allow this exact call? [y/N]: ")).trim().toLowerCase();+ const answer = String(await rl.question(" allow this exact call? [y/N]: ", { history: false }) ?? "").trim().toLowerCase();if (answer === "y" || answer === "yes") approved = true;}if (!approved) return { ok: false, result: "denied by user" };@@ -187,16 +188,16 @@ async function main() {history: Array.isArray(agentSession.history) ? agentSession.history.slice(-48) : [],pendingSkill: null,};- const rl = readline.createInterface({- input: process.stdin, output: process.stdout, terminal: true, historySize: 100,- completer: (line) => slashCompleter(line, session),- });- process.on("SIGINT", () => { console.log("\nUse /exit to quit."); });+ const rl = new AgentComposer({ input: process.stdin, output: process.stdout, colors: C });+ const completeSlash = (line) => slashCompletionItems(session.state.skills, line, process.cwd());try {while (true) {let line = "";- try { line = (await rl.question(`\n${C.blue}${C.bold}›${C.reset} `)).trim(); }- catch { break; }+ try {+ const answer = await rl.question(`\n${C.blue}${C.bold}›${C.reset} `, { complete: completeSlash });+ if (answer === null) break;+ line = answer.trim();+ } catch { break; }if (!line) continue;if (line.startsWith("/")) {try {