agent-relay-runner 0.120.0 → 0.120.2

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.120.0",
3
+ "version": "0.120.2",
4
4
  "description": "Unified provider lifecycle runner for Agent Relay",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "agent-relay-providers": "0.104.3",
24
- "agent-relay-sdk": "0.2.107",
24
+ "agent-relay-sdk": "0.2.108",
25
25
  "callmux": "0.23.0"
26
26
  },
27
27
  "devDependencies": {
@@ -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.120.0",
4
+ "version": "0.120.2",
5
5
  "agentRelayContracts": {
6
6
  "providerPluginProtocol": 1
7
7
  }
package/src/config.ts CHANGED
@@ -81,6 +81,19 @@ function relayUrlFromEnv(): string | undefined {
81
81
  return process.env.AGENT_RELAY_URL;
82
82
  }
83
83
 
84
+ function textEnvOrFile(name: string): string | undefined {
85
+ const inline = process.env[name];
86
+ if (inline) return inline;
87
+ const file = process.env[`${name}_FILE`];
88
+ if (!file) return undefined;
89
+ try {
90
+ const text = readFileSync(file, "utf8");
91
+ return text.length > 0 ? text : undefined;
92
+ } catch {
93
+ return undefined;
94
+ }
95
+ }
96
+
84
97
  export function relayTokenFromEnv(): string | undefined {
85
98
  return process.env.AGENT_RELAY_TOKEN;
86
99
  }
@@ -117,15 +130,23 @@ export function agentProfileNameFromEnv(): string | undefined {
117
130
  }
118
131
 
119
132
  export function agentProfileJsonFromEnv(): string | undefined {
120
- return process.env.AGENT_RELAY_AGENT_PROFILE_JSON;
133
+ return textEnvOrFile("AGENT_RELAY_AGENT_PROFILE_JSON");
121
134
  }
122
135
 
123
136
  export function workspaceJsonFromEnv(): string | undefined {
124
- return process.env.AGENT_RELAY_WORKSPACE_JSON;
137
+ return textEnvOrFile("AGENT_RELAY_WORKSPACE_JSON");
125
138
  }
126
139
 
127
140
  export function relayInjectionEventsJsonFromEnv(): string | undefined {
128
- return process.env.AGENT_RELAY_INJECTION_EVENTS_JSON;
141
+ return textEnvOrFile("AGENT_RELAY_INJECTION_EVENTS_JSON");
142
+ }
143
+
144
+ export function promptFromEnv(): string | undefined {
145
+ return textEnvOrFile("AGENT_RELAY_PROMPT");
146
+ }
147
+
148
+ export function systemPromptAppendFromEnv(): string | undefined {
149
+ return textEnvOrFile("AGENT_RELAY_SYSTEM_PROMPT_APPEND");
129
150
  }
130
151
 
131
152
  export function tmuxSessionFromEnv(): string | undefined {
package/src/index.ts CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  loadGlobalConfig,
13
13
  loadProviderConfigFromRelay,
14
14
  policyNameFromEnv,
15
+ promptFromEnv,
15
16
  relayInjectionEventsJsonFromEnv,
16
17
  resolveCwd,
17
18
  runnerId,
@@ -19,6 +20,7 @@ import {
19
20
  runtimeTokenJtiFromEnv,
20
21
  runtimeTokenProfileFromEnv,
21
22
  spawnRequestIdFromEnv,
23
+ systemPromptAppendFromEnv,
22
24
  taskIdFromEnv,
23
25
  tmuxSessionFromEnv,
24
26
  workspaceJsonFromEnv,
@@ -109,8 +111,8 @@ export async function main(argv = process.argv): Promise<void> {
109
111
  profile: opts.profile ?? agentProfileNameFromEnv(),
110
112
  agentProfile: parseAgentProfileEnv(agentProfileJsonFromEnv()),
111
113
  workspace: parseWorkspaceEnv(workspaceJsonFromEnv()),
112
- prompt: opts.prompt,
113
- systemPromptAppend: opts.systemPromptAppend,
114
+ prompt: opts.prompt ?? promptFromEnv(),
115
+ systemPromptAppend: opts.systemPromptAppend ?? systemPromptAppendFromEnv(),
114
116
  relayInjectionEvents: parseRelayInjectionEventsEnv(relayInjectionEventsJsonFromEnv()),
115
117
  tmuxSession: tmuxSessionFromEnv(),
116
118
  tags: opts.tags,
@@ -50,6 +50,7 @@ import {
50
50
  runnerAgentStatus,
51
51
  runnerBusErrorAction,
52
52
  runnerMessageMatches,
53
+ runnerMessageShouldDirtyObligations,
53
54
  runnerShouldResolveProviderExit,
54
55
  runnerShouldRestartUnexpectedProviderExit,
55
56
  runtimeProviderCapabilities,
@@ -441,8 +442,9 @@ export class AgentRunner {
441
442
  this.bus.on("message.new", (message) => {
442
443
  // A delivered message may create a new reply obligation — warm the snapshot so the
443
444
  // next turn-end sees it without a hot-path server read.
444
- this.obligationCache.markDirty();
445
- this.enqueueMessage(message as Message);
445
+ const msg = message as Message;
446
+ if (runnerMessageShouldDirtyObligations(msg, this.agentId)) this.obligationCache.markDirty();
447
+ this.enqueueMessage(msg);
446
448
  });
447
449
  this.bus.on("command", (type, params, commandId, command) => {
448
450
  void this.handleCommand(type, params, commandId, command);
@@ -49,6 +49,10 @@ export function runnerMessageMatches(message: Pick<Message, "to" | "resolvedToAg
49
49
  });
50
50
  }
51
51
 
52
+ export function runnerMessageShouldDirtyObligations(message: Pick<Message, "from">, agentId: string): boolean {
53
+ return message.from !== agentId;
54
+ }
55
+
52
56
  export function taskIdFromMessage(message: Pick<Message, "payload">): number | undefined {
53
57
  const taskId = message.payload?.taskId;
54
58
  return Number.isSafeInteger(taskId) ? taskId as number : undefined;