oagi-core 0.12.0__py3-none-any.whl → 0.12.1__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/agent/default.py CHANGED
@@ -16,7 +16,7 @@ from ..constants import (
16
16
  DEFAULT_TEMPERATURE,
17
17
  MODEL_ACTOR,
18
18
  )
19
- from ..handler import reset_handler
19
+ from ..handler.utils import reset_handler
20
20
  from ..types import (
21
21
  ActionEvent,
22
22
  AsyncActionHandler,
@@ -19,7 +19,7 @@ from oagi.constants import (
19
19
  DEFAULT_TEMPERATURE,
20
20
  MODEL_ACTOR,
21
21
  )
22
- from oagi.handler import reset_handler
22
+ from oagi.handler.utils import reset_handler
23
23
  from oagi.types import (
24
24
  URL,
25
25
  ActionEvent,
@@ -16,7 +16,7 @@ from oagi.constants import (
16
16
  DEFAULT_TEMPERATURE,
17
17
  MODEL_ACTOR,
18
18
  )
19
- from oagi.handler import reset_handler
19
+ from oagi.handler.utils import reset_handler
20
20
  from oagi.types import AsyncActionHandler, AsyncImageProvider, AsyncObserver, SplitEvent
21
21
 
22
22
  from ..protocol import AsyncAgent
oagi/handler/__init__.py CHANGED
@@ -5,28 +5,43 @@
5
5
  # This file is part of the official API project.
6
6
  # Licensed under the MIT License.
7
7
  # -----------------------------------------------------------------------------
8
- from oagi.handler.async_pyautogui_action_handler import AsyncPyautoguiActionHandler
9
- from oagi.handler.async_screenshot_maker import AsyncScreenshotMaker
10
- from oagi.handler.pil_image import PILImage
11
- from oagi.handler.pyautogui_action_handler import (
12
- PyautoguiActionHandler,
13
- PyautoguiConfig,
14
- )
15
- from oagi.handler.screenshot_maker import ScreenshotMaker
16
-
17
-
18
- def reset_handler(handler) -> None:
19
- """Reset handler state if supported.
20
-
21
- Uses duck-typing to check if the handler has a reset() method.
22
- This allows handlers to reset their internal state (e.g., capslock state)
23
- at the start of a new automation task.
24
-
25
- Args:
26
- handler: The action handler to reset
27
- """
28
- if hasattr(handler, "reset"):
29
- handler.reset()
8
+ import importlib
9
+ from typing import TYPE_CHECKING
10
+
11
+ from .utils import reset_handler
12
+
13
+ # Lazy imports for pyautogui-dependent modules to avoid import errors on headless systems
14
+ _LAZY_IMPORTS: dict[str, str] = {
15
+ "AsyncPyautoguiActionHandler": "oagi.handler.async_pyautogui_action_handler",
16
+ "AsyncScreenshotMaker": "oagi.handler.async_screenshot_maker",
17
+ "PILImage": "oagi.handler.pil_image",
18
+ "PyautoguiActionHandler": "oagi.handler.pyautogui_action_handler",
19
+ "PyautoguiConfig": "oagi.handler.pyautogui_action_handler",
20
+ "ScreenshotMaker": "oagi.handler.screenshot_maker",
21
+ }
22
+
23
+ if TYPE_CHECKING:
24
+ from oagi.handler.async_pyautogui_action_handler import AsyncPyautoguiActionHandler
25
+ from oagi.handler.async_screenshot_maker import AsyncScreenshotMaker
26
+ from oagi.handler.pil_image import PILImage
27
+ from oagi.handler.pyautogui_action_handler import (
28
+ PyautoguiActionHandler,
29
+ PyautoguiConfig,
30
+ )
31
+ from oagi.handler.screenshot_maker import ScreenshotMaker
32
+
33
+
34
+ def __getattr__(name: str):
35
+ """Lazy import for pyautogui-dependent modules."""
36
+ if name in _LAZY_IMPORTS:
37
+ module = importlib.import_module(_LAZY_IMPORTS[name])
38
+ return getattr(module, name)
39
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
40
+
41
+
42
+ def __dir__() -> list[str]:
43
+ """Return all public names including lazy imports."""
44
+ return sorted(set(__all__) | set(_LAZY_IMPORTS.keys()))
30
45
 
31
46
 
32
47
  __all__ = [
oagi/handler/utils.py ADDED
@@ -0,0 +1,21 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Copyright (c) OpenAGI Foundation
3
+ # All rights reserved.
4
+ #
5
+ # This file is part of the official API project.
6
+ # Licensed under the MIT License.
7
+ # -----------------------------------------------------------------------------
8
+
9
+
10
+ def reset_handler(handler) -> None:
11
+ """Reset handler state if supported.
12
+
13
+ Uses duck-typing to check if the handler has a reset() method.
14
+ This allows handlers to reset their internal state (e.g., capslock state)
15
+ at the start of a new automation task.
16
+
17
+ Args:
18
+ handler: The action handler to reset
19
+ """
20
+ if hasattr(handler, "reset"):
21
+ handler.reset()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: oagi-core
3
- Version: 0.12.0
3
+ Version: 0.12.1
4
4
  Summary: Official API of OpenAGI Foundation
5
5
  Project-URL: Homepage, https://github.com/agiopen-org/oagi
6
6
  Author-email: OpenAGI Foundation <contact@agiopen.org>
@@ -9,7 +9,7 @@ oagi/actor/base.py,sha256=UUZdS1tufZDIbtQHLs-es6ptGHQpa-EPWf7RSbVpQnU,7921
9
9
  oagi/actor/short.py,sha256=wKLCxvf7Ys6rYxXpHe4zbZdbf_1q1qcmm5WyWubwj3E,2630
10
10
  oagi/actor/sync.py,sha256=QTY1WNTI75jwkWBghdVViHIp5rYkbm3kumlLedU8YeQ,3588
11
11
  oagi/agent/__init__.py,sha256=KTVLUMhbjgpTJoOWMUZkkiqwhgumvbOZV2tJ9XCLfao,901
12
- oagi/agent/default.py,sha256=YKAAq_XJrM-YpYuLtDtEH9XA502eijsdiawQKAf4iJ0,4709
12
+ oagi/agent/default.py,sha256=Ax05kBa8Fb14Ev8wd9LS6xkF65grf6qdxxTlgpkkDuk,4715
13
13
  oagi/agent/factories.py,sha256=syi_EOlU4SUjo-0CKaML8eIPu3ToUEKua2VHp9lvNF0,5839
14
14
  oagi/agent/protocol.py,sha256=IQJGiMN4yZIacrh5e9JQsoM9TyHb8wJRQR4LAk8dSA0,1615
15
15
  oagi/agent/registry.py,sha256=7bMA2-pH3xQ9ZavrHB_mnc2fOGSMeICPbOGtHoM7It0,4851
@@ -23,8 +23,8 @@ oagi/agent/tasker/__init__.py,sha256=1iTEFe7lzcqh96TL9R0QADPpLJLrUP0shtZ4DlZSv_8
23
23
  oagi/agent/tasker/memory.py,sha256=NR13l5yxRA8GUE-oupAP4W1n80ZNG0SxpUfxsNltkUY,5033
24
24
  oagi/agent/tasker/models.py,sha256=sMQgwIMKhT1tvVF2yoc1hh8GwEiJ6i6qPMy9WoiA8JM,2137
25
25
  oagi/agent/tasker/planner.py,sha256=q6IvH6sfU2kYX1NcC9VHjGaQ0X9jF18yjuAYXisNCg0,15489
26
- oagi/agent/tasker/taskee_agent.py,sha256=VquuEkkjpLYOVPamHDz53e9GClj6v93VPMHoiNmR8-U,18084
27
- oagi/agent/tasker/tasker_agent.py,sha256=kbWvvRVS12S8eFd0PRszFrcSSWRzz_f6Jd7LuaRcwJQ,11285
26
+ oagi/agent/tasker/taskee_agent.py,sha256=OugYJbTbFKxgNjbIyQBBH4Zm5u5PuWN1F6R81_eIro8,18090
27
+ oagi/agent/tasker/tasker_agent.py,sha256=yb0BdQzJyAPpK3njHPWgQruV8zpUGBXn1WjOGEMIO-g,11291
28
28
  oagi/cli/__init__.py,sha256=aDnJViTseShpo5fdGPTj-ELysZhmdvB6Z8mEj2D-_N4,359
29
29
  oagi/cli/agent.py,sha256=fd7WtR5zoRJmyHDr67zfBvEX-_BLIjPbBqp-dhy4AAk,11061
30
30
  oagi/cli/display.py,sha256=Y8_Dn5RIEfRqZUHVGF6URItW0C3XC7bPLWoAmmhvBS0,1829
@@ -36,7 +36,7 @@ oagi/client/__init__.py,sha256=F9DShPUdb6vZYmN1fpM1VYzp4MWqUao_e_R1KYmM4Q4,410
36
36
  oagi/client/async_.py,sha256=m7hkJSebH2MyXAwEbpsFw0UQm6aRJQ8HZiULBlZxvM4,9385
37
37
  oagi/client/base.py,sha256=kKkdpd-YkjFfTVCOQzVRjjkQnCpH2hZLtyM1vKizy6I,14693
38
38
  oagi/client/sync.py,sha256=-wtaW1H5jgj32_1TDVxMO7zdZ47ZV6ZG7a6jF2ztbv0,9158
39
- oagi/handler/__init__.py,sha256=vEUvyiUvTRf1GE4vTiz_bQjLv3psdmHyt0mfKJHq24M,1247
39
+ oagi/handler/__init__.py,sha256=Ec5zhBSfJQmOUT8s6Mr8pN2g8ILY0uNYuX4M23vzfhs,1938
40
40
  oagi/handler/_macos.py,sha256=Gs8GrhA_WAyv9Yw0D41duliP32Xk6vouyMeWjWJJT90,5187
41
41
  oagi/handler/_windows.py,sha256=MSgPDYEOetSjbn9eJDSrdzBVlUGgGsTlegaTDc4C4Ss,2828
42
42
  oagi/handler/async_pyautogui_action_handler.py,sha256=wfNRBBURZnwQkNTcs9OPMmFJIAPtnXmcqxWbjda_q7I,1863
@@ -45,6 +45,7 @@ oagi/handler/capslock_manager.py,sha256=40LzWt1_1wbncF5koUTdbd9V3eo5Ex_mEWwjtEmH
45
45
  oagi/handler/pil_image.py,sha256=yUcAoGBL-aZ0PCjSaAmQsDwtyzjldXHqXQp_OYRk6e4,4080
46
46
  oagi/handler/pyautogui_action_handler.py,sha256=BVmpKuYAMINJ5Ue_PK_WxFScAqLeyXC64g4NWQUtG_M,10146
47
47
  oagi/handler/screenshot_maker.py,sha256=j1jTW-awx3vAnb1N5_FIMBC0Z-rNVQbiBP-S6Gh5dlE,1284
48
+ oagi/handler/utils.py,sha256=jj10z-v4_LUuVb8aClyXkUfZVEaqsWgi3be4t3Gw7oI,697
48
49
  oagi/server/__init__.py,sha256=uZx8u3vJUb87kkNzwmmVrgAgbqRu0WxyMIQCLSx56kk,452
49
50
  oagi/server/agent_wrappers.py,sha256=j8va0A7u80bzOM82nndAplK1uaO_T3kufHWScK6kfWM,3263
50
51
  oagi/server/config.py,sha256=AJ1PLKuxrc6pRuur1hm5DwG2g2otxPwOCfKgzIACkSk,1691
@@ -69,8 +70,8 @@ oagi/types/models/step.py,sha256=RSI4H_2rrUBq_xyCoWKaq7JHdJWNobtQppaKC1l0aWU,471
69
70
  oagi/utils/__init__.py,sha256=vHXyX66hEsf33OJJkmZSUjaTYU0UngfbtjcZgxfOj3A,441
70
71
  oagi/utils/output_parser.py,sha256=U7vzmoD8pyzDg23z3vy-L9a_jKPsAlr3x8lIdPszrY8,5322
71
72
  oagi/utils/prompt_builder.py,sha256=_Q1HY82YUrq3jSCTZ3Rszu3qmI3Wn_fmq8hf14NuwQM,2180
72
- oagi_core-0.12.0.dist-info/METADATA,sha256=a8SJt-skg0xQjodJEqwLd0EOJzhw8BrHBUIqlYGEf1Y,12176
73
- oagi_core-0.12.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
74
- oagi_core-0.12.0.dist-info/entry_points.txt,sha256=zzgsOSWX6aN3KUB0Z1it8DMxFFBJBqmZVqMVAJRjYuw,44
75
- oagi_core-0.12.0.dist-info/licenses/LICENSE,sha256=sy5DLA2M29jFT4UfWsuBF9BAr3FnRkYtnAu6oDZiIf8,1075
76
- oagi_core-0.12.0.dist-info/RECORD,,
73
+ oagi_core-0.12.1.dist-info/METADATA,sha256=Qs8cvjTBeZCrlCh7DNc-Ai3oyFgw2NlsE60oab-vccE,12176
74
+ oagi_core-0.12.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
75
+ oagi_core-0.12.1.dist-info/entry_points.txt,sha256=zzgsOSWX6aN3KUB0Z1it8DMxFFBJBqmZVqMVAJRjYuw,44
76
+ oagi_core-0.12.1.dist-info/licenses/LICENSE,sha256=sy5DLA2M29jFT4UfWsuBF9BAr3FnRkYtnAu6oDZiIf8,1075
77
+ oagi_core-0.12.1.dist-info/RECORD,,