Skip to content

feat: add LoadArtifact + PatchArtifact tools, fix field mapping bugs (FC-2, FC-3) - #36

Merged
dahai80 merged 1 commit into
mainfrom
feat/fc2-fc3-artifact-tools
Aug 3, 2026
Merged

dahai80 merged 1 commit into
mainfrom
feat/fc2-fc3-artifact-tools

Conversation

@dahai80

@dahai80 dahai80 commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

Implements Phase 2 of artifact enhancement (#32 → #35), now that upstream fusion-artifacts-engine v0.3.0 provides artifact.patch and artifact.get_content RPCs.

New Tools

  • LoadArtifactTool (FC-2): Load artifact content by ID + optional version via artifact.get_content RPC. Preview truncation at 2000 chars.
  • PatchArtifactTool (FC-3): Incremental section-level edits via artifact.patch RPC. 4 operations (replace_section/append/prepend/delete_section), anchor matching, optimistic lock.

Bug Fixes

  • ArtifactCreateTool: Fixed field mapping — result.id → result.artifact.id, result.version → result.version.version_num
  • ArtifactUpdateTool: Fixed field mapping — result.id → result.version.artifact_id, result.version → result.version.version_num

Refactor

  • Extracted shared artifactsRPC helper to src/tools/shared/artifactsRPC.ts

Registration

  • Added LoadArtifact + PatchArtifact to getAllBaseTools() and FULL_TOOLS set

Upstream Dependencies

  • fusion-artifacts-engine ≥ v0.3.0 (artifact.patch + artifact.get_content)

Closes #35

🤖 Generated with Claude Code

…(FC-2, FC-3)

- FC-2: LoadArtifactTool calls artifact.get_content RPC
  - Load artifact content by ID with optional version
  - Preview truncation at 2000 chars in tool result
- FC-3: PatchArtifactTool calls artifact.patch RPC
  - 4 operations: replace_section, append, prepend, delete_section
  - Anchor matching for markdown headings and code functions
  - Optimistic lock via expected_version
- Fix: ArtifactCreateTool field mapping (result.id → result.artifact.id)
- Fix: ArtifactUpdateTool field mapping (result.version → result.version.version_num)
- Extract shared artifactsRPC helper from duplicate implementations
- Register LoadArtifact + PatchArtifact in tools.ts + FULL_TOOLS set
- Update ArtifactCreateTool/UpdateArtifact prompts to reference new tools

Upstream dependency: fusion-artifacts-engine v0.3.0 (artifact.patch + artifact.get_content)

Co-Authored-By: Claude <[email protected]>
@dahai80
dahai80 merged commit a46e84d into main Aug 3, 2026
1 check passed
@dahai80
dahai80 deleted the feat/fc2-fc3-artifact-tools branch August 3, 2026 08:14
dahai80 added a commit that referenced this pull request Aug 29, 2026
….1.1 slice #36) (#209)

REPL.tsx agent-transcript disk-load bootstrap useEffect body (26 LOC,
PURE-ASYNC-HELPER class, 2nd — like slice #23 onInit / #31 initialMessage)
extracted to src/screens/agentTranscriptBootstrap.ts
applyAgentTranscriptBootstrap(ctx). 3 closure deps (viewingAgentTaskId,
needsBootstrap, setAppState); guard stays in REPL thin shell. 2 now-dead
imports removed from REPL (getAgentTranscript sole-user, asAgentId
sole-user; isLocalAgentTask kept — 2 residual uses). Byte-identical
behavior; gates 0/921/new-file-clean/build:dev.

Co-authored-by: Claude Fable 5 <[email protected]>
dahai80 added a commit that referenced this pull request Aug 29, 2026
… slice #37) (#210)

Transcript  key (less-style open-in-$EDITOR) render block extracted
from REPL.tsx useInput v-branch to applyEditorOpenInExternalEditor in
editorStatusRender.ts. PURE-ASYNC-HELPER class (3rd, like slice #23
onInit / #31 processInitialMessage / #36 agentTranscriptBootstrap).

ctx carries 3 refs (gen/timer/rendering) + setEditorStatus +
deferredMessages + tools (closure deps). Imported helpers
(renderMessagesToPlainText/openFileInExternalEditor/writeFile/join/tmpdir)
imported directly in new file, not via ctx. double-tap-drop guard +
gen-capture + staleness-aware setStatus stay in helper (ref-mutate,
not useInput deps). event.stopImmediatePropagation stays REPL thin shell
(input-event concern). No JSX, no hooks.

REPL 5660 -> 5614 (-46). 5 sole-user imports removed (writeFile, tmpdir,
join, openFileInExternalEditor, renderMessagesToPlainText); dirname kept
(multi-use). Byte-identical behavior.

Gates: typecheck 0 / 921 tests / biome new-file-formatted (3 node-protocol
infos match repo convention, like slice #33) / build:dev green.

Co-authored-by: Claude Fable 5 <[email protected]>
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.

feat: artifact incremental tools Phase 2 (FC-2 LoadArtifact, FC-3 PatchArtifact)

1 participant