omp-auto-loop 0.1.1 → 0.2.1

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/README.md CHANGED
@@ -1,50 +1,78 @@
1
- # 🔄 Agent Loop
1
+ # omp-auto-loop
2
2
 
3
- General-purpose loop extension for pi. Repeats agent turns automatically in three modes: until a goal is met, for a fixed number of passes, or through a sequence of named pipeline stages.
3
+ General-purpose agent loop extension for the Oh-My-Pi coding agent. When you send a normal (non-slash) message it becomes the loop goal and the extension runs repeated agent turns until the goal is finished or you stop the loop.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- pi install npm:pi-agent-loop
8
+ omp plugin install omp-auto-loop
9
9
  ```
10
10
 
11
- ## What it does
11
+ ## Overview
12
12
 
13
- Registers a `/loop` command and a `loop_control` tool. On each iteration, the agent does its work then calls `loop_control` to either advance to the next iteration (`next`) or declare the goal complete (`done`). The loop context is injected into the system prompt automatically so the agent always knows where it is.
13
+ - Starts a loop when the user sends a normal message (one that does NOT start with `/`). That message becomes the loop `goal`.
14
+ - Injects a short loop-focused system prompt so the agent knows the current iteration and goal.
15
+ - Provides a tool named `loop_control` which the agent must call to indicate progress: use `status: "next"` to continue, or `status: "done"` to finish.
16
+ - Registers a `loop-stop` command and a `Ctrl+Shift+X` shortcut to stop the active loop from the UI.
14
17
 
15
- ## Commands
18
+ ## Usage
16
19
 
17
- | Command | Description |
18
- |---|---|
19
- | `/loop goal <description>` | Repeat until the LLM declares the goal met (open-ended) |
20
- | `/loop passes <N> <task>` | Run exactly N passes |
21
- | `/loop pipeline <s1\|s2\|s3> <goal>` | Run named stages sequentially, stop after the last |
22
- | `/loop-stop` | Stop the active loop immediately |
20
+ - Start a loop: send a normal message like `Refactor all test files to use the new assertion API` (do NOT prefix with `/`). The extension will begin iterating on that goal.
21
+ - One-off message: prefix with `/once ` to send a single, non-looping turn (e.g. `/once Quick status check`).
22
+ - Stop loop: run the `loop-stop` command or press `Ctrl+Shift+X` to abort the active loop immediately.
23
23
 
24
- ## Shortcut
24
+ ## Tool: `loop_control`
25
25
 
26
- | Shortcut | Description |
27
- |---|---|
28
- | `Ctrl+Shift+X` | Emergency abort — stops the loop and cancels the current turn |
26
+ Call this tool from the assistant to signal what happened during the iteration. The tool is only meaningful while a loop is active.
29
27
 
30
- ## Tool: `loop_control`
28
+ Parameters:
29
+
30
+ - `status` — string: either `"next"` or `"done"`.
31
+ - `summary` — string: brief summary of what was accomplished this iteration.
32
+ - `reason` — optional string: a reason explaining why the goal is complete (used with `"done"`).
33
+
34
+ Behavior notes:
31
35
 
32
- The LLM calls this tool to signal progress. It is only active during a loop.
36
+ - When the model calls `loop_control` with `status: "next"`, the extension advances the iteration count and schedules the next iteration (it sends a steer message with the updated loop prompt).
37
+ - When the model calls `loop_control` with `status: "done"`, the extension asks for confirmation (it sets a `confirmingDone` flag and returns a prompt asking the model to either call `loop_control` again or finish the response). The loop is finalized if the model finishes the response (skips calling `loop_control` again) or explicitly confirms by calling `loop_control` with `done` again.
33
38
 
34
- | Parameter | Type | Description |
35
- |---|---|---|
36
- | `status` | `"next" \| "done"` | Advance to next iteration or declare completion |
37
- | `summary` | `string` | Brief summary of what was accomplished this iteration |
38
- | `reason` | `string?` | Why the goal is met (used with `"done"`) |
39
+ Fallbacks:
40
+
41
+ - If the agent ends its turn without calling `loop_control` and without scheduling the next step, the extension increments the iteration count and sends a steer message reminding the agent to call `loop_control` (so work won't silently stop).
39
42
 
40
43
  ## Examples
41
44
 
45
+ - Start by sending a goal (normal message):
46
+
42
47
  ```
43
- /loop goal Refactor all test files to use the new assertion API
44
- /loop passes 3 Review and improve the README
45
- /loop pipeline analyze|implement|test Write and test the new auth module
48
+ Refactor all test files to use the new assertion API
46
49
  ```
47
50
 
48
- ## TUI widget
51
+ - Example tool call (assistant -> tool):
52
+
53
+ ```json
54
+ {
55
+ "toolName": "loop_control",
56
+ "params": { "status": "next", "summary": "Refactored 3 files; more work remains" }
57
+ }
58
+ ```
59
+
60
+ - Marking completion (assistant -> tool):
61
+
62
+ ```json
63
+ {
64
+ "toolName": "loop_control",
65
+ "params": { "status": "done", "summary": "All tests updated and passing" }
66
+ }
67
+ ```
68
+
69
+ If the extension asks for confirmation after a `done` call, finish the response (or call `loop_control` with `done` again) to finalize the loop.
70
+
71
+ ## UI
72
+
73
+ - While a loop is active the status bar and a small widget show the current iteration and provide the `Ctrl+Shift+X` stop shortcut.
74
+
75
+ ## Notes
49
76
 
50
- While a loop is active, a status bar entry and widget show the current mode, goal, and iteration count.
77
+ - Package name: `omp-auto-loop` (see `package.json`).
78
+ - Peer-dep: this extension expects to run within `@oh-my-pi/pi-coding-agent`.
package/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { ExtensionAPI, ExtensionContext } from "@oh-my-pi/pi-coding-agent";
2
2
  import { Key } from "@oh-my-pi/pi-tui";
3
- import { buildPrompt, emptyState, getSystemPromptAddition, type LoopState, updateWidget } from "./state.js";
4
- import { getLoopControlToolDefinition, handleLoopControlTool, renderLoopControlCall, renderLoopControlResult } from "./tool.js";
3
+ import { buildPrompt, emptyState, getSystemPromptAddition, type LoopState, updateWidget } from "./state.ts";
4
+ import { getLoopControlToolDefinition, handleLoopControlTool, renderLoopControlCall, renderLoopControlResult } from "./tool.ts";
5
5
 
6
6
  export default function (pi: ExtensionAPI) {
7
7
  let state = emptyState();
Binary file
package/package.json CHANGED
@@ -1,14 +1,21 @@
1
1
  {
2
2
  "name": "omp-auto-loop",
3
- "version": "0.1.1",
4
- "description": "General-purpose agent loop extension for pi. Supports goal loops (repeat until done), fixed-pass loops, and multi-stage pipelines via /loop goal, /loop passes, and /loop pipeline commands.",
3
+ "version": "0.2.1",
4
+ "description": "General-purpose auto agent loop plugin for omp.",
5
+ "type": "module",
6
+ "main": "index.ts",
5
7
  "keywords": [
6
- "pi-package"
8
+ "omp-plugin"
7
9
  ],
8
10
  "license": "MIT",
9
11
  "pi": {
10
12
  "extensions": [
11
- "."
13
+ "index.ts"
14
+ ]
15
+ },
16
+ "omp": {
17
+ "extensions": [
18
+ "index.ts"
12
19
  ]
13
20
  },
14
21
  "peerDependencies": {
package/tool.ts CHANGED
@@ -2,7 +2,7 @@ import { StringEnum } from "@oh-my-pi/pi-ai";
2
2
  import type { ExtensionAPI, ExtensionContext } from "@oh-my-pi/pi-coding-agent";
3
3
  import { Text } from "@oh-my-pi/pi-tui";
4
4
  import { Type } from "@sinclair/typebox";
5
- import { buildPrompt, type LoopState } from "./state.js";
5
+ import { buildPrompt, type LoopState } from "./state.ts";
6
6
 
7
7
  export function handleLoopControlTool(opts: {
8
8
  params: { status: "next" | "done"; summary: string; reason?: string };