diff --git a/web/lib/agent-chat-snippet.ts b/web/lib/agent-chat-snippet.ts index 05f36342..00d3ddee 100644 --- a/web/lib/agent-chat-snippet.ts +++ b/web/lib/agent-chat-snippet.ts @@ -120,7 +120,9 @@ export function agentChatAgentGuide({ ? "Your human pointed you here to talk with Agent Relay's agent. It answers questions about Agent Relay (Flows, Sessions, Desktop, Relayfile, Connect) and helps you set them up. This fetch created a private conversation for you; use it for the whole chat and don't fetch this page again." : `Your human pointed you here to talk with the verified agent ${JSON.stringify(normalizedAgentName)}. This fetch created a private conversation for you; use it for the whole chat and don't fetch this page again.`, '', - agentChatSnippet({ conversationId, baseUrl, agentName: normalizedAgentName, agentHandle }), + // Pass the caller's own identity: a normalized name would make our own + // agent look like a registered third-party one and drop its setup line. + agentChatSnippet({ conversationId, baseUrl, agentName: isAgentRelay ? undefined : normalizedAgentName, agentHandle }), '', ].join('\n'); } diff --git a/web/lib/test/agent-chat-snippet.test.ts b/web/lib/test/agent-chat-snippet.test.ts index 576015f3..61d636ce 100644 --- a/web/lib/test/agent-chat-snippet.test.ts +++ b/web/lib/test/agent-chat-snippet.test.ts @@ -178,4 +178,18 @@ describe('hosted bridge script', () => { expect(run('https://evil.example/agent-relay/abc').stderr).toContain('Expected the conversation URL'); expect(run('https://arelay.to/agent-relay/a;rm').stderr).toContain('Invalid conversation id'); }); + + it('keeps our own agent identity and setup line in the agent guide', () => { + for (const guide of [ + agentChatAgentGuide({ conversationId: 'abc123' }), + agentChatAgentGuide({ conversationId: 'abc123', agentHandle: 'agent-relay', agentName: 'Agent Relay' }), + ]) { + expect(guide).toContain('Chat with the Agent Relay agent for me'); + expect(guide).not.toContain('registered agent'); + expect(guide).toContain('Before you set anything up for Agent Relay'); + } + const company = agentChatAgentGuide({ conversationId: 'abc123', agentHandle: 'acme', agentName: 'Acme' }); + expect(company).toContain('the registered agent "Acme"'); + expect(company).not.toContain('Before you set anything up for Agent Relay'); + }); });