oagi-core 0.14.2__py3-none-any.whl → 0.15.0__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.
- oagi/converters/oagi.py +13 -9
- oagi/handler/pyautogui_action_handler.py +2 -2
- oagi/handler/ydotool_action_handler.py +2 -2
- oagi/server/socketio_server.py +1 -1
- oagi/types/models/action.py +1 -0
- oagi/utils/output_parser.py +2 -1
- oagi/utils/prompt_builder.py +1 -0
- {oagi_core-0.14.2.dist-info → oagi_core-0.15.0.dist-info}/METADATA +1 -1
- {oagi_core-0.14.2.dist-info → oagi_core-0.15.0.dist-info}/RECORD +12 -12
- {oagi_core-0.14.2.dist-info → oagi_core-0.15.0.dist-info}/WHEEL +0 -0
- {oagi_core-0.14.2.dist-info → oagi_core-0.15.0.dist-info}/entry_points.txt +0 -0
- {oagi_core-0.14.2.dist-info → oagi_core-0.15.0.dist-info}/licenses/LICENSE +0 -0
oagi/converters/oagi.py
CHANGED
|
@@ -51,21 +51,21 @@ class OagiActionConverter(BaseActionConverter[Action]):
|
|
|
51
51
|
"""
|
|
52
52
|
converted: list[str] = []
|
|
53
53
|
failed: list[tuple[str, str]] = []
|
|
54
|
-
|
|
54
|
+
has_terminal = False
|
|
55
55
|
|
|
56
56
|
if not actions:
|
|
57
57
|
return converted
|
|
58
58
|
|
|
59
59
|
for action in actions:
|
|
60
|
-
# Check for duplicate finish() during iteration
|
|
61
|
-
|
|
62
|
-
if
|
|
63
|
-
if
|
|
60
|
+
# Check for duplicate finish()/fail() during iteration
|
|
61
|
+
is_terminal = action.type in (ActionType.FINISH, ActionType.FAIL)
|
|
62
|
+
if is_terminal:
|
|
63
|
+
if has_terminal:
|
|
64
64
|
raise ValueError(
|
|
65
|
-
"Duplicate finish() detected. "
|
|
66
|
-
"Only one finish() is allowed per action sequence."
|
|
65
|
+
"Duplicate finish()/fail() detected. "
|
|
66
|
+
"Only one finish() or fail() is allowed per action sequence."
|
|
67
67
|
)
|
|
68
|
-
|
|
68
|
+
has_terminal = True
|
|
69
69
|
|
|
70
70
|
try:
|
|
71
71
|
converted.extend(self._convert_action(action))
|
|
@@ -172,6 +172,10 @@ class OagiActionConverter(BaseActionConverter[Action]):
|
|
|
172
172
|
self._log_info("Task completion action -> DONE")
|
|
173
173
|
return ["DONE"]
|
|
174
174
|
|
|
175
|
+
if action_type == ActionType.FAIL.value:
|
|
176
|
+
self._log_info("Task infeasible action -> FAIL")
|
|
177
|
+
return ["FAIL"]
|
|
178
|
+
|
|
175
179
|
if action_type == ActionType.CALL_USER.value:
|
|
176
180
|
self._log_info("User intervention requested")
|
|
177
181
|
return []
|
|
@@ -179,7 +183,7 @@ class OagiActionConverter(BaseActionConverter[Action]):
|
|
|
179
183
|
raise ValueError(
|
|
180
184
|
f"Unknown action type: '{action_type}'. "
|
|
181
185
|
"Supported: click, left_double, left_triple, right_single, drag, "
|
|
182
|
-
"hotkey, type, scroll, wait, finish, call_user"
|
|
186
|
+
"hotkey, type, scroll, wait, finish, fail, call_user"
|
|
183
187
|
)
|
|
184
188
|
|
|
185
189
|
def serialize_actions(self, actions: list[Action]) -> list[dict[str, Any]]:
|
|
@@ -250,8 +250,8 @@ class PyautoguiActionHandler:
|
|
|
250
250
|
)
|
|
251
251
|
pyautogui.scroll(scroll_amount)
|
|
252
252
|
|
|
253
|
-
case ActionType.FINISH:
|
|
254
|
-
# Task completion - reset handler state
|
|
253
|
+
case ActionType.FINISH | ActionType.FAIL:
|
|
254
|
+
# Task completion or infeasible - reset handler state
|
|
255
255
|
self.reset()
|
|
256
256
|
|
|
257
257
|
case ActionType.WAIT:
|
|
@@ -164,8 +164,8 @@ class YdotoolActionHandler(Ydotool):
|
|
|
164
164
|
text = self.caps_manager.transform_text(text)
|
|
165
165
|
self._run_ydotool(["type", text], count=count)
|
|
166
166
|
|
|
167
|
-
case ActionType.FINISH:
|
|
168
|
-
# Task completion - reset handler state
|
|
167
|
+
case ActionType.FINISH | ActionType.FAIL:
|
|
168
|
+
# Task completion or infeasible - reset handler state
|
|
169
169
|
self.reset()
|
|
170
170
|
|
|
171
171
|
case ActionType.WAIT:
|
oagi/server/socketio_server.py
CHANGED
|
@@ -364,7 +364,7 @@ class SessionNamespace(socketio.AsyncNamespace):
|
|
|
364
364
|
timeout=self.config.socketio_timeout,
|
|
365
365
|
)
|
|
366
366
|
|
|
367
|
-
case ActionType.FINISH:
|
|
367
|
+
case ActionType.FINISH | ActionType.FAIL:
|
|
368
368
|
return await self.call(
|
|
369
369
|
"finish",
|
|
370
370
|
FinishEventData(**common).model_dump(),
|
oagi/types/models/action.py
CHANGED
oagi/utils/output_parser.py
CHANGED
|
@@ -45,7 +45,7 @@ def parse_raw_output(raw_output: str) -> Step:
|
|
|
45
45
|
parsed_action = _parse_action(action_text.strip())
|
|
46
46
|
if parsed_action:
|
|
47
47
|
actions.append(parsed_action)
|
|
48
|
-
if parsed_action.type
|
|
48
|
+
if parsed_action.type in (ActionType.FINISH, ActionType.FAIL):
|
|
49
49
|
stop = True
|
|
50
50
|
|
|
51
51
|
return Step(reason=reason, actions=actions, stop=stop)
|
|
@@ -105,6 +105,7 @@ def _parse_action(action_text: str) -> Action | None:
|
|
|
105
105
|
- scroll(x, y, direction, c) # scroll at position
|
|
106
106
|
- wait() # wait for a while
|
|
107
107
|
- finish() # indicate task is finished
|
|
108
|
+
- fail() # indicate task is infeasible
|
|
108
109
|
|
|
109
110
|
Args:
|
|
110
111
|
action_text: String representation of a single action
|
oagi/utils/prompt_builder.py
CHANGED
|
@@ -24,6 +24,7 @@ In the action field, you have the following action formats:
|
|
|
24
24
|
8. scroll(x, y, direction, c) # scroll the mouse at position (x, y) in the direction of up or down for c times, where x and y are integers normalized between 0 and 1000
|
|
25
25
|
9. wait() # wait for a while
|
|
26
26
|
10. finish() # indicate the task is finished
|
|
27
|
+
11. fail() # indicate the task is infeasible
|
|
27
28
|
|
|
28
29
|
Directly output the text beginning with <|think_start|>, no additional text is needed for this scenario.
|
|
29
30
|
|
|
@@ -39,7 +39,7 @@ oagi/client/base.py,sha256=CWAvE0AcpL8HD_i00n7Fq53AIAQGhBhS_n6LifUCqxE,14736
|
|
|
39
39
|
oagi/client/sync.py,sha256=4xNqqNihXmgLU385h22mMJ9wmmlw-jeOdWI4fmpEpTk,9369
|
|
40
40
|
oagi/converters/__init__.py,sha256=4ADgInzAQNCvghXT4cKYt8zUnj-V-szjzRnrxJRE5Tw,1875
|
|
41
41
|
oagi/converters/base.py,sha256=0wHVMf9xAqVidBD_VtsqfLDlBPOqUADt6or4JGAha1A,9096
|
|
42
|
-
oagi/converters/oagi.py,sha256=
|
|
42
|
+
oagi/converters/oagi.py,sha256=iunNs-t9gNU8oFgjMAjNTn1wNC-Z8Ca4pg1JRrSCYHE,7635
|
|
43
43
|
oagi/handler/__init__.py,sha256=ZMQIeN_uJKUK_dn0w7ggsPfdRzzwts7G-Sppsrt22Lg,2528
|
|
44
44
|
oagi/handler/_macos.py,sha256=Gs8GrhA_WAyv9Yw0D41duliP32Xk6vouyMeWjWJJT90,5187
|
|
45
45
|
oagi/handler/_windows.py,sha256=MSgPDYEOetSjbn9eJDSrdzBVlUGgGsTlegaTDc4C4Ss,2828
|
|
@@ -49,19 +49,19 @@ oagi/handler/async_screenshot_maker.py,sha256=_myV4Rq6X_evCOuatalFSW5nsUDXi_0ej0
|
|
|
49
49
|
oagi/handler/async_ydotool_action_handler.py,sha256=HB4QQk3OaG08g37eLb3EwsnkWKWPrpDei0ZsnBxrGZY,2159
|
|
50
50
|
oagi/handler/capslock_manager.py,sha256=40LzWt1_1wbncF5koUTdbd9V3eo5Ex_mEWwjtEmHAf4,1878
|
|
51
51
|
oagi/handler/pil_image.py,sha256=s8UGZ6ALbmOxRO2GL1EUFN7_6ZEFseSE9OHABCe7wek,5380
|
|
52
|
-
oagi/handler/pyautogui_action_handler.py,sha256=
|
|
52
|
+
oagi/handler/pyautogui_action_handler.py,sha256=Mk4r2tcQar9NcalUYGKiTy2_ySe-NaxO_QwCHVlQrKI,11194
|
|
53
53
|
oagi/handler/screen_manager.py,sha256=FV0-6ZyTVv9yZlAg4Krga0xW9O_LDsk1iaCJjWgET-g,6565
|
|
54
54
|
oagi/handler/screenshot_maker.py,sha256=740k7NjDRKW6KwVqy_nVoczgVuw9_yTKM0gLFKB1iNs,1600
|
|
55
55
|
oagi/handler/utils.py,sha256=WnYvPkpiNYDnv4EDLfOTdO5gEGuJVpB42G0HQkp6aEg,18173
|
|
56
56
|
oagi/handler/wayland_support.py,sha256=qUIAQMqc3wp1VIypVmZjFDYT8t0yH0QvikTTV8pD-XA,7905
|
|
57
|
-
oagi/handler/ydotool_action_handler.py,sha256=
|
|
57
|
+
oagi/handler/ydotool_action_handler.py,sha256=eDxhmHoAI5bln5plfnzZHrc8MYAihycGfEzXux8H72M,9028
|
|
58
58
|
oagi/server/__init__.py,sha256=uZx8u3vJUb87kkNzwmmVrgAgbqRu0WxyMIQCLSx56kk,452
|
|
59
59
|
oagi/server/agent_wrappers.py,sha256=j8va0A7u80bzOM82nndAplK1uaO_T3kufHWScK6kfWM,3263
|
|
60
60
|
oagi/server/config.py,sha256=AJ1PLKuxrc6pRuur1hm5DwG2g2otxPwOCfKgzIACkSk,1691
|
|
61
61
|
oagi/server/main.py,sha256=jnTxk7Prc5CzlsUnkBNJp4MOoYN-7HN_Be_m1d3COa8,4829
|
|
62
62
|
oagi/server/models.py,sha256=DXjuf5icpCOgCUGMzzoLfRCoreM541KBWKBZnCk5_S0,2688
|
|
63
63
|
oagi/server/session_store.py,sha256=l7t31rNWuZkIPLnaqrllVusHkJkE8j50PMfyb1di9mI,3750
|
|
64
|
-
oagi/server/socketio_server.py,sha256=
|
|
64
|
+
oagi/server/socketio_server.py,sha256=Fs-8p1LYPrSt226afz2KLjqoUAb0pCT-uQP72GgaV-o,14236
|
|
65
65
|
oagi/task/__init__.py,sha256=8l3z5nxA3RtGHP94Iu4ot1Wo3Lx-U7_Led2CsVwYINg,760
|
|
66
66
|
oagi/types/__init__.py,sha256=_UyzzRnoKvp00BUBjxW9Tv3_xBNf8Lxb2PUC2DkjOkg,1384
|
|
67
67
|
oagi/types/action_handler.py,sha256=NH8E-m5qpGqWcXzTSWfF7W0Xdp8SkzJsbhCmQ0B96cg,1075
|
|
@@ -72,15 +72,15 @@ oagi/types/image_provider.py,sha256=IhKEnwCGZ5l_rO3AvJ6xv5RZMTmTDmqsFRynI9h0R_M,
|
|
|
72
72
|
oagi/types/step_observer.py,sha256=E7igVqpOeoizUkhXbGRRX80ZOuqoM-zcRyjNyOXwWc8,2380
|
|
73
73
|
oagi/types/url.py,sha256=145jLl3yecFBVKhJDbrR63C48D3l9_w0kpA_8C_gM78,868
|
|
74
74
|
oagi/types/models/__init__.py,sha256=VcNrVQvw9p8igBunOv3LQBPnRpp5WEcWBf1Nr9FGkeI,843
|
|
75
|
-
oagi/types/models/action.py,sha256=
|
|
75
|
+
oagi/types/models/action.py,sha256=BcyXus3K_cHNEOME8YAbxm7gXvx7L-4syGLbtqGV-eQ,2601
|
|
76
76
|
oagi/types/models/client.py,sha256=5fUZVTPviTunoh2KXM3jmLPtPIrvPwrr8o2bR6Phj5M,1156
|
|
77
77
|
oagi/types/models/image_config.py,sha256=tl6abVg_-IAPLwpaWprgknXu7wRWriMg-AEVyUX73v0,1567
|
|
78
78
|
oagi/types/models/step.py,sha256=RSI4H_2rrUBq_xyCoWKaq7JHdJWNobtQppaKC1l0aWU,471
|
|
79
79
|
oagi/utils/__init__.py,sha256=vHXyX66hEsf33OJJkmZSUjaTYU0UngfbtjcZgxfOj3A,441
|
|
80
|
-
oagi/utils/output_parser.py,sha256=
|
|
81
|
-
oagi/utils/prompt_builder.py,sha256=
|
|
82
|
-
oagi_core-0.
|
|
83
|
-
oagi_core-0.
|
|
84
|
-
oagi_core-0.
|
|
85
|
-
oagi_core-0.
|
|
86
|
-
oagi_core-0.
|
|
80
|
+
oagi/utils/output_parser.py,sha256=X75n20eJ2dG9sIragq5wjwQ8nw5V3-c_ksoN6N7sYvs,5384
|
|
81
|
+
oagi/utils/prompt_builder.py,sha256=ILTiSnTNCU6J2zoA7aP4uwNKhi_HKt9WvVTfeY68Tt4,2225
|
|
82
|
+
oagi_core-0.15.0.dist-info/METADATA,sha256=nZkxSJ1gg-eRqdBzKTcmvmvrysFw1fmTdjL074Q0u-s,16854
|
|
83
|
+
oagi_core-0.15.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
84
|
+
oagi_core-0.15.0.dist-info/entry_points.txt,sha256=zzgsOSWX6aN3KUB0Z1it8DMxFFBJBqmZVqMVAJRjYuw,44
|
|
85
|
+
oagi_core-0.15.0.dist-info/licenses/LICENSE,sha256=sy5DLA2M29jFT4UfWsuBF9BAr3FnRkYtnAu6oDZiIf8,1075
|
|
86
|
+
oagi_core-0.15.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|