agent-relay-runner 0.11.2 → 0.11.4
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.11.
|
|
3
|
+
"version": "0.11.4",
|
|
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.3"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/bun": "latest",
|
package/src/runner.ts
CHANGED
|
@@ -361,6 +361,7 @@ export class AgentRunner {
|
|
|
361
361
|
const deliverable: Message[] = [];
|
|
362
362
|
const providerAlreadyBusy = this.claims.reasons().includes("provider-turn");
|
|
363
363
|
for (const message of messages) {
|
|
364
|
+
let toDeliver = message;
|
|
364
365
|
if (message.claimable) {
|
|
365
366
|
const claimed = await this.http.claimMessageResult(message.id, this.agentId).catch(() => ({ ok: false, claimExpiresAt: undefined }));
|
|
366
367
|
if (!claimed.ok) continue;
|
|
@@ -374,9 +375,12 @@ export class AgentRunner {
|
|
|
374
375
|
agentId: this.agentId,
|
|
375
376
|
metadata: { messageId: message.id, completedBy: "runner" },
|
|
376
377
|
}).catch((error) => console.error(`[runner] task ${taskId} in_progress update failed: ${error}`));
|
|
378
|
+
// Runner owns claim + status here; drop the server's self-claim instruction
|
|
379
|
+
// so the agent doesn't improvise a stray claim send (see stripRunnerClaimedGuidance).
|
|
380
|
+
toDeliver = { ...message, body: stripRunnerClaimedGuidance(message.body) };
|
|
377
381
|
}
|
|
378
382
|
}
|
|
379
|
-
deliverable.push(
|
|
383
|
+
deliverable.push(toDeliver);
|
|
380
384
|
}
|
|
381
385
|
if (deliverable.length === 0) {
|
|
382
386
|
this.delivering = false;
|
|
@@ -1075,6 +1079,19 @@ export function taskIdFromMessage(message: Pick<Message, "payload">): number | u
|
|
|
1075
1079
|
return Number.isSafeInteger(taskId) ? taskId as number : undefined;
|
|
1076
1080
|
}
|
|
1077
1081
|
|
|
1082
|
+
// The server appends a self-claim/status instruction to task message bodies
|
|
1083
|
+
// (taskMessageBody in src/db.ts: "Claim this task before working it, then update
|
|
1084
|
+
// task status when finished."). For runner-managed agents the runner already owns
|
|
1085
|
+
// claim + status, so that line is not only redundant but actively harmful: the
|
|
1086
|
+
// agent tries to follow it, has no real claim command, and improvises a stray
|
|
1087
|
+
// `agent-relay /send-claimable claim <id>` that leaves an orphan claimable message.
|
|
1088
|
+
// Strip the trailing guidance from messages the runner has auto-claimed.
|
|
1089
|
+
const RUNNER_CLAIMED_GUIDANCE_RE = /\s*Claim this task before working it, then update task status when finished\.\s*$/;
|
|
1090
|
+
|
|
1091
|
+
export function stripRunnerClaimedGuidance(body: string): string {
|
|
1092
|
+
return body.replace(RUNNER_CLAIMED_GUIDANCE_RE, "");
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1078
1095
|
function csvTags(raw: string | undefined): string[] {
|
|
1079
1096
|
return (raw || "").split(",").map((tag) => tag.trim()).filter(Boolean);
|
|
1080
1097
|
}
|