feat: add prompt-first batches and pausable task guidance
This commit is contained in:
1 parent
cec9898e4c
commit
057f0c3050
44 files changed
+1080
-191
No files matched your search
+10
-12
@@ -23,6 +23,7 @@ from artemis.controllers.unified_controller import UnifiedMobileController
|
||||
from artemis.data_engine.trace import trace
|
||||
from artemis.graph.state import State
|
||||
from artemis.graph.visibility import strict_state
|
||||
from artemis.runtime.task_control import TaskControl
|
||||
from artemis.utils.logger import get_logger
|
||||
from artemis.utils.ocr_api import is_ocr_configured, perform_ocr
|
||||
from artemis.utils.ocr_xml_fusion import (
|
||||
@@ -78,18 +79,9 @@ def _check_injected_instruction_file(base_dir: str) -> dict | None:
|
||||
Returns the payload dict: `instruction` (str | None) plus the explicit
|
||||
`release_loop` stop signal (bool) declared by the injecting caller.
|
||||
"""
|
||||
instruction_path = Path(base_dir) / "injected_instruction.json"
|
||||
if instruction_path.exists():
|
||||
with open(instruction_path, encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
instruction_path.unlink()
|
||||
payload = {
|
||||
"instruction": data.get("instruction"),
|
||||
"release_loop": bool(data.get("release_loop")),
|
||||
}
|
||||
logger.info(f"Read and deleted injected instruction payload: {payload}")
|
||||
return payload
|
||||
return None
|
||||
from artemis.runtime.task_control import consume_instructions
|
||||
|
||||
return consume_instructions(base_dir)
|
||||
|
||||
|
||||
def _unprotect_current_check_lines(ctx: ArtemisContext) -> None:
|
||||
@@ -122,6 +114,12 @@ async def perception_node(state: State, ctx: ArtemisContext) -> dict:
|
||||
"""
|
||||
state = strict_state(state, "perception")
|
||||
logger.info("Entering Perception Node...")
|
||||
control = getattr(ctx, "task_control", None)
|
||||
if isinstance(control, TaskControl):
|
||||
await control.checkpoint(
|
||||
on_pause=getattr(ctx, "on_task_pause", None),
|
||||
on_resume=getattr(ctx, "on_task_resume", None),
|
||||
)
|
||||
|
||||
if not ctx.data_engine.current_step_id:
|
||||
ctx.data_engine.allocate_step_id()
|
||||
|
||||
Reference in new issue
Block a user