ag-ui-protocol / ag-ui-protocol/ag-ui
[Bug]: Dart SDK: AgUiClient hard-requires an absolute http(s) baseUrl — no relative-path support for same-origin / reverse-proxied Flutter Web deployments
- 主要語言
- Python
- 星號
- 15.9k
- 分支
- 1.4k
- 平均合併
- 1 天 17 小時
- 30 天內合併 PR
- 163
描述
### Pre-flight Checklist
- [x] I have searched [existing issues](https://github.com/ag-ui-protocol/ag-ui/issues) and this hasn't been reported yet.
- [x] I am using the **latest** version AG-UI.
### Describe the Bug
`AgUiClient` in the Dart SDK (`sdks/community/dart`, published as `ag_ui` 0.3.0)
forces `baseUrl` to be an **absolute** `http://` / `https://` URL. A relative base
path (e.g. `api/agui` or `/api/agui`) is rejected synchronously inside `runAgent`,
before any request is made. This makes it impossible for a Flutter Web app to point
at a backend served from the same origin under a path prefix (or behind a reverse
proxy) without hard-coding the deployment origin at build time.
### Steps to Reproduce
```dart
import 'package:ag_ui/ag_ui.dart';
void main() {
final client = AgUiClient(
// Relative base path: backend lives at /api/agui.
config: AgUiClientConfig(baseUrl: 'api/agui'),
);
// Throws synchronously before any request is sent:
client.runAgent('run', SimpleRunAgentInput(messages: []));
}
```
ValidationError: Invalid URL format or empty host for "baseUrl" (field: baseUrl) (constraint: valid-url) (value: api/agui)
### Expected Behavior
Allow a relative baseUrl (with or without a leading /) and resolve it against the current origin before sending the request — on the web this is Uri.base.resolve(...) semantics. Where no ambient origin exists (VM/native), either reject a scheme-less value with a clear error or require an explicit origin.
Optionally: let baseUrl be an empty/optional value on the web so it defaults to the page origin, or accept scheme + host + basePath as separate configuration.
Keep the existing strict absolute-URL validation as the default when an absolute URL is supplied (the control-character / credential checks in validateUrl remain valuable) — the ask is to add a supported relative mode, not to weaken the current one.
### Environment
```text
- Package: `ag_ui` 0.3.0 (`sdks/community/dart`)
- Target: Flutter Web — the SDK already works there (`package:http` only, no `dart:io`)
- Dart SDK: >= 3.3
```
### Screenshots
_No response_
### Logs & Errors
```shell
```
### Additional Context
_No response_
貢獻指南
評估
這個 Issue 還沒有評估資料。