refactor(skills): cleanup dead code + full workflow A→B→C→D integration
Cleanup: - Remove unused validate_yaml() helper from lib.sh - Remove USER_MANUAL.html + mqtt-broker-setup.html (no refs found) Workflow A (create_session ↔ delegate-job): - Add --submit-job <prompt> option to create_session.sh - Auto-register session in delegate-job registry, store delegate_job_id in YAML Workflow B (push-based monitor): - Migrate reconcile.sh to MQTT subscriber mode (polling fallback preserved) Workflow C (unified status): - status.sh now shows session + delegate-job state in single column Workflow D (audit log + perms): - JSON job files chmod 600 - create/delete/resume now publish lifecycle events to delegate-job
This commit is contained in:
@@ -55,6 +55,19 @@ if [ "$AGENT" = "agy" ] && [ -n "$PANE_PID" ]; then
|
||||
CHILD_PID="${CHILD_PID:-0}"
|
||||
fi
|
||||
|
||||
DELEGATE_JOB_ID=$(env_python "$AGENT_SESSIONS_YAML" SESSION_NAME="$SESSION_NAME" <<'PYEOF'
|
||||
import os, yaml
|
||||
name = os.environ['SESSION_NAME']
|
||||
with open(os.environ['YAML_PATH']) as f:
|
||||
d = yaml.safe_load(f) or {}
|
||||
for s in d.get('tmux_sessions', []):
|
||||
if s.get('name') == name:
|
||||
print(s.get('delegate_job_id', '') or '')
|
||||
raise SystemExit(0)
|
||||
raise SystemExit(0)
|
||||
PYEOF
|
||||
)
|
||||
|
||||
atomic_dump_yaml "$AGENT_SESSIONS_YAML" \
|
||||
SESSION_NAME="$SESSION_NAME" UUID="$UUID" AGENT="$AGENT" NOW_ISO="$NOW_ISO" \
|
||||
PANE_PID="$PANE_PID" CHILD_PID="$CHILD_PID" <<'PYEOF'
|
||||
@@ -104,3 +117,17 @@ snap.pop('terminated_at_epoch', None)
|
||||
|
||||
print(f"updated: {name} status=running (resume id -> per-row own id)", flush=True)
|
||||
PYEOF
|
||||
|
||||
if [ -n "$DELEGATE_JOB_ID" ]; then
|
||||
py_bin="python3"
|
||||
d_dir="$(dirname "${BASH_SOURCE[0]}")"
|
||||
while [ "$d_dir" != "/" ] && [ -n "$d_dir" ]; do
|
||||
if [ -x "$d_dir/.venv/bin/python" ]; then
|
||||
py_bin="$d_dir/.venv/bin/python"
|
||||
break
|
||||
fi
|
||||
d_dir="$(dirname "$d_dir")"
|
||||
done
|
||||
pub_script="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)/delegate-job/scripts/publish_event.py"
|
||||
"$py_bin" "$pub_script" --job "$DELEGATE_JOB_ID" --event progress --detail "resumed" || true
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user