@underactive/pi-topping-moa-fusion 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/README.md +437 -0
- package/agents/mf-plan.md +43 -0
- package/agents/moa-debater.md +37 -0
- package/agents/moa-explore.md +56 -0
- package/agents/moa-opinion.md +29 -0
- package/agents/moa-proposer.md +49 -0
- package/agents/moa-synthesizer.md +124 -0
- package/agents/moa-verifier.md +67 -0
- package/index.ts +3 -0
- package/package.json +61 -0
- package/src/activityMeter.ts +193 -0
- package/src/agents/authoritative.ts +91 -0
- package/src/agents/defaults.ts +123 -0
- package/src/agents/discovery.ts +119 -0
- package/src/config/modelCatalogue.ts +54 -0
- package/src/config/planName.ts +74 -0
- package/src/config/rosters.ts +118 -0
- package/src/config/settings.ts +161 -0
- package/src/debate/debateContract.ts +89 -0
- package/src/debate/debateFanout.ts +285 -0
- package/src/debate/debateFile.ts +38 -0
- package/src/debate/debateResults.ts +115 -0
- package/src/debate/debateRounds.ts +61 -0
- package/src/debate/runDebate.ts +143 -0
- package/src/index.ts +283 -0
- package/src/moa/conflictContract.ts +49 -0
- package/src/moa/conflicts.ts +153 -0
- package/src/moa/contextContract.ts +52 -0
- package/src/moa/fanout.ts +152 -0
- package/src/moa/fanoutWiring.ts +88 -0
- package/src/moa/implementationRetry.ts +292 -0
- package/src/moa/modelRuntime.ts +87 -0
- package/src/moa/orchestration.ts +105 -0
- package/src/moa/planInfo.ts +57 -0
- package/src/moa/planlessRetry.ts +72 -0
- package/src/moa/reviewLoop.ts +170 -0
- package/src/moa/runContext.ts +118 -0
- package/src/moa/synthesis.ts +420 -0
- package/src/moa/verdicts.ts +81 -0
- package/src/moa/verification.ts +791 -0
- package/src/moa/verificationCriteria.ts +127 -0
- package/src/moa/verifyGate.ts +137 -0
- package/src/opinion/opinionContract.ts +21 -0
- package/src/opinion/opinionFanout.ts +135 -0
- package/src/opinion/opinionFile.ts +38 -0
- package/src/opinion/opinionResults.ts +73 -0
- package/src/opinion/runOpinion.ts +156 -0
- package/src/planning/askUserQuestion.ts +83 -0
- package/src/planning/instructions.ts +146 -0
- package/src/planning/modeState.ts +61 -0
- package/src/planning/planFile.ts +273 -0
- package/src/planning/planMode.ts +673 -0
- package/src/planning/tools/enterPlanMode.ts +165 -0
- package/src/planning/tools/exitPlanMode.ts +159 -0
- package/src/planning/tools/mfPlanSubagent.ts +311 -0
- package/src/planning/tools/shared.ts +19 -0
- package/src/planning/tools/writePlan.ts +33 -0
- package/src/runtime/activityTracking.ts +141 -0
- package/src/runtime/cancelRun.ts +134 -0
- package/src/runtime/mutationTripwire.ts +251 -0
- package/src/runtime/processPool.ts +55 -0
- package/src/runtime/results.ts +103 -0
- package/src/runtime/runner.ts +538 -0
- package/src/runtime/wire.ts +177 -0
- package/src/shared/functionKeys.ts +30 -0
- package/src/shared/modelRefs.ts +91 -0
- package/src/ui/agentStatus.ts +84 -0
- package/src/ui/agentTranscript.ts +112 -0
- package/src/ui/cancelOverlay.ts +191 -0
- package/src/ui/chrome.ts +151 -0
- package/src/ui/conflictOverlay.ts +363 -0
- package/src/ui/debateModelPicker.ts +273 -0
- package/src/ui/menu.ts +679 -0
- package/src/ui/moaModelPicker.ts +900 -0
- package/src/ui/moaProgressWidget.ts +910 -0
- package/src/ui/moaSetupOverlay.ts +368 -0
- package/src/ui/modelLabel.ts +61 -0
- package/src/ui/observeOverlay.ts +206 -0
- package/src/ui/opinionModelPicker.ts +246 -0
- package/src/ui/planReviewOverlay.ts +315 -0
- package/src/ui/promptEditor.ts +87 -0
- package/src/ui/rosterEditor.ts +310 -0
- package/src/ui/shimmer.ts +77 -0
- package/src/ui/toolActivity.ts +35 -0
- package/src/ui/twoPaneModelThinking.ts +272 -0
- package/src/ui/verificationFindingsOverlay.ts +137 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { ExtensionContext, KeybindingsManager, Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { getMarkdownTheme, keyHint } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import { Markdown, type Component, type TUI } from "@earendil-works/pi-tui";
|
|
4
|
+
import { ROUNDED_SINGLE_BOX, createFrame, ratioViewport, safeRenderWidth } from "./chrome.ts";
|
|
5
|
+
|
|
6
|
+
const OVERLAY_HEIGHT_RATIO = 0.9;
|
|
7
|
+
const OVERLAY_MARGIN = 1;
|
|
8
|
+
/** Fixed chrome: top border, title, separator, separator, help row, bottom border. */
|
|
9
|
+
const CHROME_LINES = 6;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Show the complete verifier report in a read-only, scrollable overlay. This is
|
|
13
|
+
* a non-terminal step in the post-verification decision: closing it returns to
|
|
14
|
+
* the same repair/accept choices. Outside TUI mode there is no overlay surface,
|
|
15
|
+
* so it returns immediately rather than opening a view-and-return loop the user
|
|
16
|
+
* cannot actually see.
|
|
17
|
+
*/
|
|
18
|
+
export async function showVerificationFindings(ctx: ExtensionContext, findingsMarkdown: string): Promise<void> {
|
|
19
|
+
if (ctx.mode !== "tui") return;
|
|
20
|
+
await ctx.ui.custom<void>(
|
|
21
|
+
(tui, theme, keybindings, done) => new VerificationFindingsOverlay(tui, theme, keybindings, findingsMarkdown, done),
|
|
22
|
+
{
|
|
23
|
+
overlay: true,
|
|
24
|
+
overlayOptions: {
|
|
25
|
+
anchor: "center",
|
|
26
|
+
width: "90%",
|
|
27
|
+
minWidth: 60,
|
|
28
|
+
maxHeight: "90%",
|
|
29
|
+
margin: OVERLAY_MARGIN,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
class VerificationFindingsOverlay implements Component {
|
|
36
|
+
private readonly tui: TUI;
|
|
37
|
+
private readonly theme: Theme;
|
|
38
|
+
private readonly keybindings: KeybindingsManager;
|
|
39
|
+
private readonly markdown: Markdown;
|
|
40
|
+
private readonly done: (value: void) => void;
|
|
41
|
+
private scrollOffset = 0;
|
|
42
|
+
|
|
43
|
+
constructor(
|
|
44
|
+
tui: TUI,
|
|
45
|
+
theme: Theme,
|
|
46
|
+
keybindings: KeybindingsManager,
|
|
47
|
+
findingsMarkdown: string,
|
|
48
|
+
done: (value: void) => void,
|
|
49
|
+
) {
|
|
50
|
+
this.tui = tui;
|
|
51
|
+
this.theme = theme;
|
|
52
|
+
this.keybindings = keybindings;
|
|
53
|
+
this.done = done;
|
|
54
|
+
this.markdown = new Markdown(findingsMarkdown, 0, 0, getMarkdownTheme());
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private viewportLines(): number {
|
|
58
|
+
return ratioViewport(process.stdout.rows, {
|
|
59
|
+
fallbackRows: 24,
|
|
60
|
+
ratio: OVERLAY_HEIGHT_RATIO,
|
|
61
|
+
minimum: 6,
|
|
62
|
+
margin: OVERLAY_MARGIN,
|
|
63
|
+
chromeRows: CHROME_LINES,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
handleInput(data: string): void {
|
|
68
|
+
const keys = this.keybindings;
|
|
69
|
+
if (keys.matches(data, "tui.select.cancel")) {
|
|
70
|
+
this.done(undefined);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let delta = 0;
|
|
75
|
+
if (keys.matches(data, "tui.select.down")) delta = 1;
|
|
76
|
+
else if (keys.matches(data, "tui.select.up")) delta = -1;
|
|
77
|
+
else if (keys.matches(data, "tui.select.pageDown")) delta = this.viewportLines() - 2;
|
|
78
|
+
else if (keys.matches(data, "tui.select.pageUp")) delta = -(this.viewportLines() - 2);
|
|
79
|
+
else if (keys.matches(data, "tui.altScreen.top")) this.scrollOffset = 0;
|
|
80
|
+
else if (keys.matches(data, "tui.altScreen.bottom")) this.scrollOffset = Number.MAX_SAFE_INTEGER;
|
|
81
|
+
else return;
|
|
82
|
+
|
|
83
|
+
this.scrollOffset += delta;
|
|
84
|
+
this.tui.requestRender();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
render(width: number): string[] {
|
|
88
|
+
// Overlay re-renders can briefly receive a bogus width while handling input.
|
|
89
|
+
// Never pass an unbounded value to Markdown.render(), which pads via String.repeat().
|
|
90
|
+
const terminalWidth = Math.max(20, process.stdout.columns ?? 80);
|
|
91
|
+
const safeWidth = safeRenderWidth(width, terminalWidth);
|
|
92
|
+
const innerWidth = Math.max(20, safeWidth - 4);
|
|
93
|
+
const frame = createFrame(this.theme, innerWidth, {
|
|
94
|
+
glyphs: ROUNDED_SINGLE_BOX,
|
|
95
|
+
horizontalPadding: 1,
|
|
96
|
+
truncationMark: "…",
|
|
97
|
+
padToWidth: true,
|
|
98
|
+
minimumBodyWidth: 10,
|
|
99
|
+
});
|
|
100
|
+
const bodyWidth = frame.bodyWidth;
|
|
101
|
+
const rendered = this.markdown.render(bodyWidth);
|
|
102
|
+
const viewport = Math.min(this.viewportLines(), Math.max(6, rendered.length));
|
|
103
|
+
const maxOffset = Math.max(0, rendered.length - viewport);
|
|
104
|
+
this.scrollOffset = Math.max(0, Math.min(this.scrollOffset, maxOffset));
|
|
105
|
+
|
|
106
|
+
const visible = rendered.slice(this.scrollOffset, this.scrollOffset + viewport);
|
|
107
|
+
while (visible.length < viewport) visible.push("");
|
|
108
|
+
|
|
109
|
+
const th = this.theme;
|
|
110
|
+
const position = rendered.length > viewport
|
|
111
|
+
? ` lines ${this.scrollOffset + 1}-${Math.min(this.scrollOffset + viewport, rendered.length)}/${rendered.length}`
|
|
112
|
+
: ` ${rendered.length} lines`;
|
|
113
|
+
// Help reflects the user's configured keybindings, not fixed labels.
|
|
114
|
+
const help = [
|
|
115
|
+
keyHint("tui.select.up", "scroll"),
|
|
116
|
+
keyHint("tui.select.pageDown", "page"),
|
|
117
|
+
keyHint("tui.altScreen.top", "top"),
|
|
118
|
+
keyHint("tui.altScreen.bottom", "bottom"),
|
|
119
|
+
keyHint("tui.select.cancel", "close"),
|
|
120
|
+
].join(" · ");
|
|
121
|
+
return [
|
|
122
|
+
frame.top(),
|
|
123
|
+
frame.row(th.fg("accent", "Verification findings") + th.fg("dim", position)),
|
|
124
|
+
frame.separator(),
|
|
125
|
+
...visible.map((line) => frame.row(line)),
|
|
126
|
+
frame.separator(),
|
|
127
|
+
frame.row(th.fg("dim", help)),
|
|
128
|
+
frame.bottom(),
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
invalidate(): void {
|
|
133
|
+
this.markdown.invalidate();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
dispose(): void {}
|
|
137
|
+
}
|