omp-auto-loop 0.2.3 → 0.2.4
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 +18 -10
- package/package.json +1 -1
- package/tool.ts +0 -3
package/index.ts
CHANGED
|
@@ -62,19 +62,21 @@ export default function (pi: ExtensionAPI) {
|
|
|
62
62
|
|
|
63
63
|
if (state.nextScheduled) {
|
|
64
64
|
state.nextScheduled = false;
|
|
65
|
+
pi.sendMessage(
|
|
66
|
+
{ customType: "loop-iteration", content: buildPrompt(state), display: false },
|
|
67
|
+
{ triggerTurn: true, deliverAs: "nextTurn" }
|
|
68
|
+
);
|
|
65
69
|
return;
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
// Fallback: LLM stopped without calling loop_control or confirming done
|
|
69
73
|
state.currentStep++;
|
|
70
74
|
updateWidget(state, ctx);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}, { triggerTurn: true, deliverAs: "steer" });
|
|
77
|
-
}, 100);
|
|
75
|
+
pi.sendMessage({
|
|
76
|
+
customType: "loop-fallback",
|
|
77
|
+
content: "You stopped without calling `loop_control`. If the task is incomplete, continue working. If done, call `loop_control` with status 'done'.",
|
|
78
|
+
display: false
|
|
79
|
+
}, { triggerTurn: true, deliverAs: "nextTurn" });
|
|
78
80
|
});
|
|
79
81
|
|
|
80
82
|
pi.registerTool({
|
|
@@ -85,9 +87,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
85
87
|
updateWidget(state, ctx);
|
|
86
88
|
return { content: result.content, details: result.details };
|
|
87
89
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
renderCall: renderLoopControlCall as any,
|
|
91
|
+
renderResult: renderLoopControlResult as any,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const stopLoop = (ctx: ExtensionContext, reason: string) => {
|
|
95
|
+
if (!state.active) {
|
|
96
|
+
ctx.ui.notify("No active loop", "info");
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
91
99
|
state.active = false;
|
|
92
100
|
state.done = true;
|
|
93
101
|
state.reasonDone = reason;
|
package/package.json
CHANGED
package/tool.ts
CHANGED
|
@@ -33,9 +33,6 @@ export function handleLoopControlTool(opts: {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const newState = { ...state, currentStep: state.currentStep + 1, confirmingDone: false, nextScheduled: true };
|
|
36
|
-
setTimeout(() => {
|
|
37
|
-
pi.sendMessage({ customType: "loop-iteration", content: buildPrompt(newState), display: false }, { triggerTurn: true, deliverAs: "steer" });
|
|
38
|
-
}, 100);
|
|
39
36
|
|
|
40
37
|
return {
|
|
41
38
|
content: [{ type: "text", text: `→ Advancing to step ${newState.currentStep + 1}. Summary: ${params.summary}` }],
|