[feat] Add node replacement store and types (#8364)

## Summary
Add infrastructure for automatic node replacement feature that allows
missing/deprecated nodes to be replaced with their newer equivalents.

## Changes
- **Types**: `NodeReplacement`, `NodeReplacementResponse` types matching
backend API spec (PR #12014)
- **Service**: `fetchNodeReplacements()` API wrapper
- **Store**: `useNodeReplacementStore` with `getReplacementFor()`,
`hasReplacement()`, `isEnabled()`
- **Setting**: `Comfy.NodeReplacement.Enabled` toggle (experimental)
- **Tests**: 11 unit tests covering store functionality

## Related
- Backend PR: Comfy-Org/ComfyUI#12014

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-8364-feat-Add-node-replacement-store-and-types-2f66d73d3650816bb771c9cc6a8e1774)
by [Unito](https://www.unito.io)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Automatic node replacement is now available, allowing missing nodes to
be replaced with their newer equivalents when replacement mappings
exist.
* Added "Enable automatic node replacement" experimental setting in
Workflow preferences (enabled by default).
  * Replacement data is loaded during app initialization.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Jin Yi
2026-02-03 14:15:05 +09:00
committed by GitHub
parent cc10684c19
commit 5847071bc1
7 changed files with 342 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import type { NodeReplacementResponse } from './types'
import { api } from '@/scripts/api'
export async function fetchNodeReplacements(): Promise<NodeReplacementResponse> {
const response = await api.fetchApi('/node_replacements')
if (!response.ok) {
throw new Error(
`Failed to fetch node replacements: ${response.status} ${response.statusText}`
)
}
return response.json()
}