Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Finalize anthropic backend parity updates and tests
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
  • Loading branch information
Copilot and sawka committed Mar 3, 2026
commit 96467627e8b39aaa5dadb4a3c21c617be7a4c847
16 changes: 14 additions & 2 deletions pkg/aiusechat/anthropic/anthropic-backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"io"
"net/http"
"net/url"
"sort"
"strings"
"time"

Expand Down Expand Up @@ -621,7 +622,15 @@ func extractPartialTextFromState(state *streamingState) *anthropicChatMessage {
content = append(content, block)
}
}
for _, st := range state.blockMap {
var partialIdx []int
for idx, st := range state.blockMap {
if st.kind == blockText && st.contentBlock != nil && st.contentBlock.Text != "" {
partialIdx = append(partialIdx, idx)
}
}
sort.Ints(partialIdx)
for _, idx := range partialIdx {
st := state.blockMap[idx]
if st.kind == blockText && st.contentBlock != nil && st.contentBlock.Text != "" {
content = append(content, *st.contentBlock)
}
Expand All @@ -630,9 +639,10 @@ func extractPartialTextFromState(state *streamingState) *anthropicChatMessage {
return nil
}
return &anthropicChatMessage{
MessageId: uuid.New().String(),
MessageId: state.rtnMessage.MessageId,
Role: "assistant",
Content: content,
Usage: state.rtnMessage.Usage,
}
}

Expand Down Expand Up @@ -856,6 +866,8 @@ func handleAnthropicEvent(
}
state.rtnMessage.Content = append(state.rtnMessage.Content, toolUseBlock)
}
// extractPartialTextFromState reads blockMap for still-in-flight content, so remove completed blocks
// once they have been appended to rtnMessage.Content to avoid duplicate text on disconnect.
delete(state.blockMap, *ev.Index)
return nil, nil

Expand Down
7 changes: 1 addition & 6 deletions tsunami/demo/cpuchart/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ module tsunami/app/cpuchart

go 1.25.6

require (
github.com/shirou/gopsutil/v4 v4.25.8
github.com/wavetermdev/waveterm/tsunami v0.0.0
)
require github.com/shirou/gopsutil/v4 v4.25.8

require (
github.com/ebitengine/purego v0.8.4 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/outrigdev/goid v0.3.0 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/tklauser/go-sysconf v0.3.15 // indirect
github.com/tklauser/numcpus v0.10.0 // indirect
Expand Down
12 changes: 0 additions & 12 deletions tsunami/demo/cpuchart/go.sum
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw=
github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws=
github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/shirou/gopsutil/v4 v4.25.8 h1:NnAsw9lN7587WHxjJA9ryDnqhJpFH6A+wagYWTOH970=
github.com/shirou/gopsutil/v4 v4.25.8/go.mod h1:q9QdMmfAOVIw7a+eF86P7ISEU6ka+NLgkUxlopV4RwI=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4=
github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4=
github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso=
Expand All @@ -32,5 +22,3 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
7 changes: 0 additions & 7 deletions tsunami/demo/githubaction/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@ module tsunami/app/githubaction

go 1.25.6

require github.com/wavetermdev/waveterm/tsunami v0.0.0

require (
github.com/google/uuid v1.6.0 // indirect
github.com/outrigdev/goid v0.3.0 // indirect
)

replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami
4 changes: 0 additions & 4 deletions tsunami/demo/githubaction/go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws=
github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE=
7 changes: 0 additions & 7 deletions tsunami/demo/modaltest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@ module github.com/wavetermdev/waveterm/tsunami/demo/modaltest

go 1.25.6

require github.com/wavetermdev/waveterm/tsunami v0.0.0-00010101000000-000000000000

require (
github.com/google/uuid v1.6.0 // indirect
github.com/outrigdev/goid v0.3.0 // indirect
)

replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami
4 changes: 0 additions & 4 deletions tsunami/demo/modaltest/go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws=
github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE=
7 changes: 0 additions & 7 deletions tsunami/demo/pomodoro/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@ module tsunami/app/pomodoro

go 1.25.6

require github.com/wavetermdev/waveterm/tsunami v0.0.0

require (
github.com/google/uuid v1.6.0 // indirect
github.com/outrigdev/goid v0.3.0 // indirect
)

replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami
4 changes: 0 additions & 4 deletions tsunami/demo/pomodoro/go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws=
github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE=
7 changes: 0 additions & 7 deletions tsunami/demo/recharts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@ module tsunami/app/recharts

go 1.25.6

require github.com/wavetermdev/waveterm/tsunami v0.0.0

require (
github.com/google/uuid v1.6.0 // indirect
github.com/outrigdev/goid v0.3.0 // indirect
)

replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami
4 changes: 0 additions & 4 deletions tsunami/demo/recharts/go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws=
github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE=
7 changes: 0 additions & 7 deletions tsunami/demo/tabletest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@ module tsunami/app/tabletest

go 1.25.6

require github.com/wavetermdev/waveterm/tsunami v0.0.0

require (
github.com/google/uuid v1.6.0 // indirect
github.com/outrigdev/goid v0.3.0 // indirect
)

replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami
4 changes: 0 additions & 4 deletions tsunami/demo/tabletest/go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws=
github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE=
7 changes: 0 additions & 7 deletions tsunami/demo/todo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@ module tsunami/app/todo

go 1.25.6

require github.com/wavetermdev/waveterm/tsunami v0.0.0

require (
github.com/google/uuid v1.6.0 // indirect
github.com/outrigdev/goid v0.3.0 // indirect
)

replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami
4 changes: 0 additions & 4 deletions tsunami/demo/todo/go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws=
github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE=
7 changes: 0 additions & 7 deletions tsunami/demo/tsunamiconfig/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@ module tsunami/app/tsunamiconfig

go 1.25.6

require github.com/wavetermdev/waveterm/tsunami v0.0.0

require (
github.com/google/uuid v1.6.0 // indirect
github.com/outrigdev/goid v0.3.0 // indirect
)

replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami
4 changes: 0 additions & 4 deletions tsunami/demo/tsunamiconfig/go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws=
github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE=