process-gpt-agent-sdk 0.1.8__py3-none-any.whl → 0.2.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.

Potentially problematic release.


This version of process-gpt-agent-sdk might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: process-gpt-agent-sdk
3
- Version: 0.1.8
3
+ Version: 0.2.0
4
4
  Summary: Supabase 기반 이벤트/작업 폴링으로 A2A AgentExecutor를 실행하는 SDK
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/your-org/process-gpt-agent-sdk
@@ -1,7 +1,7 @@
1
1
  processgpt_agent_sdk/__init__.py,sha256=IvAL5WBZhI83LYQogRP6-i04bxZkhmkgmES4FRQY888,185
2
- processgpt_agent_sdk/server.py,sha256=MQMAnaFFik_1h9aaQdd8yTHf6uYbLA_SMVCJAWdqMYU,8922
2
+ processgpt_agent_sdk/server.py,sha256=1RCUPNeuDJ7ZQfIiz4d0G9oWNKbYZGWls6SV2U8MR6I,8966
3
3
  processgpt_agent_sdk/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- processgpt_agent_sdk/core/database.py,sha256=o5QEWoMdgliylFN-U7wlYd7Qng_GEnfzixRdhOZN_ZY,18790
4
+ processgpt_agent_sdk/core/database.py,sha256=GSXYcJXADs0wCoFo54lu82MnqQPoEvqQ6n5BDXA8o60,18956
5
5
  processgpt_agent_sdk/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  processgpt_agent_sdk/tools/human_query_tool.py,sha256=pntznVNt3FOsWunPe3-WIlRd7cB2ibyM6Tndyi6YQJk,10314
7
7
  processgpt_agent_sdk/tools/knowledge_tools.py,sha256=AOtxvLypu343877ZzzELGq3At-E_2NiAqEw0Njlephg,8937
@@ -11,8 +11,8 @@ processgpt_agent_sdk/utils/context_manager.py,sha256=QDL5ya4FfUPx4EKScSVIllJGKS1
11
11
  processgpt_agent_sdk/utils/crewai_event_listener.py,sha256=343btAePWM19KbjDwElYb9K3FIbVm80_ZLLdOyFSsj4,8815
12
12
  processgpt_agent_sdk/utils/event_handler.py,sha256=ogmKcfhD2PHVQCQHpjVevZOe6LThwKIsrJcWFYqGlPA,2337
13
13
  processgpt_agent_sdk/utils/logger.py,sha256=2hX1GClkrE3ZVzvV61ORlZg4QDh59g-lr3qJyIRAfD4,948
14
- processgpt_agent_sdk/utils/summarizer.py,sha256=XV7e4pyKEK7NiGK_PAc1xorKSO2MKlSHCAiV7slOdus,4527
15
- process_gpt_agent_sdk-0.1.8.dist-info/METADATA,sha256=XG89U3KJ4JUe2RDOHEiqzjLiDonHVfitbStDnd_FfzU,12898
16
- process_gpt_agent_sdk-0.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
- process_gpt_agent_sdk-0.1.8.dist-info/top_level.txt,sha256=Xe6zrj3_3Vv7d0pl5RRtenVUckwOVBVLQn2P03j5REo,21
18
- process_gpt_agent_sdk-0.1.8.dist-info/RECORD,,
14
+ processgpt_agent_sdk/utils/summarizer.py,sha256=j57R5TSr8QNy_INA-sh0tFEUCGcea07brT5sahHxATI,4567
15
+ process_gpt_agent_sdk-0.2.0.dist-info/METADATA,sha256=4cg2HqmrXfT0dd_qgQ4JDDh7a6N828NRmsblMiNanVM,12898
16
+ process_gpt_agent_sdk-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
+ process_gpt_agent_sdk-0.2.0.dist-info/top_level.txt,sha256=Xe6zrj3_3Vv7d0pl5RRtenVUckwOVBVLQn2P03j5REo,21
18
+ process_gpt_agent_sdk-0.2.0.dist-info/RECORD,,
@@ -27,7 +27,7 @@ from typing import Callable, TypeVar
27
27
 
28
28
  T = TypeVar("T")
29
29
 
30
- from ..utils.logger import handle_application_error as _emit_error, write_log_message as _emit_log
30
+ from ..utils.logger import handle_application_error, write_log_message
31
31
 
32
32
 
33
33
  async def _async_retry(
@@ -52,16 +52,16 @@ async def _async_retry(
52
52
  last_err = e
53
53
  jitter = random.uniform(0, 0.3)
54
54
  delay = base_delay * (2 ** (attempt - 1)) + jitter
55
- _emit_log(f"{name} 재시도 {attempt}/{retries} (delay={delay:.2f}s): {e}", level=logging.WARNING)
55
+ write_log_message(f"{name} 재시도 {attempt}/{retries} (delay={delay:.2f}s): {e}", level=logging.WARNING)
56
56
  await asyncio.sleep(delay)
57
- _emit_log(f"{name} 최종 실패: {last_err}", level=logging.ERROR)
57
+ write_log_message(f"{name} 최종 실패: {last_err}", level=logging.ERROR)
58
58
  if fallback is not None:
59
59
  try:
60
60
  fb_val = fallback()
61
- _emit_log(f"{name} 폴백 사용", level=logging.WARNING)
61
+ write_log_message(f"{name} 폴백 사용", level=logging.WARNING)
62
62
  return fb_val
63
63
  except Exception as e:
64
- _emit_log(f"{name} 폴백 실패: {e}", level=logging.ERROR)
64
+ write_log_message(f"{name} 폴백 실패: {e}", level=logging.ERROR)
65
65
  return None
66
66
 
67
67
 
@@ -161,7 +161,7 @@ async def record_event(todo: Dict[str, Any], data: Dict[str, Any], event_type: O
161
161
 
162
162
  resp = await _async_retry(_call, name="record_event", fallback=lambda: None)
163
163
  if resp is None:
164
- _emit_log("record_event 최종 실패(무시)", level=logging.WARNING)
164
+ write_log_message("record_event 최종 실패(무시)", level=logging.WARNING)
165
165
 
166
166
 
167
167
  # ------------------------------
@@ -332,9 +332,10 @@ async def fetch_form_types(tool_val: str, tenant_id: str) -> Tuple[str, List[Dic
332
332
  client.table("form_def").select("fields_json").eq("id", form_id).eq("tenant_id", tenant_id).execute()
333
333
  )
334
334
  fields_json = resp.data[0].get("fields_json") if resp.data else None
335
+ form_html = resp.data[0].get('html') if resp.data else None
335
336
  if not fields_json:
336
- return form_id, [{"key": form_id, "type": "default", "text": ""}]
337
- return form_id, fields_json
337
+ return form_id, [{"key": form_id, "type": "default", "text": ""}], form_html
338
+ return form_id, fields_json, form_html
338
339
 
339
340
  resp = await _async_retry(_call, name="fetch_form_types", fallback=lambda: (tool_val, [{"key": tool_val, "type": "default", "text": ""}]))
340
341
  return resp if resp else (tool_val, [{"key": tool_val, "type": "default", "text": ""}])
@@ -349,7 +350,7 @@ async def fetch_tenant_mcp_config(tenant_id: str) -> Optional[Dict[str, Any]]:
349
350
  resp = await _async_retry(_call, name="fetch_tenant_mcp_config", fallback=lambda: None)
350
351
  return resp.data.get("mcp") if resp and resp.data else None
351
352
  except Exception as e:
352
- _emit_error("fetch_tenant_mcp_config 실패", e, raise_error=False)
353
+ handle_application_error("fetch_tenant_mcp_config 실패", e, raise_error=False)
353
354
  return None
354
355
 
355
356
 
@@ -395,14 +396,14 @@ def save_notification(
395
396
  try:
396
397
  # 대상 사용자가 없으면 작업 생략
397
398
  if not user_ids_csv:
398
- _emit_log(f"알림 저장 생략: 대상 사용자 없음 (user_ids_csv={user_ids_csv})")
399
+ write_log_message(f"알림 저장 생략: 대상 사용자 없음 (user_ids_csv={user_ids_csv})")
399
400
  return
400
401
 
401
402
  supabase = get_db_client()
402
403
 
403
404
  user_ids: List[str] = [uid.strip() for uid in user_ids_csv.split(',') if uid and uid.strip()]
404
405
  if not user_ids:
405
- _emit_log(f"알림 저장 생략: 유효한 사용자 ID 없음 (user_ids_csv={user_ids_csv})")
406
+ write_log_message(f"알림 저장 생략: 유효한 사용자 ID 없음 (user_ids_csv={user_ids_csv})")
406
407
  return
407
408
 
408
409
  rows: List[Dict[str, Any]] = []
@@ -421,10 +422,10 @@ def save_notification(
421
422
  )
422
423
 
423
424
  supabase.table("notifications").insert(rows).execute()
424
- _emit_log(f"알림 저장 완료: {len(rows)}건")
425
+ write_log_message(f"알림 저장 완료: {len(rows)}건")
425
426
  except Exception as e:
426
427
  # 알림 저장 실패는 치명적이지 않으므로 오류만 로깅
427
- _emit_error("알림저장오류", e, raise_error=False)
428
+ handle_application_error("알림저장오류", e, raise_error=False)
428
429
 
429
430
 
430
431
  def _is_valid_uuid(value: str) -> bool:
@@ -502,7 +503,7 @@ async def fetch_human_users_by_proc_inst_id(proc_inst_id: str) -> str:
502
503
  return ','.join(human_user_emails)
503
504
 
504
505
  except Exception as e:
505
- _emit_error("사용자조회오류", e, raise_error=False)
506
+ handle_application_error("사용자조회오류", e, raise_error=False)
506
507
  return ""
507
508
 
508
509
  return await asyncio.to_thread(_sync)
@@ -86,7 +86,7 @@ class ProcessGPTAgentServer:
86
86
  mcp_config = await fetch_tenant_mcp_config(str(task_record.get("tenant_id", "")))
87
87
  write_log_message(f"[PREP] mcp_config(툴) → {mcp_config}")
88
88
 
89
- form_id, form_types = await fetch_form_types(
89
+ form_id, form_types, form_html = await fetch_form_types(
90
90
  str(task_record.get("tool", "")),
91
91
  str(task_record.get("tenant_id", ""))
92
92
  )
@@ -108,6 +108,7 @@ class ProcessGPTAgentServer:
108
108
  "mcp_config": mcp_config,
109
109
  "form_id": form_id,
110
110
  "form_types": form_types or [],
111
+ "form_html": form_html or "",
111
112
  "activity_name": str(task_record.get("activity_name", "")),
112
113
  "message": str(task_record.get("description", "")),
113
114
  "agent_orch": str(task_record.get("agent_orch", "")),
@@ -6,7 +6,7 @@ import asyncio
6
6
  from typing import Any, Tuple
7
7
 
8
8
  import openai
9
- from .logger import handle_error as _emit_error, log as _emit_log
9
+ from .logger import handle_application_error, write_log_message
10
10
 
11
11
 
12
12
  async def summarize_async(outputs: Any, feedbacks: Any, contents: Any = None) -> Tuple[str, str]:
@@ -24,12 +24,12 @@ async def summarize_async(outputs: Any, feedbacks: Any, contents: Any = None) ->
24
24
  feedback_summary = ""
25
25
 
26
26
  if outputs_str:
27
- _emit_log("요약 호출(이전결과물)")
27
+ write_log_message("요약 호출(이전결과물)")
28
28
  output_prompt = _create_output_summary_prompt(outputs_str)
29
29
  output_summary = await _call_openai_api_async(output_prompt, task_name="output")
30
30
 
31
31
  if feedbacks_str or contents_str:
32
- _emit_log("요약 호출(피드백)")
32
+ write_log_message("요약 호출(피드백)")
33
33
  feedback_prompt = _create_feedback_summary_prompt(feedbacks_str, contents_str)
34
34
  feedback_summary = await _call_openai_api_async(feedback_prompt, task_name="feedback")
35
35
 
@@ -113,10 +113,10 @@ async def _call_openai_api_async(prompt: str, task_name: str) -> str:
113
113
  raise
114
114
  except Exception as e:
115
115
  if attempt < 3:
116
- _emit_error("요약 호출 오류(재시도)", e, raise_error=False, extra={"attempt": attempt})
116
+ handle_application_error("요약 호출 오류(재시도)", e, raise_error=False, extra={"attempt": attempt})
117
117
  # 간단한 지수 백오프
118
118
  await asyncio.sleep(0.8 * (2 ** (attempt - 1)))
119
119
  continue
120
120
  # 최종 실패 시 빈 문자열로 폴백
121
- _emit_error("요약 호출 최종 실패", e, raise_error=False)
121
+ handle_application_error("요약 호출 최종 실패", e, raise_error=False)
122
122
  return ""