Use @extrachill/chat canonical diff parser, delete local fork#7
Merged
Conversation
The editor carried a parallel `src/diff/canonicalDiff.ts` with its own CanonicalDiffType / CanonicalDiffStatus / CanonicalDiffItem / CanonicalDiffData types and its own parseCanonicalDiffFromJson. That duplication existed because the upstream parser only recognized `container.diff` as a nesting layer, while Data Machine's unified PendingActionHelper::stage() envelope nests under `preview`. @extrachill/chat v0.11.0 landed three relevant changes: - #21: adds `actionId` as the canonical field on CanonicalDiffData (alongside the deprecated `diffId` alias). The editor already spoke `actionId` so no vocabulary change was needed here, but the type on the upstream package was missing it until 0.11. - #22: forwards onToolCalls + sessionContext from <Chat> to useChat (not used by this file directly, but relevant for other editor work). - #23: parseCanonicalDiff now recognizes `container.preview` and `container.preview_data` as nesting keys, which is exactly the shape our local fork existed to handle. With 0.11 in place, the local fork is redundant. Migration: - src/types.ts: import CanonicalDiffData / CanonicalDiffType from '@extrachill/chat' instead of './diff/canonicalDiff'. - src/sidebar/EditorChatSidebar.tsx: add parseCanonicalDiffFromJson to the existing @extrachill/chat imports, drop the local import. - Delete src/diff/canonicalDiff.ts (92 lines). - Bump @extrachill/chat from ^0.10.1 to ^0.11.0 in package.json. No runtime behaviour change — the upstream parser now handles the same nesting shapes our fork did, and we were already consuming the `actionId` field which v0.11 surfaces on the typed shape.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The editor carried a parallel
src/diff/canonicalDiff.tswith its ownCanonicalDiffType/CanonicalDiffStatus/CanonicalDiffItem/CanonicalDiffDatatypes and its ownparseCanonicalDiffFromJson. That duplication existed because the upstream parser only recognizedcontainer.diffas a nesting layer, while Data Machine's unifiedPendingActionHelper::stage()envelope nests the preview payload undercontainer.preview.@extrachill/chat@0.11.0(just published) lands three relevant changes:actionIdas the canonical field onCanonicalDiffData(alongside a deprecateddiffIdalias). The editor already spokeactionIdso no vocabulary change was needed here, but the type on the upstream package was missing it until 0.11.onToolCalls+sessionContextfrom<Chat>touseChat. Not used by this file directly, but relevant for other editor work.parseCanonicalDiffnow recognizescontainer.previewandcontainer.preview_dataas nesting keys. That's exactly the shape our local fork existed to handle.With 0.11 in place, the local fork is redundant.
Migration
src/types.ts— importCanonicalDiffData/CanonicalDiffTypefrom@extrachill/chatinstead of./diff/canonicalDiff.src/sidebar/EditorChatSidebar.tsx— addparseCanonicalDiffFromJsonto the existing@extrachill/chatimports, drop the local import.src/diff/canonicalDiff.ts(92 lines).@extrachill/chatfrom^0.10.1to^0.11.0inpackage.json.Behaviour
No runtime change. The upstream parser now handles the same nesting shapes our fork did, and we were already consuming the
actionIdfield which v0.11 surfaces on the typed shape.Validation
npm install @extrachill/chat@^0.11.0— resolves to 0.11.0 from the npm registry.npm run typecheck— clean.npm run build— clean.Diff stat
AI assistance