process-gpt-agent-sdk 0.3.5__tar.gz → 0.3.7__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.3.5
3
+ Version: 0.3.7
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.3.5
3
+ Version: 0.3.7
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
@@ -8,6 +8,7 @@ from .database import (
8
8
  initialize_db,
9
9
  get_consumer_id,
10
10
  polling_pending_todos,
11
+ fetch_any_task,
11
12
  record_event,
12
13
  record_events_bulk,
13
14
  save_task_result,
@@ -30,6 +31,7 @@ __all__ = [
30
31
  "initialize_db",
31
32
  "get_consumer_id",
32
33
  "polling_pending_todos",
34
+ "fetch_any_task",
33
35
  "record_event",
34
36
  "record_events_bulk",
35
37
  "save_task_result",
@@ -81,7 +81,8 @@ def initialize_db() -> None:
81
81
  if os.getenv("ENV") != "production":
82
82
  load_dotenv()
83
83
  supabase_url = os.getenv("SUPABASE_URL") or os.getenv("SUPABASE_KEY_URL")
84
- supabase_key = os.getenv("SUPABASE_KEY") or os.getenv("SUPABASE_ANON_KEY")
84
+ supabase_key = os.getenv("SERVICE_ROLE_KEY") or os.getenv("SUPABASE_KEY") or os.getenv("SUPABASE_ANON_KEY")
85
+ print("supabase_url: %s\n, supabase_key: %s\n", supabase_url, supabase_key)
85
86
  if not supabase_url or not supabase_key:
86
87
  raise RuntimeError("SUPABASE_URL 및 SUPABASE_KEY가 필요합니다")
87
88
  _supabase_client = create_client(supabase_url, supabase_key)
@@ -129,7 +130,7 @@ async def polling_pending_todos(agent_orch: str, consumer: str) -> Optional[Dict
129
130
  "p_env": p_env,
130
131
  },
131
132
  ).execute()
132
-
133
+ print("polling_pending_todos resp: %s", resp)
133
134
  rows = resp.data or []
134
135
  if not rows:
135
136
  return None
@@ -147,6 +148,21 @@ async def polling_pending_todos(agent_orch: str, consumer: str) -> Optional[Dict
147
148
 
148
149
  return await _async_retry(_call, name="polling_pending_todos", fallback=lambda: None)
149
150
 
151
+ async def fetch_any_task(limit: int = 1) -> Optional[Dict[str, Any]]:
152
+ """테스트용: 아무 조건 없이 그냥 SELECT만"""
153
+
154
+ def _call():
155
+ client = get_db_client()
156
+ resp = client.table("todolist").select("*").limit(limit).execute()
157
+ print("fetch_any_task resp: %s", resp)
158
+ # resp = client.rpc("fetch_any_task", {"p_limit": limit}).execute()
159
+ rows = resp.data or []
160
+ if not rows:
161
+ return None
162
+ return rows[0]
163
+
164
+ return await _async_retry(_call, name="fetch_any_task", fallback=lambda: None)
165
+
150
166
 
151
167
  # ------------------------------ Events & Results ------------------------------
152
168
  async def record_events_bulk(payloads: List[Dict[str, Any]]) -> None:
@@ -16,6 +16,7 @@ from a2a.types import TaskArtifactUpdateEvent, TaskState, TaskStatusUpdateEvent
16
16
  from .database import (
17
17
  initialize_db,
18
18
  polling_pending_todos,
19
+ fetch_any_task,
19
20
  record_events_bulk,
20
21
  record_event,
21
22
  save_task_result,
@@ -392,6 +393,16 @@ class ProcessGPTAgentServer:
392
393
  try:
393
394
  logger.info("🔍 [폴링 시작] 작업 대기 중... (agent_orch=%s)", self.agent_orch)
394
395
 
396
+ # 테스트: 조건 없이 레코드 확인
397
+
398
+ test_row = await fetch_any_task(limit=1)
399
+ if test_row:
400
+ logger.info("📋 [테스트 조회] 조건 없이 발견된 작업: ID=%s, status=%s, agent_mode=%s, draft=%s, draft_status=%s, agent_orch=%s, tenant_id=%s",
401
+ test_row.get('id'), test_row.get('status'), test_row.get('agent_mode'),
402
+ test_row.get('draft'), test_row.get('draft_status'), test_row.get('agent_orch'), test_row.get('tenant_id'))
403
+ else:
404
+ logger.info("📋 [테스트 조회] todolist 테이블에 레코드가 없음 %s", str(test_row))
405
+
395
406
  row = await polling_pending_todos(self.agent_orch, get_consumer_id())
396
407
 
397
408
  if row:
@@ -408,7 +419,9 @@ class ProcessGPTAgentServer:
408
419
  self._current_todo_id = None
409
420
  # 작업이 있었으므로 슬립 생략 → 즉시 다음 폴링
410
421
  continue
411
-
422
+ else:
423
+ logger.info("⏸️ [폴링 결과 없음] 조건에 맞는 작업이 없음 - 10초 대기 %s", str(row))
424
+
412
425
  # 작업 없을 때만 10초 대기
413
426
  await asyncio.sleep(10)
414
427
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "process-gpt-agent-sdk"
7
- version = "0.3.5"
7
+ version = "0.3.7"
8
8
  description = "Supabase 기반 이벤트/작업 폴링으로 A2A AgentExecutor를 실행하는 SDK"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"