Skip to content

Commit 7c17a56

Browse files
Fix incorrect API endpoints in RemoteConversation
- Fix sendMessage endpoint from /send_message to /events - Fix setConfirmationPolicy endpoint from /set_confirmation_policy to /confirmation_policy - Fix sendConfirmationResponse endpoint from /send_confirmation_response to /events/respond_to_confirmation - Fix updateSecrets endpoint from /update_secrets to /secrets - Fix conversationStats to get stats from conversation info instead of non-existent /stats endpoint All endpoints now match the OpenAPI specification from the agent server implementation. Co-authored-by: openhands <[email protected]>
1 parent 5ac6dcb commit 7c17a56

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/conversation/remote-conversation.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ export class RemoteConversation {
8181
}
8282

8383
async conversationStats(): Promise<ConversationStats> {
84-
const response = await this.client.get<ConversationStats>(
85-
`/api/conversations/${this.id}/stats`
84+
const response = await this.client.get<ConversationInfo>(
85+
`/api/conversations/${this.id}`
8686
);
87-
return response.data;
87+
return response.data.stats;
8888
}
8989

9090
async sendMessage(message: string | Message): Promise<void> {
@@ -104,7 +104,7 @@ export class RemoteConversation {
104104
};
105105
}
106106

107-
await this.client.post(`/api/conversations/${this.id}/send_message`, messageContent);
107+
await this.client.post(`/api/conversations/${this.id}/events`, messageContent);
108108
}
109109

110110
async run(): Promise<void> {
@@ -116,12 +116,12 @@ export class RemoteConversation {
116116
}
117117

118118
async setConfirmationPolicy(policy: ConfirmationPolicyBase): Promise<void> {
119-
await this.client.post(`/api/conversations/${this.id}/set_confirmation_policy`, policy);
119+
await this.client.post(`/api/conversations/${this.id}/confirmation_policy`, policy);
120120
}
121121

122122
async sendConfirmationResponse(accept: boolean, reason?: string): Promise<void> {
123123
const request: ConfirmationResponseRequest = { accept, reason };
124-
await this.client.post(`/api/conversations/${this.id}/send_confirmation_response`, request);
124+
await this.client.post(`/api/conversations/${this.id}/events/respond_to_confirmation`, request);
125125
}
126126

127127
async generateTitle(maxLength: number = 50, llm?: any): Promise<string> {
@@ -145,7 +145,7 @@ export class RemoteConversation {
145145
}
146146

147147
const request: UpdateSecretsRequest = { secrets: secretStrings };
148-
await this.client.post(`/api/conversations/${this.id}/update_secrets`, request);
148+
await this.client.post(`/api/conversations/${this.id}/secrets`, request);
149149
}
150150

151151
async startWebSocketClient(): Promise<void> {

0 commit comments

Comments
 (0)