Skip to content

Commit f7670b9

Browse files
ericdalloeca
andcommitted
Add chat/promptSteer support for steering running prompts
🤖 Generated with [eca](https://eca.dev) Co-Authored-By: eca <git@eca.dev>
1 parent 2053d55 commit f7670b9

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

src/bridge/api.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ export class EcaRemoteApi {
132132
});
133133
}
134134

135+
/** Steer a running prompt by injecting a message at the next turn boundary. */
136+
async steerPrompt(chatId: string, message: string): Promise<void> {
137+
return this.request(`/chats/${chatId}/steer`, {
138+
method: 'POST',
139+
body: { message },
140+
});
141+
}
142+
135143
/** Approve a pending tool call. Ignores 409 (already handled). */
136144
async approveToolCall(chatId: string, toolCallId: string, save?: string): Promise<void> {
137145
return this.request(`/chats/${chatId}/approve/${toolCallId}`, {

src/bridge/outbound-handler.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ export async function handleOutbound(
6767
await api.stopPrompt(data.chatId);
6868
break;
6969

70+
case 'chat/promptSteer':
71+
await api.steerPrompt(data.chatId, data.message);
72+
break;
73+
7074
case 'chat/delete':
7175
// No-op in web: closing a tab should not delete the chat from the
7276
// server cache. The webview already removes it locally via resetChat.

src/bridge/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ export type OutboundMessage =
239239
| { type: 'chat/toolCallApprove'; data: { chatId: string; toolCallId: string; save?: string } }
240240
| { type: 'chat/toolCallReject'; data: { chatId: string; toolCallId: string } }
241241
| { type: 'chat/promptStop'; data: { chatId: string } }
242+
| { type: 'chat/promptSteer'; data: { chatId: string; message: string } }
242243
| { type: 'chat/delete'; data: { chatId: string } }
243244
| { type: 'chat/rollback'; data: { chatId: string; contentId: string } }
244245
| { type: 'chat/clearChat'; data: { chatId: string } }

0 commit comments

Comments
 (0)