Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor agent implementation #165

Merged
merged 4 commits into from
May 20, 2024
Merged

Refactor agent implementation #165

merged 4 commits into from
May 20, 2024

Conversation

alcarney
Copy link
Member

Rather than try to embed a JSON-RPC message inside another JSON-RPC
message (i.e. the MessageText notification) this commit changes the
agent to forward the message onto the inspector program (mostly)
unmodified.

The most important detail is that we leave the message encoded as
bytes, this way we don't introduce any errors caused by Python
counting the length of unicode characters differently, depending on if
they are a string or a sequence of bytes. Closes #157

>>> len('∊')
1
>>> len('∊'.encode())
3

As for the metadata fields that were included in the MessageText,
these are now passed as additional headers prepended to the captured
message

alcarney added 4 commits May 20, 2024 22:51
Rather than try to embed a JSON-RPC message inside another JSON-RPC
message (i.e. the `MessageText` notification) this commit changes the
agent to forward the message onto the inspector program (mostly)
unmodified.

The most important detail is that we leave the message encoded as
bytes, this way we don't introduce any errors caused by Python
counting the length of unicode characters differently, depending on if
they are a string or a sequence of bytes.

```python
>>> len('∊')
1
>>> len('∊'.encode())
3
```

As for the metadata fields that were included in the `MessageText`,
these are now passed as additional headers prepended to the captured
message
@alcarney alcarney merged commit 03b0947 into swyddfa:develop May 20, 2024
8 checks passed
@alcarney alcarney deleted the unicode branch May 20, 2024 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

record --to-file having trouble with unicode?
1 participant