process-gpt-agent-sdk 0.2.3__py3-none-any.whl → 0.2.4__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.
Potentially problematic release.
This version of process-gpt-agent-sdk might be problematic. Click here for more details.
- {process_gpt_agent_sdk-0.2.3.dist-info → process_gpt_agent_sdk-0.2.4.dist-info}/METADATA +1 -1
- {process_gpt_agent_sdk-0.2.3.dist-info → process_gpt_agent_sdk-0.2.4.dist-info}/RECORD +5 -5
- processgpt_agent_sdk/utils/event_handler.py +23 -26
- {process_gpt_agent_sdk-0.2.3.dist-info → process_gpt_agent_sdk-0.2.4.dist-info}/WHEEL +0 -0
- {process_gpt_agent_sdk-0.2.3.dist-info → process_gpt_agent_sdk-0.2.4.dist-info}/top_level.txt +0 -0
|
@@ -9,10 +9,10 @@ processgpt_agent_sdk/tools/safe_tool_loader.py,sha256=18aT1M9FqCecu-JJvKxikYpl7n
|
|
|
9
9
|
processgpt_agent_sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
processgpt_agent_sdk/utils/context_manager.py,sha256=efNUGxMMJi8Nxy5bOpfYAk2AIjgWoXS0tz6zkROZKrs,1804
|
|
11
11
|
processgpt_agent_sdk/utils/crewai_event_listener.py,sha256=MwIMtRjw7L1uV8QRvlNV1agxRzjL3hC5EYBQIsMX2XA,9155
|
|
12
|
-
processgpt_agent_sdk/utils/event_handler.py,sha256=
|
|
12
|
+
processgpt_agent_sdk/utils/event_handler.py,sha256=8N7cQNVwhqAieLJv94VdWBt9dvwcrNpzopEJyneuJd4,2654
|
|
13
13
|
processgpt_agent_sdk/utils/logger.py,sha256=d6Chvwx6qLAyirXRFg4bARzEovo1UYaRgLTaknHad9E,1271
|
|
14
14
|
processgpt_agent_sdk/utils/summarizer.py,sha256=0XMRZZGCM8XgmvjXMMNhbDKqFEJd5ykqqovQlbCjYZQ,5677
|
|
15
|
-
process_gpt_agent_sdk-0.2.
|
|
16
|
-
process_gpt_agent_sdk-0.2.
|
|
17
|
-
process_gpt_agent_sdk-0.2.
|
|
18
|
-
process_gpt_agent_sdk-0.2.
|
|
15
|
+
process_gpt_agent_sdk-0.2.4.dist-info/METADATA,sha256=Fanryl1OcjeTwep1ReUQlBhqBBdlIjQO2Nes-zrtNMk,12898
|
|
16
|
+
process_gpt_agent_sdk-0.2.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
17
|
+
process_gpt_agent_sdk-0.2.4.dist-info/top_level.txt,sha256=Xe6zrj3_3Vv7d0pl5RRtenVUckwOVBVLQn2P03j5REo,21
|
|
18
|
+
process_gpt_agent_sdk-0.2.4.dist-info/RECORD,,
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import json
|
|
4
|
-
import uuid
|
|
5
|
-
from datetime import datetime, timezone
|
|
6
3
|
from typing import Any, Dict
|
|
7
4
|
|
|
8
5
|
from a2a.server.events import Event
|
|
@@ -11,35 +8,40 @@ from ..core.database import record_event, save_task_result
|
|
|
11
8
|
from ..tools.safe_tool_loader import SafeToolLoader
|
|
12
9
|
|
|
13
10
|
|
|
11
|
+
# =============================================================================
|
|
12
|
+
# 이벤트 변환: Event 또는 dict를 표준 dict로 통일
|
|
13
|
+
# =============================================================================
|
|
14
|
+
|
|
14
15
|
def convert_event_to_dictionary(event: Event) -> Dict[str, Any]:
|
|
16
|
+
"""Event/dict를 표준 dict로 변환한다."""
|
|
15
17
|
try:
|
|
18
|
+
# 이미 dict로 전달된 경우 그대로 사용
|
|
19
|
+
if isinstance(event, dict):
|
|
20
|
+
return event
|
|
21
|
+
# Event 객체면 공개 필드만 추출
|
|
16
22
|
if hasattr(event, "__dict__"):
|
|
17
23
|
return {k: v for k, v in event.__dict__.items() if not k.startswith("_")}
|
|
18
|
-
|
|
24
|
+
# 알 수 없는 타입은 문자열로 보존
|
|
25
|
+
return {"type": "event", "data": str(event)}
|
|
19
26
|
except Exception as e:
|
|
20
27
|
handle_application_error("event dict 변환 실패", e, raise_error=False)
|
|
21
|
-
return {"event": str(event)}
|
|
28
|
+
return {"type": "event", "data": str(event)}
|
|
22
29
|
|
|
23
30
|
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
# =============================================================================
|
|
32
|
+
# 이벤트 처리: type에 따라 저장 위치 분기
|
|
33
|
+
# =============================================================================
|
|
26
34
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- "done": 실행 종료 신호 → 이벤트 기록 후 MCP 리소스 정리
|
|
30
|
-
"""
|
|
35
|
+
async def process_event_message(todo: Dict[str, Any], event: Event) -> None:
|
|
36
|
+
"""이벤트 타입별로 todolist/events에 저장하거나 리소스 정리."""
|
|
31
37
|
try:
|
|
32
38
|
data = convert_event_to_dictionary(event)
|
|
33
39
|
evt_type = str(data.get("type") or data.get("event_type") or "").lower()
|
|
34
40
|
|
|
35
41
|
# done: 종료 이벤트 → 기록 후 MCP 정리
|
|
36
42
|
if evt_type == "done":
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"timestamp": datetime.now(timezone.utc).isoformat(),
|
|
40
|
-
**data,
|
|
41
|
-
}
|
|
42
|
-
await record_event(todo, normalized, event_type="done")
|
|
43
|
+
# 워커에서 전달한 데이터를 그대로 보존해 기록
|
|
44
|
+
await record_event(todo, data, event_type="done")
|
|
43
45
|
try:
|
|
44
46
|
SafeToolLoader.shutdown_all_adapters()
|
|
45
47
|
write_log_message("MCP 리소스 정리 완료")
|
|
@@ -49,18 +51,13 @@ async def process_event_message(todo: Dict[str, Any], event: Event) -> None:
|
|
|
49
51
|
|
|
50
52
|
# output: 결과 저장만 수행
|
|
51
53
|
if evt_type == "output":
|
|
52
|
-
payload = data.get("data") or
|
|
53
|
-
is_final = bool(payload.get("final") or payload.get("is_final"))
|
|
54
|
+
payload = data.get("data") or {}
|
|
55
|
+
is_final = bool(payload.get("final") or payload.get("is_final")) if isinstance(payload, dict) else False
|
|
54
56
|
content = payload.get("content") if isinstance(payload, dict) else payload
|
|
55
57
|
await save_task_result(str(todo.get("id")), content, final=is_final)
|
|
56
58
|
return
|
|
57
59
|
|
|
58
|
-
# event: 일반 이벤트 저장
|
|
59
|
-
|
|
60
|
-
"id": str(uuid.uuid4()),
|
|
61
|
-
"timestamp": datetime.now(timezone.utc).isoformat(),
|
|
62
|
-
**data,
|
|
63
|
-
}
|
|
64
|
-
await record_event(todo, normalized, event_type="event")
|
|
60
|
+
# event: 일반 이벤트 저장 (워커 데이터 그대로 보존)
|
|
61
|
+
await record_event(todo, data, event_type="event")
|
|
65
62
|
except Exception as e:
|
|
66
63
|
handle_application_error("process_event_message 처리 실패", e, raise_error=False)
|
|
File without changes
|
{process_gpt_agent_sdk-0.2.3.dist-info → process_gpt_agent_sdk-0.2.4.dist-info}/top_level.txt
RENAMED
|
File without changes
|