a2aproject / a2aproject/a2a-js

[Bug]: toCoreMessage defaults optional taskId to "" instead of undefined

Offen
#678 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
613
Forks
169
Ø Merge
1 T. 6 Std.
Gemergte PRs (30 T.)
21

Beschreibung

### What happened?

When a v0.3 message does not have a `taskId`, `toCoreMessage` in the compat layer sets it to `""` instead of leaving it as `undefined`:

```
// dist/compat/v0_3/client/index.js, line 996
taskId: compatMsg.taskId ?? "",
```

`taskId` is optional in v0.3, so not every message has one. Setting it to `""` causes problems for consumers that check whether `taskId` is present, because `""` looks like a value but is not a valid task ID. In JavaScript, an optional field that is not set should be `undefined`, not `""`.

### Relevant log output

```shell

```

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.