Skip to content

Commit 2e5e8d6

Browse files
committed
updated code
1 parent 99cc881 commit 2e5e8d6

File tree

5 files changed

+7
-18
lines changed

5 files changed

+7
-18
lines changed

src/client/interceptors.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,13 @@ export type ClientCallResult<K extends keyof Client = keyof Client> = MethodResu
8181
* }
8282
*/
8383
type MethodInput<T, TMembers extends keyof T = keyof T> = {
84-
[M in TMembers]: M extends keyof RequestOverrides
85-
? { readonly method: M; value: RequestOverrides[M] }
84+
[M in TMembers]: T[M] extends (requestOptions: RequestOptions | undefined) => unknown
85+
? { readonly method: M; value?: undefined }
8686
: T[M] extends (payload: infer P) => unknown
8787
? { readonly method: M; value: P }
8888
: never;
8989
}[TMembers];
9090

91-
interface RequestOverrides {
92-
getAgentCard: undefined;
93-
}
94-
9591
/**
9692
* For
9793
*

src/client/multitransport-client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ export class Client {
7878
async getAgentCard(options?: RequestOptions): Promise<AgentCard> {
7979
if (this.agentCard.supportsAuthenticatedExtendedCard) {
8080
this.agentCard = await this.executeWithInterceptors(
81-
{ method: 'getAgentCard', value: undefined },
81+
{ method: 'getAgentCard' },
8282
options,
83-
this.transport.getAuthenticatedExtendedAgentCard.bind(this.transport)
83+
(_, options) => this.transport.getAuthenticatedExtendedAgentCard(options)
8484
);
8585
}
8686
return this.agentCard;

src/client/transports/json_rpc_transport.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,13 @@ export class JsonRpcTransport implements Transport {
5050
}
5151

5252
async getAuthenticatedExtendedAgentCard(
53-
params: undefined,
5453
options?: RequestOptions,
5554
idOverride?: number
5655
): Promise<AgentCard> {
5756
const rpcResponse = await this._sendRpcRequest<
5857
undefined,
5958
GetAuthenticatedExtendedCardSuccessResponse
60-
>('agent/getAuthenticatedExtendedCard', params, idOverride, options);
59+
>('agent/getAuthenticatedExtendedCard', undefined, idOverride, options);
6160
return rpcResponse.result;
6261
}
6362

src/client/transports/transport.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ import { A2AStreamEventData, SendMessageResult } from '../client.js';
1313
import { RequestOptions } from '../multitransport-client.js';
1414

1515
export interface Transport {
16-
getAuthenticatedExtendedAgentCard(
17-
params: undefined,
18-
options?: RequestOptions
19-
): Promise<AgentCard>;
16+
getAuthenticatedExtendedAgentCard(options?: RequestOptions): Promise<AgentCard>;
2017

2118
sendMessage(params: MessageSendParams, options?: RequestOptions): Promise<SendMessageResult>;
2219

test/client/multitransport-client.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,8 @@ describe('Client', () => {
6363
client = new Client(transport, agentCardWithExtendedSupport);
6464

6565
let caughtOptions;
66-
let caughtParam;
67-
transport.getAuthenticatedExtendedAgentCard.callsFake(async (param, options) => {
66+
transport.getAuthenticatedExtendedAgentCard.callsFake(async (options) => {
6867
caughtOptions = options;
69-
caughtParam = param;
7068
return extendedAgentCard;
7169
});
7270

@@ -78,7 +76,6 @@ describe('Client', () => {
7876
expect(transport.getAuthenticatedExtendedAgentCard.calledOnce).to.be.true;
7977
expect(result).to.equal(extendedAgentCard);
8078
expect(caughtOptions).to.equal(expectedOptions);
81-
expect(caughtParam).to.equal(undefined);
8279
});
8380

8481
it('should not call transport.getAuthenticatedExtendedAgentCard if not supported', async () => {

0 commit comments

Comments
 (0)