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
fix(agent): resolve resumes across full session store
Rahman62d2c1e1d740
diff --git a/bin/mso b/bin/msoindex 023d479d..ef467ea3 100755--- a/bin/mso+++ b/bin/mso@@ -126,7 +126,7 @@# Docs: https://github.com/rahmanef63/msoset -euo pipefail-VERSION="1.6.1"+VERSION="1.6.2"ROOT="$(cd "$(dirname "$(readlink -f "$0")")/.." && pwd)"die() { echo "mso: $*" >&2; exit 1; }diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 56cc6e04..259ab982 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -23,6 +23,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.**Fixed**+- `agent` resolve resumes across full session store- `mcp` remove session lookup contention- `agent` wake prompt after child tty sigint- `cli` clarify version and update labelsdiff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex 8d0b2056..3dc664ea 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -2,6 +2,10 @@Running log of what shipped each phase. Newest at top.+## 2026-09-02 — Full-store session resume resolution — SHIPPED++MSO CLI **1.6.2** moves direct resume resolution to the server-side durable session store instead of first truncating the candidate set to 100 recent summaries in the terminal client. `--continue`, `--resume`, `/session <query>`, and `/resume <query>` now resolve `latest`, modified-order index, full/short id, exact/prefix/fuzzy title against every owner-visible durable session; the interactive picker intentionally remains a bounded newest-first view for fast navigation. Empty default CLI shells are excluded from index/latest selection, matching the human picker. Ambiguity errors use human titles rather than exposing internal ids. Regression coverage includes a target beyond 275 synthetic recent rows so the 100-row regression cannot return.+## 2026-09-02 — Cognitive Runtime P1: typed memory + measurable agent quality — SHIPPEDP1 upgrades durable agent memory without breaking the existing `USER.md` / `MEMORY.md` contract. Each client principal can now persist a private `records-v1.json` ledger of semantic/episodic/procedural claims carrying confidence, sensitivity, validity windows, provenance authority/channel, supersession/retraction and competing-claim evidence. Legacy Markdown remains readable until the first structured mutation, then seeds the ledger and becomes a resolved compatibility projection. Resolution is deterministic by temporal effectiveness → authority → confidence → recency; future facts do not erase still-current facts early. MCP adds read-only `agent_memory_search`; raw ChatGPT conversation ids are never persisted in provenance.diff --git a/lib/agent/session-query.test.ts b/lib/agent/session-query.test.tsnew file mode 100644index 00000000..ba686a02--- /dev/null+++ b/lib/agent/session-query.test.ts@@ -0,0 +1,38 @@+import { describe, expect, it } from "vitest";+import { chooseAgentSessionRecord } from "./session-query";+import type { AgentSession } from "./session-types";++function row(n: number, title: string, updatedAt: string, overrides: Partial<AgentSession> = {}): AgentSession {+ return {+ id: `20260901_120000_${n.toString(16).padStart(8, "0")}`, principalHash: "p", source: "cli",+ title, titleSource: "auto", createdAt: updatedAt, updatedAt, memorySnapshot: { user: "", memory: "", capturedAt: updatedAt },+ history: [{ role: "user", text: title }], events: [], estimatedTokens: 1, lifetimeEstimatedTokens: 1,+ compactThresholdTokens: 700000, compactionCount: 0, archiveCount: 0, ...overrides,+ };+}++describe("full-store agent session resolver", () => {+ it("sorts latest/index by modified time and skips empty default CLI clutter", () => {+ const rows = [+ row(1, "Older", "2026-09-01T10:00:00Z"),+ row(2, "Newest", "2026-09-01T12:00:00Z"),+ row(3, "MSO Agent session", "2026-09-01T13:00:00Z", { titleSource: "default", history: [] }),+ row(4, "Middle", "2026-09-01T11:00:00Z"),+ ];+ expect(chooseAgentSessionRecord(rows, "latest").title).toBe("Newest");+ expect(chooseAgentSessionRecord(rows, "2").title).toBe("Middle");+ });++ it("can resolve a named session far beyond a 100-row client summary", () => {+ const rows = Array.from({ length: 350 }, (_, i) => row(i + 1, `Session ${i + 1}`, new Date(1_788_000_000_000 - i * 1000).toISOString()));+ rows[275]!.title = "Ancient Important Project";+ expect(chooseAgentSessionRecord(rows, "Ancient Important").title).toBe("Ancient Important Project");+ expect(chooseAgentSessionRecord(rows, rows[275]!.id.slice(-8)).id).toBe(rows[275]!.id);+ });++ it("supports unique fuzzy titles but refuses ambiguous matches using human labels", () => {+ const rows = [row(1, "Deploy Baton", "2026-09-01T12:00:00Z"), row(2, "Audit Baton", "2026-09-01T11:00:00Z")];+ expect(chooseAgentSessionRecord(rows, "Deploy Bat").title).toBe("Deploy Baton");+ expect(() => chooseAgentSessionRecord(rows, "Baton")).toThrow(/Deploy Baton.*Audit Baton|Audit Baton.*Deploy Baton/);+ });+});diff --git a/lib/agent/session-query.ts b/lib/agent/session-query.tsindex 47237437..711094bc 100644--- a/lib/agent/session-query.ts+++ b/lib/agent/session-query.ts@@ -7,24 +7,49 @@ function cleanRef(value: string): string {return value.trim().replace(/^-(?=\d{8}_\d{6}_[a-f0-9]{8}$)/, "");}-function choose(records: AgentSession[], refValue: string): AgentSession {+export function chooseAgentSessionRecord(records: AgentSession[], refValue: string): AgentSession {+ const resumable = records.filter((row) => {+ const emptyDefaultCli = row.source === "cli" && row.history.length === 0 && row.title === "MSO Agent session"+ && (row.titleSource === "default" || row.titleSource === "manual");+ return !emptyDefaultCli;+ }).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));+ if (!resumable.length) throw new Error("session_not_found");+const ref = cleanRef(refValue), q = ref.toLowerCase();- const exactId = records.find((row) => row.id === ref); if (exactId) return exactId;- const idPrefix = records.filter((row) => row.id.startsWith(ref)); if (idPrefix.length === 1) return idPrefix[0]!;- const exactTitle = records.filter((row) => row.title.toLowerCase() === q); if (exactTitle.length === 1) return exactTitle[0]!;- const titlePrefix = records.filter((row) => row.title.toLowerCase().startsWith(q)); if (titlePrefix.length === 1) return titlePrefix[0]!;- const matches = [...idPrefix, ...exactTitle, ...titlePrefix];- if (matches.length > 1) throw new Error(`session reference is ambiguous: ${[...new Set(matches.map((row) => row.id))].slice(0, 6).join(", ")}`);+ if (!ref || q === "latest" || q === "continue") return resumable[0]!;+ const exactId = resumable.find((row) => row.id === ref); if (exactId) return exactId;+ if (/^[1-9]\d{0,3}$/.test(ref)) {+ const indexed = resumable[Number(ref) - 1];+ if (indexed) return indexed;+ throw new Error("session_not_found");+ }++ const idMatches = resumable.filter((row) => row.id.toLowerCase().startsWith(q) || row.id.toLowerCase().endsWith(q));+ if (idMatches.length === 1) return idMatches[0]!;++ const exactTitle = resumable.filter((row) => row.title.toLowerCase() === q);+ if (exactTitle.length === 1) return exactTitle[0]!;+ const titlePrefix = resumable.filter((row) => row.title.toLowerCase().startsWith(q));+ if (titlePrefix.length === 1) return titlePrefix[0]!;+ const fuzzyTitle = resumable.filter((row) => row.title.toLowerCase().includes(q));+ if (fuzzyTitle.length === 1) return fuzzyTitle[0]!;++ const matches = [...idMatches, ...exactTitle, ...titlePrefix, ...fuzzyTitle];+ const unique = [...new Map(matches.map((row) => [row.id, row])).values()];+ if (unique.length > 1) {+ const labels = unique.slice(0, 6).map((row) => row.title.replace(/[\r\n\t]+/g, " ").slice(0, 72));+ throw new Error(`session reference is ambiguous: ${labels.join(" | ")}`);+ }throw new Error("session_not_found");}export async function resolveAgentSessionRef(principal: string, ref: string): Promise<AgentSession> {const owner = principalHash(principal);- return choose((await listSessionRecords()).filter((row) => row.principalHash === owner), ref);+ return chooseAgentSessionRecord((await listSessionRecords()).filter((row) => row.principalHash === owner), ref);}export async function resolveAgentSessionOwnerRef(ref: string): Promise<AgentSession> {- return choose(await listSessionRecords(), ref);+ return chooseAgentSessionRecord(await listSessionRecords(), ref);}function resumedSummary(target: AgentSession): string {diff --git a/scripts/mso-agent-session-ui.mjs b/scripts/mso-agent-session-ui.mjsindex 6f7e3df1..0d04d01a 100644--- a/scripts/mso-agent-session-ui.mjs+++ b/scripts/mso-agent-session-ui.mjs@@ -1,5 +1,5 @@import { C, createCliSession, listCliSessions, renameCliSession, resumeCliSession, saveCliSession } from "./mso-agent-runtime.mjs";-import { formatSessionModified, resolveSessionQuery, sessionCompletionItems, sessionPromptHistory, visibleSessionRows } from "./mso-agent-sessions.mjs";+import { sessionCompletionItems, sessionPromptHistory, visibleSessionRows } from "./mso-agent-sessions.mjs";function autoTitle(history) {const first = history.find((row) => row?.role === "user" && typeof row.text === "string" && row.text.trim());@@ -26,33 +26,8 @@ export async function renameCurrentSession(session, title) {return session.titleOverride;}-export function printSessions(rows) {- if (!rows.length) { console.log("No MSO Agent sessions yet."); return; }- console.log(`${C.bold}Matching MSO Agent sessions${C.reset}`);- rows.forEach((row, index) => {- const title = String(row.title || "MSO Agent session").replace(/[\r\n\t]+/g, " ").trim().slice(0, 72);- const modified = formatSessionModified(row.updatedAt || row.createdAt);- console.log(` ${String(index + 1).padStart(2)} ${C.blue}${title}${C.reset} ${C.dim}· modified ${modified}${C.reset}`);- });- console.log(`${C.dim}Resume by title or list index; exact ids remain accepted as a scriptable escape hatch.${C.reset}`);-}--async function resolveResume(query, rows = null) {- const sessions = rows || await listCliSessions(100);- const result = resolveSessionQuery(sessions, query);- if (result.session) return result.session;- if (result.ambiguous?.length) {- console.log(`${C.warn}resume query is ambiguous:${C.reset}`);- printSessions(result.ambiguous);- return null;- }- throw new Error(`no resumable MSO Agent session matches: ${query || "latest"}`);-}--export async function resumeInto(rl, session, query, rows = null) {- const target = await resolveResume(query, rows);- if (!target) return false;- const loaded = await resumeCliSession(target.id);+export async function resumeInto(rl, session, query) {+ const loaded = await resumeCliSession(query);if (!loaded || loaded.source !== "cli") throw new Error("could not create a CLI continuation session");Object.assign(session, {agentSession: loaded,@@ -79,7 +54,7 @@ export async function resumePicker(rl, session) {selectOnEnter: true,escapeCancels: true,});- return answer?.trim() ? resumeInto(rl, session, answer.trim(), rows) : false;+ return answer?.trim() ? resumeInto(rl, session, answer.trim()) : false;}export function resumeArg(argv) {@@ -93,8 +68,5 @@ export function resumeArg(argv) {}export async function startupSession(requested) {- if (!requested) return createCliSession();- const target = await resolveResume(requested, await listCliSessions(100));- if (!target) throw new Error(`cannot resume ambiguous session query: ${requested}`);- return resumeCliSession(target.id);+ return requested ? resumeCliSession(requested) : createCliSession();}diff --git a/scripts/mso-model-dx-contract.test.ts b/scripts/mso-model-dx-contract.test.tsindex 3354af3f..3b778fd3 100644--- a/scripts/mso-model-dx-contract.test.ts+++ b/scripts/mso-model-dx-contract.test.ts@@ -14,7 +14,7 @@ const all = [cli, agentCli, configRoute, oauthRoute, slash, picker].join("\n");describe("MSO model/provider/session CLI contract", () => {it("keeps provider auth (`models`) separate from active selection (`model`)", () => {- expect(cli).toContain('VERSION="1.6.1"');+ expect(cli).toContain('VERSION="1.6.2"');expect(cli).toContain("models * Configure AI providers/auth");expect(cli).toContain("model [ref] Select active model");expect(agentCli).toContain("run_models()");