MCPcopy Create free account
hub / github.com/apache/maka / applyViewUpdate

Function applyViewUpdate

packages/cli/src/shell-run-hydration.ts:30–51  ·  view source on GitHub ↗
(
    candidate: ShellRunUpdate,
    options?: { announceSettle?: boolean },
  )

Source from the content-addressed store, hash-verified

28 const pendingUpdates = new ShellRunUpdateBuffer('cli.pi-tui-hydration-buffer');
29
30 const applyViewUpdate = (
31 candidate: ShellRunUpdate,
32 options?: { announceSettle?: boolean },
33 ): boolean => {
34 const index = ownerMappings.findIndex(
35 (update) =>
36 update.sessionId === candidate.sessionId &&
37 update.sourceToolCallId === candidate.sourceToolCallId,
38 );
39 const merged = mergeShellRunUpdate(
40 index >= 0 ? ownerMappings[index] : undefined,
41 candidate,
42 'cli.pi-tui-runner',
43 );
44 const retainOwnerMapping =
45 merged.update.ownership.kind === 'source_owned' &&
46 isActiveShellRunStatus(merged.update.result.status);
47 if (index >= 0 && retainOwnerMapping) ownerMappings[index] = merged.update;
48 else if (index >= 0) ownerMappings.splice(index, 1);
49 else if (retainOwnerMapping) ownerMappings.push(merged.update);
50 return input.applyToTranscript(merged.update, options);
51 };
52
53 const replayPendingUpdates = (sessionId: string): boolean => {
54 const buffered = pendingUpdates.drain();

Callers 3

replayPendingUpdatesFunction · 0.85
runHydrationFunction · 0.85

Calls 3

mergeShellRunUpdateFunction · 0.90
isActiveShellRunStatusFunction · 0.90
pushMethod · 0.65

Tested by

no test coverage detected