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

Function toggleAllThinkingExpansion

packages/cli/src/pi-transcript.ts:458–476  ·  view source on GitHub ↗
(state: MakaPiTranscriptState)

Source from the content-addressed store, hash-verified

456 * toggleAllToolExpansion (#1134).
457 */
458export function toggleAllThinkingExpansion(state: MakaPiTranscriptState): boolean {
459 if (togglesInert(state)) return false;
460 const candidates = state.entries.filter(
461 (entry): entry is MakaPiThinkingEntry =>
462 entry.kind === 'thinking' && Boolean(entry.text.trim()),
463 );
464 if (candidates.length === 0) return false;
465 state.expandAllThinking = !state.expandAllThinking;
466 const targets = candidates.filter((entry) => entryInLiveViewport(state, entry));
467 for (const entry of targets) entry.expanded = state.expandAllThinking;
468 if (targets.length === 0) {
469 state.entries.push({
470 kind: 'notice',
471 level: 'info',
472 text: `No thinking in view to toggle — thinking above stays as rendered in scrollback. New thinking starts ${state.expandAllThinking ? 'expanded' : 'collapsed'}.`,
473 });
474 }
475 return true;
476}
477
478export async function submitCompactToTranscript(input: {
479 state: MakaPiTranscriptState;

Callers 2

runMakaPiTuiFunction · 0.85

Calls 4

togglesInertFunction · 0.85
entryInLiveViewportFunction · 0.85
pushMethod · 0.65
trimMethod · 0.45

Tested by

no test coverage detected