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

Function renderMakaPiPendingQueue

packages/cli/src/pi-transcript.ts:1409–1441  ·  view source on GitHub ↗
(state: MakaPiTranscriptState, width: number)

Source from the content-addressed store, hash-verified

1407 * Renders nothing when both queues are empty.
1408 */
1409export function renderMakaPiPendingQueue(state: MakaPiTranscriptState, width: number): string[] {
1410 if (
1411 state.steering.length === 0 &&
1412 state.followup.length === 0 &&
1413 state.pendingFallback.length === 0
1414 ) {
1415 return [];
1416 }
1417 const safeWidth = Math.max(1, width);
1418 const steering = [
1419 ...state.steering,
1420 ...state.pendingFallback
1421 .filter((entry) => entry.enqueue === 'steer')
1422 .map((entry) => entry.text),
1423 ];
1424 const followup = [
1425 ...state.followup,
1426 ...state.pendingFallback
1427 .filter((entry) => entry.enqueue === 'queue')
1428 .map((entry) => entry.text),
1429 ];
1430 const lines: string[] = [];
1431 for (const text of steering) {
1432 lines.push(
1433 fitLine(`${ansi.accent('Steering:')} ${ansi.dim(firstLinePreview(text))}`, safeWidth),
1434 );
1435 }
1436 for (const text of followup) {
1437 lines.push(fitLine(`${ansi.dim('Queued:')} ${ansi.dim(firstLinePreview(text))}`, safeWidth));
1438 }
1439 lines.push(fitLine(ansi.dim('alt+↑ 取回队列以重新编辑'), safeWidth));
1440 return lines;
1441}
1442
1443/** First non-empty line of a queued message, trimmed for a one-line preview. */
1444function firstLinePreview(text: string): string {

Callers 1

renderMethod · 0.85

Calls 3

fitLineFunction · 0.85
firstLinePreviewFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected