Merge pull request #838 from samcharles93/fix/telegram-output-and-bot-upgrade
fix(telegram): summarise tool results instead of quoting an arbitrary line
This commit is contained in:
5 files changed
+358
-59
No files matched your search
@@ -68,7 +68,7 @@ require (
|
||||
github.com/BurntSushi/toml v1.6.0
|
||||
github.com/go-git/go-billy/v6 v6.0.0-alpha.2
|
||||
github.com/go-git/go-git/v6 v6.0.0-alpha.5
|
||||
github.com/go-telegram/bot v1.25.0
|
||||
github.com/go-telegram/bot v1.27.0
|
||||
github.com/google/codesearch v1.3.0-rc.1
|
||||
github.com/google/go-github/v78 v78.0.0
|
||||
github.com/google/uuid v1.6.0
|
||||
|
||||
@@ -2,21 +2,16 @@ cel.dev/cel-go v0.32.0 h1:irvpFKr5EuGPyxeME03ERh0rii1TX+BDAnB9eL3IvNk=
|
||||
cel.dev/cel-go v0.32.0/go.mod h1:DnVip7tpJSsgZymwfT+m1tnEVy3ivAjSMXPx12YrMkU=
|
||||
cel.dev/expr v0.25.3 h1:A2jO8jwOugrrovveCWfj0KEZOfqiLgAcwjpHPhzIGw0=
|
||||
cel.dev/expr v0.25.3/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4=
|
||||
cloud.google.com/go/auth v0.18.2/go.mod h1:xD+oY7gcahcu7G2SG2DsBerfFxgPAJz17zz2joOFF3M=
|
||||
cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10=
|
||||
code.gitea.io/sdk/gitea v0.25.1 h1:yywxWwoV+SdjHtbC6unBiXojWdZOtoHuGhEazEXeWuE=
|
||||
code.gitea.io/sdk/gitea v0.25.1/go.mod h1:uDFWYBU8dgZsgOHwe6C/6olxvf8FHguNB3wW1i83fgg=
|
||||
github.com/42wim/httpsig v1.2.4 h1:mI5bH0nm4xn7K18fo1K3okNDRq8CCJ0KbBYWyA6r8lU=
|
||||
github.com/42wim/httpsig v1.2.4/go.mod h1:yKsYfSyTBEohkPik224QPFylmzEBtda/kjyIAJjh3ps=
|
||||
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
|
||||
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
|
||||
github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.33.0/go.mod h1:pJTkW8hEUIIi3Pf65lPZOnn4Y81yCllX6IWk2jNXdkM=
|
||||
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
|
||||
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
|
||||
github.com/ProtonMail/go-crypto v1.4.1 h1:9RfcZHqEQUvP8RzecWEUafnZVtEvrBVL9BiF67IQOfM=
|
||||
github.com/ProtonMail/go-crypto v1.4.1/go.mod h1:e1OaTyu5SYVrO9gKOEhTc+5UcXtTUa+P3uLudwcgPqo=
|
||||
github.com/a-h/templ v0.3.1020/go.mod h1:A2DlK61v+K+NRoGnhmYbNYVmtYHcFO5/AisMvBdDxTM=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.8.0 h1:bVV5ZAuwaREn4klRSJusYaA+A7NXq8Qi9C/knCaQ2N4=
|
||||
@@ -25,18 +20,14 @@ github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYW
|
||||
github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
||||
github.com/bwesterb/go-ristretto v1.2.4/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
|
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cloudflare/circl v1.6.5 h1:O64F26HEqNhznd/hrC5KZXVKYuKM2rx4deZDTc4ihQA=
|
||||
github.com/cloudflare/circl v1.6.5/go.mod h1:h5LNyxAc5nTue9DS5jT+48en2PSDYt3zdGnz5OstK6c=
|
||||
github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4=
|
||||
github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI=
|
||||
github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M=
|
||||
github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE=
|
||||
github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk=
|
||||
github.com/containerd/typeurl/v2 v2.2.0/go.mod h1:8XOOxnyatxSWuG8OfsZXVnAF4iZfedjS/8UHSPJnX4g=
|
||||
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davidmz/go-pageant v1.0.2 h1:bPblRCh5jGU+Uptpz6LgMZGD5hJoOt7otgT454WvHn0=
|
||||
@@ -51,10 +42,6 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp
|
||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
|
||||
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
|
||||
github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU=
|
||||
github.com/envoyproxy/go-control-plane/envoy v1.37.0/go.mod h1:DReE9MMrmecPy+YvQOAOHNYMALuowAnbjjEMkkWOi6A=
|
||||
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4=
|
||||
github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0=
|
||||
github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc=
|
||||
github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE=
|
||||
github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
|
||||
@@ -69,17 +56,13 @@ github.com/go-git/go-git-fixtures/v6 v6.0.0-alpha.1 h1:gmqi2jvsreu0s8JMLylYDFq4s
|
||||
github.com/go-git/go-git-fixtures/v6 v6.0.0-alpha.1/go.mod h1:ECf1MqJlBdYpKggBrOXjo/0EnvRZx6D++I86UYjPgAQ=
|
||||
github.com/go-git/go-git/v6 v6.0.0-alpha.5 h1:sE+OlkHgYWNMVmN1s9sR7uyFgsWLtxcNWse/vBYKxRE=
|
||||
github.com/go-git/go-git/v6 v6.0.0-alpha.5/go.mod h1:3IjhiZnM+uBmUrOGSeqrJpsmi4Vd0H2NZO/uK2a7d0s=
|
||||
github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
|
||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8=
|
||||
github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow=
|
||||
github.com/go-telegram/bot v1.25.0 h1:C072msZtr+GjJiQsX/UJLirz+jzSNZVWkckxWufR7Ww=
|
||||
github.com/go-telegram/bot v1.25.0/go.mod h1:i2TRs7fXWIeaceF3z7KzsMt/he0TwkVC680mvdTFYeM=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang/glog v1.2.5/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
|
||||
github.com/go-telegram/bot v1.27.0 h1:PG9yBDzM8O26oUerE9SZwWlHon4RpH8WcNslZ7CEZmE=
|
||||
github.com/go-telegram/bot v1.27.0/go.mod h1:i2TRs7fXWIeaceF3z7KzsMt/he0TwkVC680mvdTFYeM=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/google/codesearch v1.3.0-rc.1 h1:vSFGuF5wS3sjimuLzqPG+PGjWQ9VvEtPFbxdZD7YuuQ=
|
||||
@@ -93,14 +76,10 @@ github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfh
|
||||
github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU=
|
||||
github.com/google/go-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo=
|
||||
github.com/google/go-tpm v0.9.8/go.mod h1:h9jEsEECg7gtLis0upRBQU+GhYVH6jMjrFxI8u6bVUY=
|
||||
github.com/google/go-tpm-tools v0.3.13-0.20230620182252-4639ecce2aba/go.mod h1:EFYHy8/1y2KfgTAsx7Luu7NGhoxtuVHnNo8jE7FikKc=
|
||||
github.com/google/pprof v0.0.0-20260802141513-ef3492d7dac3 h1:LMLX+LgTNWpfvCBdFebv6EsYotImrt/Ppc5cXIriCSo=
|
||||
github.com/google/pprof v0.0.0-20260802141513-ef3492d7dac3/go.mod h1:jl5iWTm0/hd5PjEYEOuwAJ57L/CibdZfrqZ5XA5GrCk=
|
||||
github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
|
||||
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/googleapis/enterprise-certificate-proxy v0.3.11/go.mod h1:RFV7MUdlb7AgEq2v7FmMCfeSMCllAzWxFgRdusoGks8=
|
||||
github.com/googleapis/gax-go/v2 v2.17.0/go.mod h1:mzaqghpQp4JDh3HvADwrat+6M3MOIDp5YKHhb9PAgDY=
|
||||
github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaXPSCnA=
|
||||
github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
|
||||
@@ -128,7 +107,6 @@ github.com/moby/moby/api v1.56.0 h1:GQzua3NA599ASSIICx0iFgiJeO9YkdDARvQsm23ZZuQ=
|
||||
github.com/moby/moby/api v1.56.0/go.mod h1:sZ+THbVWkjOmBPPfbnzdD/G1LuIexWhqlSHHPTDQ1Uk=
|
||||
github.com/moby/moby/client v0.6.0 h1:AJjEB21QPbXSXjDsZorFBoDZPhMrfbpaPLgSMAW9Bgs=
|
||||
github.com/moby/moby/client v0.6.0/go.mod h1:OCo00wNRyA3m4lmJ228W3JbyCN4ZNNYjpOXiJydBdcQ=
|
||||
github.com/moby/term v0.5.2/go.mod h1:d3djjFCrjnB+fl8NJux+EJzu0msscUP+f8it8hPkFLc=
|
||||
github.com/nats-io/jwt/v2 v2.8.2 h1:XXRgB60MSTnqsRwejQurVDs/hcv2dkt+86GjI+I/bMc=
|
||||
github.com/nats-io/jwt/v2 v2.8.2/go.mod h1:Ag/56sq9OblL4JgdYufDd16Egb17Kr/8WwwuO/forVc=
|
||||
github.com/nats-io/nats-server/v2 v2.14.6 h1:dHjEHa49lUTxIb5jrsk5kz/AmOyOQ4T9ti8djcBumDQ=
|
||||
@@ -149,20 +127,15 @@ github.com/pjbgf/sha1cd v0.6.0 h1:3WJ8Wz8gvDz29quX1OcEmkAlUg9diU4GxJHqs0/XiwU=
|
||||
github.com/pjbgf/sha1cd v0.6.0/go.mod h1:lhpGlyHLpQZoxMv8HcgXvZEhcGs0PG/vsZnEJ7H0iCM=
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
|
||||
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
|
||||
github.com/samcharles93/ai-sdk v0.1.32 h1:rfBpWUOADuRTaq2kyCnMjdhtlFfaqUbsyL5DbIluqmA=
|
||||
github.com/samcharles93/ai-sdk v0.1.32/go.mod h1:u4zrQ9/Q58L5mNEut4bNQ1ks+RCKq71LN5EDz2N/0Zk=
|
||||
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY=
|
||||
github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw=
|
||||
github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
|
||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/spiffe/go-spiffe/v2 v2.7.0/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
|
||||
@@ -171,7 +144,6 @@ github.com/traefik/yaegi v0.16.1 h1:f1De3DVJqIDKmnasUF6MwmWv1dSEEat0wcpXhD2On3E=
|
||||
github.com/traefik/yaegi v0.16.1/go.mod h1:4eVhbPb3LnD2VigQjhYbEJ69vDRFdT2HQNrXx8eEwUY=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/contrib/detectors/gcp v1.44.0/go.mod h1:tNAsgd8avTGke1+MndXlU5Cru4PQ9Ai/cCNWQv/ZJ/s=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.71.0 h1:3g7B90UzBltIDKq1/5mrTGxTnOFDV0ICOhLoxiZ8jlg=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.71.0/go.mod h1:Ef8SuTh59BT7+ofpDxN9z+yOlc4t2GjLmKDgYNJL/NU=
|
||||
go.opentelemetry.io/otel v1.46.0 h1:FHt5/CDyVxi/8IM1CH7VE/rRgq3kLHa2mSTVMO8AWyc=
|
||||
@@ -199,7 +171,6 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To=
|
||||
golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU=
|
||||
golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
|
||||
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
|
||||
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@@ -221,8 +192,6 @@ golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI=
|
||||
golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo=
|
||||
golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY=
|
||||
golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGNv1ib0J382/DPCRS/BPnsGebyM1Gj5VSDpG8=
|
||||
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
|
||||
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260904194346-d0f1323225a4 h1:NCe/UiklGd/9xjT+ROBVhJ1kf6TRQaFedsR+z7u1gvo=
|
||||
|
||||
@@ -230,7 +230,10 @@ func TestLiveReplyRendersNoisyToolTurnAsCompactTelegramText(t *testing.T) {
|
||||
live.finalize(context.Background(), "I found the relevant renderer and stopped after the output-volume cap.")
|
||||
|
||||
got := (*calls)[len(*calls)-1].body()
|
||||
want := "🔧 read — done\n\npackage gateway\n… 7 more lines\n\n" +
|
||||
// A tool result is described, never quoted with an invented line count:
|
||||
// "… 7 more lines" was the renderer counting its own truncated sample, and
|
||||
// it cannot agree with the total the tool actually reported.
|
||||
want := "🔧 read — done\n\npackage gateway\n\n" +
|
||||
"🔧 find — done\n\n/home/sam/projects/unrelated/main.go\n\n" +
|
||||
"🔧 shell — failed\n\ncommand_exit: exit status 2\n\n" +
|
||||
"🔧 tools — stopped ×5\n\ntool-output limit reached (200000 chars); further results suppressed\n\n" +
|
||||
@@ -238,6 +241,9 @@ func TestLiveReplyRendersNoisyToolTurnAsCompactTelegramText(t *testing.T) {
|
||||
if got != want {
|
||||
t.Fatalf("Telegram-visible text:\n%s\n\nwant:\n%s", got, want)
|
||||
}
|
||||
if strings.Contains(got, "more lines") {
|
||||
t.Errorf("renderer invented a line count from a truncated sample:\n%s", got)
|
||||
}
|
||||
for i, call := range *calls {
|
||||
for _, forbidden := range []string{
|
||||
`\\n`, `\\\"`, "[string]", "turn budget exceeded",
|
||||
@@ -704,9 +710,15 @@ func TestLiveReplyFramedTextClampsAnOversizedToolBlock(t *testing.T) {
|
||||
if !strings.Contains(last.body(), "the answer") {
|
||||
t.Fatalf("answer was lost after bounding oversized tool output: %.80q…", last.body())
|
||||
}
|
||||
if strings.Count(last.body(), "ok") > 3 || !strings.Contains(last.body(), "more lines") {
|
||||
// The oversized block must be summarised rather than dumped, and the
|
||||
// summary must not be a line count the renderer invented: "ok" repeats far
|
||||
// more than three times, so anything that echoed the sample fails here.
|
||||
if strings.Count(last.body(), "ok") > 3 {
|
||||
t.Fatalf("oversized tool output was not summarized: %.80q…", last.body())
|
||||
}
|
||||
if strings.Contains(last.body(), "more lines") {
|
||||
t.Errorf("summary invented a line count from a truncated sample: %.80q…", last.body())
|
||||
}
|
||||
}
|
||||
|
||||
// A provider error is not an acknowledged interruption the way /stop is, so
|
||||
|
||||
+189
-23
@@ -3,6 +3,7 @@ package gateway
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/webhookguard"
|
||||
@@ -65,37 +66,210 @@ func toolProgressBlock(name, status, preview string) string {
|
||||
return "🔧 " + name + " — " + status + "\n```text\n" + truncateRunes(preview, 180) + "\n```"
|
||||
}
|
||||
|
||||
// toolPreview reduces a tool result to one informative line.
|
||||
//
|
||||
// The result is described, never quoted: a search returns match lines that say
|
||||
// nothing on their own (a path, a line number, a closing brace), so the preview
|
||||
// states what came back and how much of it. The count comes from the tool's own
|
||||
// truncation notice when it printed one, because a count recomputed from the
|
||||
// visible sample describes the sample, not the result set -- rendering both
|
||||
// produced two different numbers for one search ("194 more lines" next to
|
||||
// "… 3 more lines"), which reads as noise.
|
||||
func toolPreview(name, output string) string {
|
||||
content, _ := unwrapToolContent(output)
|
||||
preview, skipped := compactToolPreview(content)
|
||||
if preview == "" {
|
||||
if strings.TrimSpace(content) == "" {
|
||||
return "completed"
|
||||
if strings.TrimSpace(content) == "" {
|
||||
return "completed"
|
||||
}
|
||||
// A notice the tool printed is the only trustworthy source for how much
|
||||
// came back; anything counted here describes the visible sample.
|
||||
if summary, ok := toolNoticeSummary(content); ok {
|
||||
return summary
|
||||
}
|
||||
// Only a search gets a counted summary. A compiler or linter diagnostic has
|
||||
// the same "file.go:42: message" shape as a search hit, so counting every
|
||||
// tool's output would report a build error as "3 matches" and hide the very
|
||||
// output the operator asked for.
|
||||
if isSearchTool(name) {
|
||||
if summary, ok := searchResultSummary(content); ok {
|
||||
return summary
|
||||
}
|
||||
}
|
||||
preview := firstInformativeLine(content)
|
||||
if preview == "" {
|
||||
return "completed with no printable preview"
|
||||
}
|
||||
remaining := max(countNonEmptyOrContentLines(content)-1-skipped, 0)
|
||||
if remaining > 0 {
|
||||
return fmt.Sprintf("%s\n… %d more lines", preview, remaining)
|
||||
}
|
||||
_ = name
|
||||
return preview
|
||||
}
|
||||
|
||||
func compactToolPreview(output string) (string, int) {
|
||||
skipped := 0
|
||||
for line := range strings.SplitSeq(output, "\n") {
|
||||
// searchToolNames are the tools whose output is a set of matches, and so reads
|
||||
// better counted than sampled. Every other tool is described by its first
|
||||
// informative line.
|
||||
var searchToolNames = map[string]bool{
|
||||
"grep": true,
|
||||
"rg": true,
|
||||
"search": true,
|
||||
"toolsearch": true,
|
||||
}
|
||||
|
||||
func isSearchTool(name string) bool {
|
||||
return searchToolNames[strings.ToLower(strings.TrimSpace(name))]
|
||||
}
|
||||
|
||||
// toolNoticeSummary renders the "how much came back" summary from the
|
||||
// truncation notice the tool printed, if any.
|
||||
//
|
||||
// Two notice shapes exist (internal/tools/builtin): shell prints "[truncated:
|
||||
// showing last N/M lines, …]" and the other tools print "[truncated: showing
|
||||
// N/M lines, …]". Both are metadata, never content, so both must be recognised
|
||||
// -- missing the "last" form would quote the raw notice as the preview, which
|
||||
// is the exact defect this change removes.
|
||||
//
|
||||
// The same notice also tells us WHICH END was kept, which changes the summary:
|
||||
// a head-truncation ("showing 3/197") lost the tail, so "showing 3" describes
|
||||
// the sample; a tail-truncation ("showing last 66/97") lost the head, so the
|
||||
// count of what is visible says nothing useful about the whole.
|
||||
func toolNoticeSummary(content string) (string, bool) {
|
||||
for line := range strings.SplitSeq(content, "\n") {
|
||||
notice, ok := parseTruncationNotice(strings.TrimSpace(line))
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if notice.total <= notice.shown {
|
||||
continue // showing everything is not a truncation
|
||||
}
|
||||
if notice.truncatedHead {
|
||||
return fmt.Sprintf("%d lines total; showing last %d", notice.total, notice.shown), true
|
||||
}
|
||||
return fmt.Sprintf("%d lines total; showing %d", notice.total, notice.shown), true
|
||||
}
|
||||
return "", false
|
||||
}
|
||||
|
||||
// truncationNotice describes how much a tool reported and which end it kept.
|
||||
type truncationNotice struct {
|
||||
shown int
|
||||
total int
|
||||
truncatedHead bool // the kept lines are the tail ("showing last N/M")
|
||||
}
|
||||
|
||||
// parseTruncationNotice reads "<shown>/<total> lines" out of a truncation
|
||||
// notice, accepting both the plain and the "showing last" form.
|
||||
//
|
||||
// The "[truncated: … ]" wrapper is required, not tolerated. It is the only
|
||||
// marker that distinguishes a notice the tool printed from ordinary output that
|
||||
// happens to contain the same phrasing: both built-in producers emit the
|
||||
// wrapper (internal/tools/builtin/truncate.go), so a bare "showing 3/197 lines"
|
||||
// inside a log or a document is content and must be left alone rather than
|
||||
// replaced by a summary.
|
||||
func parseTruncationNotice(line string) (truncationNotice, bool) {
|
||||
_, rest, found := strings.Cut(line, "[truncated: ")
|
||||
if !found {
|
||||
return truncationNotice{}, false
|
||||
}
|
||||
_, rest, found = strings.Cut(rest, "showing ")
|
||||
if !found {
|
||||
return truncationNotice{}, false
|
||||
}
|
||||
truncatedHead := false
|
||||
if after, ok := strings.CutPrefix(rest, "last "); ok {
|
||||
rest, truncatedHead = after, true
|
||||
}
|
||||
counts, _, found := strings.Cut(rest, " lines")
|
||||
if !found {
|
||||
return truncationNotice{}, false
|
||||
}
|
||||
left, right, found := strings.Cut(counts, "/")
|
||||
if !found {
|
||||
return truncationNotice{}, false
|
||||
}
|
||||
shown, errShown := strconv.Atoi(strings.TrimSpace(left))
|
||||
total, errTotal := strconv.Atoi(strings.TrimSpace(right))
|
||||
if errShown != nil || errTotal != nil {
|
||||
return truncationNotice{}, false
|
||||
}
|
||||
return truncationNotice{shown: shown, total: total, truncatedHead: truncatedHead}, true
|
||||
}
|
||||
|
||||
// searchResultSummary counts the match lines in ripgrep-shaped output. Only
|
||||
// matches are counted: with context requested, ripgrep also emits context lines
|
||||
// ("path-12-text", hyphen separator) and "--" group separators, and counting
|
||||
// those would report the match count plus every context line around it.
|
||||
func searchResultSummary(content string) (string, bool) {
|
||||
matches := countSearchMatches(content)
|
||||
if matches == 0 {
|
||||
return "", false
|
||||
}
|
||||
return fmt.Sprintf("%d %s", matches, pluralize(matches, "match", "matches")), true
|
||||
}
|
||||
|
||||
// countSearchMatches counts lines using ripgrep's match separator (":").
|
||||
func countSearchMatches(content string) int {
|
||||
matches := 0
|
||||
for line := range strings.SplitSeq(content, "\n") {
|
||||
if isSearchMatchLine(strings.TrimSpace(line)) {
|
||||
matches++
|
||||
}
|
||||
}
|
||||
return matches
|
||||
}
|
||||
|
||||
// isSearchMatchLine reports whether line has ripgrep's "path:N:text" match
|
||||
// shape -- a colon separator. The hyphen form ("path-N-text") is a CONTEXT
|
||||
// line, not a match, and "--" is a group separator between context blocks;
|
||||
// neither is a match and neither is counted.
|
||||
//
|
||||
// The path may itself contain colons, so the separator is located by scanning
|
||||
// from the end for a colon followed by digits and another colon.
|
||||
func isSearchMatchLine(line string) bool {
|
||||
if line == "" || strings.HasPrefix(line, "[") {
|
||||
return false
|
||||
}
|
||||
if strings.Trim(line, "-") == "" {
|
||||
return false // "--" group separator
|
||||
}
|
||||
for i := len(line) - 1; i > 0; i-- {
|
||||
if line[i] != ':' {
|
||||
continue
|
||||
}
|
||||
digits := line[i+1:]
|
||||
end := 0
|
||||
for end < len(digits) && digits[end] >= '0' && digits[end] <= '9' {
|
||||
end++
|
||||
}
|
||||
// Require <path>:<digits>:<text> -- the trailing colon distinguishes a
|
||||
// match from a "path:42" reference with nothing after it.
|
||||
if end > 0 && end < len(digits) && digits[end] == ':' {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// firstInformativeLine returns the first line worth showing: not blank, not a
|
||||
// module-cache path, and not a truncation notice (which is metadata the notice
|
||||
// path already consumed).
|
||||
func firstInformativeLine(content string) string {
|
||||
for line := range strings.SplitSeq(content, "\n") {
|
||||
line = strings.TrimSpace(line)
|
||||
if line == "" {
|
||||
continue
|
||||
}
|
||||
if strings.Contains(line, "/pkg/mod/") {
|
||||
skipped++
|
||||
continue
|
||||
}
|
||||
return truncateRunes(line, 120), skipped
|
||||
if _, ok := parseTruncationNotice(line); ok {
|
||||
continue
|
||||
}
|
||||
return truncateRunes(line, 120)
|
||||
}
|
||||
return "", skipped
|
||||
return ""
|
||||
}
|
||||
|
||||
func pluralize(n int, one, many string) string {
|
||||
if n == 1 {
|
||||
return one
|
||||
}
|
||||
return many
|
||||
}
|
||||
|
||||
func unwrapToolContent(output string) (string, bool) {
|
||||
@@ -116,14 +290,6 @@ func unwrapToolContent(output string) (string, bool) {
|
||||
return output, false
|
||||
}
|
||||
|
||||
func countNonEmptyOrContentLines(s string) int {
|
||||
if strings.TrimSpace(s) == "" {
|
||||
return 0
|
||||
}
|
||||
trimmed := strings.TrimRight(s, "\r\n")
|
||||
return strings.Count(trimmed, "\n") + 1
|
||||
}
|
||||
|
||||
func cleanToolError(name, raw string) string {
|
||||
line := firstNonEmptyLine(raw)
|
||||
prefix := "tool " + strings.TrimSpace(name) + ": "
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Operator report (2026-09-17): tool output in the Telegram channel was
|
||||
// unreadable. A grep-heavy turn rendered as a wall of fenced blocks, each
|
||||
// quoting one arbitrary match line under a heading that said only
|
||||
// "grep — done":
|
||||
//
|
||||
// 🔧 grep — done
|
||||
// /path/config.json-322- }
|
||||
// … 194 more lines
|
||||
//
|
||||
// One call rendered as 86 runes carrying no usable information: a path, a line
|
||||
// number, and a stray closing brace. The renderer now describes the result
|
||||
// instead of quoting it, and never states a count it computed itself.
|
||||
//
|
||||
// Cases are table-driven per the development protocol in AGENTS.md.
|
||||
func TestToolPreviewDescribesTheResult(t *testing.T) {
|
||||
// A 197-line grep result whose first visible line is an arbitrary match;
|
||||
// the tool's own notice is the only trustworthy total.
|
||||
truncatedGrep := strings.Join([]string{
|
||||
"/home/example/.config/app.json-322- }",
|
||||
"/home/example/.config/app.json-323- }",
|
||||
"/home/example/.config/app.json-324- }",
|
||||
"",
|
||||
"[truncated: showing 3/197 lines, 412B/24.1KB]",
|
||||
}, "\n")
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
tool string
|
||||
output string
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "truncated search reports the tool's total, which is a head truncation",
|
||||
tool: "grep",
|
||||
output: truncatedGrep,
|
||||
want: "197 lines total; showing 3",
|
||||
},
|
||||
{
|
||||
name: "shell truncation notice says 'showing last' and is still metadata, not content",
|
||||
tool: "shell",
|
||||
output: strings.Join([]string{
|
||||
"[truncated: showing last 66/97 lines, 46.2KB/164.8KB]",
|
||||
"",
|
||||
"the last line of the output",
|
||||
}, "\n"),
|
||||
want: "97 lines total; showing last 66",
|
||||
},
|
||||
{
|
||||
name: "an untruncated search is counted, not sampled",
|
||||
tool: "grep",
|
||||
output: "/src/a.go:12:func main() {\n/src/b.go:40:\treturn nil\n/src/c.go:99:}",
|
||||
want: "3 matches",
|
||||
},
|
||||
{
|
||||
name: "search context lines are not matches",
|
||||
tool: "grep",
|
||||
output: strings.Join([]string{
|
||||
"/src/a.go:12:func main() {",
|
||||
"/src/a.go-13-\treturn nil",
|
||||
"/src/a.go-14-}",
|
||||
"--",
|
||||
"/src/b.go:40:\treturn nil",
|
||||
}, "\n"),
|
||||
want: "2 matches",
|
||||
},
|
||||
{
|
||||
name: "a single match is singular",
|
||||
tool: "grep",
|
||||
output: "/src/a.go:12:func main() {",
|
||||
want: "1 match",
|
||||
},
|
||||
{
|
||||
name: "a colon in the path does not hide the match",
|
||||
tool: "grep",
|
||||
output: "/src/weird:dir/a.go:12:func main() {",
|
||||
want: "1 match",
|
||||
},
|
||||
{
|
||||
// A compiler diagnostic has the same "file:line:text" shape as a
|
||||
// search hit. Counting it would report a build error as "N matches"
|
||||
// and hide the diagnostic the operator actually needs.
|
||||
name: "a compiler diagnostic is shown, not counted as matches",
|
||||
tool: "shell",
|
||||
output: "internal/webui/api_tasks.go:42: undefined: forgeLocator",
|
||||
want: "internal/webui/api_tasks.go:42: undefined: forgeLocator",
|
||||
},
|
||||
{
|
||||
name: "a non-search tool keeps its first informative line",
|
||||
tool: "find",
|
||||
output: "/home/example/projects/app\n/home/example/projects/app/internal",
|
||||
want: "/home/example/projects/app",
|
||||
},
|
||||
{
|
||||
name: "module-cache noise is skipped",
|
||||
tool: "read",
|
||||
output: "/home/example/go/pkg/mod/github.com/x/y@v1.0/z.go\npackage y",
|
||||
want: "package y",
|
||||
},
|
||||
{
|
||||
// Only the built-in truncation producers emit this phrasing, and
|
||||
// they always wrap it as "[truncated: …]". Accepting the phrasing on
|
||||
// its own would rewrite genuine output that merely mentions a count
|
||||
// as if it were a truncation notice, hiding the real result.
|
||||
name: "ordinary text mentioning a line count is not truncation metadata",
|
||||
tool: "shell",
|
||||
output: "the log said showing 3/197 lines before it continued\nand trailing output",
|
||||
want: "the log said showing 3/197 lines before it continued",
|
||||
},
|
||||
{
|
||||
name: "empty output is reported as completed without a preview",
|
||||
tool: "shell",
|
||||
output: " \n ",
|
||||
want: "completed",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
got := RenderToolCall(ToolCallEvent{Name: tc.tool, Output: tc.output})
|
||||
if !strings.Contains(got, tc.want) {
|
||||
t.Errorf("preview missing %q:\n%s", tc.want, got)
|
||||
}
|
||||
// The renderer must never state a count it computed from its own
|
||||
// truncated sample: that produced two different numbers for one
|
||||
// result set ("194 more lines" beside "… 3 more lines").
|
||||
if strings.Contains(got, "more lines") && !strings.Contains(got, "lines total") {
|
||||
t.Errorf("renderer invented a line count from its own sample:\n%s", got)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestToolRenderIsBoundedAndAggregatable: one rendered call must stay small so
|
||||
// a tool-heavy turn cannot crowd the answer out of a single Telegram frame.
|
||||
func TestToolRenderIsBoundedAndAggregatable(t *testing.T) {
|
||||
output := strings.Repeat("/very/long/path/to/some/file.go:1234: someLineOfSource();\n", 50)
|
||||
got := RenderToolCall(ToolCallEvent{Name: "grep", Output: output})
|
||||
if n := len([]rune(got)); n > 220 {
|
||||
t.Errorf("one rendered tool call is %d runes, want <= 220:\n%s", n, got)
|
||||
}
|
||||
// 14 such calls must leave the majority of the frame for the answer.
|
||||
if n := len([]rune(got)) * 14; n > 3900/2 {
|
||||
t.Errorf("14 rendered calls would consume %d of a 3900-rune frame", n)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user