A desktop coding agent with free access to frontier models.
TypeScript
fix: refresh editor after undo and skip compaction prompts
ogsamrat4415cad35040
diff --git a/apps/app/src/app/lib/files-rewound.ts b/apps/app/src/app/lib/files-rewound.tsnew file mode 100644index 00000000..04fd2495--- /dev/null+++ b/apps/app/src/app/lib/files-rewound.ts@@ -0,0 +1,39 @@+/**+ * "An undo or redo just changed the project's files": every successful+ * revert / unrevert of a chat says so, and the code editor re-reads its open+ * files (a file without unsaved changes takes the disk text; one with unsaved+ * changes is flagged as changed on disk, Reload offered first).+ */+export type FilesRewound = {+ kind: "undo" | "redo";+ sessionId: string;+ /** The files the engine says it restored or merged (undo only; a redo re-reads every open file). */+ files: string[];+};++type Listener = (event: FilesRewound) => void;+const listeners = new Set<Listener>();++export function onFilesRewound(listener: Listener): () => void {+ listeners.add(listener);+ return () => {+ listeners.delete(listener);+ };+}++export function notifyFilesRewound(event: FilesRewound): void {+ for (const listener of [...listeners]) {+ try {+ listener(event);+ } catch {+ // A listener never fails the undo.+ }+ }+}++/** The files a revert answer names as restored or merged. */+export function rewoundFiles(session: unknown): string[] {+ const revert = (session as { revert?: { restored?: unknown; merged?: unknown } | null } | null)?.revert;+ const list = (value: unknown) => (Array.isArray(value) ? value.filter((item): item is string => typeof item === "string") : []);+ return [...new Set([...list(revert?.restored), ...list(revert?.merged)])];+}diff --git a/apps/app/src/app/lib/opencode-session.ts b/apps/app/src/app/lib/opencode-session.tsindex 67d6a686..44b09c54 100644--- a/apps/app/src/app/lib/opencode-session.ts+++ b/apps/app/src/app/lib/opencode-session.ts@@ -10,6 +10,7 @@import type { Session } from "@opencode-ai/sdk/v2/client";import type { Client, ModelRef } from "../types";import { unwrap } from "./opencode";+import { notifyFilesRewound, rewoundFiles } from "./files-rewound";export type AbortSessionLogContext = {source: string;@@ -97,7 +98,9 @@ export async function revertSession(sessionID: string,messageID: string,): Promise<Session> {- return unwrap(await client.session.revert({ sessionID, messageID })) as Session;+ const session = unwrap(await client.session.revert({ sessionID, messageID })) as Session;+ notifyFilesRewound({ kind: "undo", sessionId: sessionID, files: rewoundFiles(session) });+ return session;}/**@@ -118,7 +121,9 @@ export async function unrevertSession(client: Client,sessionID: string,): Promise<Session> {- return unwrap(await client.session.unrevert({ sessionID })) as Session;+ const session = unwrap(await client.session.unrevert({ sessionID })) as Session;+ notifyFilesRewound({ kind: "redo", sessionId: sessionID, files: [] });+ return session;}/**diff --git a/apps/app/src/react-app/domains/session/commands/turn-messages.ts b/apps/app/src/react-app/domains/session/commands/turn-messages.tsnew file mode 100644index 00000000..c9b599b6--- /dev/null+++ b/apps/app/src/react-app/domains/session/commands/turn-messages.ts@@ -0,0 +1,28 @@+/**+ * Which user messages start a turn someone sent. A compaction adds user+ * messages of its own (the compaction request, and the automatic "continue"+ * after a compaction mid-turn); undo, redo and the prompt put back in the+ * composer skip them, so one undo takes back the whole turn.+ */+type MessageLike = { info: unknown; parts: ReadonlyArray<unknown> };++type PartLike = { type?: unknown; synthetic?: unknown; providerMetadata?: { opencode?: { synthetic?: unknown } } };++const isSynthetic = (part: PartLike) => part.synthetic === true || part.providerMetadata?.opencode?.synthetic === true;++/** A user message the person sent (not a compaction's request, its summary or its automatic follow-up). */+export function isPersonUserMessage(message: MessageLike | null | undefined): boolean {+ if (!message) return false;+ const info = message.info as { role?: unknown; summary?: unknown; mode?: unknown; agent?: unknown } | null;+ if (info?.role !== "user") return false;+ if (info.summary === true || info.mode === "compaction" || info.agent === "compaction") return false;+ const parts = message.parts as ReadonlyArray<PartLike>;+ if (parts.some((part) => part.type === "compaction" || part.type === "data-compaction")) return false;+ const text = parts.filter((part) => part.type === "text");+ return !(text.length > 0 && text.length === parts.length && text.every(isSynthetic));+}++/** The user messages that start turns, oldest first. */+export function personUserMessages<T extends MessageLike>(messages: readonly T[]): T[] {+ return messages.filter((message) => isPersonUserMessage(message));+}diff --git a/apps/app/src/react-app/domains/session/commands/use-session-commands.ts b/apps/app/src/react-app/domains/session/commands/use-session-commands.tsindex 77748795..bd1e3b58 100644--- a/apps/app/src/react-app/domains/session/commands/use-session-commands.ts+++ b/apps/app/src/react-app/domains/session/commands/use-session-commands.ts@@ -17,6 +17,7 @@ import {import { getComposerDraft, useComposerStateStore } from "@/react-app/domains/session/surface/composer-state-store";import { REDO_NOTICE, projectTracksFiles, undoNotice } from "./undo-notice";import { commandTemplateLabel } from "./review-message";+import { isPersonUserMessage } from "./turn-messages";export type SessionCommandTarget = {workspaceId: string;@@ -47,7 +48,6 @@ export function useOpencodeClient(target: Pick<SessionCommandTarget, "opencodeBa);}-const role = (message: OmniRushSessionMessage) => (message.info as { role?: string }).role;/** The messages the chat shows: those before its revert point (an undo hides the rest until redo). */export function visibleMessages(snapshot: OmniRushSessionSnapshot | null | undefined): OmniRushSessionMessage[] {@@ -56,9 +56,9 @@ export function visibleMessages(snapshot: OmniRushSessionSnapshot | null | undefreturn revertId ? snapshot.messages.filter((message) => message.info.id < revertId) : snapshot.messages;}-/** The user message an undo rewinds to: the newest one the chat still shows. */+/** The user message an undo rewinds to: the newest one the person sent that the chat still shows (a compaction's own are skipped). */export function undoTarget(snapshot: OmniRushSessionSnapshot | null | undefined): OmniRushSessionMessage | null {- return visibleMessages(snapshot).findLast((message) => role(message) === "user") ?? null;+ return visibleMessages(snapshot).findLast((message) => isPersonUserMessage(message)) ?? null;}/** The text a user message was sent with (what goes back into the composer after an undo). */diff --git a/apps/app/src/react-app/domains/session/editor/editor-models.ts b/apps/app/src/react-app/domains/session/editor/editor-models.tsindex cadcc5a0..fe2f406d 100644--- a/apps/app/src/react-app/domains/session/editor/editor-models.ts+++ b/apps/app/src/react-app/domains/session/editor/editor-models.ts@@ -6,6 +6,7 @@*/import type * as MonacoApi from "monaco-editor/editor/editor.api.js";+import { onFilesRewound } from "@/app/lib/files-rewound";import type { OmniRushServerClient } from "@/app/lib/omnirush-server";import { languageForPath, type Monaco } from "./monaco";import { useEditorStore } from "./editor-store";@@ -33,6 +34,8 @@ export class EditorDocuments {private docs = new Map<string, FileDoc>();private loading = new Map<string, Promise<OpenResult>>();private baselines = new Map<string, MonacoApi.editor.ITextModel>();+ /** Editor panels showing these documents (they re-read them after an undo themselves, and say what conflicts). */+ shown = 0;constructor(readonly monaco: Monaco,@@ -145,8 +148,10 @@ export class EditorDocuments {* Reads open files again (after a turn, on focus): a clean document takes* the disk text (one undo step), a dirty one is flagged as a conflict.*/- async refresh(paths?: string[]): Promise<void> {+ async refresh(paths?: string[], options: { discard?: boolean } = {}): Promise<void> {const targets = (paths ?? [...this.docs.keys()]).map((path) => this.docs.get(path)).filter((doc): doc is FileDoc => Boolean(doc));+ // Discarding: the document counts as clean, whatever was typed into it.+ const dirty = (doc: FileDoc) => !options.discard && this.isDirty(doc);await Promise.all(targets.map(async (doc) => {let file;try {@@ -154,13 +159,14 @@ export class EditorDocuments {} catch (error) {// Deleted on disk: a clean document empties and says so; a dirty one keeps the user's text.if ((error as { status?: number }).status === 404 && !doc.missing) {- if (this.isDirty(doc)) {+ if (dirty(doc)) {doc.conflict = true;return;}if (doc.model.getValueLength() > 0) doc.model.pushEditOperations([], [{ range: doc.model.getFullModelRange(), text: "" }], () => null);doc.updatedAt = null;doc.missing = true;+ doc.conflict = false;doc.savedVersion = doc.model.getAlternativeVersionId();useEditorStore.getState().setDirty(this.workspaceId, doc.path, false);}@@ -177,25 +183,34 @@ export class EditorDocuments {useEditorStore.getState().setDirty(this.workspaceId, doc.path, false);return;}- if (file.updatedAt === doc.updatedAt) return;- if (this.isDirty(doc)) {+ if (!options.discard && file.updatedAt === doc.updatedAt) return;+ if (dirty(doc)) {doc.conflict = true;return;}doc.model.pushEditOperations([], [{ range: doc.model.getFullModelRange(), text: file.content }], () => null);doc.updatedAt = file.updatedAt;+ doc.conflict = false;doc.savedVersion = doc.model.getAlternativeVersionId();useEditorStore.getState().setDirty(this.workspaceId, doc.path, false);}));}+ /**+ * After an undo or redo: every open file read again. Returns the files with+ * unsaved changes that changed on disk (newly flagged as a conflict).+ */+ async refreshAfterRewind(): Promise<string[]> {+ const before = new Set([...this.docs.values()].filter((doc) => doc.conflict).map((doc) => doc.path));+ await this.refresh();+ return [...this.docs.values()].filter((doc) => doc.conflict && !before.has(doc.path)).map((doc) => doc.path);+ }+/** Discards unsaved changes: the disk text again. */async revert(path: string): Promise<void> {const doc = this.docs.get(path);if (!doc) return;- doc.savedVersion = -1;- doc.updatedAt = -1;- await this.refresh([path]).catch(() => undefined);+ await this.refresh([path], { discard: true }).catch(() => undefined);}/** The read-only "before" model of a review or git diff. */@@ -241,6 +256,11 @@ export class EditorDocuments {const byWorkspace = new Map<string, EditorDocuments>();+// An undo or redo changed files: documents no editor panel shows are read again here (a shown one's panel does it).+onFilesRewound(() => {+ for (const docs of byWorkspace.values()) if (docs.shown === 0) void docs.refresh().catch(() => undefined);+});+export function editorDocuments(monaco: Monaco, client: OmniRushServerClient, workspaceId: string): EditorDocuments {const existing = byWorkspace.get(workspaceId);if (existing) {diff --git a/apps/app/src/react-app/domains/session/editor/editor-panel.tsx b/apps/app/src/react-app/domains/session/editor/editor-panel.tsxindex 083161ec..ade926c5 100644--- a/apps/app/src/react-app/domains/session/editor/editor-panel.tsx+++ b/apps/app/src/react-app/domains/session/editor/editor-panel.tsx@@ -36,6 +36,7 @@ import { toast } from "@/components/ui/sonner";import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";import { cn } from "@/lib/utils";+import { onFilesRewound } from "@/app/lib/files-rewound";import { editorDocuments, type EditorDocuments, type FileDoc } from "./editor-models";import { editorWorkspaceState, tabId, useEditorStore, type EditorSideView, type EditorTab, type ReviewScope } from "./editor-store";import { EditorSurface, type SurfaceDoc } from "./editor-surface";@@ -478,6 +479,23 @@ function GitView(props: {);}+/**+ * A file with unsaved changes changed on disk (an undo, the agent, another+ * program): Reload (the disk text) is the first choice; Overwrite writes+ * the editor's text over it.+ */+function showConflict(path: string, input: { reload: () => void; overwrite: () => void; reason: "save" | "undo" }) {+ const message = input.reason === "undo"+ ? `${path} changed on disk (undo or redo). Your unsaved changes are still in the editor.`+ : `${path} changed on disk since you opened it.`;+ toast.warning(message, {+ id: `editor-conflict:${path}`,+ duration: 20_000,+ action: { label: "Reload", onClick: input.reload },+ cancel: { label: "Overwrite", onClick: input.overwrite },+ });+}+export default function EditorPanel(props: EditorPanelProps) {const { client, workspaceId, workspaceRoot, sessionId, sessionBusy, opencodeClient } = props;const monaco = useMemo<Monaco>(() => setupMonaco(), []);@@ -537,6 +555,34 @@ export default function EditorPanel(props: EditorPanelProps) {wasBusy.current = sessionBusy;}, [docs, queryClient, sessionBusy, workspaceId]);+ // An undo or redo changed files: open files without unsaved changes take the disk text; one with+ // unsaved changes is flagged and Reload is offered first (an Overwrite would take the undo back).+ useEffect(() => {+ docs.shown += 1;+ const unsubscribe = onFilesRewound(() => {+ void docs.refreshAfterRewind().then((conflicts) => {+ setDocsTick((value) => value + 1);+ for (const path of conflicts) {+ showConflict(path, {+ reload: () => void docs.revert(path).then(() => setDocsTick((value) => value + 1)),+ overwrite: () => void docs.save(path, { sessionId, source: "editor", force: true }).then((result) => {+ if (!result.ok) toast.error(result.message);+ void queryClient.invalidateQueries({ queryKey: ["editor-git", workspaceId] });+ }),+ reason: "undo",+ });+ }+ }).catch(() => undefined);+ void queryClient.invalidateQueries({ queryKey: ["editor-tree", workspaceId] });+ void queryClient.invalidateQueries({ queryKey: ["editor-git", workspaceId] });+ void queryClient.invalidateQueries({ queryKey: ["editor-changes", workspaceId] });+ });+ return () => {+ docs.shown -= 1;+ unsubscribe();+ };+ }, [docs, queryClient, sessionId, workspaceId]);+// Back in the window: files may have changed outside the app.useEffect(() => {let last = 0;@@ -798,12 +844,7 @@ export default function EditorPanel(props: EditorPanelProps) {return;}if (result.conflict) {- toast.error(`${path} changed on disk since you opened it.`, {- id: `editor-conflict:${path}`,- duration: 20_000,- action: { label: "Overwrite", onClick: () => void save({ force: true }) },- cancel: { label: "Reload", onClick: () => void docs.revert(path) },- });+ showConflict(path, { reload: () => void docs.revert(path), overwrite: () => void save({ force: true }), reason: "save" });return;}toast.error(result.message);diff --git a/apps/app/src/react-app/domains/session/sync/actions-store.ts b/apps/app/src/react-app/domains/session/sync/actions-store.tsindex 3153dd67..c9e43aa9 100644--- a/apps/app/src/react-app/domains/session/sync/actions-store.ts+++ b/apps/app/src/react-app/domains/session/sync/actions-store.ts@@ -35,6 +35,7 @@ import { clearSessionDraft, LOCAL_SESSION_DRAFT_SCOPE, saveSessionDraft } from "import { firstLineLocalFileParts, isReadInlineablePath } from "./prompt-file-parts";import { composerAttachmentToFilePart } from "./attachment-file-part";import { mentionPromptParts } from "./mention-parts";+import { personUserMessages } from "../commands/turn-messages";type SessionModelConfig = {applyPendingSessionChoice: (sessionId: string) => void;@@ -701,10 +702,8 @@ export function createSessionActionsStore(options: {reason: "abort active run before undoing last user message",});- const users = options.messages().filter((message) => {- const role = (message.info as { role?: string }).role;- return role === "user";- });+ // The messages that start turns: a compaction's own user messages are skipped (one undo, the whole turn).+ const users = personUserMessages(options.messages());const target = users[users.length - 1];if (!target) return;@@ -736,10 +735,8 @@ export function createSessionActionsStore(options: {const revertMessageID = options.selectedSession()?.revert?.messageID ?? null;if (!revertMessageID) return;- const users = options.messages().filter((message) => {- const role = (message.info as { role?: string }).role;- return role === "user";- });+ // The messages that start turns: a compaction's own user messages are skipped (one undo, the whole turn).+ const users = personUserMessages(options.messages());const next = users.find((message) => {const id = options.messageIdFromInfo(message);diff --git a/apps/app/tests/undo-editor-sync.test.ts b/apps/app/tests/undo-editor-sync.test.tsnew file mode 100644index 00000000..84502342--- /dev/null+++ b/apps/app/tests/undo-editor-sync.test.ts@@ -0,0 +1,155 @@+import { describe, expect, mock, test } from "bun:test";++import { notifyFilesRewound, onFilesRewound, rewoundFiles, type FilesRewound } from "../src/app/lib/files-rewound";+import { revertSession, unrevertSession } from "../src/app/lib/opencode-session";+import { isPersonUserMessage, personUserMessages } from "../src/react-app/domains/session/commands/turn-messages";++// Monaco itself does not load outside the app; the documents only need a language name.+mock.module("../src/react-app/domains/session/editor/monaco", () => ({ languageForPath: () => "plaintext" }));+const { EditorDocuments } = await import("../src/react-app/domains/session/editor/editor-models");+const { undoTarget } = await import("../src/react-app/domains/session/commands/use-session-commands");++type Part = Record<string, unknown>;+const msg = (id: string, role: "user" | "assistant", parts: Part[], info: Record<string, unknown> = {}) => ({ info: { id, role, ...info }, parts });+const text = (value: string, extra: Part = {}) => ({ type: "text", text: value, ...extra });++// One turn with an automatic compaction in the middle of it: the person's prompt, the agent's+// work, the compaction's request and summary, the automatic "continue", the rest of the work.+const COMPACTED_TURN = [+ msg("m01", "user", [text("first")]),+ msg("m02", "assistant", [text("done")]),+ msg("m03", "user", [text("refactor the parser"), { type: "file", url: "file:///a.ts" }, text("Called the Read tool", { synthetic: true })]),+ msg("m04", "assistant", [{ type: "tool", tool: "edit" }]),+ msg("m05", "user", [{ type: "compaction", auto: true }]),+ msg("m06", "assistant", [text("summary")], { summary: true, mode: "compaction" }),+ msg("m07", "user", [text("Continue if you have next steps", { synthetic: true })]),+ msg("m08", "assistant", [{ type: "tool", tool: "write" }, text("finished")]),+];++describe("turn user messages", () => {+ test("a compaction's request and its automatic follow-up do not start turns", () => {+ expect(personUserMessages(COMPACTED_TURN).map((message) => message.info.id)).toEqual(["m01", "m03"]);+ expect(isPersonUserMessage(msg("x", "user", [text("hi")]))).toBe(true);+ // A prompt that is only an attachment (no typed text) is still the person's.+ expect(isPersonUserMessage(msg("x", "user", [{ type: "file", url: "file:///a.png" }]))).toBe(true);+ expect(isPersonUserMessage(msg("x", "user", [{ type: "data-compaction" }]))).toBe(false);+ expect(isPersonUserMessage(msg("x", "user", [text("go on", { providerMetadata: { opencode: { synthetic: true } } })]))).toBe(false);+ expect(isPersonUserMessage(msg("x", "user", [text("s")], { summary: true }))).toBe(false);+ // A user message's diff summary object is not a compaction mark.+ expect(isPersonUserMessage(msg("x", "user", [text("hi")], { summary: { diffs: [] } }))).toBe(true);+ expect(isPersonUserMessage(msg("x", "assistant", [text("hi")]))).toBe(false);+ expect(isPersonUserMessage(null)).toBe(false);+ });++ test("undo picks the turn's own prompt in one press", () => {+ const snapshot = { session: { id: "s", revert: null }, messages: COMPACTED_TURN } as never;+ expect(undoTarget(snapshot)?.info.id).toBe("m03");+ // After that undo the chat shows m01–m02: the next undo picks m01.+ const after = { session: { id: "s", revert: { messageID: "m03" } }, messages: COMPACTED_TURN } as never;+ expect(undoTarget(after)?.info.id).toBe("m01");+ });+});++describe("files rewound", () => {+ test("rewoundFiles lists the restored and merged files once", () => {+ expect(rewoundFiles({ revert: { restored: ["a.ts", "b.ts"], merged: ["b.ts", "c.ts"], kept: ["d.ts"], outside: ["e.ts"] } })).toEqual(["a.ts", "b.ts", "c.ts"]);+ expect(rewoundFiles({ revert: null })).toEqual([]);+ expect(rewoundFiles(null)).toEqual([]);+ });++ test("every successful revert and unrevert says so; a failed one does not", async () => {+ const seen: FilesRewound[] = [];+ const off = onFilesRewound((event) => seen.push(event));+ const client = {+ session: {+ revert: async ({ messageID }: { messageID: string }) => (messageID === "bad"+ ? { error: { name: "BusyError" }, response: { status: 409 } }+ : { data: { id: "s1", revert: { messageID, restored: ["a.ts"], merged: [] } } }),+ unrevert: async () => ({ data: { id: "s1" } }),+ },+ } as never;+ await revertSession(client, "s1", "m03");+ await unrevertSession(client, "s1");+ await expect(revertSession(client, "s1", "bad")).rejects.toBeDefined();+ off();+ notifyFilesRewound({ kind: "redo", sessionId: "s1", files: [] });+ expect(seen).toEqual([+ { kind: "undo", sessionId: "s1", files: ["a.ts"] },+ { kind: "redo", sessionId: "s1", files: [] },+ ]);+ });+});++// A Monaco text model as far as the documents use it.+function fakeModel(initial: string) {+ let value = initial;+ let version = 1;+ const listeners: Array<() => void> = [];+ const set = (next: string) => {+ value = next;+ version += 1;+ for (const listener of listeners) listener();+ };+ return {+ getValue: () => value,+ getValueLength: () => value.length,+ getAlternativeVersionId: () => version,+ getFullModelRange: () => ({}),+ pushEditOperations: (_: unknown, ops: Array<{ text: string }>) => set(ops[0]?.text ?? ""),+ onDidChangeContent: (listener: () => void) => listeners.push(listener),+ dispose: () => undefined,+ type: (next: string) => set(next),+ };+}++describe("editor documents after an undo", () => {+ test("a clean buffer takes the restored text; a buffer with unsaved changes is flagged once", async () => {+ const disk = new Map<string, { content: string; updatedAt: number }>([+ ["agent.ts", { content: "agent edit\n", updatedAt: 10 }],+ ["mine.ts", { content: "agent edit too\n", updatedAt: 10 }],+ ["same.ts", { content: "untouched\n", updatedAt: 10 }],+ ]);+ const models: ReturnType<typeof fakeModel>[] = [];+ const monaco = {+ Uri: { from: (value: unknown) => value },+ editor: {+ createModel: (content: string) => {+ const model = fakeModel(content);+ models.push(model);+ return model;+ },+ EndOfLinePreference: { TextDefined: 0 },+ getModels: () => [],+ },+ } as never;+ const client = {+ editorReadFile: async (_: string, path: string) => {+ const file = disk.get(path);+ if (!file) throw Object.assign(new Error("missing"), { status: 404 });+ return { path, content: file.content, updatedAt: file.updatedAt };+ },+ } as never;+ const docs = new EditorDocuments(monaco, client, "ws-undo-test");+ for (const path of ["agent.ts", "mine.ts", "same.ts"]) expect((await docs.open(path)).ok).toBe(true);+ // Unsaved typing in mine.ts.+ (docs.get("mine.ts")!.model as unknown as ReturnType<typeof fakeModel>).type("my unsaved text\n");++ // The undo restores both agent-edited files on disk.+ disk.set("agent.ts", { content: "original\n", updatedAt: 20 });+ disk.set("mine.ts", { content: "original too\n", updatedAt: 20 });+ expect(await docs.refreshAfterRewind()).toEqual(["mine.ts"]);+ expect(docs.get("agent.ts")!.model.getValue()).toBe("original\n");+ expect(docs.isDirty(docs.get("agent.ts")!)).toBe(false);+ expect(docs.get("agent.ts")!.updatedAt).toBe(20);+ expect(docs.get("mine.ts")!.model.getValue()).toBe("my unsaved text\n");+ expect(docs.get("mine.ts")!.conflict).toBe(true);+ expect(docs.get("same.ts")!.model.getValue()).toBe("untouched\n");+ // Already flagged: a second refresh does not report it again.+ expect(await docs.refreshAfterRewind()).toEqual([]);+ // Reload takes the disk text and clears the flag.+ await docs.revert("mine.ts");+ expect(docs.get("mine.ts")!.model.getValue()).toBe("original too\n");+ expect(docs.get("mine.ts")!.conflict).toBe(false);+ expect(docs.isDirty(docs.get("mine.ts")!)).toBe(false);+ });+});