()
| 459 | return False |
| 460 | |
| 461 | def run(): |
| 462 | wt_ctx = {"path": None} |
| 463 | |
| 464 | def _wt_cwd(): |
| 465 | p = wt_ctx["path"] |
| 466 | return Path(p) if p else None |
| 467 | |
| 468 | def _run_bash(command: str) -> str: |
| 469 | return run_bash(command, cwd=_wt_cwd()) |
| 470 | |
| 471 | def _run_read(path: str) -> str: |
| 472 | return run_read(path, cwd=_wt_cwd()) |
| 473 | |
| 474 | def _run_write(path: str, content: str) -> str: |
| 475 | return run_write(path, content, cwd=_wt_cwd()) |
| 476 | |
| 477 | def _run_list_tasks(): |
| 478 | tasks = list_tasks() |
| 479 | if not tasks: |
| 480 | return "No tasks." |
| 481 | return "\n".join( |
| 482 | f" {t.id}: {t.subject} [{t.status}]" |
| 483 | + (f" (wt:{t.worktree})" if t.worktree else "") |
| 484 | for t in tasks) |
| 485 | |
| 486 | def _run_claim_task(task_id: str): |
| 487 | result = claim_task(task_id, owner=name) |
| 488 | if "Claimed" in result: |
| 489 | task = load_task(task_id) |
| 490 | wt_ctx["path"] = (str(WORKTREES_DIR / task.worktree) |
| 491 | if task.worktree else None) |
| 492 | return result |
| 493 | |
| 494 | def _run_complete_task(task_id: str): |
| 495 | result = complete_task(task_id) |
| 496 | wt_ctx["path"] = None |
| 497 | return result |
| 498 | |
| 499 | messages = [{"role": "user", "content": prompt}] |
| 500 | sub_tools = [ |
| 501 | {"name": "bash", "description": "Run a shell command.", |
| 502 | "input_schema": {"type": "object", |
| 503 | "properties": {"command": {"type": "string"}}, |
| 504 | "required": ["command"]}}, |
| 505 | {"name": "read_file", "description": "Read file.", |
| 506 | "input_schema": {"type": "object", |
| 507 | "properties": {"path": {"type": "string"}}, |
| 508 | "required": ["path"]}}, |
| 509 | {"name": "write_file", "description": "Write file.", |
| 510 | "input_schema": {"type": "object", |
| 511 | "properties": {"path": {"type": "string"}, |
| 512 | "content": {"type": "string"}}, |
| 513 | "required": ["path", "content"]}}, |
| 514 | {"name": "send_message", |
| 515 | "description": "Send message to another agent.", |
| 516 | "input_schema": {"type": "object", |
| 517 | "properties": {"to": {"type": "string"}, |
| 518 | "content": {"type": "string"}}, |
nothing calls this directly
no test coverage detected