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

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

Aperta
#1,230 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement SDK
Lingua principale
Python
Stelle
15.9k
Fork
1.4k
Merge medio
1g 17h
PR unite (30g)
163

Descrizione

_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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.