{"version":3,"file":"web.mjs","names":["isRecord","MediaPreview","MediaPreview","channelFileEdits","fileLinksFiles"],"sources":["../../src/types/webFiles.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/filesModel.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/filesStore.ts","../../src/extensions/workspaces/sessions/(frontend)/channel/file-edits.web.ts","../../src/types/apiRoutes.ts","../../generated/client.ts","../../src/types/fileEditsApi.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/filesApi.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/fileIdentity.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/fileView.ts","../../src/extensions/workspaces/sessions/(frontend)/_components/DeleteFileDialog.tsx","../../src/extensions/workspaces/sessions/(frontend)/_components/SessionMediaPreview.tsx","../../src/extensions/workspaces/sessions/(frontend)/_components/FilePanel.tsx","../../src/extensions/workspaces/sessions/(frontend)/file-links/_components/FilePreviewPanel.tsx","../../src/extensions/workspaces/sessions/(frontend)/file-links/_lib/fileLinks.ts","../../src/extensions/workspaces/sessions/(frontend)/file-links/files.web.ts","../../generated/web.ts"],"sourcesContent":["import type { FileEditTool } from './domain';\n\n/**\n * View types shared by this package's hub channel and its web plugin. Wire\n * JSON only, no node types, so the cockpit bundle can carry them; the\n * cockpit receives them as 'file_edits' channel payloads.\n *\n * The channel carries the list alone. One file's diffs and content are large\n * and only wanted once a reader opens the file, so those come from the session\n * API instead (see fileEditsApi.ts).\n */\n\n/** One file this session changed, as the activity dock lists it. */\nexport interface FilesItemView {\n  /** Absolute path, and the identity every API route takes back. */\n  path: string;\n  /** Path relative to the session's working directory, which is what a row shows. */\n  relPath: string;\n  /** The tool behind the most recent change. */\n  tool: FileEditTool;\n  /** When that change happened, epoch milliseconds. */\n  at: number;\n  /** How many changes this session recorded for the file. */\n  count: number;\n  /**\n   * Whether any change captured a baseline, so a diff can be shown at all. A\n   * file found by comparing the tree around a bash call has no \"before\", so it\n   * is listed and readable but never diffed.\n   */\n  diffable: boolean;\n}\n\n/** The frame type the hub publishes and the web plugin claims; declared in the poWeb block too. */\nexport const filesChannelType = 'file_edits';\n\n/** Footer status key whose presence shows the activity group; the extension publishes it. */\nexport const filesStatusKey = 'po-file-edit-files';\n","import type { FilesItemView } from '../../../../../types/webFiles';\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n  return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isItem(value: unknown): value is FilesItemView {\n  return (\n    isRecord(value) &&\n    typeof value.path === 'string' &&\n    typeof value.relPath === 'string' &&\n    typeof value.tool === 'string' &&\n    typeof value.at === 'number' &&\n    typeof value.count === 'number'\n  );\n}\n\nexport interface FilesPayload {\n  items: FilesItemView[];\n}\n\n/** The shared wire gate for browser and native stores. */\nexport function parseFilesPayload(input: unknown): FilesPayload | null {\n  if (!isRecord(input) || !Array.isArray(input.items)) return null;\n  return { items: input.items.filter(isItem) };\n}\n","import { defineSessionStore } from '@agimon-ai/po-core/web';\nimport type { ReviewComment } from '@agimon-ai/po-web-components';\n\nimport type { FileEditsDetailView } from '../../../../../types/fileEditsApi';\nimport { filesChannelType, type FilesItemView } from '../../../../../types/webFiles';\nimport { parseFilesPayload, type FilesPayload } from './filesModel';\nexport type { FilesPayload } from './filesModel';\n\n/**\n * One session's record: the hub's last report plus whatever this page does with\n * it. Records are immutable values; the reducer and every action return a new one.\n *\n * Detail is cached per file rather than per open tab, because a reader closes a\n * file and comes back to it, and refetching the same history for the same click\n * is work the session already did.\n */\nexport interface FilesSession {\n  items: FilesItemView[];\n  /** One file's fetched history, keyed by absolute path. */\n  detail: Readonly<Record<string, FileEditsDetailView>>;\n  /** Paths with a detail request in flight, so a panel can say it is loading. */\n  loading: readonly string[];\n  /** What a failed fetch or a refused save reported, keyed by absolute path. */\n  errors: Readonly<Record<string, string>>;\n  /** Review notes waiting to be sent, in the order they were written. */\n  comments: readonly ReviewComment[];\n}\n\nconst empty: FilesSession = { items: [], detail: {}, loading: [], errors: {}, comments: [] };\n\nexport const files = defineSessionStore<FilesSession>(empty);\n\n/** The plugin's session data channel: 'file_edits' payloads into the store. */\nexport const filesChannel = files.channel<FilesPayload>({\n  channel: filesChannelType,\n  parse: parseFilesPayload,\n  // Only the list is replaced. The cached detail and the pending notes belong\n  // to files a reader opened, not to the list: a file the session deletes stops\n  // being listed, and pruning here would blank the tab still open on it and\n  // then refetch it on the next frame.\n  reduce: (current, { items }) => ({ ...current, items }),\n});\n\nexport function markLoading(sessionId: string, filePath: string): void {\n  files.update(sessionId, (current) =>\n    current.loading.includes(filePath)\n      ? current\n      : { ...current, loading: [...current.loading, filePath], errors: withoutKey(current.errors, filePath) },\n  );\n}\n\nexport function storeDetail(sessionId: string, detail: FileEditsDetailView): void {\n  files.update(sessionId, (current) => ({\n    ...current,\n    detail: { ...current.detail, [detail.path]: detail },\n    loading: current.loading.filter((path) => path !== detail.path),\n    errors: withoutKey(current.errors, detail.path),\n  }));\n}\n\nexport function storeError(sessionId: string, filePath: string, message: string): void {\n  files.update(sessionId, (current) => ({\n    ...current,\n    loading: current.loading.filter((path) => path !== filePath),\n    errors: { ...current.errors, [filePath]: message },\n  }));\n}\n\nexport function addComment(sessionId: string, comment: ReviewComment): void {\n  files.update(sessionId, (current) => ({ ...current, comments: [...current.comments, comment] }));\n}\n\nexport function removeComment(sessionId: string, id: string): void {\n  files.update(sessionId, (current) => ({\n    ...current,\n    comments: current.comments.filter((comment) => comment.id !== id),\n  }));\n}\n\nexport function clearComments(sessionId: string, filePath: string): void {\n  files.update(sessionId, (current) => ({\n    ...current,\n    comments: current.comments.filter((comment) => comment.path !== filePath),\n  }));\n}\n\nfunction withoutKey(source: Readonly<Record<string, string>>, key: string): Record<string, string> {\n  return Object.fromEntries(Object.entries(source).filter(([entry]) => entry !== key));\n}\n","import { defineChannelFile } from '@agimon-ai/po-core/web';\n\nimport { filesChannel } from '../_lib/filesStore';\nexport default defineChannelFile(filesChannel);\n","import type { ApiResponseOf, ApiRoutes } from '@agimon-ai/po-core/web';\n\nimport type { FileEditsDetailView, FileEditsPreviewView, FileEditsSaveView } from './fileEditsApi';\n\n/**\n * This package's routes, as data.\n *\n * No scope and no base path. The build reads both off\n * `src/extensions/workspaces/sessions/(backend)/api/file-edits/`, so the mount\n * is stated once, by the folder that creates it. They used to be written here,\n * in the contract and again inside every URL the page built, and the copies\n * were free to disagree.\n *\n * This is the one file the routes, the Hono app and the browser all read, so a\n * path cannot move on one side alone.\n */\nexport const routes = {\n  detail: {\n    method: 'GET',\n    path: '/detail',\n    query: ['path'],\n    response: undefined as unknown as ApiResponseOf<FileEditsDetailView>,\n  },\n  preview: {\n    method: 'GET',\n    path: '/preview',\n    query: ['path'],\n    response: undefined as unknown as ApiResponseOf<FileEditsPreviewView>,\n  },\n  save: {\n    method: 'PUT',\n    path: '/content',\n    response: undefined as unknown as ApiResponseOf<FileEditsSaveView>,\n  },\n  /** The same path as `save`; the method is the whole of the difference. */\n  remove: {\n    method: 'DELETE',\n    path: '/content',\n    query: ['path'],\n  },\n  /**\n   * The host's own bytes route, not this package's.\n   *\n   * `host: true` hangs it off the session root rather than under `/plugins`,\n   * which is how the cockpit already serves it. Declaring it here is the first\n   * time anything records that this package's previews depend on it.\n   */\n  file: {\n    method: 'GET',\n    path: '/file',\n    raw: true,\n    query: ['path'],\n    host: true,\n  },\n} as const satisfies ApiRoutes;\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { createApiClient, sessionApiAddress } from '@agimon-ai/po-core/web';\nimport { browserTransport } from '@agimon-ai/po-web-security/browser';\n\nimport { routes } from '../src/types/apiRoutes';\n\n/** Scopes the tree mounts 'file-edits' at. */\nexport const apiScopes = ['session'] as const;\n\nexport const api = createApiClient(routes, {\n  scopes: apiScopes,\n  basePath: 'file-edits',\n  transport: (input, init) => browserTransport.fetch(input, init),\n  sessionAddress: sessionApiAddress,\n});\n","import type { FileEditOrigin, FileEditTool } from './domain';\n\n/**\n * The wire vocabulary this package's API shares with whatever calls it.\n *\n * It lives under src/types because that is the one server root a browser\n * bundle may read: the cockpit plugin builds its URLs from these and the\n * routes answer them, so neither half can drift from the other.\n *\n * Routes live in `./apiRoutes`, which the contract, the Hono app and the\n * generated client all read. This file holds the shapes that travel over them.\n *\n * Opening a changed file wants its whole history at once, so `detail` answers\n * in one round trip rather than making the page stitch three reads together;\n * `content` takes the manual save back; `preview` reads a file the session\n * never changed, which has no history to answer with.\n */\n\n/** Where a host mounts this package's API; the segment after /api/plugins/. */\nexport const API_BASE_PATH = 'file-edits';\n\n/** Query parameter naming the file a request is about. */\nexport const PATH_QUERY_PARAM = 'path';\n\n/**\n * One line of a diff. The number is the new file's for context and additions\n * and the old file's for removals, so it always says where the line lives.\n */\nexport interface FileEditsDiffRow {\n  marker: '+' | '-' | ' ';\n  line: number;\n  content: string;\n}\n\n/**\n * A run of changed lines with its surrounding context. Hunks are sent apart\n * rather than joined by an elision marker, so the page draws the gap between\n * them instead of parsing one out of a string.\n */\nexport interface FileEditsDiffHunk {\n  /** The line number the hunk opens at. */\n  start: number;\n  rows: FileEditsDiffRow[];\n}\n\n/**\n * One change in a file's history, each rendered on its own so a file edited\n * four times shows four distinct diffs rather than one merged blur.\n */\nexport interface FileEditsVersionView {\n  /** Position in the file's history, oldest first, starting at 1. */\n  index: number;\n  tool: FileEditTool;\n  at: number;\n  origin: FileEditOrigin;\n  additions: number;\n  removals: number;\n  /** The changed lines of this one change; absent when no baseline was captured. */\n  hunks?: FileEditsDiffHunk[];\n  /** Why there is no diff, shown in its place. */\n  note?: string;\n}\n\n/** Everything this session did to the file: its first baseline against what is on disk now. */\nexport interface FileEditsCumulativeView {\n  additions: number;\n  removals: number;\n  hunks?: FileEditsDiffHunk[];\n  note?: string;\n}\n\n/** The file as it stands on disk right now, which is what the source view edits. */\nexport interface FileEditsWorkingView {\n  content: string;\n  /** sha256 of the content; the token a save hands back to prove it is not stale. */\n  hash: string;\n  /** True when the file is binary, missing, or past the size cap, so `content` is empty. */\n  unavailable: boolean;\n  reason?: string;\n}\n\n/** What the detail route answers with. */\nexport interface FileEditsDetailView {\n  path: string;\n  relPath: string;\n  versions: FileEditsVersionView[];\n  cumulative: FileEditsCumulativeView;\n  working: FileEditsWorkingView;\n}\n\n/**\n * What the preview route answers with: the file as it stands, and nothing\n * about how it got there. A file this session never touched has no history and\n * no baseline, so there is no diff to send and no save to take back.\n */\nexport interface FileEditsPreviewView {\n  path: string;\n  relPath: string;\n  working: FileEditsWorkingView;\n}\n\n/** What the save route takes. */\nexport interface FileEditsSaveRequest {\n  path: string;\n  /** The hash the reader loaded; a mismatch means the file moved underneath them. */\n  expectedHash: string;\n  content: string;\n}\n\n/** What the save route answers with. */\nexport interface FileEditsSaveView {\n  hash: string;\n}\n\n/** What a route reports when it refuses; the page shows `error` verbatim. */\nexport interface FileEditsErrorView {\n  error: string;\n  /** On a stale save, the hash the file actually has now. */\n  hash?: string;\n}\n","import { api } from '../../../../../../generated/client';\nimport {\n  type FileEditsDetailView,\n  type FileEditsPreviewView,\n  PATH_QUERY_PARAM,\n} from '../../../../../types/fileEditsApi';\n\n/**\n * The page's half of this package's session API: one file's history, the\n * manual save, and the deletion.\n *\n * These are adapters now, not a transport. The generated client owns the URL\n * and the sealed transport with it, so nothing here spells a route or reaches\n * for `fetch`. What stays is this package's own vocabulary: which refusals the\n * reader is shown, and the stale-save contract the editor depends on.\n *\n * Sealing still matters and still happens, one layer down. What travels here is\n * file contents in both directions, which is the worst thing in the cockpit to\n * hand a tunnel's relay in the clear.\n */\n\nconst UNREACHABLE = 'The session is unreachable.';\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n  return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Where a file's raw bytes are served from, for the ones the page shows rather\n * than edits.\n *\n * This is the host's route, not this package's, which is why the route table\n * marks it `host: true` and it lands beside the session rather than under\n * `/plugins`. The cockpit already serves any file under a session's working\n * directory, and that route carries the traversal guard, the size cap and the\n * content-type mapping. A second one here would duplicate a security boundary\n * to avoid duplicating a URL, which is the wrong way round.\n */\nexport function sessionFileUrl(sessionId: string, relPath: string): string {\n  return api.session(sessionId).file.url({ query: { [PATH_QUERY_PARAM]: relPath } });\n}\n\n/** The message a reader is shown: the route's own words, or why there were none. */\nfunction messageOf(result: { status: number; error: string }): string {\n  if (result.status === 0) return UNREACHABLE;\n  return result.error === '' ? `The session answered ${result.status}.` : result.error;\n}\n\nexport type FetchDetailResult = { ok: true; detail: FileEditsDetailView } | { ok: false; error: string };\n\nexport async function fetchFileDetail(sessionId: string, filePath: string): Promise<FetchDetailResult> {\n  const result = await api.session(sessionId).detail({ query: { [PATH_QUERY_PARAM]: filePath } });\n  if (!result.ok) return { ok: false, error: messageOf(result) };\n  if (!isRecord(result.data)) return { ok: false, error: 'The session answered with no detail.' };\n  return { ok: true, detail: result.data };\n}\n\nexport type FetchPreviewResult = { ok: true; preview: FileEditsPreviewView } | { ok: false; error: string };\n\n/** One file the session never changed, read only; the route bounds it to the working directory. */\nexport async function fetchFilePreview(sessionId: string, filePath: string): Promise<FetchPreviewResult> {\n  const result = await api.session(sessionId).preview({ query: { [PATH_QUERY_PARAM]: filePath } });\n  if (!result.ok) return { ok: false, error: messageOf(result) };\n  if (!isRecord(result.data)) return { ok: false, error: 'The session answered with no file.' };\n  return { ok: true, preview: result.data };\n}\n\nexport type SaveResult =\n  | { ok: true; hash: string }\n  /** The file moved under the editor; `hash` is what it holds now. */\n  | { ok: false; stale: true; error: string; hash?: string }\n  | { ok: false; stale: false; error: string };\n\nexport async function saveFileContent(\n  sessionId: string,\n  filePath: string,\n  expectedHash: string,\n  content: string,\n): Promise<SaveResult> {\n  const result = await api.session(sessionId).save({ body: { path: filePath, expectedHash, content } });\n  // The agent runs in the same working directory, so it can rewrite the file\n  // while a reader is still editing it. A moved hash is the one refusal the\n  // editor recovers from, so it is read before the generic failure.\n  if (result.status === 409) {\n    const data = result.ok ? undefined : result.data;\n    const hash = isRecord(data) && typeof data.hash === 'string' ? data.hash : undefined;\n    return {\n      ok: false,\n      stale: true,\n      error: result.ok ? 'The file changed since it was opened.' : messageOf(result),\n      ...(hash === undefined ? {} : { hash }),\n    };\n  }\n  if (!result.ok) return { ok: false, stale: false, error: messageOf(result) };\n  return { ok: true, hash: isRecord(result.data) && typeof result.data.hash === 'string' ? result.data.hash : '' };\n}\n\nexport type DeleteResult = { ok: true } | { ok: false; error: string };\n\n/**\n * Removes the file from disk.\n *\n * The route takes only a path, with no hash to prove the reader saw what is\n * there now: a deletion discards the file whatever it holds, so a staleness\n * check would guard nothing. The confirmation in front of it is the guard.\n */\nexport async function deleteFile(sessionId: string, filePath: string): Promise<DeleteResult> {\n  const result = await api.session(sessionId).remove({ query: { [PATH_QUERY_PARAM]: filePath } });\n  return result.ok ? { ok: true } : { ok: false, error: messageOf(result) };\n}\n","/** A short, stable fingerprint of a string; enough to separate two paths in an id. */\nfunction fingerprint(value: string): string {\n  let hash = 2166136261;\n  for (let index = 0; index < value.length; index += 1) {\n    hash ^= value.charCodeAt(index);\n    hash = Math.imul(hash, 16777619);\n  }\n  return (hash >>> 0).toString(36);\n}\n\n/** The transient tab id for one file; stable, so reopening focuses rather than duplicates. */\nexport function fileTabId(filePath: string): string {\n  // The id reaches a URL, so anything outside the safe set becomes a dash, and\n  // the path's own fingerprint keeps two similarly-named files apart.\n  const slug = filePath.replaceAll(/[^a-zA-Z0-9]+/gu, '-').replace(/^-|-$/gu, '');\n  return `files-file-${fingerprint(filePath)}-${slug.slice(-40)}`;\n}\n","export { fileTabId } from './fileIdentity';\nimport { buildReviewPrompt, grammarKeyOf, mediaKindOf, type ReviewComment } from '@agimon-ai/po-web-components';\n\nimport type { FileEditTool } from '../../../../../types/domain';\nimport type { FilesItemView } from '../../../../../types/webFiles';\n\n/**\n * Pure view logic the file surfaces share: how a change is labelled, how a\n * file is identified, and how a review reaches the agent.\n *\n * None of this touches React or the DOM beyond what it is handed, so the\n * awkward parts are pinned by tests rather than by clicking through a browser.\n * Wording a review and drawing a diff are shared with other review surfaces\n * and live in po-web-components.\n */\n\n/** What a row says about the tool behind a change. */\nexport const TOOL_LABEL: Readonly<Record<FileEditTool, string>> = {\n  edit: 'edit',\n  write: 'write',\n  bash: 'command',\n  user: 'you',\n};\n\n/** Filters visible relative paths without changing the timeline's newest-first order. */\nexport function filterFileItems(items: readonly FilesItemView[], query: string): FilesItemView[] {\n  const normalized = query.trim().toLocaleLowerCase();\n  if (normalized.length === 0) return [...items];\n  return items.filter((item) => item.relPath.toLocaleLowerCase().includes(normalized));\n}\n\n/**\n * How the preview shows a file: as the thing it is, wherever the browser can.\n *\n * One value rather than a chain of checks at the call site, because the order\n * carries the decisions. Media comes first, so a PNG the snapshot store\n * refused as binary is still a picture rather than an apology. `unavailable`\n * comes next, since a file with no readable text has nothing for the rest of\n * the list to render. Then the two documents that have a rendering of their\n * own, and then code, which is shown highlighted rather than as flat text.\n */\nexport type PreviewMode = 'media' | 'unavailable' | 'markdown' | 'html' | 'code' | 'text';\n\nexport function previewModeOf(filePath: string, unavailable: boolean): PreviewMode {\n  if (mediaKindOf(filePath) !== 'download') return 'media';\n  if (unavailable) return 'unavailable';\n  const lower = filePath.toLowerCase();\n  if (lower.endsWith('.md') || lower.endsWith('.markdown')) return 'markdown';\n  if (lower.endsWith('.html') || lower.endsWith('.htm')) return 'html';\n  return grammarKeyOf(filePath) === undefined ? 'text' : 'code';\n}\n\n/**\n * Sends a review as a deferred follow-up and reports whether it left.\n *\n * `follow_up` waits behind a running turn and starts when idle, without\n * treating the review as an explicit Queue action. The sender throws when\n * disconnected, so the caller keeps the comments and reports the reason.\n */\nexport function sendReviewFrame(\n  send: (frame: Record<string, unknown>) => void,\n  comments: readonly ReviewComment[],\n): string | undefined {\n  try {\n    send({ type: 'follow_up', message: buildReviewPrompt(comments) });\n    return undefined;\n  } catch (error) {\n    return error instanceof Error ? error.message : String(error);\n  }\n}\n","import {\n  Button,\n  Dialog,\n  DialogBody,\n  DialogContent,\n  DialogDescription,\n  DialogFooter,\n  DialogHeader,\n  DialogTitle,\n} from '@agimon-ai/po-web-components';\n\n/**\n * The confirmation that stands between the delete button and the unlink.\n *\n * Deleting is the one action here with nothing behind it: a manual save can be\n * undone from the file's own history, and a comment can be removed before it\n * is sent, but this session's snapshots go when the session does, so a file\n * removed by mistake is not coming back from anything the cockpit holds.\n */\nexport interface DeleteFileDialogProps {\n  relPath: string;\n  open: boolean;\n  onConfirm: () => void;\n  onCancel: () => void;\n}\n\nexport function DeleteFileDialog({ relPath, open, onConfirm, onCancel }: DeleteFileDialogProps) {\n  return (\n    <Dialog\n      open={open}\n      onOpenChange={(next) => {\n        if (!next) onCancel();\n      }}\n    >\n      <DialogContent width=\"sm\" data-testid=\"files-delete-dialog\" aria-describedby={undefined}>\n        <DialogHeader>\n          <DialogTitle>delete file</DialogTitle>\n        </DialogHeader>\n        <DialogBody>\n          <DialogDescription>\n            this removes <span className=\"font-semibold text-po-hi\">{relPath}</span> from disk. the session keeps its\n            record of the change, but the file itself is gone.\n          </DialogDescription>\n          <DialogFooter>\n            <Button variant=\"outline\" size=\"md\" data-testid=\"files-delete-cancel\" autoFocus onClick={onCancel}>\n              cancel\n            </Button>\n            <Button variant=\"danger\" size=\"md\" data-testid=\"files-delete-confirm\" onClick={onConfirm}>\n              delete\n            </Button>\n          </DialogFooter>\n        </DialogBody>\n      </DialogContent>\n    </Dialog>\n  );\n}\n","import { MediaPreview } from '@agimon-ai/po-web-components';\nimport { browserTransport } from '@agimon-ai/po-web-security/browser';\nimport { useEffect, useState } from 'react';\n\nimport { sessionFileUrl } from '../_lib/filesApi';\n\n/** Media elements cannot issue the encrypted fetch required by remote session files. */\nexport function SessionMediaPreview({\n  src,\n  path,\n  'data-testid': testId,\n}: {\n  src: string;\n  path: string;\n  'data-testid'?: string;\n}) {\n  const [loaded, setLoaded] = useState<{ source: string; url?: string; contentType?: string; error?: string }>();\n  useEffect(() => {\n    if (src === '') return;\n    const controller = new AbortController();\n    let url: string | undefined;\n    void (async () => {\n      const response = await browserTransport.fetch(src, { signal: controller.signal, cache: 'no-store' });\n      if (!response.ok) throw new Error(`Media could not be loaded (${response.status}).`);\n      const blob = await response.blob();\n      if (controller.signal.aborted) return;\n      url = URL.createObjectURL(blob);\n      setLoaded({\n        source: src,\n        url,\n        contentType: (response.headers.get('content-type') ?? blob.type).split(';', 1)[0]?.trim().toLowerCase() ?? '',\n      });\n    })().catch((error: unknown) => {\n      if (!controller.signal.aborted)\n        setLoaded({ source: src, error: error instanceof Error ? error.message : String(error) });\n    });\n    return () => {\n      controller.abort();\n      if (url !== undefined) URL.revokeObjectURL(url);\n    };\n  }, [src]);\n  const current = loaded?.source === src ? loaded : undefined;\n  if (current?.url === undefined)\n    return <p role={current?.error ? 'alert' : 'status'}>{current?.error ?? 'Loading media...'}</p>;\n  return <MediaPreview src={current.url} path={path} contentType={current.contentType} data-testid={testId} />;\n}\n\n/** Resolves markdown images beside their document, leaving containment to the host. */\nexport async function loadMarkdownImage(sessionId: string | null, documentPath: string, path: string) {\n  if (sessionId === null) throw new Error('The session is unavailable.');\n  const directory = documentPath.slice(0, documentPath.lastIndexOf('/') + 1);\n  const resolved = path.startsWith('/') ? path : `${directory}${path}`;\n  const response = await browserTransport.fetch(sessionFileUrl(sessionId, resolved), { cache: 'no-store' });\n  if (!response.ok) throw new Error(`Image could not be loaded (${response.status}).`);\n  const url = URL.createObjectURL(await response.blob());\n  return { url, dispose: () => URL.revokeObjectURL(url), path: resolved };\n}\n","import type { TransientTab, WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport {\n  Badge,\n  Breadcrumb,\n  Button,\n  CodeEditor,\n  type DiffSide,\n  DiffView,\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuTrigger,\n  type EditorSelectionRange,\n  KebabIcon,\n  Markdown,\n  markdownMediaReview,\n  ReviewCommentDraft,\n  reviewCommentAnchor,\n} from '@agimon-ai/po-web-components';\nimport { useStore } from '@tanstack/react-store';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport type { FileEditsVersionView } from '../../../../../types/fileEditsApi';\nimport { deleteFile, fetchFileDetail, saveFileContent, sessionFileUrl } from '../_lib/filesApi';\nimport {\n  addComment,\n  clearComments,\n  files,\n  markLoading,\n  removeComment,\n  storeDetail,\n  storeError,\n} from '../_lib/filesStore';\nimport { fileTabId, previewModeOf, sendReviewFrame, TOOL_LABEL } from '../_lib/fileView';\nimport { DeleteFileDialog } from './DeleteFileDialog';\nimport { loadMarkdownImage, SessionMediaPreview as MediaPreview } from './SessionMediaPreview';\n\n/**\n * One file's tab: what this session did to it, and what the reader wants done\n * next.\n *\n * Three views over the same file. The diff answers \"what changed\", the history\n * below it answers \"in what order\", and edit is where a reader fixes a line\n * themselves rather than asking for it. Preview exists because a changed\n * README is read, not diffed, and because a changed PDF or screenshot has no\n * text to read at all.\n *\n * The tab is transient: it belongs to the session and the page, and closing it\n * is how it ends. Its cached detail lives in the session store, so reopening\n * the same file does not refetch a history the session already answered.\n */\n\n/**\n * `preview` and `diff` are the two ways of reading the file and sit in the\n * header. `edit` is a mode entered from the menu and left by picking either\n * reading view; the draft survives the trip, so leaving to check a diff does\n * not throw away what was typed.\n */\ntype View = 'preview' | 'diff' | 'edit';\n\ninterface FilePanelProps extends WebPluginSlotProps {\n  filePath: string;\n  relPath: string;\n}\n\ninterface Draft {\n  snippet: string;\n  /** Set by a diff selection; absent means the new side, as in the editor and preview. */\n  side?: DiffSide;\n  startLine?: number;\n  endLine?: number;\n}\n\n/** How a version heads its row: what ran, when, and what it moved. */\nfunction versionSummary(version: FileEditsVersionView): string {\n  const time = new Date(version.at).toLocaleTimeString();\n  const counts = version.hunks === undefined ? '' : ` +${version.additions} -${version.removals}`;\n  return `${time} · ${TOOL_LABEL[version.tool] ?? version.tool}${counts}`;\n}\n\nexport function FilePanel(props: FilePanelProps) {\n  const { filePath, relPath, sessionId, sendSessionFrame, closeTransientTab } = props;\n  const session = useStore(files.store, (state) => files.select(state, sessionId));\n  const detail = session.detail[filePath];\n  const error = session.errors[filePath];\n  const loading = session.loading.includes(filePath);\n  const comments = session.comments.filter((comment) => comment.path === filePath);\n\n  // Preview first: clicking a file is a request to look at the file, and the\n  // diff is one question about it. The diff is one click away and the counts\n  // beside the toggles already say whether there is one worth opening.\n  const [view, setView] = useState<View>('preview');\n  const [draft, setDraft] = useState<Draft | undefined>(undefined);\n  const [source, setSource] = useState<string | undefined>(undefined);\n  const [expanded, setExpanded] = useState<number | undefined>(undefined);\n  const [saving, setSaving] = useState(false);\n  const [saveNote, setSaveNote] = useState<string | undefined>(undefined);\n  const [confirmingDelete, setConfirmingDelete] = useState(false);\n  const [reviewError, setReviewError] = useState<string | undefined>(undefined);\n  // The editor reports a range on every cursor move, and the comment box takes\n  // focus when it opens. Holding the latest range here and raising the box on\n  // mouse or key release keeps a drag from stealing focus halfway through it,\n  // and a ref rather than state keeps a cursor move from re-rendering the tab.\n  const selection = useRef<EditorSelectionRange | undefined>(undefined);\n\n  // One fetch per open, and again whenever the session reports the file moved:\n  // the count changing is the cheapest signal that the history grew.\n  const revision = session.items.find((item) => item.path === filePath)?.count ?? 0;\n  useEffect(() => {\n    if (sessionId === null) return;\n    let cancelled = false;\n    markLoading(sessionId, filePath);\n    void fetchFileDetail(sessionId, filePath).then((result) => {\n      if (cancelled) return;\n      if (result.ok) {\n        storeDetail(sessionId, result.detail);\n        setSource(undefined);\n        setSaveNote(undefined);\n      } else storeError(sessionId, filePath, result.error);\n    });\n    return () => {\n      cancelled = true;\n    };\n  }, [sessionId, filePath, revision]);\n\n  const working = detail?.working;\n  const outside = relPath === '..' || relPath.startsWith('../') || relPath.startsWith('/');\n  const content = source ?? working?.content ?? '';\n  const previewMode = previewModeOf(relPath, working?.unavailable === true);\n  // An image, a video or a PDF is shown rather than read as text, and it is\n  // shown from the hub's own bytes route rather than from the detail payload,\n  // which carries text only.\n  const loadImage = useCallback((path: string) => loadMarkdownImage(sessionId, relPath, path), [sessionId, relPath]);\n  const mediaSrc = sessionId === null ? '' : sessionFileUrl(sessionId, relPath);\n\n  const openDraft = (selection: Draft): void => {\n    setDraft(selection);\n  };\n\n  /** Raises the comment box on whatever the editor last reported, if that was a selection. */\n  const openSelectionDraft = (): void => {\n    const range = selection.current;\n    if (range === undefined || range.text.trim() === '') return;\n    openDraft({ snippet: range.text, startLine: range.startLine, endLine: range.endLine });\n  };\n\n  const submitDraft = (body: string): void => {\n    if (sessionId === null || draft === undefined) return;\n    addComment(sessionId, {\n      // The anchor plus the note's position is unique within a file, and a\n      // comment never outlives the session that holds it.\n      id: `${filePath}:${draft.side ?? 'new'}:${draft.startLine ?? 0}:${comments.length}:${body.length}`,\n      path: filePath,\n      relPath,\n      ...(draft.side === undefined ? {} : { side: draft.side }),\n      ...(draft.startLine === undefined ? {} : { startLine: draft.startLine }),\n      ...(draft.endLine === undefined ? {} : { endLine: draft.endLine }),\n      snippet: draft.snippet,\n      body,\n    });\n    setDraft(undefined);\n  };\n\n  const sendReview = (): void => {\n    if (sessionId === null || comments.length === 0) return;\n    // The comments go only once the frame has left; a disconnected session\n    // keeps them so the reader can send again rather than retype them.\n    const failure = sendReviewFrame((frame) => sendSessionFrame(sessionId, frame), comments);\n    setReviewError(failure);\n    if (failure === undefined) clearComments(sessionId, filePath);\n  };\n\n  const confirmDelete = async (): Promise<void> => {\n    if (sessionId === null) return;\n    setConfirmingDelete(false);\n    const result = await deleteFile(sessionId, filePath);\n    if (!result.ok) {\n      storeError(sessionId, filePath, result.error);\n      return;\n    }\n    // The file leaves the dock on the next channel frame, and this tab is now\n    // a view of something that is not there, so it goes with it.\n    closeTransientTab(fileTabId(filePath));\n  };\n\n  const save = async (): Promise<void> => {\n    if (sessionId === null || working === undefined || source === undefined) return;\n    setSaving(true);\n    const result = await saveFileContent(sessionId, filePath, working.hash, source);\n    setSaving(false);\n    if (result.ok) {\n      setSaveNote('saved');\n      setSource(undefined);\n      markLoading(sessionId, filePath);\n      const refreshed = await fetchFileDetail(sessionId, filePath);\n      if (refreshed.ok) storeDetail(sessionId, refreshed.detail);\n      else storeError(sessionId, filePath, refreshed.error);\n      return;\n    }\n    setSaveNote(result.error);\n  };\n\n  return (\n    <div data-testid=\"files-file-panel\" className=\"flex min-h-0 flex-1 flex-col\">\n      <header className=\"flex shrink-0 items-center gap-2 border-b border-po-border px-4 py-2\">\n        <Breadcrumb path={relPath} data-testid=\"files-breadcrumb\" className=\"min-w-0 flex-1\" />\n        {/* Edit is not one of the header's two toggles, so with neither lit the\n            mode needs saying; picking either toggle leaves it. */}\n        {view === 'edit' ? (\n          <Badge tone=\"neutral\" data-testid=\"files-editing\" className=\"shrink-0 \">\n            editing\n          </Badge>\n        ) : null}\n        {detail === undefined ? null : (\n          <span className=\"shrink-0 text-sm text-po-dim\">\n            +{detail.cumulative.additions} -{detail.cumulative.removals}\n          </span>\n        )}\n        {/* The two ways of looking at the file sit in the header; the things\n            that act on it live behind the kebab, so a destructive one is never\n            a mis-click away from a view toggle. */}\n        <nav className=\"flex shrink-0 items-center gap-1\">\n          {(['preview', 'diff'] as const).map((entry) => (\n            <Button\n              key={entry}\n              variant={view === entry ? 'outline' : 'ghost'}\n              size=\"xs\"\n              data-testid={`files-view-${entry}`}\n              onClick={() => setView(entry)}\n              className=\"\"\n            >\n              {entry}\n            </Button>\n          ))}\n        </nav>\n        <DropdownMenu>\n          <DropdownMenuTrigger asChild>\n            <Button\n              variant=\"ghost\"\n              size=\"icon\"\n              data-testid=\"files-menu\"\n              title=\"file actions\"\n              className=\"shrink-0 text-po-faint hover:text-po-hi\"\n            >\n              <KebabIcon className=\"h-3 w-3\" />\n            </Button>\n          </DropdownMenuTrigger>\n          <DropdownMenuContent data-testid=\"files-menu-list\">\n            <DropdownMenuItem\n              data-testid=\"files-edit\"\n              disabled={outside || working?.unavailable === true}\n              onSelect={() => setView('edit')}\n            >\n              edit\n            </DropdownMenuItem>\n            <DropdownMenuItem\n              variant=\"destructive\"\n              data-testid=\"files-delete\"\n              disabled={outside || working?.unavailable === true}\n              onSelect={() => setConfirmingDelete(true)}\n            >\n              delete\n            </DropdownMenuItem>\n            <DropdownMenuItem data-testid=\"files-close\" onSelect={() => closeTransientTab(fileTabId(filePath))}>\n              close\n            </DropdownMenuItem>\n          </DropdownMenuContent>\n        </DropdownMenu>\n      </header>\n\n      <DeleteFileDialog\n        relPath={relPath}\n        open={confirmingDelete}\n        onConfirm={() => void confirmDelete()}\n        onCancel={() => setConfirmingDelete(false)}\n      />\n\n      {loading && detail === undefined ? (\n        <p data-testid=\"files-loading\" className=\"px-4 py-3 text-sm text-po-dim\">\n          reading this file's history…\n        </p>\n      ) : null}\n      {error === undefined ? null : (\n        <p data-testid=\"files-error\" className=\"px-4 py-3 text-sm text-po-red\">\n          {error}\n        </p>\n      )}\n\n      <div className=\"min-h-0 flex-1 overflow-y-auto\">\n        {detail === undefined ? null : view === 'diff' ? (\n          <div className=\"flex flex-col\">\n            {detail.cumulative.note === undefined ? null : (\n              <p data-testid=\"files-cumulative-note\" className=\"px-4 py-2 text-sm text-po-yellow\">\n                {detail.cumulative.note}\n              </p>\n            )}\n            {detail.cumulative.hunks === undefined ? null : (\n              <DiffView\n                hunks={detail.cumulative.hunks}\n                testId=\"files-cumulative-diff\"\n                onSelect={(selection) => openDraft(selection)}\n              />\n            )}\n            <section className=\"mt-2 border-t border-po-border\">\n              <h2 className=\"px-4 py-2 text-lg font-semibold text-po-hi \">\n                {detail.versions.length} {detail.versions.length === 1 ? 'change' : 'changes'} this session\n              </h2>\n              {detail.versions.map((version) => (\n                <article key={version.index} data-testid={`files-version-${version.index}`}>\n                  <Button\n                    variant=\"ghost\"\n                    size=\"card\"\n                    data-testid={`files-version-toggle-${version.index}`}\n                    onClick={() => setExpanded(expanded === version.index ? undefined : version.index)}\n                    className=\"w-full gap-2 rounded-none px-4 py-1.5 hover:bg-po-panel\"\n                  >\n                    <span className=\"flex w-full min-w-0 items-center gap-2\">\n                      <span className=\"shrink-0 text-sm text-po-dim\">#{version.index}</span>\n                      <span className=\"min-w-0 flex-1 truncate text-left text-base text-po-text\">\n                        {versionSummary(version)}\n                      </span>\n                      {version.origin === 'scan' ? (\n                        <Badge tone=\"neutral\" className=\"shrink-0 \">\n                          no baseline\n                        </Badge>\n                      ) : null}\n                      <span className=\"shrink-0 text-sm text-po-dim\">{expanded === version.index ? '▾' : '▸'}</span>\n                    </span>\n                  </Button>\n                  {expanded !== version.index ? null : version.hunks === undefined ? (\n                    <p className=\"px-4 py-1.5 text-sm text-po-dim\">{version.note ?? 'nothing to show'}</p>\n                  ) : (\n                    <DiffView\n                      hunks={version.hunks}\n                      testId={`files-version-diff-${version.index}`}\n                      onSelect={(selection) => openDraft(selection)}\n                    />\n                  )}\n                </article>\n              ))}\n            </section>\n          </div>\n        ) : view === 'edit' ? (\n          <div className=\"flex h-full flex-col gap-2 p-3\">\n            {working?.unavailable === true ? (\n              <p data-testid=\"files-source-unavailable\" className=\"text-sm text-po-dim\">\n                {working.reason ?? 'this file cannot be shown'}\n              </p>\n            ) : (\n              <>\n                {/* The release, not the selection, is what raises the comment\n                    box: the editor reports a range continuously through a drag\n                    and the box takes focus when it opens. */}\n                <div\n                  className=\"min-h-[24rem] flex-1\"\n                  onMouseUp={openSelectionDraft}\n                  onKeyUp={(event) => {\n                    if (event.shiftKey) openSelectionDraft();\n                  }}\n                >\n                  <CodeEditor\n                    data-testid=\"files-source\"\n                    value={content}\n                    path={relPath}\n                    onChange={setSource}\n                    onSelect={(range) => {\n                      selection.current = range;\n                    }}\n                    className=\"h-full rounded border border-po-border\"\n                  />\n                </div>\n                <div className=\"flex shrink-0 items-center gap-2\">\n                  <Button\n                    variant=\"outline\"\n                    size=\"xs\"\n                    data-testid=\"files-save\"\n                    loading={saving}\n                    disabled={source === undefined || saving}\n                    onClick={() => void save()}\n                    className=\"\"\n                  >\n                    save to disk\n                  </Button>\n                  {source === undefined ? null : (\n                    <Button\n                      variant=\"ghost\"\n                      size=\"xs\"\n                      data-testid=\"files-revert\"\n                      onClick={() => setSource(undefined)}\n                      className=\"\"\n                    >\n                      discard edits\n                    </Button>\n                  )}\n                  {saveNote === undefined ? null : (\n                    <span\n                      data-testid=\"files-save-note\"\n                      className={saveNote === 'saved' ? 'text-sm text-po-green' : 'text-sm text-po-red'}\n                    >\n                      {saveNote}\n                    </span>\n                  )}\n                </div>\n              </>\n            )}\n          </div>\n        ) : (\n          <div\n            data-testid=\"files-preview\"\n            data-mode={previewMode}\n            className={\n              previewMode === 'code'\n                ? 'flex h-full flex-col gap-2 p-4 text-base text-po-text'\n                : 'flex flex-col gap-2 p-4 text-base text-po-text'\n            }\n            onMouseUp={() => {\n              // Highlighted source knows which lines were picked, so a note on\n              // it is anchored. A rendered document has no honest mapping back\n              // to source lines, and a note there carries its quotation and\n              // says it has none.\n              if (previewMode === 'code') {\n                openSelectionDraft();\n                return;\n              }\n              const text = globalThis.getSelection?.()?.toString() ?? '';\n              if (text.trim() !== '') openDraft({ snippet: text });\n            }}\n          >\n            {/* A file the editor cannot hold is still a file the reader came\n                to see, so the reason is said and the bytes are shown anyway. */}\n            {previewMode === 'unavailable' ? (\n              <p data-testid=\"files-preview-unavailable\" className=\"text-sm text-po-dim\">\n                {working?.reason ?? 'this file cannot be shown'}\n              </p>\n            ) : null}\n            {previewMode === 'media' || previewMode === 'unavailable' ? (\n              <MediaPreview src={mediaSrc} path={relPath} data-testid=\"files-preview-media\" />\n            ) : previewMode === 'markdown' ? (\n              <Markdown\n                text={content}\n                loadImage={loadImage}\n                documentPath={relPath}\n                renderMediaReview={markdownMediaReview(props)}\n              />\n            ) : previewMode === 'html' ? (\n              <iframe\n                data-testid=\"files-preview-html\"\n                title={relPath}\n                sandbox=\"\"\n                srcDoc={content}\n                className=\"h-[36rem] w-full rounded border border-po-border bg-po-deep\"\n              />\n            ) : previewMode === 'code' ? (\n              // The same editor the edit view uses, held open. Reading code as\n              // flat text is the one thing a cockpit should never make anyone\n              // do, and read-only keeps the two views honestly apart.\n              <CodeEditor\n                data-testid=\"files-preview-code\"\n                value={content}\n                path={relPath}\n                readOnly\n                onSelect={(range) => {\n                  selection.current = range;\n                }}\n                className=\"min-h-[24rem] flex-1 rounded border border-po-border\"\n              />\n            ) : (\n              // Everything else is shown as it is written. Preview is the file\n              // as it stands, so a file with nothing to render still has a\n              // reading view rather than an empty pane.\n              <pre\n                data-testid=\"files-preview-text\"\n                className=\"whitespace-pre-wrap break-words font-mono text-sm leading-normal text-po-text\"\n              >\n                {content}\n              </pre>\n            )}\n          </div>\n        )}\n      </div>\n\n      {draft === undefined ? null : (\n        <ReviewCommentDraft\n          testIdPrefix=\"files-comment\"\n          snippet={draft.snippet}\n          {...(draft.side === undefined ? {} : { side: draft.side })}\n          {...(draft.startLine === undefined ? {} : { startLine: draft.startLine })}\n          {...(draft.endLine === undefined ? {} : { endLine: draft.endLine })}\n          onSubmit={submitDraft}\n          onCancel={() => setDraft(undefined)}\n        />\n      )}\n\n      {comments.length === 0 ? null : (\n        <footer data-testid=\"files-review\" className=\"shrink-0 border-t border-po-border px-3 py-2\">\n          <div className=\"flex items-center gap-2 pb-1\">\n            <span className=\"flex-1 text-base font-semibold text-po-hi\">\n              {comments.length} {comments.length === 1 ? 'comment' : 'comments'}\n            </span>\n            <Button variant=\"outline\" size=\"xs\" data-testid=\"files-send-review\" onClick={sendReview} className=\"\">\n              send review\n            </Button>\n          </div>\n          {reviewError === undefined ? null : (\n            <p role=\"alert\" data-testid=\"files-review-error\" className=\"pb-1 text-sm text-po-red\">\n              review not sent: {reviewError}\n            </p>\n          )}\n          {comments.map((comment) => (\n            <div key={comment.id} data-testid=\"files-review-comment\" className=\"flex items-start gap-2 py-0.5\">\n              <span className=\"shrink-0 text-sm text-po-dim\">{reviewCommentAnchor(comment)}</span>\n              <span className=\"min-w-0 flex-1 truncate text-base text-po-text\">{comment.body}</span>\n              <Button\n                variant=\"ghost\"\n                size=\"xs\"\n                data-testid=\"files-review-remove\"\n                onClick={() => {\n                  if (sessionId !== null) removeComment(sessionId, comment.id);\n                }}\n                className=\"shrink-0 \"\n              >\n                remove\n              </Button>\n            </div>\n          ))}\n        </footer>\n      )}\n    </div>\n  );\n}\n\n/** The transient tab one file opens in; the same file reopens rather than duplicating. */\nexport function fileTab(filePath: string, relPath: string): TransientTab {\n  return {\n    id: fileTabId(filePath),\n    label: relPath.split('/').at(-1) ?? relPath,\n    panel: (props) => <FilePanel {...props} filePath={filePath} relPath={relPath} />,\n  };\n}\n","import type { TransientTab, WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport { Breadcrumb, Button, CodeEditor, Markdown, markdownMediaReview } from '@agimon-ai/po-web-components';\nimport { useCallback, useEffect, useState } from 'react';\n\nimport type { FileEditsPreviewView } from '../../../../../../types/fileEditsApi';\nimport { loadMarkdownImage, SessionMediaPreview as MediaPreview } from '../../_components/SessionMediaPreview';\nimport { fetchFilePreview, sessionFileUrl } from '../../_lib/filesApi';\nimport { fileTabId, previewModeOf } from '../../_lib/fileView';\n\n/**\n * A file the session never changed, opened read-only.\n *\n * The tab a changed file opens is built around its history: a diff, a version\n * list, an editor, a delete. None of that exists for a file the session only\n * read, and offering an edit view over a file this package holds no baseline\n * for would put a save behind a reader who cannot see what they are about to\n * overwrite. So this is one view, the file as it stands, and nothing else.\n *\n * Its content comes from the preview route, which is bounded by the session's\n * working directory rather than by the timeline.\n */\n\ninterface FilePreviewPanelProps extends WebPluginSlotProps {\n  filePath: string;\n}\n\n/** What one fetch settled on, tagged with the file it was about. */\ninterface Loaded {\n  sessionId: string;\n  path: string;\n  preview?: FileEditsPreviewView;\n  error?: string;\n}\n\nexport function FilePreviewPanel(props: FilePreviewPanelProps) {\n  const { filePath, sessionId, closeTransientTab } = props;\n  // The answer carries the path it answered for, so switching files is a state\n  // that does not match rather than a reset the effect has to perform.\n  const [loaded, setLoaded] = useState<Loaded | undefined>(undefined);\n\n  useEffect(() => {\n    if (sessionId === null) return;\n    let cancelled = false;\n    void fetchFilePreview(sessionId, filePath).then((result) => {\n      if (cancelled) return;\n      setLoaded(\n        result.ok\n          ? { sessionId, path: filePath, preview: result.preview }\n          : { sessionId, path: filePath, error: result.error },\n      );\n    });\n    return () => {\n      cancelled = true;\n    };\n  }, [sessionId, filePath]);\n\n  const current = loaded?.path === filePath && loaded.sessionId === sessionId ? loaded : undefined;\n  const preview = current?.preview;\n  const error = current?.error;\n  // Before the answer arrives the path is all there is to name the file by,\n  // and the route's own relative path replaces it once it does.\n  const relPath = preview?.relPath ?? filePath;\n  const working = preview?.working;\n  const content = working?.content ?? '';\n  const previewMode = previewModeOf(relPath, working?.unavailable === true);\n  const loadImage = useCallback((path: string) => loadMarkdownImage(sessionId, relPath, path), [sessionId, relPath]);\n  const mediaSrc = sessionId === null ? '' : sessionFileUrl(sessionId, relPath);\n\n  return (\n    <div data-testid=\"files-preview-panel\" className=\"flex min-h-0 flex-1 flex-col\">\n      <header className=\"flex shrink-0 items-center gap-2 border-b border-po-border px-4 py-2\">\n        <Breadcrumb path={relPath} data-testid=\"files-preview-breadcrumb\" className=\"min-w-0 flex-1\" />\n        <span className=\"shrink-0 text-sm text-po-dim\">unchanged</span>\n        <Button\n          variant=\"ghost\"\n          size=\"xs\"\n          data-testid=\"files-preview-close\"\n          onClick={() => closeTransientTab(filePreviewTabId(filePath))}\n          className=\"shrink-0 \"\n        >\n          close\n        </Button>\n      </header>\n\n      {error === undefined ? null : (\n        <p data-testid=\"files-preview-error\" className=\"px-4 py-3 text-sm text-po-red\">\n          {error}\n        </p>\n      )}\n      {preview === undefined && error === undefined ? (\n        <p data-testid=\"files-preview-loading\" className=\"px-4 py-3 text-sm text-po-dim\">\n          reading this file…\n        </p>\n      ) : null}\n\n      {preview === undefined ? null : (\n        <div className=\"min-h-0 flex-1 overflow-y-auto\">\n          <div\n            data-testid=\"files-preview\"\n            data-mode={previewMode}\n            className=\"flex h-full flex-col gap-2 p-4 text-base text-po-text\"\n          >\n            {previewMode === 'unavailable' ? (\n              <p data-testid=\"files-preview-unavailable\" className=\"text-sm text-po-dim\">\n                {working?.reason ?? 'this file cannot be shown'}\n              </p>\n            ) : null}\n            {previewMode === 'media' || previewMode === 'unavailable' ? (\n              <MediaPreview src={mediaSrc} path={relPath} data-testid=\"files-preview-media\" />\n            ) : previewMode === 'markdown' ? (\n              <Markdown\n                text={content}\n                loadImage={loadImage}\n                documentPath={relPath}\n                renderMediaReview={markdownMediaReview(props)}\n              />\n            ) : previewMode === 'html' ? (\n              <iframe\n                data-testid=\"files-preview-html\"\n                title={relPath}\n                sandbox=\"\"\n                srcDoc={content}\n                className=\"h-[36rem] w-full rounded border border-po-border bg-po-deep\"\n              />\n            ) : previewMode === 'code' ? (\n              <CodeEditor\n                data-testid=\"files-preview-code\"\n                value={content}\n                path={relPath}\n                readOnly\n                className=\"min-h-[24rem] flex-1 rounded border border-po-border\"\n              />\n            ) : (\n              <pre\n                data-testid=\"files-preview-text\"\n                className=\"whitespace-pre-wrap break-words font-mono text-sm leading-normal text-po-text\"\n              >\n                {content}\n              </pre>\n            )}\n          </div>\n        </div>\n      )}\n    </div>\n  );\n}\n\n/**\n * The id of the read-only tab, kept apart from the changed-file tab's own id:\n * the same file can be read now and changed later, and the two tabs are not\n * the same view of it.\n */\nexport function filePreviewTabId(filePath: string): string {\n  return `${fileTabId(filePath)}-preview`;\n}\n\n/** The transient tab an unchanged file opens in; the same file reopens rather than duplicating. */\nexport function filePreviewTab(filePath: string): TransientTab {\n  return {\n    id: filePreviewTabId(filePath),\n    label: filePath.split('/').at(-1) ?? filePath,\n    panel: (props) => <FilePreviewPanel {...props} filePath={filePath} />,\n  };\n}\n","import type { FileLinkSource, TransientTab } from '@agimon-ai/po-core/web';\n\nimport type { FilesItemView } from '../../../../../../types/webFiles';\nimport { fileTab } from '../../_components/FilePanel';\nimport { files } from '../../_lib/filesStore';\nimport { filePreviewTab } from '../_components/FilePreviewPanel';\n\n/**\n * The files a message names, as links into the same tab the activity dock\n * opens.\n *\n * Only files this session recorded a change to are claimed. A message quotes a\n * great deal that is shaped like nothing in particular, class names and globs\n * and flags among it, and guessing at what is a path produces links that open\n * an error. The recorded set is the one thing the page knows for certain, and\n * it is also the set a reader is most likely to want open.\n */\n\n/** A reference the way a message writes one: 'src/app.ts:42' or 'src/app.ts:42:9'. */\nconst LINE_SUFFIX = /:\\d+(?::\\d+)?$/;\n\nfunction itemsFor(sessionId: string | null): readonly FilesItemView[] {\n  return files.select(files.store.state, sessionId).items;\n}\n\nfunction match(sessionId: string | null, path: string): FilesItemView | undefined {\n  const candidate = path.trim().replace(LINE_SUFFIX, '');\n  if (candidate === '') return undefined;\n  return itemsFor(sessionId).find((item) => item.relPath === candidate || item.path === candidate);\n}\n\nexport const fileLinks: FileLinkSource = {\n  subscribe(listener: () => void) {\n    const subscription = files.store.subscribe(listener);\n    return () => subscription.unsubscribe();\n  },\n  // The paths themselves, not their count: a file that leaves the list while\n  // another arrives changes what resolves without changing how many do.\n  fingerprint: (sessionId) =>\n    itemsFor(sessionId)\n      .map((item) => item.relPath)\n      .join('\\n'),\n  resolve: (sessionId, path): TransientTab | undefined => {\n    const item = match(sessionId, path);\n    return item === undefined ? undefined : fileTab(item.path, item.relPath);\n  },\n  // A tool argument is a path on purpose, so nothing here has to be guessed.\n  // A file the session changed opens on its history; one it only read opens\n  // read-only, and the route behind that tab is what decides whether a path\n  // outside the working directory may be shown at all.\n  openPath: (sessionId, path): TransientTab | undefined => {\n    const item = match(sessionId, path);\n    if (item !== undefined) return fileTab(item.path, item.relPath);\n    // A call with no path argument at all hands this an empty string, and\n    // there is no file to open behind it.\n    const candidate = path.trim();\n    return candidate === '' || candidate.startsWith('artifact:') ? undefined : filePreviewTab(candidate);\n  },\n};\n","import { defineFileLinks } from '@agimon-ai/po-core/web';\n\nimport { fileLinks } from './_lib/fileLinks';\nexport default defineFileLinks(fileLinks);\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/po-core/web';\n\nimport channelFileEdits from '../src/extensions/workspaces/sessions/(frontend)/channel/file-edits.web';\nimport fileLinksFiles from '../src/extensions/workspaces/sessions/(frontend)/file-links/files.web';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n  (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const webPlugin = defineWebPlugin({\n  id: 'files',\n  packageName: '@agimon-ai/po-file-edit',\n  session: {\n    get channels(): WebPluginContributions['channels'] { return [via({ channel: 'file_edits' }, channelFileEdits)]; },\n    get fileLinks(): WebPluginContributions['fileLinks'] { return fileLinksFiles; },\n  },\n});\n"],"mappings":";;;;;;;;AAiCA,MAAa,mBAAmB;;;AC/BhC,SAASA,WAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,OAAO,OAAwC;CACtD,OACEA,WAAS,KAAK,KACd,OAAO,MAAM,SAAS,YACtB,OAAO,MAAM,YAAY,YACzB,OAAO,MAAM,SAAS,YACtB,OAAO,MAAM,OAAO,YACpB,OAAO,MAAM,UAAU;AAE3B;;AAOA,SAAgB,kBAAkB,OAAqC;CACrE,IAAI,CAACA,WAAS,KAAK,KAAK,CAAC,MAAM,QAAQ,MAAM,KAAK,GAAG,OAAO;CAC5D,OAAO,EAAE,OAAO,MAAM,MAAM,OAAO,MAAM,EAAE;AAC7C;ACKA,MAAa,QAAQ,mBAAiC;CAFxB,OAAO,CAAC;CAAG,QAAQ,CAAC;CAAG,SAAS,CAAC;CAAG,QAAQ,CAAC;CAAG,UAAU,CAAC;AAEnC,CAAK;;AAG3D,MAAa,eAAe,MAAM,QAAsB;CACtD,SAAS;CACT,OAAO;CAKP,SAAS,SAAS,EAAE,aAAa;EAAE,GAAG;EAAS;CAAM;AACvD,CAAC;AAED,SAAgB,YAAY,WAAmB,UAAwB;CACrE,MAAM,OAAO,YAAY,YACvB,QAAQ,QAAQ,SAAS,QAAQ,IAC7B,UACA;EAAE,GAAG;EAAS,SAAS,CAAC,GAAG,QAAQ,SAAS,QAAQ;EAAG,QAAQ,WAAW,QAAQ,QAAQ,QAAQ;CAAE,CAC1G;AACF;A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