Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
- **ompweb as a single binary, with no Node or npm.** Each release now also carries `ompweb-linux-x64`, `ompweb-linux-arm64`, `ompweb-darwin-x64`, `ompweb-darwin-arm64` (`.tar.gz`) and `ompweb-windows-x64` (`.zip`): one `ompweb` program with the web files beside it. It takes the same options and environment variables as the npm `ompweb`, and runs the daemon too (`ompweb host`). It has no tray, service installers or in-app update: the README's "Single binary" section shows the service units, and Settings → System links the release page when an update is out. Build one with `npm run build:binary`.
- **Binary prereleases from `main`.** Each commit on `main` that passes CI is published as a GitHub prerelease titled with its build time in ISO 8601 UTC (for example `2026-11-01T10:30:00Z`; tag `20261101T103000Z-<short sha>`) with the five single-binary archives. Prereleases are never marked latest, publish no npm package and trigger no update notice.
- **Settings → Hosts shows link protocol versions.** Each host shows the link protocol version its daemon speaks, and the page shows the version this web app expects.
- **Attach any file to a message, up to 2 GiB each.** The composer no longer refuses archives, PDFs or other binary files, and images are no longer capped at 5 MB per message. A file that cannot go inline is uploaded to the session's `local://` directory (`local/uploads/`) on the machine the session runs on, and the message tells the agent its `local://` URL and absolute path. Each image has an **Inline / As file** switch: Inline sends it with the message as before (omp resizes it for the model), As file keeps the exact bytes. An image too large to go inline switches to As file by itself. Uploads stream in chunks over the browser connection (or over HTTP in SSE mode) and on to the host, and show progress on each chip; Send waits until they finish. An upload resumes by itself from what the host already has when the browser connection drops, the web server restarts, the server loses the host's link, or the upload makes no progress for 2 minutes: the chip shows **Reconnecting…** meanwhile, in both the WebSocket and SSE modes. **Retry** appears only after 5 minutes of such an outage, or for a failure that waiting cannot fix. Update ompweb on the server first, then on its hosts: a host on an older build shows "Update ompweb on the session's host to attach files" when a file is attached. After an in-place upgrade, "This machine" takes uploads only once the ompweb host service (`ompweb-host`) is restarted, and the chip says so; restarting it ends the runs on this machine.
- **Attach any file to a message, up to 2 GiB each.** The composer no longer refuses archives, PDFs or other binary files, and images are no longer capped at 5 MB per message. A file that cannot go inline is uploaded to the session's `local://` directory (`local/uploads/`) on the machine the session runs on, and the message tells the agent its `local://` URL and absolute path; in the chat, each such file is a link that opens it. Each image has an **Inline / As file** switch: Inline sends it with the message as before (omp resizes it for the model), As file keeps the exact bytes. An image too large to go inline switches to As file by itself. Uploads stream in chunks over the browser connection (or over HTTP in SSE mode) and on to the host, and show progress on each chip; Send waits until they finish. An upload resumes by itself from what the host already has when the browser connection drops, the web server restarts, the server loses the host's link, or the upload makes no progress for 2 minutes: the chip shows **Reconnecting…** meanwhile, in both the WebSocket and SSE modes. **Retry** appears only after 5 minutes of such an outage, or for a failure that waiting cannot fix. Update ompweb on the server first, then on its hosts: a host on an older build shows "Update ompweb on the session's host to attach files" when a file is attached. After an in-place upgrade, "This machine" takes uploads only once the ompweb host service (`ompweb-host`) is restarted, and the chip says so; restarting it ends the runs on this machine.
- **Keep a host running with the single binary.** The README's "Keep a host running as a service" section has a systemd user unit (Linux), a logon scheduled task (Windows) and, for macOS, a restart script to run in tmux: launchd jobs cannot use the login keychain and SSH agent that omp sessions need. In tmux, macOS Local Network privacy blocks the daemon from LAN addresses, so link it to a URL that does not resolve to one (the server's public URL, or a VPN or tailnet name).
- **Session search shows where each session matched.** While searching the sidebar, the arrow beside a session lists its matches one per line, best match first and newest first among equals, ten at a time with **Load more…**. Matches in the messages of the open conversation are highlighted, typos and partial words included (thinking, tool output and math are not searched; link addresses and image descriptions do not count), and clicking a match opens its session, scrolls to it and marks it as the current one, like the browser's find. Closing or clearing the search removes the highlights. Browsers without the CSS Custom Highlight API (before Chrome 105, Safari 17.2 or Firefox 140) still jump to the match but do not paint it.
- **Show tool calls outside Process details.** A new setting keeps each tool call's row in the transcript instead of folding it; whether the row opens still follows "Keep tool calls collapsed".
Expand All @@ -31,6 +31,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
- **Removing an upload while offline still deletes it from the host.** A file you remove (or a finished upload you discard) is now deleted from the host's staging area once the browser, the server and the host can reach each other again, even if the browser connection dropped or the host was offline when you removed it. As a backstop, a running host now deletes staged files older than a day every hour, not only when it starts or receives a new upload, which also covers a removal that ompweb lost because it restarted while the host was offline.
- **`!` commands you run have their own look.** A shell command you ran with `!` now shows as a terminal-style card with a `$ command` prompt line, instead of the same row as the agent's tool calls. A failed run shows its exit code (`exit 1`) or `cancelled`, and a `!!` run is tagged `local`. Click the card to show its output. Long pending commands wrap even on narrow screens, switching to a different run resets its expansion, and screen readers can identify successful runs.
- **Reconnecting uploads no longer leave Send blocked by a hanging retry.** The five-minute deadline stops an in-flight retry as well as its back-off, keeping staged bytes for Retry. A connection lost midway through an HTTP response resumes automatically, and tooltips identify network failures instead of showing only “Upload failed”.
- **Files named `agent.db` or `models.yml` open again unless they are omp's own.** The file viewer refused those names anywhere under `~/.omp`, so an uploaded `agent.db` could not be opened from its link. It now refuses only the files omp keeps in its agent directory (and a profile's), with their SQLite sidecars, backups and `models.yaml`/`models.json`. Both symlinked agent directories and individually symlinked credential files keep their real targets protected, including targets with different names; unrelated uploaded copies still open.
- **Uploads no longer leave submitted messages or restored pages stuck.** A slow attachment copy keeps its session alive even after you switch chats. Commands that change Advisor wait until that preparation is dispatched before they may replace the session's child. Returning through browser Back/Forward shows Retry for an interrupted upload instead of leaving Send permanently blocked.
- **Attachment retries no longer accept missing files or stale upload errors.** An attachment removed or replaced by a directory is reported as missing before it is marked complete. Failed receipt writes leave the staged file available to retry without creating a duplicate, and cancellation cannot be undone by an attachment still finishing. Replies from earlier upload attempts no longer fail a newer Retry. Retrying also waits for failed-write cleanup, so an old attempt cannot delete the new attempt's staged files.
- **A conflicting upload start no longer interrupts the original file.** Reusing an upload ID with another filename or MIME type is rejected before changing the active transfer, so the original upload continues normally.
Expand Down
28 changes: 28 additions & 0 deletions components/MarkdownBody.file-links.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,31 @@ test("inline-code paths stay code outside a file-opening view and inside existin
assert.equal(links.length, 1);
assert.equal(links[0].getAttribute("href"), "https://x.test");
});

test("an Attached files line opens its upload, POSIX or Windows, whatever the name holds", () => {
const opened = [];
const { container } = renderChat(
[
"Attached files (this session's local:// directory):",
"- [`local://uploads/a (1) #2 &amp; 50%.txt`](/home/u/s/local/uploads/a%20%281%29%20%232%20%26amp;%2050%25.txt) (/home/u/s/local/uploads/a (1) #2 &amp; 50%.txt, 10 B, text/plain)",
"- [`local://uploads/[z] b.bin`](d:%5CUsers%5Cme%5C.omp%5Cs%5Clocal%5Cuploads%5C%5Bz%5D%20b.bin) (d:\\Users\\me\\.omp\\s\\local\\uploads\\[z] b.bin, 1 B, application/octet-stream)",
].join("\n"),
opened,
);
const links = [...container.querySelectorAll("a")];
assert.deepEqual(links.map((a) => a.textContent), ["local://uploads/a (1) #2 &amp; 50%.txt", "local://uploads/[z] b.bin"]);
for (const link of links) assert.equal(fireEvent.click(link, { button: 0 }), false, "click default must be prevented");
assert.equal(fireEvent.click(links[0], { button: 0, ctrlKey: true }), false, "a modified click opens the file too");
for (const link of links) {
const middleClick = new MouseEvent("auxclick", { button: 1, bubbles: true, cancelable: true });
assert.equal(fireEvent(link, middleClick), false, "middle-click must not navigate to the filesystem href");
}
assert.deepEqual(opened, ["/home/u/s/local/uploads/a (1) #2 &amp; 50%.txt", "d:/Users/me/.omp/s/local/uploads/[z] b.bin", "/home/u/s/local/uploads/a (1) #2 &amp; 50%.txt"]);
});

test("without a file panel (a remote host's session) a path link renders as its text, not an app URL", () => {
const { container } = render(React.createElement(MarkdownBody, { cwd: "/home/me/project" }, "- [`local://uploads/a.txt`](/remote/s/local/uploads/a.txt) (x) and [site](https://x.test)"));
const links = [...container.querySelectorAll("a")];
assert.deepEqual(links.map((a) => a.getAttribute("href")), ["https://x.test"]);
assert.match(container.textContent, /local:\/\/uploads\/a\.txt/);
});
19 changes: 12 additions & 7 deletions components/MarkdownBody.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { Children, cloneElement, isValidElement, useContext, useMemo, type ComponentProps, type MouseEvent, type ReactElement, type ReactNode } from "react";
import ReactMarkdown, { type Components } from "react-markdown";
import ReactMarkdown, { type Components, type UrlTransform } from "react-markdown";
import { remarkInlineCodeFileLinks, resolveLocalFileHref } from "@/lib/file-links";
import { encodeFilePathForApi } from "@/lib/file-paths";
import { AgentLinkContext, agentAwareUrlTransform, agentLinkIds, remarkAgentLinks } from "../lib/agent-links";
Expand All @@ -11,6 +11,9 @@ import { markdownCodeRenderer } from "./MarkdownCode";
import { ClickableImage } from "./ImageLightbox";
import { TableChart } from "./TableChart";

// The default sanitizer reads `C:` as a scheme; a drive path (`\` arrives as `%5C`) is a local file the `a` renderer opens.
const urlTransform: UrlTransform = (url, key, node) => (/^[A-Za-z]:(?:\/|%5C)/i.test(url) ? url : agentAwareUrlTransform(url, key, node));

interface MarkdownBodyProps {
children: string;
className?: string;
Expand Down Expand Up @@ -121,18 +124,20 @@ export function MarkdownBody({ children, className, isStreaming, cwd, onOpenFile
const anchor = <a href={href} {...props} onClick={handleClick} onAuxClick={(event) => event.preventDefault()}>{textParts}</a>;
return imageParts.length > 0 ? <>{anchor}{imageParts}</> : anchor;
}
const filePath = onOpenFile ? resolveLocalFileHref(href, cwd) : null;
const openFile = onOpenFile;
if (filePath && openFile) {
const filePath = resolveLocalFileHref(href, cwd);
if (filePath) {
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
// Without a file panel (a remote host's session, a dialog) a path link has nowhere to go: show its text.
if (!onOpenFile) return <>{textParts}{imageParts}</>;
const openFile = onOpenFile;
const handleClick = (event: MouseEvent<HTMLAnchorElement>) => {
// No modifier escape hatch: the href is a filesystem path, which the browser cannot open in a new tab.
if (event.defaultPrevented || event.button !== 0) return;
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
const target = event.currentTarget.getAttribute("target");
if (target && target !== "_self") return;
event.preventDefault();
openFile(filePath);
};
const anchor = <a href={href} {...props} onClick={handleClick}>{textParts}</a>;
const anchor = <a href={href} {...props} onClick={handleClick} onAuxClick={(event) => event.preventDefault()}>{textParts}</a>;
return imageParts.length > 0 ? <>{anchor}{imageParts}</> : anchor;
}

Expand Down Expand Up @@ -162,7 +167,7 @@ export function MarkdownBody({ children, className, isStreaming, cwd, onOpenFile
remarkPlugins={remarkPlugins}
rehypePlugins={rehypePlugins}
components={components}
urlTransform={agentAwareUrlTransform}
urlTransform={urlTransform}
>
{normalizedMarkdown}
</ReactMarkdown>
Expand Down
5 changes: 3 additions & 2 deletions docs/specs/2026-11-02-file-uploads-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ The composer refuses every file that is neither an image nor text (a `.zip` cann
- When the prompt is sent, the server appends one block to the message:
```
Attached files (this session's local:// directory):
- local://uploads/data.zip (/home/u/.omp/agent/sessions/…/local/uploads/data.zip, 12.3 MB, application/zip)
- [`local://uploads/data.zip`](/home/u/.omp/agent/sessions/…/local/uploads/data.zip) (/home/u/.omp/agent/sessions/…/local/uploads/data.zip, 12.3 MB, application/zip)
```
The `local://` URL is for omp's tools; the absolute path is for shell commands.
The `local://` URL is for omp's tools; the absolute path in the parentheses, exact, is for shell commands. Each URL is a Markdown link (a code span whose fence outruns any backtick run in it) to the percent-encoded path (`encodeURI`, plus `(`, `)`, `#`, `?`, `&`), so the chat opens the file from it whatever the name holds. Chat Markdown keeps Windows drive hrefs (`C:%5C…`, `C:/…`), which the sanitizer would otherwise read as a scheme. Where the chat has no file panel (a remote host's session, whose files main cannot read), a path link renders as its text.
Local file links handle modified left-clicks in the file panel and suppress middle-click navigation to filesystem paths.
- Limits: 2 GiB per file, 20 files per message.

### U2. What the composer does
Expand Down
2 changes: 1 addition & 1 deletion graphify-out/graph.json

Large diffs are not rendered by default.

Loading
Loading