omp-auto-loop 0.2.2 → 0.2.3
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/index.ts +3 -8
- package/package.json +1 -1
- package/state.ts +1 -3
- package/tool.ts +9 -2
- package/test-run.ts +0 -2
package/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ExtensionAPI, ExtensionContext } from "@oh-my-pi/pi-coding-agent";
|
|
2
2
|
import { buildPrompt, emptyState, getSystemPromptAddition, type LoopState, updateWidget } from "./state.ts";
|
|
3
|
+
|
|
3
4
|
import { getLoopControlToolDefinition, handleLoopControlTool, renderLoopControlCall, renderLoopControlResult } from "./tool.ts";
|
|
4
5
|
|
|
5
6
|
export default function (pi: ExtensionAPI) {
|
|
@@ -84,14 +85,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
84
85
|
updateWidget(state, ctx);
|
|
85
86
|
return { content: result.content, details: result.details };
|
|
86
87
|
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
const stopLoop = (ctx: ExtensionContext, reason: string) => {
|
|
92
|
-
if (!state.active) {
|
|
93
|
-
ctx.ui.notify("No active loop", "info");
|
|
94
|
-
return;
|
|
88
|
+
renderCall: renderLoopControlCall as any,
|
|
89
|
+
renderResult: renderLoopControlResult as any,
|
|
95
90
|
}
|
|
96
91
|
state.active = false;
|
|
97
92
|
state.done = true;
|
package/package.json
CHANGED
package/state.ts
CHANGED
|
@@ -25,15 +25,13 @@ export function buildPrompt(state: LoopState): string {
|
|
|
25
25
|
|
|
26
26
|
export function updateWidget(state: LoopState, ctx: ExtensionContext) {
|
|
27
27
|
if (!state.active) {
|
|
28
|
-
ctx.ui.setStatus("loop", undefined);
|
|
29
28
|
ctx.ui.setWidget("loop", undefined);
|
|
30
29
|
return;
|
|
31
30
|
}
|
|
32
31
|
const label = `iteration ${state.currentStep + 1}`;
|
|
33
|
-
ctx.ui.setStatus("loop", `🔄 ${label}`);
|
|
34
32
|
ctx.ui.setWidget("loop", [
|
|
35
33
|
`┌─ Loop ──────────`,
|
|
36
|
-
`│ ${label}`,
|
|
34
|
+
`│ 🔄 ${label}`,
|
|
37
35
|
`└─ Ctrl+Shift+X to stop ─`,
|
|
38
36
|
]);
|
|
39
37
|
}
|
package/tool.ts
CHANGED
|
@@ -57,8 +57,15 @@ export function getLoopControlToolDefinition() {
|
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
export function renderLoopControlCall(args: { status: string }, theme: any) {
|
|
61
|
-
|
|
60
|
+
export function renderLoopControlCall(args: { status: string; summary?: string; reason?: string }, theme: any) {
|
|
61
|
+
let text = theme.fg("toolTitle", theme.bold("loop_control ")) + theme.fg(args.status === "done" ? "success" : "accent", args.status);
|
|
62
|
+
if (args.summary) {
|
|
63
|
+
text += `\n${theme.dim("Summary: ")}${args.summary}`;
|
|
64
|
+
}
|
|
65
|
+
if (args.reason) {
|
|
66
|
+
text += `\n${theme.dim("Reason: ")}${args.reason}`;
|
|
67
|
+
}
|
|
68
|
+
return new Text(text, 0, 0);
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
export function renderLoopControlResult(result: { details?: LoopState }, _opts: unknown, theme: any) {
|
package/test-run.ts
DELETED