feat(web): support local Markdown images in conversation messages (#2215)

* fix(web): resolve relative Markdown assets in file previews

* fix(web): harden standalone Markdown asset resolution

* fix(web): preserve Markdown URI and image policies

* fix(web): route Markdown file links through app history

* fix(web): preserve session reference navigation in previews

* feat(web): support local Markdown images in conversation messages

* fix(cli): bound session file reads

* fix(cli): avoid blocking bounded reads on FIFOs

* test(cli): run FIFO regression with Bun

* fix(hub): preserve legacy session file RPC calls

* test(web): update markdown preview fixture context

* fix(cli): reject symlinked session files outside workspace
This commit is contained in:
Ananovo
2026-10-29 22:12:57 +08:00
committed by GitHub
parent f29be07bb9
commit 0f76485ad9
23 changed files with 987 additions and 105 deletions
@@ -27,6 +27,7 @@ export type WorkspaceFilePathPolicy = {
type WorkspaceReadFileRequest = {
cwd?: unknown
path?: unknown
maxBytes?: unknown
}
type WorkspaceListDirectoryRequest = {
@@ -180,7 +181,11 @@ export function registerWorkspaceFileHandlers(
if (!stats.isFile()) {
throw new Error('Path is not a regular file')
}
const buffer = await readBoundedRegularFile(resolved.path, MAX_WORKSPACE_FILE_BYTES)
const requestedMaxBytes = typeof data.maxBytes === 'number' && Number.isFinite(data.maxBytes) && data.maxBytes > 0
? Math.floor(data.maxBytes)
: MAX_WORKSPACE_FILE_BYTES
const maxBytes = Math.min(requestedMaxBytes, MAX_WORKSPACE_FILE_BYTES)
const buffer = await readBoundedRegularFile(resolved.path, maxBytes)
return {
success: true,
content: buffer.toString('base64'),