MCPcopy
hub / github.com/thesysdev/openui / registerMutations

Function registerMutations

packages/lang-core/src/runtime/queryManager.ts:443–469  ·  view source on GitHub ↗
(nodes: MutationNode[])

Source from the content-addressed store, hash-verified

441 // ── Mutation methods ─────────────────────────────────────────────────────
442
443 function registerMutations(nodes: MutationNode[]) {
444 const activeIds = new Set(nodes.map((n) => n.statementId));
445
446 // Clean up removed mutations
447 for (const sid of mutations.keys()) {
448 if (!activeIds.has(sid)) mutations.delete(sid);
449 }
450
451 // Register/update active mutations
452 for (const node of nodes) {
453 const existing = mutations.get(node.statementId);
454 if (existing) {
455 if (existing.toolName !== node.toolName) {
456 existing.toolName = node.toolName;
457 existing.result = { status: "idle", data: null, error: null };
458 existing.error = undefined;
459 }
460 } else {
461 mutations.set(node.statementId, {
462 toolName: node.toolName,
463 result: { status: "idle" },
464 });
465 }
466 }
467
468 if (rebuildSnapshot()) notify();
469 }
470
471 async function fireMutation(
472 statementId: string,

Callers

nothing calls this directly

Calls 5

hasMethod · 0.80
rebuildSnapshotFunction · 0.70
notifyFunction · 0.70
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected