process-gpt-agent-sdk 0.4.8__tar.gz → 0.4.10__tar.gz

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.4.8
3
+ Version: 0.4.10
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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: process-gpt-agent-sdk
3
- Version: 0.4.8
3
+ Version: 0.4.10
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
@@ -322,38 +322,104 @@ class ProcessGPTEventQueue(EventQueue):
322
322
  raise
323
323
 
324
324
  def _extract_payload(self, event: Event) -> Any:
325
- artifact_or_none = getattr(event, "artifact", None)
326
- status_or_none = getattr(event, "status", None)
327
- message_or_none = getattr(status_or_none, "message", None)
328
- source = artifact_or_none if artifact_or_none is not None else message_or_none
329
- return self._parse_json_or_text(source)
325
+ try:
326
+ logger.info("🔧 [이벤트 페이로드 추출 시작] event_type: %s", type(event).__name__)
327
+ artifact_or_none = getattr(event, "artifact", None)
328
+ status_or_none = getattr(event, "status", None)
329
+ message_or_none = getattr(status_or_none, "message", None) if status_or_none else None
330
+
331
+ logger.info("🔧 [이벤트 페이로드] artifact: %s", artifact_or_none)
332
+ logger.info("🔧 [이벤트 페이로드] status: %s", status_or_none)
333
+ logger.info("🔧 [이벤트 페이로드] message: %s", message_or_none)
334
+
335
+ source = artifact_or_none if artifact_or_none is not None else message_or_none
336
+ logger.info("🔧 [이벤트 페이로드] source: %s (type: %s)", source, type(source).__name__)
337
+
338
+ result = self._parse_json_or_text(source)
339
+ logger.info("🔧 [이벤트 페이로드] 파싱 결과: %s (type: %s)", result, type(result).__name__)
340
+ return result
341
+ except Exception as e:
342
+ logger.error("❌ [이벤트 페이로드 추출 실패] %s", str(e), exc_info=e)
343
+ return {}
330
344
 
331
345
  def _parse_json_or_text(self, value: Any) -> Any:
346
+ logger.info("🔧 [JSON 파싱 시작] value: %s (type: %s)", value, type(value).__name__)
347
+
332
348
  if value is None:
349
+ logger.info("🔧 [JSON 파싱] None 값 -> 빈 객체 반환")
333
350
  return {}
351
+
334
352
  if isinstance(value, str):
335
353
  text = value.strip()
354
+ logger.info("🔧 [JSON 파싱] 문자열 처리 - text: '%s' (길이: %d)", text, len(text))
336
355
  if not text:
356
+ logger.info("🔧 [JSON 파싱] 빈 문자열 -> 빈 문자열 반환")
337
357
  return ""
338
- return json.loads(text)
358
+ # JSON인지 먼저 확인 (중괄호나 대괄호로 시작하는지)
359
+ if text.startswith(('{', '[')):
360
+ try:
361
+ result = json.loads(text)
362
+ logger.info("🔧 [JSON 파싱] JSON 파싱 성공: %s", result)
363
+ return result
364
+ except json.JSONDecodeError as e:
365
+ logger.debug("🔧 [JSON 파싱] JSON 파싱 실패 - 텍스트로 처리: %s", str(e))
366
+ return text
367
+ else:
368
+ logger.debug("🔧 [JSON 파싱] 문자열은 JSON 형태가 아님 - 텍스트로 처리")
369
+ return text
339
370
  if hasattr(value, "model_dump") and callable(getattr(value, "model_dump")):
371
+ logger.info("🔧 [JSON 파싱] model_dump() 호출")
340
372
  value = value.model_dump()
341
373
  elif not isinstance(value, dict) and hasattr(value, "dict") and callable(getattr(value, "dict")):
374
+ logger.info("🔧 [JSON 파싱] dict() 호출")
342
375
  value = value.dict()
343
376
  elif not isinstance(value, dict) and hasattr(value, "__dict__"):
377
+ logger.info("🔧 [JSON 파싱] __dict__ 사용")
344
378
  value = value.__dict__
379
+
345
380
  if isinstance(value, dict):
381
+ logger.info("🔧 [JSON 파싱] 딕셔너리 처리 시작")
346
382
  parts = value.get("parts")
347
383
  if isinstance(parts, list) and parts:
384
+ logger.info("🔧 [JSON 파싱] parts 배열 처리 - parts: %s", parts)
348
385
  first = parts[0] if isinstance(parts[0], dict) else None
349
386
  if first and isinstance(first, dict):
350
387
  txt = first.get("text") or first.get("content") or first.get("data")
388
+ logger.info("🔧 [JSON 파싱] parts[0]에서 텍스트 추출: %s", txt)
351
389
  if isinstance(txt, str):
352
- return json.loads(txt)
390
+ # JSON인지 먼저 확인 (중괄호나 대괄호로 시작하는지)
391
+ txt_stripped = txt.strip()
392
+ if txt_stripped.startswith(('{', '[')):
393
+ try:
394
+ result = json.loads(txt)
395
+ logger.info("🔧 [JSON 파싱] parts 텍스트 JSON 파싱 성공: %s", result)
396
+ return result
397
+ except Exception as e:
398
+ logger.debug("🔧 [JSON 파싱] parts 텍스트 JSON 파싱 실패 - 텍스트로 처리: %s", str(e))
399
+ return txt
400
+ else:
401
+ logger.debug("🔧 [JSON 파싱] parts 텍스트는 JSON 형태가 아님 - 텍스트로 처리")
402
+ return txt
353
403
  top_text = value.get("text") or value.get("content") or value.get("data")
404
+ logger.info("🔧 [JSON 파싱] 최상위 텍스트 추출: %s", top_text)
354
405
  if isinstance(top_text, str):
355
- return json.loads(top_text)
406
+ # JSON인지 먼저 확인 (중괄호나 대괄호로 시작하는지)
407
+ top_text_stripped = top_text.strip()
408
+ if top_text_stripped.startswith(('{', '[')):
409
+ try:
410
+ result = json.loads(top_text)
411
+ logger.info("🔧 [JSON 파싱] 최상위 텍스트 JSON 파싱 성공: %s", result)
412
+ return result
413
+ except Exception as e:
414
+ logger.debug("🔧 [JSON 파싱] 최상위 텍스트 JSON 파싱 실패 - 텍스트로 처리: %s", str(e))
415
+ return top_text
416
+ else:
417
+ logger.debug("🔧 [JSON 파싱] 최상위 텍스트는 JSON 형태가 아님 - 텍스트로 처리")
418
+ return top_text
419
+ logger.info("🔧 [JSON 파싱] 딕셔너리 그대로 반환: %s", value)
356
420
  return value
421
+
422
+ logger.info("🔧 [JSON 파싱] 기타 타입 그대로 반환: %s", value)
357
423
  return value
358
424
 
359
425
  def task_done(self) -> None:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "process-gpt-agent-sdk"
7
- version = "0.4.8"
7
+ version = "0.4.10"
8
8
  description = "Supabase 기반 이벤트/작업 폴링으로 A2A AgentExecutor를 실행하는 SDK"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"