charmbracelet / charmbracelet/fantasy

Include accumulated text in OnTextEnd callback

Open
#239 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
987
Forks
137
Avg merge
14h 41m
Merged PRs (30d)
12

Description

Currently `OnTextEndFunc` receives only the message ID:

```go
OnTextEndFunc func(id string) error
```

Consumers who need the full accumulated text (e.g., to collect or persist completed messages) must buffer all deltas themselves. This duplicates the internal `activeTextContent` map already maintained by the agent.

`OnReasoningEndFunc` already passes the full content:

```go
OnReasoningEndFunc func(id string, reasoning ReasoningContent) error
```

Proposal: add the accumulated text as a second parameter:

```go
OnTextEndFunc func(id string, text string) error
```

The text is already available at the call site from `activeTextContent[part.ID]`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.