feat(web): render tool evidence and preview session artifacts - #496
feat(web): render tool evidence and preview session artifacts#496SSK988I wants to merge 6 commits into
Conversation
tt-a1i
left a comment
There was a problem hiding this comment.
Reviewed at exact head 3a81319.
Standards
[P1] The Web-only write wrapper silently adds read authority to every permitted write. It opens pre/post snapshots with O_RDONLY and persists up to 32 KiB of the old content in details.diff, without passing those reads through Pi’s read tool or permission/trust hooks. A policy may allow overwriting a path while denying disclosure of its contents. Please obtain evidence from a Pi-owned authorized mutation primitive, require explicit read admission, or omit the pre-image when read authority is unavailable.
[P2] Every visible preview polls every two seconds and rereads, allocates, and hashes the full artifact (up to 20 MiB), indefinitely. Concurrency is bounded but cumulative I/O is not. Poll bounded metadata/revision identity and fetch bytes only after a change or explicit refresh/backoff boundary.
Spec
[P1] Windows absolute Markdown artifact links never reach the new resolver. rehypeSanitize removes C: / C:/ hrefs before the custom local-link component runs. Exact-head SSR rendered both C:\\work\\repo\\report.md and C:/work/repo/report.md without an artifact button, violating the issue’s explicit absolute-path acceptance. Add a component/browser regression that safely preserves Windows local paths without enabling arbitrary URL schemes.
[P2] Successful foreground terminal/test evidence projects state: returned but processState: unknown, so the UI reports “Process: unknown · exit code unavailable” even for canonical success. Project completed/returned without inventing exit code 0.
Problem
Closes #345. Tool output is difficult to review as generic text, and local artifact links cannot use ordinary Web navigation to reach authenticated files. Includes the controlled artifact access and revision-following slice requested in the maintainer's comments:
Value
Users can inspect file contents, additions/deletions, test observations and terminal receipts, then open/download a generated report and see its next version after modification. Presentation stays tied to observed tool results rather than a success label.
Approach
Validation
Final merged revision:
943d13d(includes main0d17f45). Validation is not fully green:bun run check: passes in a clean LF export of the final commit. The Windows working checkout fails format checking on existing CRLF files; no repository-wide line-ending rewrite was made..spec.tsfiles through the repository's Vitest runner: 10 files / 132 tests passed after the merge.bun run test:web:e2e: 11 passed / 1 failed after the merge. The new artifact scenario passes, using real Pi read/write/edit operations and the real Host with fixture model responses. The failing upstream workspace-selection test computesworkspaceNamewithcanonicalWorkspace.split("/"), leaving a full backslash-separated Windows path and timing out finding the menu item (tests/web/openpi-web.e2e.ts:805-816). It is unchanged by this PR. Before the upstream merge, all 10 browser tests passed.bun run test: latest parallel Node phase 1370 passed / 2 failed / 9 skipped, then the runner stopped before the serial/frontend phases. Failures were the existing setup integration child-process timeout and detached-workflow settlement timeout. Both files passed isolated earlier. An earlier full run also hung after background-terminal manager assertions completed; owned test processes were stopped and remaining tests run separately. No claim of a complete passing full-suite run.git diff --check: passed.Impact
writeimplementation adds bounded result details; its ordinary textual response is preserved.