kimi-code/apps/web/test
qer ec74eab9ce
feat(chat): preview files outside the workspace via host fs:content (#172)
* feat(chat): preview files outside the workspace via host fs:content

File preview is a local read-only action, so out-of-workspace absolute
paths (chat/Markdown links, tool-call paths, turn-summary files) now read
through the daemon's global fs:content instead of being refused with the
outsideWorkspace error. The allowHostRead opt-in is removed entirely;
workspace-level trust gating will land as a separate feature.

* fix(chat): harden out-of-workspace preview reads

- Lexically normalize absolute preview paths so an in-cwd path with ".."
  (src/../a.ts) keeps the session fs:read path (download / reveal / line
  count) instead of falling into the host-read branch.
- Preserve the POSIX root when resolving relative links/images inside an
  out-of-workspace Markdown preview (/tmp/notes/a.md + ./b.md no longer
  resolves to the workspace-relative tmp/notes/b.md).
- Cap readHostFileContent at 10 MiB (FileTooLargeError): fs:content has no
  truncation semantics and the body is decoded in full in the renderer, so
  an unbounded read could hang or OOM the app. The preview maps it to a
  dedicated too-large error state.

* fix(chat): refuse oversized host reads early and load external markdown images

- DaemonHttpClient.getBlob gains a maxBytes option that rejects at the
  Content-Length header (cancelling the body stream) instead of after the
  whole body is downloaded; readHostFileContent passes its 10 MiB cap
  through it, keeping the post-read check as the missing-header fallback.
- resolveImageUrl now reads out-of-workspace absolute image paths via the
  host fs:content (base64 data URL), so relative images inside an external
  Markdown preview — and model-referenced /tmp images in chat — render
  instead of falling back to a same-origin URL that can never load.

* fix(chat): handle Windows absolute paths in image and markdown-link resolution

- resolveImageUrl classifies any local absolute path (POSIX, Windows drive,
  UNC) instead of POSIX-only: in-cwd ones relativize via pathRelativeTo for
  the session fs:read (in-workspace Windows absolute images render too now),
  outside ones read via the host fs:content.
- The Markdown preview's link/image resolvers pass Windows-drive and UNC
  absolute targets through unchanged instead of拼接ing them onto the current
  file's directory (C:/tmp/b.md no longer becomes C:/notes/C:/tmp/b.md).
2026-08-03 19:47:36 +08:00
..
agent-event-projector.test.ts feat(chat): add on-demand subagent transcripts (#137) 2026-07-28 23:06:53 +08:00
apply-event-slices.test.ts fix(chat): reconcile optimistic user messages by identity (#100) 2026-07-24 00:43:02 +08:00
apply-record-diff.test.ts perf(renderer): eliminate streaming re-render amplification and session-switch scroll flash (#112) 2026-07-27 09:52:48 +08:00
ask-user-tool-parse.test.ts chore: import kimi-web as apps/web 2026-07-10 11:38:49 +08:00
attachment-upload.test.ts feat(chat): unify attachment previews between composer and transcript (#142) 2026-07-28 20:22:39 +08:00
chat-turn-rendering.test.ts feat(chat): summarize a turn's file changes below its final text (#101) 2026-07-29 01:08:46 +08:00
clipboard.test.ts chore: import kimi-web as apps/web 2026-07-10 11:38:49 +08:00
composer-draft.test.ts chore: import kimi-web as apps/web 2026-07-10 11:38:49 +08:00
confirm-dialog.test.ts feat(desktop): show the signed-in user's profile and add the sidebar user menu (#157) 2026-07-30 16:35:39 +08:00
daemon-client.test.ts feat(desktop): persist renderer diagnostics to the app log and bundle it in session exports (#119) 2026-07-27 14:20:53 +08:00
detail-panel-toggle.test.ts feat(chat): preview files outside the workspace via host fs:content (#172) 2026-08-03 19:47:36 +08:00
event-batcher.test.ts fix(sidebar): keep new workspaces on top and stop mid-turn reorder jumps (#49) 2026-07-20 20:34:21 +08:00
event-reducer.test.ts fix(chat): reconcile optimistic user messages by identity (#100) 2026-07-24 00:43:02 +08:00
index-html.test.ts feat(web): sync upstream kimi-web changes through 09e85540 2026-07-16 12:16:06 +00:00
input-history.test.ts chore: import kimi-web as apps/web 2026-07-10 11:38:49 +08:00
lib-logic.test.ts feat(desktop): show the signed-in user's profile and add the sidebar user menu (#157) 2026-07-30 16:35:39 +08:00
log.test.ts feat(desktop): persist renderer diagnostics to the app log and bundle it in session exports (#119) 2026-07-27 14:20:53 +08:00
mention-menu.test.ts fix(composer): keep the mention menu closed for a bare @ (#152) 2026-07-30 14:43:20 +08:00
notification-logic.test.ts feat: merge notification toggles into a single master switch (#66) 2026-07-21 18:24:37 +08:00
open-file-attachment.test.ts feat(web): sync upstream kimi-web changes through 09e85540 2026-07-16 12:16:06 +00:00
pinned-sessions.test.ts feat(sidebar): pin sessions in a section above the workspace groups (#64) 2026-07-21 18:29:52 +08:00
planUsage.test.ts feat(desktop): show the signed-in user's profile and add the sidebar user menu (#157) 2026-07-30 16:35:39 +08:00
riveInputs.test.ts feat(chat): replace the moon sending placeholder with the mascot working indicator (#116) 2026-07-27 11:26:12 +08:00
server-auth.test.ts feat(web): sync upstream kimi-web changes 2026-07-15 11:33:34 +08:00
session-work-reconnect.test.ts fix: reconcile session work state after reconnect (#109) 2026-07-29 17:34:02 +08:00
side-chat.test.ts fix(chat): reconcile optimistic user messages by identity (#100) 2026-07-24 00:43:02 +08:00
slash-menu.test.ts feat(web): sync upstream kimi-web changes 2026-07-15 11:33:34 +08:00
storage-logic.test.ts feat(sidebar): pin sessions in a section above the workspace groups (#64) 2026-07-21 18:29:52 +08:00
swarm-card-rows.test.ts feat(chat): add on-demand subagent transcripts (#137) 2026-07-28 23:06:53 +08:00
swarm-groups.test.ts feat(chat): add on-demand subagent transcripts (#137) 2026-07-28 23:06:53 +08:00
swarm-result.test.ts chore: import kimi-web as apps/web 2026-07-10 11:38:49 +08:00
task-poller.test.ts ci: migrate desktop packaging to GitHub Actions and add changesets release flow (#1) 2026-07-16 22:45:14 +08:00
tool-args.test.ts feat(chat): bespoke quiet tool lines, same-kind groups and sub-agent identity card (#34) 2026-07-19 19:36:19 +08:00
trace.test.ts feat(desktop): persist renderer diagnostics to the app log and bundle it in session exports (#119) 2026-07-27 14:20:53 +08:00
turn-files-summary.test.ts fix(chat): revive the turn file-change summary's dead file rows (#148) 2026-07-29 16:01:35 +08:00
turn-injection-boundary.test.ts fix(chat): keep a Skill tool call inside the turn's activity fold (#146) 2026-07-29 13:18:11 +08:00
turn-logic.test.ts fix(chat): concatenate stream-chunk text parts on history reload (#145) 2026-07-29 13:36:31 +08:00
turns-projector.test.ts perf(renderer): eliminate streaming re-render amplification and session-switch scroll flash (#112) 2026-07-27 09:52:48 +08:00
useOAuthLoginFlow.test.ts feat: rework first-run onboarding and account settings (#72) 2026-07-22 13:51:05 +08:00
useUpdateStatus.test.ts fix(desktop): make auto-download opt-in a pure preference (#139) 2026-07-28 14:11:49 +08:00
workspace-order.test.ts feat(sidebar): rework archiving with an inline action and undo toast (#164) 2026-07-31 10:50:14 +08:00
workspace-state.test.ts fix(sidebar): backfill session list after archiving a session (#169) 2026-08-01 17:18:32 +08:00
ws-lifecycle.test.ts fix: reconcile session work state after reconnect (#109) 2026-07-29 17:34:02 +08:00