Skip to content

feat(mobile): read artifacts, and open artifacts/… links in chat - #851

Merged
Jacksondr5 merged 4 commits into
j5/mainfrom
j5code/mobile-artifacts
Nov 1, 2026
Merged

Jacksondr5 merged 4 commits into
j5/mainfrom
j5code/mobile-artifacts

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Problem

Mobile had no way to read artifacts, so the plans, specs and persona handoffs agents write couldn't be read from the phone (gap C6). Tapping an artifacts/… link in chat opened it as a workspace file, which isn't there, because artifacts live in the server's state and not the repository (C7).

Closes #833

What changed

  • Shared with web, in packages/client-runtime/src/j5/artifacts.ts: recognising artifacts/… paths, the preview revision, the preview kind (image, HTML, Markdown, text, binary), the image data URL, and the HTTP read (readArtifact, given a prepared connection). Web's artifactPath.ts and artifactPreview.logic.ts and their tests move there, and web's Artifacts page and client now call them, with no change in behaviour.
  • Route registration (reserved seam): Stack.tsx spreads J5's j5ThreadArtifactRoutes, two thread-scoped screens:
    • ThreadArtifacts: the project's artifact list, with size and age.
    • ThreadArtifact: a read-only viewer. Markdown renders with upstream's SelectableMarkdownText. Its artifacts/… links open the viewer, as on web, and its other links resolve from the workspace root. Text renders monospace. Images render through upstream's ThreadMarkdownImageView (SVG included). HTML shows as source, since a phone has no sandboxed frame we trust, as the Captain agreed. Binary shows "No preview". Pull to refresh; no delete. Opening another artifact shows loading, never the previous body; only a refresh of the same artifact keeps its body on screen.
  • Link resolver (reserved seam): in ThreadFeed.tsx, onMarkdownLinkPress makes one call to J5's openArtifactLink before its thread, media and file branches. fileContextMenu and onFileContextMenuAction each make one call first, so long-pressing an artifact link offers Open artifact and Copy path instead of workspace-file actions such as Save, which would find nothing. Links push the viewer, so going from one artifact to another can come back.
  • The list is reached through All artifacts on any opened artifact. There is no new upstream entry point, as agreed with the Captain; Jackson decides at Checkpoint 1 whether to add one (for example, a thread header row). Adding it later is one navigate("ThreadArtifacts", { environmentId, threadId }).
  • Docs: docs/j5/user/artifacts.md gains a short "On mobile" paragraph.

UI changes

Android 16 emulator, 1080×2400, light theme. Both sides use the same isolated test home, where a real Claude Haiku agent wrote the artifacts. Base is 31447c91c6, head is b54fe6fe93. iOS is deferred to Checkpoint 1 on Jackson's iPhone, and no iOS UI has been verified.

Tapping artifacts/plan.md in chat. Before: a missing workspace file. After: the artifact.

Before After
artifacts/plan.md link opened as a missing workspace file, before artifacts/plan.md rendered as Markdown in the artifact viewer, after

The viewer and list are new, so these have no before:

Text HTML as source SVG Versioned handoff
Text artifact in the viewer, after HTML artifact shown as source, after SVG artifact rendered as an image, after Versioned handoff artifact rendered as Markdown, after
All artifacts After the agent rewrote notes Missing artifact Long-press on an artifact link Repo README link
Project artifact list with sizes and ages, after Artifact list after pull to refresh, with notes grown and a new handoff, after Viewer error for an artifact that doesn't exist, after Artifact link menu offering Open artifact and Copy path only, after Repository README link still opening the workspace file viewer, after

Live testing

Android: pass at b54fe6fe93, run by the crew's tester (GPT-6 Astra through Codex) with real Claude Haiku 5.5 agents on an isolated test server. Report: project artifact test-reports/j5code-mobile-wave1b-tester/b54fe6fe93.md.

  • A chat link to artifacts/plan.md opened the viewer with the Markdown rendered.
  • A link inside the plan to artifacts/notes.txt opened that artifact, and Back returned to the plan.
  • Long-pressing an artifact link offered only Open artifact and Copy path, and Open worked.
  • Text, HTML (as source), an SVG, and a versioned handoff all displayed.
  • All artifacts listed sizes and ages, and its rows opened.
  • After a second Haiku turn rewrote notes and added a handoff, pull to refresh showed notes growing from 19 B to 42 B and the new handoffs/mobile.md, and opening notes showed the new text.
  • A missing artifact showed "Couldn't open this artifact".
  • A link to the repo's README still opened the workspace file viewer.

Since that run, the branch was rebased onto trunk (#845, #843, #850, #854) and renumbered to FORK case 98. No code changed, so I didn't re-test.

Not exercised live, and why:

  • An empty project's list. The test project already had artifacts, and the tester didn't delete them.
  • The binary fallback, and permission or disconnection errors.
  • Pasting after Copy path.
  • A deliberately slow load. No frame-by-frame or timing proof is claimed that switching artifacts never flashes the previous body. serverRead.test.ts covers that rule with deferred reads.
  • iOS. Deferred to Checkpoint 1 on Jackson's iPhone: the Captain paused iOS Simulators for the rest of wave 1.

Upstream impact

  • apps/mobile/src/Stack.tsx: one import and one spread (case 98).
  • apps/mobile/src/features/threads/ThreadFeed.tsx: one import and one call in each of the link press, long-press menu and menu action handlers (case 98).
  • apps/web/src/components/ChatMarkdown.tsx: import path only (case 33's text updated).
  • FORK.md: case 98, the Mobile seams table (Route registration and Link resolver landed), and ledger rows. upstreamSeams.test.ts has a row for each.

Checklist

  • One concern: the description has no "also"
  • Tests cover the changed behavior: artifactLinks.test.ts (which chat links open an artifact, the push, the long-press menu and its actions), serverRead.test.ts (a deferred read from artifact A to B shows loading, not A's body; a same-artifact refresh keeps it), artifacts.test.ts (path recognition, preview revision and kind, moved from web plus the kind cases), the seams test; web's artifact unit and browser tests pass (4 + 16)
  • UI changes: Android before/after above; iOS deferred to Checkpoint 1
  • Live testing: Android passed; iOS deferred to Checkpoint 1
  • Upstream-owned files: each one is recorded in FORK.md (case text and file-table row) in this PR
  • Upstream product: no change to what upstream does; both seams were reserved for this
  • Surfaces: chat links and the list on mobile; web keeps its page and chip on the shared helpers; no contract change; reading only, so there is no reverse state to add
  • Docs: user doc updated

Built by Claude Opus 5.5 in J5 Code (Claude Code harness).

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
j5-code Ready Ready Preview Nov 1, 2026 1:46am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 22 billable files and costs up to $5.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 13 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 53 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between d30e293 and 553fe75.

Files selected for processing: 22
  • FORK.md
  • apps/mobile/src/Stack.tsx
  • apps/mobile/src/features/threads/ThreadFeed.tsx
  • apps/mobile/src/j5/artifacts/ThreadArtifactsScreen.tsx
  • apps/mobile/src/j5/artifacts/artifactClient.ts
  • apps/mobile/src/j5/artifacts/artifactLinks.test.ts
  • apps/mobile/src/j5/artifacts/artifactLinks.ts
  • apps/mobile/src/j5/artifacts/routes.ts
  • apps/mobile/src/j5/artifacts/serverRead.test.ts
  • apps/mobile/src/j5/artifacts/serverRead.ts
  • apps/mobile/src/j5/upstreamSeams.test.ts
  • apps/web/src/components/ChatMarkdown.tsx
  • apps/web/src/j5/artifacts/ArtifactsPage.tsx
  • apps/web/src/j5/artifacts/artifactClient.ts
  • apps/web/src/j5/artifacts/artifactPath.test.ts
  • apps/web/src/j5/artifacts/artifactPath.ts
  • apps/web/src/j5/artifacts/artifactPreview.logic.test.ts
  • apps/web/src/j5/artifacts/artifactPreview.logic.ts
  • docs/j5/user/artifacts.md
  • packages/client-runtime/package.json
  • packages/client-runtime/src/j5/artifacts.test.ts
  • packages/client-runtime/src/j5/artifacts.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@Jacksondr5 Jacksondr5 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combined panel review (reviewer-opus + reviewer-sol) at f4f4b5bd1f

Verdict: one small should-fix. The Captain may take it as a tracked follow-up instead of blocking merge. There are also two optional observations that don't block. Still pending: device captures and the tester's verdict.

Should-fix (small): the viewer keeps the previous artifact's body when its route params change (found independently by both of us)

In ThreadArtifactsScreen.tsx:64–68, useServerRead keeps any prior ready value whenever the load key changes. It does this for a change of resource too, not only for a refresh.

Failure scenario: ThreadArtifact is the current route, and something updates its params, for example an incoming artifact deep link. React Navigation emits NAVIGATE, and StackRouter reuses the current route of the same name. The header then shows B's path over A's body until B's read settles. If B's read is slow or fails, the person is reading the wrong artifact under B's name.

Ordinary All artifacts → another artifact navigation pushes a new screen, so it doesn't reproduce there.

Fix: keep the old content only for a refresh of the same resource. Show loading when the environment, project or path changes. A test with a deferred read, going from A to B, would pin it.

Optional, not merge blockers (follow-up candidates)

  1. Chat context menu on an artifacts/… link. "Open file" correctly routes through onMarkdownLinkPress to the viewer. But "Save" (onFileContextMenuAction → shareFileChip) and the other workspace-only actions still treat the link as a repository file, so Save fails. Web hides workspace actions for artifacts (workspaceRelativePath is null in ChatMarkdown case 33). Copying the logical artifacts/… path can still be useful. Either hide the unavailable workspace actions or track a follow-up. This doesn't call for artifact download support.
  2. Links inside a Markdown artifact. The viewer passes threadId={null} to FileMarkdownPreview. That component (FileMarkdownPreview.tsx:198–216) resolves every file link and pushes NewTaskFile, so an artifacts/… link inside an artifact bypasses J5's resolver and opens a missing workspace file. Web's Artifacts page renders through ChatMarkdown, which opens it as an artifact. Handoffs often cross-link plans, so this is worth a follow-up.

Checked and fine

  • Faithful extraction. artifactPreviewKind maps one-to-one onto web's old branches (image first, then html, markdown and text when UTF-8, otherwise binary). artifactDataUrl and readArtifact, which resolves credentials at request time through executeJ5Request, move verbatim. Web's artifact unit and browser tests still pass.
  • Link resolver. The one openArtifactLink call in ThreadFeed.tsx runs after skills and before linked threads, media and file handling, so artifacts/x.png opens the viewer, not a missing workspace image. artifactPathForMarkdownLink handles relative, ./ and absolute workspace-root forms, and rejects src/artifacts/… and external URLs (tested).
  • Route registration. j5ThreadArtifactRoutes sits beside upstream's thread file routes and uses the same linking prefix and header options.
  • Project scope. useThreadSelection reads the route, so the artifact project is the routed thread's, on the routed environment's prepared connection.
  • Scope rulings followed. HTML shows as source (no WebView, per the Captain's ruling) and there's no delete. SVG renders through ThreadMarkdownImageView.
  • Records. FORK.md case 97 lands both reserved seams in the Mobile seams table, with ledger rows and two upstreamSeams.test.ts reaches. Case 33's text is updated for the moved import. docs/j5/user/artifacts.md gets a short "On mobile" note.

Reviewer-run checks

  • mobile src/j5/artifacts and upstreamSeams.test.ts: 27 passed, 2 files
  • client-runtime artifacts.test.ts: 18 passed
  • web src/j5/artifacts: 20 passed, 4 files
  • mobile vp run typecheck: exit 0

Reviewed by Claude Opus 5.5 (reviewer-opus) and Sol 6.1 (reviewer-sol) in J5 Code.

@Jacksondr5 Jacksondr5 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combined panel re-review (reviewer-opus + reviewer-sol) at 81ed39a

Verdict: the should-fix and both optional observations are resolved, with no new findings. The panel approves the source. Still pending: device captures and the tester's verdict.

  • Stale body: serverRead.ts visibleRead compares the resource before keeping a ready body. A same-resource refresh keeps it, any other resource shows loading, and a failed read retries as loading. serverRead.test.ts covers the rule. It also runs the hook with deferred reads: A settles, the route moves to B and shows loading, B settles, and a refresh keeps B's body while re-reading. List rows and every artifact link now StackActions.push, so the viewer route isn't reused for another artifact and Back returns to the previous one.
  • (1) Chat long-press: an artifacts/… link offers only "Open artifact" and "Copy path" (artifacts/<path>), with no workspace-file actions. The two calls are on the existing ThreadFeed.tsx seam, ahead of the skill and file branches (tested in artifactLinks.test.ts).
  • (2) Links inside an artifact: the viewer renders its own SelectableMarkdownText. Its artifacts/… links and long-press menu go through the same J5 helpers. Other workspace links open ThreadFile with the thread, and external links open in the browser. No new upstream edit was needed.
  • Records: FORK.md case 97 and three upstreamSeams.test.ts reaches cover the new ThreadFeed.tsx calls.

Reviewer-run checks

  • mobile src/j5/artifacts and upstreamSeams.test.ts: 35 passed, 3 files (both reviewers)
  • mobile vp run typecheck: exit 0
  • lint: no errors

Reviewed by Claude Opus 5.5 (reviewer-opus) and Sol 6.1 (reviewer-sol) in J5 Code.

@github-actions github-actions Bot added size:XL 500-999 effective changed lines (test files excluded in mixed PRs). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Nov 1, 2026
@Jacksondr5
Jacksondr5 force-pushed the j5code/mobile-artifacts branch from 81ed39a to b54fe6f Compare November 1, 2026 01:12
Jacksondr5 and others added 4 commits October 31, 2026 21:44
Mobile had no way to read the plans, specs and handoffs agents write, and an
`artifacts/…` link in chat opened as a workspace file that isn't there.

Two thread-scoped J5 screens land through the reserved Route registration
seam: the project's artifact list and a read-only viewer (Markdown, text,
images; HTML as source; no delete). The reserved Link resolver seam sends
`artifacts/…` links to the viewer. Web's artifact path, preview-kind and HTTP
read move to client-runtime so both clients share them.

Closes #833

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rtifact never shows the old body

A viewer reused for another artifact kept showing the previous body until the
new read landed; only a refresh of the same artifact keeps its body now, and
links push the viewer instead of reusing it. Long-pressing an artifact link
offers Open artifact and Copy path, not workspace-file actions that find
nothing, and links inside a Markdown artifact open as artifacts, as on web.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jacksondr5
Jacksondr5 force-pushed the j5code/mobile-artifacts branch from b54fe6f to 553fe75 Compare November 1, 2026 01:45
@Jacksondr5
Jacksondr5 merged commit f5822cd into j5/main Nov 1, 2026
33 checks passed
@Jacksondr5
Jacksondr5 deleted the j5code/mobile-artifacts branch November 1, 2026 02:02

This branch was successfully deployed

1 active deployment
Preview — 553fe75a Deployed Nov 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 effective changed lines (test files excluded in mixed PRs). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mobile: read artifacts, and open artifacts/… links in chat

1 participant