Skip to content

th-66b4c6: create_artifact HTML report tool for Big Smooth#274

Merged
brentrager merged 3 commits into
mainfrom
th-66b4c6-artifact-tool
Jul 26, 2026
Merged

th-66b4c6: create_artifact HTML report tool for Big Smooth#274
brentrager merged 3 commits into
mainfrom
th-66b4c6-artifact-tool

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

Problem

Big Smooth had no way to produce a rich, self-contained HTML report/artifact the way Claude Code Artifacts do — the agent could only write plain files with no clickable "open this" affordance.

Solution

New `create_artifact` agent tool in `smooth-tools`, modeled on `write_file`:

  • Takes `filename` (e.g. `report.html`) + `html` (a complete, self-contained document).
  • Writes into `/.smooth-artifacts/` — path routed through `resolve_workspace_path` and gated by the same `Write` deny policy as `write_file`, so it stays inside the workspace sandbox.
  • Forces a `.html` extension and strips directory components from the filename.
  • Returns the absolute path and a clickable `file://` URL in the tool result.
  • Exported as `ArtifactTool` and added to `default_tools_with_proxy`, so every host — including the daemon — gets it automatically.

Tests

Colocated `#[cfg(test)]`: writes-and-round-trips (asserts path + `file://` URL in result), `.html` extension appended when missing, directory components stripped. `cargo test -p smooai-smooth-tools` → 112 passed. Clippy clean on new code.

Follow-up

Rendering the artifact inline in smooth-web (clickable card / iframe preview in the chat UI) is intentionally out of scope here — this PR is just the tool + link. Follow-up pearl to wire the web render.

🤖 Generated with Claude Code

Big Smooth's answer to Claude Code Artifacts: a new create_artifact agent
tool that writes a self-contained HTML document into
<workspace>/.smooth-artifacts/ and returns the absolute path plus a clickable
file:// URL. Same workspace confinement + Write deny gate as write_file.
Registered in the default tool set so every host (incl. the daemon) gets it.

Inline rendering in smooth-web is a follow-up.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: eff35fd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@smooai/smooth Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brentrager
brentrager enabled auto-merge (squash) July 26, 2026 17:29
brentrager and others added 2 commits July 26, 2026 13:30
…est paths

Windows CI caught two things: (1) the test built its expected path with a
literal "a/b" join, so it compared forward slashes against the backslashes the
tool emits — now nested joins (native on both platforms); (2) a REAL bug — on
Windows `file://C:\dir\a.html` is malformed and won't open. URL rendering moved
into file_url()/file_url_parts(), emitting `file:///C:/dir/a.html` (three
slashes, forward separators) on Windows. Regression test covers both shapes
from any host.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TwUg6nyMqXHzFDsibzTKmp
@brentrager
brentrager merged commit 4d7ce2f into main Jul 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant