copex 0.8.4__py3-none-any.whl → 0.8.5__py3-none-any.whl
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.
- copex/cli.py +9 -1
- copex/plan.py +29 -6
- {copex-0.8.4.dist-info → copex-0.8.5.dist-info}/METADATA +1 -1
- {copex-0.8.4.dist-info → copex-0.8.5.dist-info}/RECORD +7 -7
- {copex-0.8.4.dist-info → copex-0.8.5.dist-info}/WHEEL +0 -0
- {copex-0.8.4.dist-info → copex-0.8.5.dist-info}/entry_points.txt +0 -0
- {copex-0.8.4.dist-info → copex-0.8.5.dist-info}/licenses/LICENSE +0 -0
copex/cli.py
CHANGED
|
@@ -932,6 +932,9 @@ def plan_command(
|
|
|
932
932
|
load_plan: Annotated[
|
|
933
933
|
Optional[Path], typer.Option("--load", "-l", help="Load plan from file instead of generating")
|
|
934
934
|
] = None,
|
|
935
|
+
max_iterations: Annotated[
|
|
936
|
+
int, typer.Option("--max-iterations", "-n", help="Max iterations per step (Ralph loop)")
|
|
937
|
+
] = 10,
|
|
935
938
|
model: Annotated[
|
|
936
939
|
str | None, typer.Option("--model", "-m", help="Model to use")
|
|
937
940
|
] = None,
|
|
@@ -966,6 +969,7 @@ def plan_command(
|
|
|
966
969
|
output=output,
|
|
967
970
|
from_step=from_step,
|
|
968
971
|
load_plan=load_plan,
|
|
972
|
+
max_iterations=max_iterations,
|
|
969
973
|
))
|
|
970
974
|
|
|
971
975
|
|
|
@@ -977,13 +981,17 @@ async def _run_plan(
|
|
|
977
981
|
output: Path | None,
|
|
978
982
|
from_step: int,
|
|
979
983
|
load_plan: Path | None,
|
|
984
|
+
max_iterations: int = 10,
|
|
980
985
|
) -> None:
|
|
981
986
|
"""Run plan generation and optional execution."""
|
|
982
987
|
client = Copex(config)
|
|
983
988
|
await client.start()
|
|
984
989
|
|
|
985
990
|
try:
|
|
986
|
-
|
|
991
|
+
# Create Ralph instance for iterative step execution
|
|
992
|
+
ralph = RalphWiggum(client)
|
|
993
|
+
executor = PlanExecutor(client, ralph=ralph)
|
|
994
|
+
executor.max_iterations_per_step = max_iterations
|
|
987
995
|
|
|
988
996
|
# Load or generate plan
|
|
989
997
|
if load_plan:
|
copex/plan.py
CHANGED
|
@@ -3,7 +3,7 @@ Plan Mode - Step-by-step task planning and execution for Copex.
|
|
|
3
3
|
|
|
4
4
|
Provides structured planning capabilities:
|
|
5
5
|
- Generate step-by-step plans from task descriptions
|
|
6
|
-
- Execute plans step by step with progress tracking
|
|
6
|
+
- Execute plans step by step with progress tracking (using Ralph loops)
|
|
7
7
|
- Interactive review before execution
|
|
8
8
|
- Resume execution from specific steps
|
|
9
9
|
- Save/load plans to files
|
|
@@ -17,7 +17,10 @@ from dataclasses import dataclass, field
|
|
|
17
17
|
from datetime import datetime
|
|
18
18
|
from enum import Enum
|
|
19
19
|
from pathlib import Path
|
|
20
|
-
from typing import Any, Callable
|
|
20
|
+
from typing import TYPE_CHECKING, Any, Callable
|
|
21
|
+
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from copex.ralph import RalphWiggum
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
class StepStatus(Enum):
|
|
@@ -194,10 +197,18 @@ Execute this step now. When done, summarize what you accomplished."""
|
|
|
194
197
|
class PlanExecutor:
|
|
195
198
|
"""Executes plans step by step using a Copex client."""
|
|
196
199
|
|
|
197
|
-
def __init__(self, client: Any):
|
|
198
|
-
"""
|
|
200
|
+
def __init__(self, client: Any, ralph: RalphWiggum | None = None):
|
|
201
|
+
"""
|
|
202
|
+
Initialize executor with a Copex client.
|
|
203
|
+
|
|
204
|
+
Args:
|
|
205
|
+
client: A Copex client instance
|
|
206
|
+
ralph: Optional RalphWiggum instance for iterative step execution
|
|
207
|
+
"""
|
|
199
208
|
self.client = client
|
|
209
|
+
self.ralph = ralph
|
|
200
210
|
self._cancelled = False
|
|
211
|
+
self.max_iterations_per_step: int = 10
|
|
201
212
|
|
|
202
213
|
def cancel(self) -> None:
|
|
203
214
|
"""Cancel ongoing execution."""
|
|
@@ -319,8 +330,20 @@ class PlanExecutor:
|
|
|
319
330
|
current_step=step.description,
|
|
320
331
|
)
|
|
321
332
|
|
|
322
|
-
|
|
323
|
-
|
|
333
|
+
# Use Ralph loop if available, otherwise single call
|
|
334
|
+
if self.ralph:
|
|
335
|
+
completion_promise = f"Step {step.number} complete"
|
|
336
|
+
ralph_state = await self.ralph.loop(
|
|
337
|
+
prompt,
|
|
338
|
+
max_iterations=self.max_iterations_per_step,
|
|
339
|
+
completion_promise=completion_promise,
|
|
340
|
+
)
|
|
341
|
+
# Use last response from Ralph loop as the result
|
|
342
|
+
step.result = ralph_state.history[-1] if ralph_state.history else "Step completed"
|
|
343
|
+
else:
|
|
344
|
+
response = await self.client.send(prompt)
|
|
345
|
+
step.result = response.content
|
|
346
|
+
|
|
324
347
|
step.status = StepStatus.COMPLETED
|
|
325
348
|
step.completed_at = datetime.now()
|
|
326
349
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: copex
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.5
|
|
4
4
|
Summary: Copilot Extended - Resilient wrapper for GitHub Copilot SDK with auto-retry, Ralph Wiggum loops, and more
|
|
5
5
|
Project-URL: Homepage, https://github.com/Arthur742Ramos/copex
|
|
6
6
|
Project-URL: Repository, https://github.com/Arthur742Ramos/copex
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
copex/__init__.py,sha256=tFeYHcqAswuLVmjBPUqG9HOJTrr6QBH0vPGqDD1ijgM,1643
|
|
2
2
|
copex/checkpoint.py,sha256=KRhadt4J9UVSqVPGlYfdrhP3cKZc8UsISOcZm_g8slo,13438
|
|
3
|
-
copex/cli.py,sha256=
|
|
3
|
+
copex/cli.py,sha256=gI-2P1dSNNpr-yTA9g542FVzo972j0a97Jkm3-F8TV8,38663
|
|
4
4
|
copex/client.py,sha256=SIZnnaCvqcaYx7X95ntA1-mE5awQv_cw9KNU2ko8Dss,27907
|
|
5
5
|
copex/config.py,sha256=yeBMO-_D9hKFHASCzZm7Odq9Ko2T5BBipM9Ddy6_GgU,10885
|
|
6
6
|
copex/mcp.py,sha256=16eLKWhk6_7DqdEsrLZi9TMuYoKcbrYosFXCAGNzMEs,16308
|
|
7
7
|
copex/metrics.py,sha256=dS4cuauTY9fKT3eGUuLrhnaLqMh6GGFycD0InkIXXAE,11979
|
|
8
8
|
copex/models.py,sha256=1O3eZNvcQBMSsOGMsq4kS28-l9BbhqeHov-J33lwmj0,1452
|
|
9
9
|
copex/persistence.py,sha256=UFA30bI1rZB-X9HW-v7RolxQ6QL7yAcO1C-V-br7d9U,10022
|
|
10
|
-
copex/plan.py,sha256=
|
|
10
|
+
copex/plan.py,sha256=BbqKVmP0hXZnF3H9df8nx6eJoQH9DjwZsSoJ-2CpyWs,12818
|
|
11
11
|
copex/ralph.py,sha256=UZHl5xuivGHaIqQKlIp5xB7WWoc9LCtHweOgzh-OuPU,8350
|
|
12
12
|
copex/tools.py,sha256=RehqIYekvyL2b4bwQlftWjkEadu9teQwtPDcEop0QxA,12072
|
|
13
13
|
copex/ui.py,sha256=oJ_ZAZOnRspvlpKeAcl8YgsOeMXEp-1kVSTZb1nOa1s,36592
|
|
14
|
-
copex-0.8.
|
|
15
|
-
copex-0.8.
|
|
16
|
-
copex-0.8.
|
|
17
|
-
copex-0.8.
|
|
18
|
-
copex-0.8.
|
|
14
|
+
copex-0.8.5.dist-info/METADATA,sha256=IrI6sZmmx1GiifQLlL1rHHJcIgAy_qkTJLX2nF5FYr8,13643
|
|
15
|
+
copex-0.8.5.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
16
|
+
copex-0.8.5.dist-info/entry_points.txt,sha256=r0gJK7Vq1SoE-j5jdtC51qO1IoIipMWGTR-I2NFhnRk,40
|
|
17
|
+
copex-0.8.5.dist-info/licenses/LICENSE,sha256=eGBwBmQ3sxCsuKPsoB1X4wnizlxrPadsO9yWotKpeQs,1069
|
|
18
|
+
copex-0.8.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|