omp-auto-loop 0.2.1 → 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 +4 -10
- package/package.json +1 -1
- package/state.ts +1 -3
- package/tool.ts +9 -2
- package/omp-auto-loop-0.2.1.tgz +0 -0
package/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ExtensionAPI, ExtensionContext } from "@oh-my-pi/pi-coding-agent";
|
|
2
|
-
import { Key } from "@oh-my-pi/pi-tui";
|
|
3
2
|
import { buildPrompt, emptyState, getSystemPromptAddition, type LoopState, updateWidget } from "./state.ts";
|
|
3
|
+
|
|
4
4
|
import { getLoopControlToolDefinition, handleLoopControlTool, renderLoopControlCall, renderLoopControlResult } from "./tool.ts";
|
|
5
5
|
|
|
6
6
|
export default function (pi: ExtensionAPI) {
|
|
@@ -85,14 +85,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
85
85
|
updateWidget(state, ctx);
|
|
86
86
|
return { content: result.content, details: result.details };
|
|
87
87
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
const stopLoop = (ctx: ExtensionContext, reason: string) => {
|
|
93
|
-
if (!state.active) {
|
|
94
|
-
ctx.ui.notify("No active loop", "info");
|
|
95
|
-
return;
|
|
88
|
+
renderCall: renderLoopControlCall as any,
|
|
89
|
+
renderResult: renderLoopControlResult as any,
|
|
96
90
|
}
|
|
97
91
|
state.active = false;
|
|
98
92
|
state.done = true;
|
|
@@ -106,7 +100,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
106
100
|
handler: async (_args, ctx) => stopLoop(ctx, "Stopped by user"),
|
|
107
101
|
});
|
|
108
102
|
|
|
109
|
-
pi.registerShortcut(
|
|
103
|
+
pi.registerShortcut("ctrl+shift+x", {
|
|
110
104
|
description: "Stop the active loop",
|
|
111
105
|
handler: async (ctx) => {
|
|
112
106
|
stopLoop(ctx, "Stopped by shortcut");
|
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/omp-auto-loop-0.2.1.tgz
DELETED
|
Binary file
|