Loading...
Loading...
Use as a baseline import in operator skills that drive repo devbox workers — documents spawn, prompt, poll, and stop lifecycle.
npx skill4agent add fellowship-dev/dogfooded-skills pylot-workersspeckit-runnerdeps-runner-procrelease-train-runner-procAuthorization: Bearer $PYLOT_DISPATCH_TOKEN$PYLOT_API$PYLOT_GATEWAY_URL$PYLOT_JOB_IDSPAWN_RESP=$(curl -s --max-time 90 -X POST \
-H "Authorization: Bearer $PYLOT_DISPATCH_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"repo\": \"$REPO\"}" \
"${PYLOT_API}/missions/${PYLOT_JOB_ID}/workers")
WID=$(echo "$SPAWN_RESP" | python3 -c 'import sys,json; print(json.load(sys.stdin).get("worker_id",""))' 2>/dev/null){"ok": true, "worker_id": <number>}WIDPROMPT_RESP=$(curl -s --max-time 30 -X POST \
-H "Authorization: Bearer $PYLOT_DISPATCH_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"prompt\": \"$PROMPT\"}" \
"${PYLOT_API}/missions/${PYLOT_JOB_ID}/workers/${WID}/prompt")
TURN_SEQ=$(echo "$PROMPT_RESP" | python3 -c 'import sys,json; print(json.load(sys.stdin).get("turn_seq",""))' 2>/dev/null){"ok": true, "turn_seq": <number>}turn_seqturn_state == "idle"turn_seq == TURN_SEQWORKER_EXIT=""; POLL_EL=0; POLL_MAX="${PYLOT_WORKER_POLL_MAX:-2400}"
while [ "$POLL_EL" -lt "$POLL_MAX" ]; do
sleep 15; POLL_EL=$((POLL_EL + 15))
ST=$(curl -s --max-time 20 \
-H "Authorization: Bearer $PYLOT_DISPATCH_TOKEN" \
"${PYLOT_API}/missions/${PYLOT_JOB_ID}/workers/${WID}")
ST_LINE=$(echo "$ST" | python3 -c '
import sys, json
try: d = json.load(sys.stdin)
except: d = {}
ec = d.get("last_exit_code")
print("%s|%s|%s" % (d.get("turn_state",""), d.get("turn_seq",""), "" if ec is None else ec))
' 2>/dev/null)
W_STATE="${ST_LINE%%|*}"; W_REST="${ST_LINE#*|}"; W_SEQ="${W_REST%%|*}"; W_EC="${W_REST##*|}"
if [ "$W_STATE" = "idle" ] && [ "$W_SEQ" = "$TURN_SEQ" ]; then WORKER_EXIT="$W_EC"; break; fi
donelast_output$STexit_code=-1curl -s --max-time 30 -X POST \
-H "Authorization: Bearer $PYLOT_DISPATCH_TOKEN" \
"${PYLOT_API}/missions/${PYLOT_JOB_ID}/workers/${WID}/stop" >/dev/null 2>&1 || truespawn → prompt(phase1) → poll-to-idle → check output →
prompt(phase2) → poll-to-idle → check output →
...
stop → emit [pylot] outcome= markerlast_output[pylot] outcome="<summary>" status=<success|partial|failed|blocked>