agent-relay-runner 0.127.2 → 0.127.3

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.127.2",
3
+ "version": "0.127.3",
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.127.2",
4
+ "version": "0.127.3",
5
5
  "agentRelayContracts": {
6
6
  "providerPluginProtocol": 1
7
7
  }
@@ -320,6 +320,9 @@ function shouldShowReplyReminder(deliveryCount) {
320
320
  function latestReplyableMessage(messages) {
321
321
  return messages.filter((message) => isPersistedRelayMessage2(message) && !isMemoryInjection(message) && !isReactionNotification(message) && !isSpawnObligationMessage(message) && message.replyExpected !== false).at(-1);
322
322
  }
323
+ function isSelfResumeInjection(message) {
324
+ return isRecord(message.payload) && message.payload.resumeInjection === true;
325
+ }
323
326
  function formatMessage(message, relaySurface) {
324
327
  const subject = message.subject ? `Subject: ${message.subject}
325
328
  ` : "";
@@ -331,7 +334,7 @@ function formatMessage(message, relaySurface) {
331
334
  `) : undefined;
332
335
  if (isMemoryContext) {
333
336
  return [
334
- `[agent-relay context from ${message.from}]`,
337
+ `[agent-relay ${isSelfResumeInjection(message) ? "self-resume continuation" : "context"} from ${message.from}]`,
335
338
  providerAttachmentText(message),
336
339
  `${subject}${preview.body}`,
337
340
  truncationGuidance
package/src/adapter.ts CHANGED
@@ -327,6 +327,10 @@ function isMemoryInjection(message: Message): boolean {
327
327
  return isRecord(message.payload) && message.payload.memoryInjection === true;
328
328
  }
329
329
 
330
+ function isSelfResumeInjection(message: Message): boolean {
331
+ return isRecord(message.payload) && message.payload.resumeInjection === true;
332
+ }
333
+
330
334
  function isReactionNotification(message: Message): boolean {
331
335
  const event = isRecord(message.payload?.event) ? message.payload.event : undefined;
332
336
  return message.payload?.reactionNotification === true || event?.type === "message.reaction";
@@ -434,7 +438,7 @@ export function providerMessageText(messages: Message[]): string {
434
438
  : undefined;
435
439
  if (isMemoryContext) {
436
440
  return [
437
- `[agent-relay context from ${message.from}]`,
441
+ `[agent-relay ${isSelfResumeInjection(message) ? "self-resume continuation" : "context"} from ${message.from}]`,
438
442
  "Guide: agent-relay /guide",
439
443
  providerAttachmentText(message),
440
444
  `${subject}${preview.body}`,
@@ -69,6 +69,10 @@ function latestReplyableMessage(messages: Message[]): Message | undefined {
69
69
  .at(-1);
70
70
  }
71
71
 
72
+ function isSelfResumeInjection(message: Message): boolean {
73
+ return isRecord(message.payload) && message.payload.resumeInjection === true;
74
+ }
75
+
72
76
  function formatMessage(message: Message, relaySurface: boolean): string {
73
77
  const subject = message.subject ? `Subject: ${message.subject}\n` : "";
74
78
  const isMemoryContext = isMemoryInjection(message);
@@ -81,7 +85,7 @@ function formatMessage(message: Message, relaySurface: boolean): string {
81
85
 
82
86
  if (isMemoryContext) {
83
87
  return [
84
- `[agent-relay context from ${message.from}]`,
88
+ `[agent-relay ${isSelfResumeInjection(message) ? "self-resume continuation" : "context"} from ${message.from}]`,
85
89
  providerAttachmentText(message),
86
90
  `${subject}${preview.body}`,
87
91
  truncationGuidance,
@@ -842,17 +842,24 @@ export class AgentRunner {
842
842
  const content = typeof params.content === "string" ? params.content.trim() : "";
843
843
  if (!content) throw new Error("content required");
844
844
  const memoryIds = Array.isArray(params.memoryIds) ? params.memoryIds.filter((id): id is string => typeof id === "string") : [];
845
+ const reason = typeof params.reason === "string" ? params.reason : undefined;
846
+ const selfResume = params.selfResume !== null && typeof params.selfResume === "object" && !Array.isArray(params.selfResume)
847
+ ? params.selfResume as Record<string, unknown>
848
+ : undefined;
849
+ const isSelfResumeContinuation = reason === "self-resume-continuation" || Boolean(selfResume);
845
850
  await this.options.adapter.deliver(this.process!, [{
846
851
  id: 0,
847
852
  from: "system",
848
853
  to: this.agentId,
849
854
  kind: "system",
850
- subject: "Agent Relay memory context",
855
+ subject: isSelfResumeContinuation ? "Agent Relay self-resume continuation" : "Agent Relay memory context",
851
856
  body: content,
852
857
  payload: {
853
858
  memoryInjection: true,
854
- reason: typeof params.reason === "string" ? params.reason : undefined,
859
+ reason,
855
860
  memoryIds,
861
+ ...(isSelfResumeContinuation ? { resumeInjection: true } : {}),
862
+ ...(selfResume ? { selfResume } : {}),
856
863
  },
857
864
  readBy: [],
858
865
  createdAt: Date.now(),