agent-relay-runner 0.66.0 → 0.67.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-relay-runner",
3
- "version": "0.66.0",
3
+ "version": "0.67.1",
4
4
  "description": "Unified provider lifecycle runner for Agent Relay",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agent-relay-runner",
3
3
  "description": "Thin Agent Relay runner bridge for Claude Code",
4
- "version": "0.66.0",
4
+ "version": "0.67.1",
5
5
  "agentRelayContracts": {
6
6
  "providerPluginProtocol": 1
7
7
  }
@@ -31,23 +31,38 @@ relay_post_status_clearing_subagents() {
31
31
  relay_post_status "$1" "${2:-}" "${3:-}" "${4:-}" "${5:-}" "${6:-}" subagent
32
32
  }
33
33
 
34
- # #502: count the background shells still running at the moment this turn ends.
34
+ # #502/#539: count user background shells still running at turn end.
35
35
  # Claude's Stop payload carries a `background_tasks` array (CC v2.1.157+) listing
36
- # the shells launched with run_in_background that have not yet finished. It is a
37
- # full live snapshot, so reporting it each turn-end can never wedge: a completed
38
- # task wakes Claude, the next Stop re-reports the (now smaller/empty) set. Older
39
- # Claude builds omit the field → count 0 → graceful no-op (no false busy).
36
+ # shells launched with run_in_background that have not yet finished. It can also
37
+ # include the long-lived Agent Relay monitor; that monitor is notification
38
+ # plumbing, not agent work, so exclude it before driving `background-script`
39
+ # busy state. Older Claude builds omit the field → count 0 → graceful no-op.
40
40
  relay_background_task_count() {
41
41
  local input="${1:-}"
42
42
  [ -z "$input" ] && { printf '0'; return 0; }
43
43
  if command -v jq >/dev/null 2>&1; then
44
44
  local n
45
- n="$(printf '%s' "$input" | jq -r '(.background_tasks // []) | length' 2>/dev/null)"
45
+ n="$(printf '%s' "$input" | jq -r '
46
+ (.background_tasks // [])
47
+ | map(select(
48
+ (.name // "") != "agent-relay-runner-monitor"
49
+ and ((.command // "") | contains("relay-monitor.ts") | not)
50
+ and ((.command // "") | contains("agent-relay-runner-monitor") | not)
51
+ ))
52
+ | length
53
+ ' 2>/dev/null)"
46
54
  case "$n" in ''|*[!0-9]*) printf '0' ;; *) printf '%s' "$n" ;; esac
47
55
  return 0
48
56
  fi
49
- # jq-less fallback: a non-empty array literal means at least one is running.
50
- if printf '%s' "$input" | tr -d '[:space:]' | grep -q '"background_tasks":\[{'; then
57
+ # jq-less fallback: avoid a false busy for the common "only relay monitor" case.
58
+ local compact
59
+ compact="$(printf '%s' "$input" | tr -d '[:space:]')"
60
+ if printf '%s' "$compact" | grep -q '"background_tasks":\[{'; then
61
+ if printf '%s' "$compact" | grep -qE '("name":"agent-relay-runner-monitor"|relay-monitor\.ts)' \
62
+ && ! printf '%s' "$compact" | grep -q '},{'; then
63
+ printf '0'
64
+ return 0
65
+ fi
51
66
  printf '1'
52
67
  else
53
68
  printf '0'
@@ -60,7 +60,7 @@ export function workspaceLifecycleNote(input: { mode?: string | null; branch?: s
60
60
  return [
61
61
  `[agent-relay] Isolated workspace: you are in a git worktree on branch ${branch}, based on ${base} — NOT the main checkout. Other agents may work in parallel and land to ${base}, so ${base} will move under you. That is expected; don't fight it.`,
62
62
  `Do NOT push this branch yourself — not with \`git push\`, not with \`tl push\` or any other push wrapper, and do not manually rebase or merge. A steward may be auto-rebasing this branch in the background; pushing concurrently races it and can leave the worktree mid-rebase. Just commit your work here. When the task is done, run \`agent-relay workspace ready\` — Relay rebases onto the latest ${base}, lands your work, and pushes for you. If the installed \`agent-relay\` binary is stale and says the workspace command is unknown, run the repo-local fallback: \`bun src/index.ts workspace ready\`.`,
63
- `After \`ready\`, the status becomes \`review_requested\` — this is the NORMAL, healthy hand-off state, NOT an escalation or a stall. Relay auto-merges clean rebases roughly every 2 minutes; a steward agent is spawned (after a short delay) ONLY if it can't land deterministically, so seeing no steward means it's working, not stuck. Wait with \`agent-relay workspace status --wait\` (it returns the moment your branch lands). On landing you'll be moved onto a fresh rebased branch whose name gains a \`--N\` suffix — expected, keep working there. Never \`cd\` into the main checkout, and never merge/push/resolve conflicts yourself — Relay and the steward own all of that. \`agent-relay workspace status\` anytime shows your current state and the next step.`,
63
+ `After \`ready\`, the status becomes \`review_requested\` — this is the NORMAL, healthy hand-off state, NOT an escalation or a stall. Relay auto-merges clean rebases roughly every 2 minutes; a steward agent is spawned (after a short delay) ONLY if it can't land deterministically, so seeing no steward means it's working, not stuck. Stop your turn after \`ready\` and go idle; do NOT wait or poll the steward queue. Relay wakes you with \`landed-success\` when your branch lands and refreshes, or \`landed-failure\` if landing fatally fails. On success you'll be on a fresh rebased branch whose name gains a \`--N\` suffix — expected, keep working there. Never \`cd\` into the main checkout, and never merge/push/resolve conflicts yourself — Relay and the steward own all of that. \`agent-relay workspace status\` anytime shows your current state and the exact next step.`,
64
64
  ].join("\n");
65
65
  }
66
66