feat: improve batch task controls and release 1.2.0
This commit is contained in:
1 parent
0e13bb5c29
commit
84e183d28d
38 files changed
+632
-147
No files matched your search
@@ -33,7 +33,7 @@ from artemis.graph.state import State
|
||||
from artemis.graph.visibility import strict_state
|
||||
from artemis.mcp.action_specs import OPERATOR_SHELL_ORDER, operator_shell_tool
|
||||
from artemis.llm.usage import usage_from_message
|
||||
from artemis.runtime.task_control import TaskControl
|
||||
from artemis.runtime.task_control import TaskControl, has_pending_instruction
|
||||
from artemis.services.llm import acomplete, get_llm, invoke_llm_with_timeout_message
|
||||
from artemis.tools.command_tool import (
|
||||
analyze_task_output_wrapper,
|
||||
@@ -539,6 +539,9 @@ class OperatorNode:
|
||||
if interrupted:
|
||||
return None, None, None, False
|
||||
assert response is not None
|
||||
if isinstance(control, TaskControl) and has_pending_instruction(control.directory):
|
||||
# The model answered a prompt that predates the user's new direction.
|
||||
return None, None, None, False
|
||||
|
||||
usage = usage_from_message(response)
|
||||
# The ledger's compaction thresholds read the operator's own
|
||||
@@ -690,10 +693,10 @@ class OperatorNode:
|
||||
if normalize_name(tool_name) in INTERRUPTIBLE_HELPERS:
|
||||
interrupted, result_obj = await self._await_or_pause(tool_call)
|
||||
if interrupted:
|
||||
span.result = "任务暂停;诊断已中断,恢复后重新观察屏幕"
|
||||
span.result = "任务被暂停或指导打断;重新观察屏幕后继续"
|
||||
results.append((span.result, "error"))
|
||||
for remaining in other_calls[len(results) :]:
|
||||
results.append(("任务暂停,未执行该工具", "error"))
|
||||
results.append(("任务已打断,未执行该工具", "error"))
|
||||
for completed, (content, status) in zip(
|
||||
other_calls, results
|
||||
):
|
||||
@@ -710,7 +713,7 @@ class OperatorNode:
|
||||
current_messages.append(
|
||||
ToolMessage(
|
||||
tool_call_id=action["id"],
|
||||
content="任务暂停,未执行屏幕操作",
|
||||
content="任务已打断,未执行屏幕操作",
|
||||
status="error",
|
||||
)
|
||||
)
|
||||
@@ -827,6 +830,9 @@ class OperatorNode:
|
||||
|
||||
action_calls = []
|
||||
|
||||
if isinstance(control, TaskControl) and has_pending_instruction(control.directory):
|
||||
return None, None, None, False
|
||||
|
||||
if action_calls:
|
||||
logger.info(
|
||||
f"Operator requested {len(action_calls)} action(s)."
|
||||
|
||||
Reference in new issue
Block a user