Skip to content

Commit ccbff66

Browse files
NikolaiSviridovslapoguzov
authored andcommitted
fix: handle warning
1 parent 097da94 commit ccbff66

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/CodexEventHandler.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import type {
1818
ItemStartedNotification, ThreadItem,
1919
ModelReroutedNotification,
2020
ThreadTokenUsageUpdatedNotification,
21-
TurnPlanUpdatedNotification
21+
TurnPlanUpdatedNotification,
22+
WarningNotification
2223
} from "./app-server/v2";
2324
import type { McpStartupCompleteEvent } from "./app-server";
2425
import {toTokenCount} from "./TokenCount";
@@ -115,6 +116,8 @@ export class CodexEventHandler {
115116
return null;
116117
case "configWarning":
117118
return await this.createConfigWarningEvent(notification.params);
119+
case "warning":
120+
return this.createWarningEvent(notification.params);
118121
case "thread/compacted":
119122
return {
120123
sessionUpdate: "agent_message_chunk",
@@ -139,7 +142,6 @@ export class CodexEventHandler {
139142
case "windowsSandbox/setupCompleted":
140143
case "account/login/completed":
141144
case "skills/changed":
142-
case "warning":
143145
case "deprecationNotice":
144146
case "mcpServer/oauthLogin/completed":
145147
case "externalAgentConfig/import/completed":
@@ -179,6 +181,16 @@ export class CodexEventHandler {
179181
}
180182
}
181183

184+
private createWarningEvent(event: WarningNotification): UpdateSessionEvent {
185+
return {
186+
sessionUpdate: "agent_message_chunk",
187+
content: {
188+
type: "text",
189+
text: `Warning: ${event.message}\n\n`
190+
}
191+
};
192+
}
193+
182194
private createModelReroutedEvent(event: ModelReroutedNotification): UpdateSessionEvent {
183195
return {
184196
sessionUpdate: "agent_thought_chunk",

0 commit comments

Comments
 (0)