agent-relay-runner 0.65.2 → 0.67.0
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.
|
|
3
|
+
"version": "0.67.0",
|
|
4
4
|
"description": "Unified provider lifecycle runner for Agent Relay",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"directory": "runner"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"agent-relay-sdk": "0.2.
|
|
23
|
+
"agent-relay-sdk": "0.2.43"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/bun": "latest",
|
|
@@ -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
|
|
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
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
# Claude builds omit the field → count 0 → graceful no-op
|
|
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 '
|
|
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
|
|
50
|
-
|
|
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'
|
|
@@ -4,6 +4,8 @@ import type { OutboxRecord } from "./outbox";
|
|
|
4
4
|
const CONTINUATION_ARCHIVE_MAX_POST_BODY_BYTES = 64 * 1024;
|
|
5
5
|
const CONTINUATION_ARCHIVE_CHUNK_TARGET_BYTES = 56 * 1024;
|
|
6
6
|
const CONTINUATION_ARCHIVE_MAX_GENERATION_BYTES = 8 * 1024 * 1024;
|
|
7
|
+
const encoder = new TextEncoder();
|
|
8
|
+
const fatalUtf8Decoder = new TextDecoder("utf-8", { fatal: true });
|
|
7
9
|
|
|
8
10
|
interface ContinuationArchiveOutboxPayload {
|
|
9
11
|
agentId: string;
|
|
@@ -18,11 +20,12 @@ interface ContinuationArchiveResponse {
|
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export function boundContinuationArchiveSegment(segment: string): { segment: string; keptBytes: number; droppedBytes: number } {
|
|
21
|
-
const
|
|
23
|
+
const encoded = encoder.encode(segment);
|
|
24
|
+
const bytes = encoded.byteLength;
|
|
22
25
|
if (bytes <= CONTINUATION_ARCHIVE_MAX_GENERATION_BYTES) {
|
|
23
26
|
return { segment, keptBytes: bytes, droppedBytes: 0 };
|
|
24
27
|
}
|
|
25
|
-
const bounded =
|
|
28
|
+
const bounded = decodeUtf8Prefix(encoded, CONTINUATION_ARCHIVE_MAX_GENERATION_BYTES);
|
|
26
29
|
const keptBytes = utf8Bytes(bounded);
|
|
27
30
|
return { segment: bounded.trimEnd(), keptBytes, droppedBytes: bytes - keptBytes };
|
|
28
31
|
}
|
|
@@ -159,18 +162,18 @@ function archiveGeneration(response: ContinuationArchiveResponse): number | unde
|
|
|
159
162
|
return typeof generation === "number" && Number.isSafeInteger(generation) && generation >= 0 ? generation : undefined;
|
|
160
163
|
}
|
|
161
164
|
|
|
162
|
-
function
|
|
163
|
-
let
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
165
|
+
function decodeUtf8Prefix(bytes: Uint8Array, maxBytes: number): string {
|
|
166
|
+
let end = Math.min(maxBytes, bytes.byteLength);
|
|
167
|
+
while (end > 0) {
|
|
168
|
+
try {
|
|
169
|
+
return fatalUtf8Decoder.decode(bytes.subarray(0, end));
|
|
170
|
+
} catch {
|
|
171
|
+
end -= 1;
|
|
172
|
+
}
|
|
170
173
|
}
|
|
171
|
-
return
|
|
174
|
+
return "";
|
|
172
175
|
}
|
|
173
176
|
|
|
174
177
|
function utf8Bytes(value: string): number {
|
|
175
|
-
return
|
|
178
|
+
return encoder.encode(value).byteLength;
|
|
176
179
|
}
|
|
@@ -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.
|
|
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
|
|