agent-relay-codex 0.4.18 → 0.4.23

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.
@@ -118,7 +118,15 @@ function isAgentRelaySessionStartCommand(command: string): boolean {
118
118
  return /agent-relay.*hooks\/session-start\.ts/.test(command);
119
119
  }
120
120
 
121
- function removeAgentRelaySessionStartToml(input: string): string {
121
+ function isSessionStartGroupHeader(header: string | null | undefined): boolean {
122
+ return header?.trim() === "[[hooks.SessionStart]]";
123
+ }
124
+
125
+ function isSessionStartHookHeader(header: string | null | undefined): boolean {
126
+ return header?.trim() === "[[hooks.SessionStart.hooks]]";
127
+ }
128
+
129
+ export function removeAgentRelaySessionStartToml(input: string): string {
122
130
  const lines = input.split(/\r?\n/);
123
131
  const blocks: Array<{ header: string | null; text: string }> = [];
124
132
 
@@ -136,15 +144,26 @@ function removeAgentRelaySessionStartToml(input: string): string {
136
144
  let output = "";
137
145
  for (let index = 0; index < blocks.length; ) {
138
146
  const block = blocks[index];
139
- if (block?.header?.startsWith("[[hooks.SessionStart")) {
140
- const group: typeof blocks = [];
141
- while (index < blocks.length && blocks[index]?.header?.startsWith("[[hooks.SessionStart")) {
142
- group.push(blocks[index]!);
147
+ if (isSessionStartGroupHeader(block?.header)) {
148
+ const group = block!;
149
+ const hooks: typeof blocks = [];
150
+ index += 1;
151
+ while (index < blocks.length && isSessionStartHookHeader(blocks[index]?.header)) {
152
+ hooks.push(blocks[index]!);
143
153
  index += 1;
144
154
  }
145
155
 
146
- const groupText = group.map((block) => block.text).join("\n");
147
- if (!isAgentRelaySessionStartCommand(groupText)) output += `${groupText}\n`;
156
+ const keptHooks = hooks.filter((hook) => !isAgentRelaySessionStartCommand(hook.text));
157
+ const groupIsAgentRelay = isAgentRelaySessionStartCommand(group.text) || (hooks.length > 0 && keptHooks.length === 0);
158
+ if (!groupIsAgentRelay || keptHooks.length > 0) {
159
+ output += `${group.text}\n`;
160
+ for (const hook of keptHooks) output += `${hook.text}\n`;
161
+ }
162
+ continue;
163
+ }
164
+
165
+ if (isSessionStartHookHeader(block?.header) && isAgentRelaySessionStartCommand(block?.text ?? "")) {
166
+ index += 1;
148
167
  continue;
149
168
  }
150
169
 
@@ -987,7 +1006,9 @@ async function main(): Promise<void> {
987
1006
  return start(command ? [command, ...args] : []);
988
1007
  }
989
1008
 
990
- main().catch((error) => {
991
- console.error(error instanceof Error ? error.message : String(error));
992
- process.exit(1);
993
- });
1009
+ if (import.meta.main) {
1010
+ main().catch((error) => {
1011
+ console.error(error instanceof Error ? error.message : String(error));
1012
+ process.exit(1);
1013
+ });
1014
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-relay-codex",
3
- "version": "0.4.18",
3
+ "version": "0.4.23",
4
4
  "description": "Codex integration for Agent Relay — auto-registers sessions as agents and enables inter-agent messaging",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-relay",
3
- "version": "0.4.18",
3
+ "version": "0.4.23",
4
4
  "description": "Agent Relay integration for Codex sessions",
5
5
  "author": {
6
6
  "name": "Edin Mujkanovic"
package/relay.ts CHANGED
@@ -66,6 +66,7 @@ export class RelayClient {
66
66
  status: "online",
67
67
  instanceId: config.instanceId,
68
68
  meta: {
69
+ provider: "codex",
69
70
  client: "codex-live",
70
71
  threadId: config.threadId,
71
72
  appServerUrl: config.appServerUrl,