Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion web/lib/agent-chat-snippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
14 changes: 14 additions & 0 deletions web/lib/test/agent-chat-snippet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
Loading