agentforge-multi 0.1.2 → 0.1.4

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.
Files changed (2) hide show
  1. package/agentforge +274 -244
  2. package/package.json +1 -1
package/agentforge CHANGED
@@ -7,7 +7,7 @@ Usage:
7
7
 
8
8
  Slash commands:
9
9
  /exit 종료
10
- /plan <목표> 계획 수립 후 실행
10
+ /resume 마지막 세션 재개
11
11
  <일반 텍스트> Worker에게 즉시 전달 (목표 설정)
12
12
  """
13
13
 
@@ -18,7 +18,6 @@ import re
18
18
  import select
19
19
  import subprocess
20
20
  import sys
21
- import tempfile
22
21
  import termios
23
22
  import textwrap
24
23
  import threading
@@ -27,6 +26,8 @@ import tty
27
26
  from collections import deque
28
27
  from pathlib import Path
29
28
 
29
+ import requests as _requests
30
+
30
31
  from rich.console import Console
31
32
  from rich.layout import Layout
32
33
  from rich.live import Live
@@ -45,6 +46,9 @@ from prompt_toolkit.formatted_text import HTML
45
46
  CODEX_BIN = Path.home() / ".npm-global" / "bin" / "codex"
46
47
  DEFAULT_MAX_ITER = 5000
47
48
  WORKER_BUF_LINES = 60
49
+ DEFAULT_WORKER_MODEL = "gpt-5.4"
50
+ DEFAULT_EVAL_MODEL = "gpt-5.1-codex-mini"
51
+ CHATGPT_RESPONSES_URL = "https://chatgpt.com/backend-api/codex/responses"
48
52
  ANSI_RE = re.compile(r'\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07]*\x07')
49
53
  DECISION_RE = re.compile(r'^(DONE|IMPROVE|REDIRECT)(?::\s*(.*))?$', re.I | re.M)
50
54
  NOISE_RE = re.compile(r'^\s*([\-─═\s]+)?$')
@@ -52,12 +56,153 @@ NOISE_RE = re.compile(r'^\s*([\-─═\s]+)?$')
52
56
  console = Console()
53
57
  _last_session: dict | None = None # {goal, history, eval_history, workdir}
54
58
  _interrupt_event = threading.Event() # ESC 감지 플래그
55
- _current_proc: subprocess.Popen | None = None # 현재 실행 중인 subprocess
59
+
60
+ # ── ChatGPT backend API ────────────────────────────────────────────────────────
61
+
62
+ def _get_auth_headers() -> dict:
63
+ """~/.codex/auth.json 에서 Bearer 헤더 + ChatGPT-Account-Id 반환."""
64
+ auth_file = Path.home() / ".codex" / "auth.json"
65
+ data = json.loads(auth_file.read_text())
66
+ token = data["tokens"]["access_token"]
67
+ account_id = data["tokens"].get("account_id", "")
68
+ return {
69
+ "Authorization": f"Bearer {token}",
70
+ "Content-Type": "application/json",
71
+ "ChatGPT-Account-Id": account_id,
72
+ }
73
+
74
+
75
+ WORKER_TOOLS = [
76
+ {
77
+ "type": "function",
78
+ "name": "shell",
79
+ "description": (
80
+ "Execute a shell command. Default timeout is 120s. "
81
+ "For long-running training/monitoring commands, set timeout_seconds (max 7200). "
82
+ "For fire-and-forget background jobs use '... &' and a short follow-up tail command."
83
+ ),
84
+ "parameters": {
85
+ "type": "object",
86
+ "properties": {
87
+ "command": {"type": "string", "description": "Shell command to run"},
88
+ "timeout_seconds": {"type": "integer", "description": "Max seconds to wait (default 120, max 7200)"},
89
+ },
90
+ "required": ["command"],
91
+ },
92
+ "strict": False,
93
+ },
94
+ {
95
+ "type": "function",
96
+ "name": "read_file",
97
+ "description": "Read the full contents of a file",
98
+ "parameters": {
99
+ "type": "object",
100
+ "properties": {
101
+ "path": {"type": "string"},
102
+ },
103
+ "required": ["path"],
104
+ },
105
+ "strict": False,
106
+ },
107
+ {
108
+ "type": "function",
109
+ "name": "write_file",
110
+ "description": "Write content to a file (creates or overwrites)",
111
+ "parameters": {
112
+ "type": "object",
113
+ "properties": {
114
+ "path": {"type": "string"},
115
+ "content": {"type": "string"},
116
+ },
117
+ "required": ["path", "content"],
118
+ },
119
+ "strict": False,
120
+ },
121
+ {
122
+ "type": "function",
123
+ "name": "list_files",
124
+ "description": "List files and directories at a path",
125
+ "parameters": {
126
+ "type": "object",
127
+ "properties": {
128
+ "path": {"type": "string"},
129
+ },
130
+ "required": ["path"],
131
+ },
132
+ "strict": False,
133
+ },
134
+ ]
135
+
136
+
137
+ def _iter_events(payload: dict):
138
+ """
139
+ ChatGPT backend-api/codex/responses 스트리밍 호출.
140
+ SSE 이벤트를 실시간으로 yield. _interrupt_event가 set되면 조기 종료.
141
+ """
142
+ headers = _get_auth_headers()
143
+ try:
144
+ r = _requests.post(
145
+ CHATGPT_RESPONSES_URL, headers=headers,
146
+ json=payload, stream=True, timeout=300,
147
+ )
148
+ r.raise_for_status()
149
+ for line in r.iter_lines():
150
+ if _interrupt_event.is_set():
151
+ break
152
+ if not line:
153
+ continue
154
+ decoded = line.decode("utf-8", errors="replace")
155
+ if decoded.startswith("data: "):
156
+ try:
157
+ yield json.loads(decoded[6:])
158
+ except Exception:
159
+ pass
160
+ except Exception as e:
161
+ yield {"type": "_error", "message": str(e)}
162
+
163
+
164
+ def _execute_tool(name: str, args: dict, workdir: str) -> str:
165
+ """Worker 도구 실행."""
166
+ try:
167
+ if name == "shell":
168
+ timeout = min(int(args.get("timeout_seconds", 120)), 7200)
169
+ result = subprocess.run(
170
+ args["command"], shell=True,
171
+ capture_output=True, text=True, errors='replace',
172
+ cwd=workdir, timeout=timeout,
173
+ )
174
+ out = (result.stdout + result.stderr).strip()
175
+ return (out[:6000] if out else "(no output)") + (
176
+ f"\n[exit code: {result.returncode}]" if result.returncode != 0 else ""
177
+ )
178
+ elif name == "read_file":
179
+ path = Path(args["path"])
180
+ if not path.is_absolute():
181
+ path = Path(workdir) / path
182
+ return path.read_text(errors='replace')[:10000]
183
+ elif name == "write_file":
184
+ path = Path(args["path"])
185
+ if not path.is_absolute():
186
+ path = Path(workdir) / path
187
+ path.parent.mkdir(parents=True, exist_ok=True)
188
+ path.write_text(args["content"])
189
+ return f"Written: {path}"
190
+ elif name == "list_files":
191
+ path = Path(args["path"])
192
+ if not path.is_absolute():
193
+ path = Path(workdir) / path
194
+ items = sorted(path.iterdir())
195
+ return "\n".join(
196
+ ("dir " if p.is_dir() else "file ") + p.name for p in items
197
+ )
198
+ else:
199
+ return f"Unknown tool: {name}"
200
+ except Exception as e:
201
+ return f"Error: {e}"
56
202
 
57
203
  # ── Slash command autocomplete ────────────────────────────────────────────────
58
204
 
59
205
  SLASH_COMMANDS = [
60
- ("/plan", "계획을 수립한 뒤 Worker + Evaluator 루프 실행"),
61
206
  ("/resume", "마지막 세션을 이어서 실행"),
62
207
  ("/exit", "agentforge 종료"),
63
208
  ]
@@ -153,24 +298,6 @@ EVALUATOR_SYSTEM = textwrap.dedent("""\
153
298
  Do NOT write anything before the decision keyword.
154
299
  """).strip()
155
300
 
156
- PLAN_SYSTEM = textwrap.dedent("""\
157
- You are a planning agent. DO NOT write any code or modify any files.
158
- Your job is to create a detailed implementation plan in Korean.
159
-
160
- If anything is unclear, list your questions first in this format:
161
- 질문:
162
- 1. ...
163
- 2. ...
164
-
165
- If everything is clear, output the plan directly:
166
- 계획:
167
- - ...
168
- - ...
169
-
170
- Be specific and actionable. No code, only plan.
171
- """).strip()
172
-
173
-
174
301
  def build_worker_prompt(goal: str, history: list) -> str:
175
302
  lines = [f"GOAL: {goal}", ""]
176
303
  if not history:
@@ -208,18 +335,6 @@ def build_evaluator_prompt(goal: str, worker_output: str, iteration: int) -> str
208
335
  ])
209
336
 
210
337
 
211
- def build_plan_prompt(goal: str, qa_history: list) -> str:
212
- lines = [PLAN_SYSTEM, "", f"목표: {goal}"]
213
- if qa_history:
214
- lines.append("")
215
- lines.append("이전 질의응답:")
216
- for qa in qa_history:
217
- lines.append(f" Q: {qa['q']}")
218
- lines.append(f" A: {qa['a']}")
219
- lines.append("")
220
- lines.append("위 정보를 바탕으로 계획을 수립하거나 질문을 출력하라.")
221
- return "\n".join(lines)
222
-
223
338
 
224
339
  # ── Auth ──────────────────────────────────────────────────────────────────────
225
340
 
@@ -290,17 +405,21 @@ def cmd_auth_status():
290
405
  # ── ESC Listener ──────────────────────────────────────────────────────────────
291
406
 
292
407
  def _esc_listener(stop: threading.Event):
293
- """데몬 스레드: ESC 감지 _interrupt_event 설정."""
408
+ """데몬 스레드: /dev/tty 직접 열어 ESC 감지."""
294
409
  try:
295
- fd = sys.stdin.fileno()
296
- old = termios.tcgetattr(fd)
410
+ tty_fd = os.open('/dev/tty', os.O_RDONLY)
297
411
  except Exception:
298
412
  return
299
413
  try:
300
- tty.setcbreak(fd)
414
+ old = termios.tcgetattr(tty_fd)
415
+ new = list(old)
416
+ new[3] &= ~(termios.ICANON | termios.ECHO)
417
+ new[6][termios.VMIN] = 1
418
+ new[6][termios.VTIME] = 0
419
+ termios.tcsetattr(tty_fd, termios.TCSANOW, new)
301
420
  while not stop.is_set():
302
- if select.select([sys.stdin], [], [], 0.1)[0]:
303
- ch = os.read(fd, 1)
421
+ if select.select([tty_fd], [], [], 0.1)[0]:
422
+ ch = os.read(tty_fd, 1)
304
423
  if ch == b'\x1b':
305
424
  _interrupt_event.set()
306
425
  break
@@ -308,103 +427,130 @@ def _esc_listener(stop: threading.Event):
308
427
  pass
309
428
  finally:
310
429
  try:
311
- termios.tcsetattr(fd, termios.TCSADRAIN, old)
430
+ termios.tcsetattr(tty_fd, termios.TCSADRAIN, old)
431
+ os.close(tty_fd)
312
432
  except Exception:
313
433
  pass
314
434
 
315
435
 
316
436
  # ── Agent Runners ─────────────────────────────────────────────────────────────
317
437
 
318
- def _run_codex(cmd: list, workdir: str, buf: deque | None,
319
- status_ref: list | None) -> tuple[str, int]:
320
- """codex exec 실행. buf가 있으면 stdout 스트리밍. 최종 메시지 반환."""
321
- with tempfile.NamedTemporaryFile(mode='w', suffix='.txt', delete=False) as f:
322
- out_file = f.name
438
+ def run_worker(prompt: str, workdir: str, model: str | None,
439
+ buf: deque, status_ref: list) -> tuple[str, int]:
440
+ """Worker: ChatGPT backend Responses API 직접 호출 + 도구 실행 루프."""
441
+ model = model or DEFAULT_WORKER_MODEL
442
+ status_ref[0] = "running"
443
+
444
+ # 입력 히스토리 (user msg + function_call + function_call_output 누적)
445
+ input_history: list[dict] = [{"role": "user", "content": prompt}]
446
+ all_text_parts: list[str] = []
447
+ line_buf = ""
448
+
449
+ def _flush_line(text: str):
450
+ nonlocal line_buf
451
+ line_buf += text
452
+ while '\n' in line_buf:
453
+ ln, line_buf = line_buf.split('\n', 1)
454
+ if ln.strip() and not NOISE_RE.match(ln):
455
+ buf.append(colorize_line(ln))
456
+
457
+ for _round in range(30):
458
+ if _interrupt_event.is_set():
459
+ break
323
460
 
324
- full_cmd = cmd + ["-o", out_file]
325
- try:
326
- if buf is not None:
327
- global _current_proc
328
- if status_ref:
329
- status_ref[0] = "running"
330
- proc = subprocess.Popen(
331
- full_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
332
- text=True, errors='replace',
333
- )
334
- _current_proc = proc
335
- prev_line = ""
336
- for raw in proc.stdout:
337
- clean = strip_ansi(raw).rstrip()
338
- if clean and not NOISE_RE.match(clean) and clean != prev_line:
339
- buf.append(colorize_line(clean))
340
- prev_line = clean
341
- proc.wait()
342
- _current_proc = None
343
- rc = proc.returncode
344
- if status_ref:
345
- status_ref[0] = "done"
346
- else:
347
- proc = subprocess.run(
348
- full_cmd, capture_output=True, text=True, errors='replace',
349
- )
350
- rc = proc.returncode
351
- except Exception as e:
352
- if buf is not None:
353
- buf.append(f"[red][ERROR] {e}[/red]")
354
- if status_ref:
355
- status_ref[0] = "error"
356
- rc = 1
461
+ payload = {
462
+ "model": model,
463
+ "instructions": WORKER_SYSTEM,
464
+ "input": input_history,
465
+ "tools": WORKER_TOOLS,
466
+ "store": False,
467
+ "stream": True,
468
+ }
469
+
470
+ # 실시간 스트리밍 처리
471
+ text_parts: list[str] = []
472
+ fc_items: list[dict] = [] # {call_id, name, arguments}
473
+ got_error = False
474
+
475
+ for ev in _iter_events(payload):
476
+ evtype = ev["type"]
477
+ if evtype == "_error":
478
+ buf.append(f"[red]API 오류: {ev['message']}[/red]")
479
+ status_ref[0] = "error"
480
+ if line_buf.strip():
481
+ buf.append(colorize_line(line_buf))
482
+ got_error = True
483
+ break
484
+ elif evtype == "response.output_text.delta":
485
+ delta = ev.get("delta", "")
486
+ text_parts.append(delta)
487
+ _flush_line(delta)
488
+ elif evtype == "response.output_item.done" and ev.get("item", {}).get("type") == "function_call":
489
+ item = ev["item"]
490
+ fc_items.append({
491
+ "call_id": item["call_id"],
492
+ "name": item["name"],
493
+ "arguments": item["arguments"],
494
+ })
495
+
496
+ if got_error:
497
+ return "\n".join(all_text_parts), 1
498
+
499
+ round_text = "".join(text_parts)
500
+ if round_text:
501
+ all_text_parts.append(round_text)
502
+
503
+ # 도구 호출 없으면 종료
504
+ if not fc_items:
505
+ break
357
506
 
358
- last_msg = ""
359
- try:
360
- last_msg = strip_ansi(Path(out_file).read_text()).strip()
361
- except Exception:
362
- if buf:
363
- last_msg = strip_ansi("\n".join(list(buf)[-10:]))
364
- finally:
365
- try:
366
- Path(out_file).unlink()
367
- except Exception:
368
- pass
507
+ # 도구 실행 및 히스토리에 추가
508
+ for fc in fc_items:
509
+ call_id = fc["call_id"]
510
+ name = fc["name"]
511
+ raw_args = fc["arguments"]
512
+ try:
513
+ args = json.loads(raw_args)
514
+ except Exception:
515
+ args = {}
369
516
 
370
- return last_msg, rc
517
+ arg_preview = raw_args[:80]
518
+ buf.append(f"[cyan]▶ {name}({arg_preview})[/cyan]")
519
+ result = _execute_tool(name, args, workdir)
520
+ short = result[:300].replace('\n', ' ')
521
+ buf.append(f"[dim]{short}[/dim]")
371
522
 
523
+ # Responses API 형식 히스토리
524
+ input_history.append({"type": "function_call", "call_id": call_id,
525
+ "name": name, "arguments": raw_args})
526
+ input_history.append({"type": "function_call_output", "call_id": call_id,
527
+ "output": result})
372
528
 
373
- def run_worker(prompt: str, workdir: str, model: str | None,
374
- buf: deque, status_ref: list) -> tuple[str, int]:
375
- cmd = [
376
- str(CODEX_BIN), "exec",
377
- "--full-auto", "--skip-git-repo-check", "--color", "never",
378
- "-C", workdir,
379
- ]
380
- if model:
381
- cmd += ["-m", model]
382
- cmd.append(prompt)
383
- return _run_codex(cmd, workdir, buf, status_ref)
529
+ # 잔여 line_buf flush
530
+ if line_buf.strip():
531
+ buf.append(colorize_line(line_buf))
532
+
533
+ status_ref[0] = "done"
534
+ return "\n".join(all_text_parts), 0
384
535
 
385
536
 
386
537
  def run_evaluator(prompt: str, workdir: str, model: str | None) -> tuple[str, int]:
387
- cmd = [
388
- str(CODEX_BIN), "exec",
389
- "-s", "read-only", "--skip-git-repo-check", "--color", "never",
390
- "-C", workdir,
391
- ]
392
- if model:
393
- cmd += ["-m", model]
394
- cmd.append(prompt)
395
- return _run_codex(cmd, workdir, None, None)
396
-
397
-
398
- def run_plan_agent(prompt: str, workdir: str, model: str | None) -> tuple[str, int]:
399
- cmd = [
400
- str(CODEX_BIN), "exec",
401
- "-s", "read-only", "--skip-git-repo-check", "--color", "never",
402
- "-C", workdir,
403
- ]
404
- if model:
405
- cmd += ["-m", model]
406
- cmd.append(prompt)
407
- return _run_codex(cmd, workdir, None, None)
538
+ """Evaluator: ChatGPT backend Responses API, 도구 없이 텍스트만."""
539
+ model = model or DEFAULT_EVAL_MODEL
540
+ payload = {
541
+ "model": model,
542
+ "instructions": EVALUATOR_SYSTEM,
543
+ "input": [{"role": "user", "content": prompt}],
544
+ "store": False,
545
+ "stream": True,
546
+ }
547
+ parts: list[str] = []
548
+ for ev in _iter_events(payload):
549
+ if ev["type"] == "_error":
550
+ return f"[Evaluator error] {ev['message']}", 1
551
+ if ev["type"] == "response.output_text.delta":
552
+ parts.append(ev.get("delta", ""))
553
+ return "".join(parts), 0
408
554
 
409
555
 
410
556
  def parse_decision(text: str) -> tuple[str, str]:
@@ -439,10 +585,9 @@ def make_layout() -> Layout:
439
585
  def render_header(goal: str, iteration: int, max_iter: int, phase: str) -> Panel:
440
586
  g = goal[:72] + "..." if len(goal) > 72 else goal
441
587
  status = {
442
- "idle": "[dim]명령 대기 중 /plan <목표> 또는 <목표> 입력[/dim]",
588
+ "idle": "[dim]명령 대기 중 목표를 입력하거나 /resume /exit[/dim]",
443
589
  "worker": "⚙ [bold yellow on black] WORKER 실행 중 [/bold yellow on black] [dim]Evaluator 대기[/dim]",
444
590
  "evaluator": "[dim]Worker 완료[/dim] → ◈ [bold magenta on black] EVALUATOR 평가 중 [/bold magenta on black]",
445
- "planning": "◑ [bold cyan on black] PLAN AGENT 실행 중 [/bold cyan on black]",
446
591
  "done": "[bold green]✓ 완료[/bold green]",
447
592
  "max": "[bold red]⚠ 최대 반복 도달[/bold red]",
448
593
  }.get(phase, phase)
@@ -528,8 +673,6 @@ def render_evaluator_panel(eval_history: list, iteration: int,
528
673
  if phase == "evaluator":
529
674
  lines.append(f"[magenta bold]── Iter {iteration} (평가 중) ──────────────[/magenta bold]")
530
675
  lines.append("[magenta blink]평가 중...[/magenta blink]")
531
- elif phase == "planning":
532
- lines.append("[cyan blink]계획 수립 중...[/cyan blink]")
533
676
  border = "green" if done else "magenta"
534
677
  is_active = (phase == "evaluator")
535
678
  if done:
@@ -546,82 +689,6 @@ def render_evaluator_panel(eval_history: list, iteration: int,
546
689
  )
547
690
 
548
691
 
549
- # ── Plan Mode ─────────────────────────────────────────────────────────────────
550
-
551
- def run_plan_mode(raw_goal: str, workdir: str, model: str | None,
552
- layout: Layout, live: Live) -> str | None:
553
- """
554
- /plan 모드: Plan Agent와 대화 후 최종 계획(목표 문자열)을 반환.
555
- 취소 시 None 반환.
556
- """
557
- goal = raw_goal.strip()
558
- if not goal:
559
- live.stop()
560
- try:
561
- goal = input("계획할 목표를 입력하세요: ").strip()
562
- except (EOFError, KeyboardInterrupt):
563
- return None
564
- if not goal:
565
- return None
566
-
567
- qa_history = []
568
-
569
- while True:
570
- # Plan Agent 실행
571
- layout["header"].update(render_header(goal, 0, 0, "planning"))
572
- layout["worker"].update(render_worker_panel(deque(), 0, "idle", [], False))
573
- layout["evaluator"].update(render_evaluator_panel([], 0, "planning", False))
574
- live.start()
575
- time.sleep(0.2)
576
-
577
- plan_prompt = build_plan_prompt(goal, qa_history)
578
- plan_output, _ = run_plan_agent(plan_prompt, workdir, model)
579
-
580
- live.stop()
581
- console.print()
582
-
583
- # 질문이 있는지 확인
584
- has_questions = '질문:' in plan_output or re.search(r'^\d+\.\s', plan_output, re.M)
585
- has_plan = '계획:' in plan_output or re.search(r'^[-•]\s', plan_output, re.M)
586
-
587
- console.print(Rule("[cyan]Plan Agent[/cyan]"))
588
- console.print(plan_output)
589
- console.print()
590
-
591
- if has_questions and not has_plan:
592
- # 질의응답
593
- console.print("[dim]질문에 답변하세요 (취소: /cancel):[/dim]")
594
- try:
595
- answer = input("> ").strip()
596
- except (EOFError, KeyboardInterrupt):
597
- return None
598
- if answer.lower() in ('/cancel', '/exit'):
599
- return None
600
- qa_history.append({'q': plan_output, 'a': answer})
601
- continue # 다시 Plan Agent 실행
602
-
603
- # 계획 수립 완료 → accept
604
- console.print("[dim]이 계획으로 진행하시겠습니까? (y: 실행 / n: 다시 작성 / /cancel: 취소)[/dim]")
605
- try:
606
- ans = input("accept (y/n) > ").strip().lower()
607
- except (EOFError, KeyboardInterrupt):
608
- return None
609
- if ans == 'y':
610
- # 계획 내용을 목표로 삼아 반환
611
- final_goal = f"{goal}\n\n[계획]\n{plan_output}"
612
- return final_goal
613
- elif ans in ('/cancel', '/exit'):
614
- return None
615
- # n → 다시 처음부터
616
- qa_history.clear()
617
- try:
618
- new_goal = input("새 목표를 입력하거나 Enter로 기존 목표 유지: ").strip()
619
- except (EOFError, KeyboardInterrupt):
620
- return None
621
- if new_goal:
622
- goal = new_goal
623
-
624
-
625
692
  # ── Agent Loop ────────────────────────────────────────────────────────────────
626
693
 
627
694
  def run_agent_loop(goal: str, workdir: str, worker_model: str | None,
@@ -676,12 +743,10 @@ def run_agent_loop(goal: str, workdir: str, worker_model: str | None,
676
743
  t.start()
677
744
  while t.is_alive():
678
745
  if _interrupt_event.is_set():
679
- if _current_proc:
680
- _current_proc.kill()
681
- break
746
+ break # worker 스레드는 _interrupt_event 확인 후 자체 중단
682
747
  refresh("worker", iteration)
683
748
  time.sleep(0.1)
684
- t.join()
749
+ t.join(timeout=10) # 최대 10초 대기 후 포기
685
750
  refresh("worker", iteration)
686
751
 
687
752
  # ESC로 중단된 경우
@@ -840,10 +905,6 @@ def main():
840
905
  auth_parser.print_help()
841
906
  return
842
907
 
843
- if not CODEX_BIN.exists():
844
- console.print(f"[bold red]Error:[/bold red] codex not found at {CODEX_BIN}")
845
- sys.exit(1)
846
-
847
908
  workdir = str(Path(args.dir).resolve())
848
909
  max_iter = args.max_iterations
849
910
 
@@ -877,7 +938,7 @@ def main():
877
938
  "agentforge auth login 으로 나중에 로그인할 수 있습니다.[/dim]"
878
939
  )
879
940
 
880
- console.print("[dim]명령을 입력하세요. /plan <목표> | /exit[/dim]")
941
+ console.print("[dim]명령을 입력하세요. /resume | /exit[/dim]")
881
942
 
882
943
  _completer = SlashCompleter()
883
944
 
@@ -906,37 +967,6 @@ def main():
906
967
  console.print("[dim]종료합니다.[/dim]")
907
968
  break
908
969
 
909
- elif cmd_name == 'plan':
910
- # Plan 모드
911
- layout["header"].update(render_header(cmd_arg or "", 0, max_iter, "idle"))
912
- layout["worker"].update(render_worker_panel(deque(), 0, "idle", [], False))
913
- layout["evaluator"].update(render_evaluator_panel([], 0, "idle", False))
914
-
915
- final_goal = run_plan_mode(cmd_arg, workdir, args.worker_model, layout, live)
916
- if final_goal is None:
917
- console.print("[dim]계획 취소됨.[/dim]")
918
- continue
919
- console.print()
920
- console.print("[cyan]계획 확정. Worker + Evaluator 루프를 시작합니다...[/cyan]")
921
- time.sleep(0.5)
922
- # 새 layout/live 인스턴스로 루프 실행
923
- layout2 = make_layout()
924
- layout2["header"].update(render_header(final_goal, 0, max_iter, "idle"))
925
- layout2["worker"].update(render_worker_panel(deque(), 0, "idle", [], False))
926
- layout2["evaluator"].update(render_evaluator_panel([], 0, "idle", False))
927
- live2 = Live(layout2, refresh_per_second=8, screen=False)
928
- outcome = run_agent_loop(
929
- final_goal, workdir, args.worker_model, args.eval_model,
930
- max_iter, layout2, live2,
931
- )
932
- goal = final_goal
933
- if outcome == 'interrupted':
934
- goal = _handle_interrupt(goal, workdir, args, max_iter)
935
- elif outcome == 'max':
936
- console.print(f"[red]{max_iter}번 반복 후에도 완료되지 않았습니다.[/red]")
937
- if outcome != 'interrupted':
938
- console.print("[dim]다음 명령을 입력하세요. /exit 로 종료.[/dim]")
939
-
940
970
  elif cmd_name == 'resume':
941
971
  if not _last_session:
942
972
  console.print("[yellow]재개할 세션이 없습니다. 먼저 목표를 실행하세요.[/yellow]")
@@ -969,7 +999,7 @@ def main():
969
999
 
970
1000
  else:
971
1001
  console.print(f"[red]알 수 없는 커맨드: /{cmd_name}[/red]")
972
- console.print("[dim]사용 가능: /plan <목표> /resume /exit[/dim]")
1002
+ console.print("[dim]사용 가능: /resume /exit[/dim]")
973
1003
 
974
1004
  else:
975
1005
  # 일반 텍스트 → 바로 Worker에게 목표로 전달
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentforge-multi",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Multi-agent CLI: Worker + Evaluator agents collaborate in a loop to achieve your goal",
5
5
  "keywords": [
6
6
  "ai",