mirror of
https://github.com/shareAI-lab/analysis_claude_code.git
synced 2026-08-06 12:03:37 +08:00
Sync s17 READMEs with the idle_poll signature change
The code change dropped the redundant agent_name parameter, but the trilingual README snippets still showed the old four-arg signature, the double-passed call site, and agent_name inside the function body (read_inbox and claim_task). Update all three language code blocks to the three-arg form and bump the translation-sync markers so the docs match the code.
This commit is contained in:
@@ -42,13 +42,13 @@ After completing a task, the teammate doesn't exit. It enters the IDLE phase —
|
|||||||
IDLE_POLL_INTERVAL = 5 # seconds
|
IDLE_POLL_INTERVAL = 5 # seconds
|
||||||
IDLE_TIMEOUT = 60 # seconds
|
IDLE_TIMEOUT = 60 # seconds
|
||||||
|
|
||||||
def idle_poll(agent_name, messages, name, role) -> str:
|
def idle_poll(name, messages, role) -> str:
|
||||||
"""Return 'work', 'shutdown', or 'timeout'."""
|
"""Return 'work', 'shutdown', or 'timeout'."""
|
||||||
for _ in range(IDLE_TIMEOUT // IDLE_POLL_INTERVAL):
|
for _ in range(IDLE_TIMEOUT // IDLE_POLL_INTERVAL):
|
||||||
time.sleep(IDLE_POLL_INTERVAL)
|
time.sleep(IDLE_POLL_INTERVAL)
|
||||||
|
|
||||||
# ① Check inbox (priority)
|
# ① Check inbox (priority)
|
||||||
inbox = BUS.read_inbox(agent_name)
|
inbox = BUS.read_inbox(name)
|
||||||
if inbox:
|
if inbox:
|
||||||
# shutdown_request handled immediately
|
# shutdown_request handled immediately
|
||||||
for msg in inbox:
|
for msg in inbox:
|
||||||
@@ -63,7 +63,7 @@ def idle_poll(agent_name, messages, name, role) -> str:
|
|||||||
unclaimed = scan_unclaimed_tasks()
|
unclaimed = scan_unclaimed_tasks()
|
||||||
if unclaimed:
|
if unclaimed:
|
||||||
task = unclaimed[0]
|
task = unclaimed[0]
|
||||||
result = claim_task(task["id"], agent_name)
|
result = claim_task(task["id"], name)
|
||||||
if "Claimed" in result:
|
if "Claimed" in result:
|
||||||
messages.append(...)
|
messages.append(...)
|
||||||
return "work"
|
return "work"
|
||||||
@@ -126,7 +126,7 @@ while True:
|
|||||||
break # WORK phase ends
|
break # WORK phase ends
|
||||||
|
|
||||||
# IDLE phase
|
# IDLE phase
|
||||||
idle_result = idle_poll(name, messages, name, role)
|
idle_result = idle_poll(name, messages, role)
|
||||||
if idle_result == "shutdown":
|
if idle_result == "shutdown":
|
||||||
break
|
break
|
||||||
if idle_result == "timeout":
|
if idle_result == "timeout":
|
||||||
@@ -268,4 +268,4 @@ Teaching version's `idle_poll()` merges CC's four mechanisms into one polling fu
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<!-- translation-sync: zh@v1, en@v1, ja@v1 -->
|
<!-- translation-sync: zh@v2, en@v2, ja@v2 -->
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ S16 の教学版 MessageBus とプロトコルツールを踏襲。本章の追
|
|||||||
IDLE_POLL_INTERVAL = 5 # seconds
|
IDLE_POLL_INTERVAL = 5 # seconds
|
||||||
IDLE_TIMEOUT = 60 # seconds
|
IDLE_TIMEOUT = 60 # seconds
|
||||||
|
|
||||||
def idle_poll(agent_name, messages, name, role) -> str:
|
def idle_poll(name, messages, role) -> str:
|
||||||
"""Return 'work', 'shutdown', or 'timeout'."""
|
"""Return 'work', 'shutdown', or 'timeout'."""
|
||||||
for _ in range(IDLE_TIMEOUT // IDLE_POLL_INTERVAL):
|
for _ in range(IDLE_TIMEOUT // IDLE_POLL_INTERVAL):
|
||||||
time.sleep(IDLE_POLL_INTERVAL)
|
time.sleep(IDLE_POLL_INTERVAL)
|
||||||
|
|
||||||
# ① 受信箱確認(優先)
|
# ① 受信箱確認(優先)
|
||||||
inbox = BUS.read_inbox(agent_name)
|
inbox = BUS.read_inbox(name)
|
||||||
if inbox:
|
if inbox:
|
||||||
# shutdown_request は即座に処理
|
# shutdown_request は即座に処理
|
||||||
for msg in inbox:
|
for msg in inbox:
|
||||||
@@ -63,7 +63,7 @@ def idle_poll(agent_name, messages, name, role) -> str:
|
|||||||
unclaimed = scan_unclaimed_tasks()
|
unclaimed = scan_unclaimed_tasks()
|
||||||
if unclaimed:
|
if unclaimed:
|
||||||
task = unclaimed[0]
|
task = unclaimed[0]
|
||||||
result = claim_task(task["id"], agent_name)
|
result = claim_task(task["id"], name)
|
||||||
if "Claimed" in result:
|
if "Claimed" in result:
|
||||||
messages.append(...)
|
messages.append(...)
|
||||||
return "work"
|
return "work"
|
||||||
@@ -126,7 +126,7 @@ while True:
|
|||||||
break # WORK フェーズ終了
|
break # WORK フェーズ終了
|
||||||
|
|
||||||
# IDLE フェーズ
|
# IDLE フェーズ
|
||||||
idle_result = idle_poll(name, messages, name, role)
|
idle_result = idle_poll(name, messages, role)
|
||||||
if idle_result == "shutdown":
|
if idle_result == "shutdown":
|
||||||
break
|
break
|
||||||
if idle_result == "timeout":
|
if idle_result == "timeout":
|
||||||
@@ -268,4 +268,4 @@ s18 Worktree Isolation → 各タスクに専用の作業ディレクトリ、
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<!-- translation-sync: zh@v1, en@v1, ja@v1 -->
|
<!-- translation-sync: zh@v2, en@v2, ja@v2 -->
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ s16 的队友能通信、能握手关机。但每个队友等 Lead 分配任务
|
|||||||
IDLE_POLL_INTERVAL = 5 # seconds
|
IDLE_POLL_INTERVAL = 5 # seconds
|
||||||
IDLE_TIMEOUT = 60 # seconds
|
IDLE_TIMEOUT = 60 # seconds
|
||||||
|
|
||||||
def idle_poll(agent_name, messages, name, role) -> str:
|
def idle_poll(name, messages, role) -> str:
|
||||||
"""Return 'work', 'shutdown', or 'timeout'."""
|
"""Return 'work', 'shutdown', or 'timeout'."""
|
||||||
for _ in range(IDLE_TIMEOUT // IDLE_POLL_INTERVAL):
|
for _ in range(IDLE_TIMEOUT // IDLE_POLL_INTERVAL):
|
||||||
time.sleep(IDLE_POLL_INTERVAL)
|
time.sleep(IDLE_POLL_INTERVAL)
|
||||||
|
|
||||||
# ① 检查收件箱(优先)
|
# ① 检查收件箱(优先)
|
||||||
inbox = BUS.read_inbox(agent_name)
|
inbox = BUS.read_inbox(name)
|
||||||
if inbox:
|
if inbox:
|
||||||
# shutdown_request 立即处理
|
# shutdown_request 立即处理
|
||||||
for msg in inbox:
|
for msg in inbox:
|
||||||
@@ -63,7 +63,7 @@ def idle_poll(agent_name, messages, name, role) -> str:
|
|||||||
unclaimed = scan_unclaimed_tasks()
|
unclaimed = scan_unclaimed_tasks()
|
||||||
if unclaimed:
|
if unclaimed:
|
||||||
task = unclaimed[0]
|
task = unclaimed[0]
|
||||||
result = claim_task(task["id"], agent_name)
|
result = claim_task(task["id"], name)
|
||||||
if "Claimed" in result:
|
if "Claimed" in result:
|
||||||
messages.append(...)
|
messages.append(...)
|
||||||
return "work"
|
return "work"
|
||||||
@@ -126,7 +126,7 @@ while True:
|
|||||||
break # WORK 阶段结束
|
break # WORK 阶段结束
|
||||||
|
|
||||||
# IDLE phase
|
# IDLE phase
|
||||||
idle_result = idle_poll(name, messages, name, role)
|
idle_result = idle_poll(name, messages, role)
|
||||||
if idle_result == "shutdown":
|
if idle_result == "shutdown":
|
||||||
break
|
break
|
||||||
if idle_result == "timeout":
|
if idle_result == "timeout":
|
||||||
@@ -268,4 +268,4 @@ s18 Worktree Isolation → 每个任务有自己的工作目录,互不干扰
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<!-- translation-sync: zh@v1, en@v1, ja@v1 -->
|
<!-- translation-sync: zh@v2, en@v2, ja@v2 -->
|
||||||
|
|||||||
Reference in New Issue
Block a user