ag-ui-protocol / ag-ui-protocol/ag-ui

[Chore]: `@ag-ui/client`, bundle-size optimization: Expose HttpClient without protobuf

Đang mở
#1,230 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement SDK
Ngôn ngữ chính
Python
Star
15.9k
Fork
1.4k
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
163

Mô tả

_Originally discussed on [Discord](https://discord.com/channels/1379082175625953370/1474619674074550404)_

The current [HTTPAgent](https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/typescript/packages/client/src/agent/http.ts) uses [`transformHttpEventStream`](https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/typescript/packages/client/src/transform/http.ts) which uses/support both protobuf responses, and non-protobuf responses.

This means that consumers that do not use protobuf either need to:
- Accept that they will import `@ag-ui/proto` as a dead-weight (unused code)
- Base themselves from the [AbstractAgent](https://github.com/ag-ui-protocol/ag-ui/blob/main/sdks/typescript/packages/client/src/agent/agent.ts), and recode part of the transformHttpEventStream.

What I'd propose is to extract the actual stream handler out of the HTTPAgent and to make it a composable part instead, allowing consumers to do something like

```ts
const mySseAgent = new HTTPAgent({parser: sseParser});
const myProtoAgent = new HTTPAgent({parser: protoParse});
```

Allowing the consumer to only use, import, and bundle the parser it actually needs.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.