core-agent-ide/codex-rs/protocol/src
Michael Bolin 3f40fbc0a8
chore: improve serialization of ServerNotification (#3193)
This PR introduces introduces a new
`OutgoingMessage::AppServerNotification` variant that is designed to
wrap a `ServerNotification`, which makes the serialization more
straightforward compared to
`OutgoingMessage::Notification(OutgoingNotification)`. We still use the
latter for serializing an `Event` as a `JSONRPCMessage::Notification`,
but I will try to get away from that in the near future.

With this change, now the generated TypeScript type for
`ServerNotification` is:

```typescript
export type ServerNotification =
  | { "method": "authStatusChange", "params": AuthStatusChangeNotification }
  | { "method": "loginChatGptComplete", "params": LoginChatGptCompleteNotification };
```

whereas before it was:

```typescript
export type ServerNotification =
  | { type: "auth_status_change"; data: AuthStatusChangeNotification }
  | { type: "login_chat_gpt_complete"; data: LoginChatGptCompleteNotification };
```

Once the `Event`s are migrated to the `ServerNotification` enum in Rust,
it should be considerably easier to work with notifications on the
TypeScript side, as it will be possible to `switch (message.method)` and
check for exhaustiveness.

Though we will probably need to introduce:

```typescript
export type ServerMessage = ServerRequest | ServerNotification;
```

and then we still need to group all of the `ServerResponse` types
together, as well.
2025-09-04 17:49:50 -07:00
..
config_types.rs [mcp-server] Update read config interface (#3093) 2025-09-04 16:26:41 -07:00
custom_prompts.rs Custom /prompts (#2696) 2025-08-29 02:16:39 +00:00
lib.rs Custom /prompts (#2696) 2025-08-29 02:16:39 +00:00
mcp_protocol.rs chore: improve serialization of ServerNotification (#3193) 2025-09-04 17:49:50 -07:00
message_history.rs fix: introduce codex-protocol crate (#2355) 2025-08-15 12:44:40 -07:00
models.rs Dividing UserMsgs into categories to send it back to the tui (#3127) 2025-09-04 05:34:50 +00:00
parse_command.rs rework message styling (#2877) 2025-09-02 17:29:58 +00:00
plan_tool.rs fix: introduce codex-protocol crate (#2355) 2025-08-15 12:44:40 -07:00
protocol.rs Correctly calculate remaining context size (#3190) 2025-09-04 23:34:14 +00:00