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.
Files changed (3) hide show
  1. package/index.ts +18 -10
  2. package/package.json +1 -1
  3. 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
- setTimeout(() => {
72
- pi.sendMessage({
73
- customType: "loop-fallback",
74
- content: "You stopped without calling `loop_control`. If the task is incomplete, continue working. If done, call `loop_control` with status 'done'.",
75
- display: false
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
- renderCall: renderLoopControlCall as any,
89
- renderResult: renderLoopControlResult as any,
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omp-auto-loop",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "General-purpose auto agent loop plugin for omp.",
5
5
  "type": "module",
6
6
  "main": "index.ts",
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}` }],