diff --git a/go.mod b/go.mod index f57496476..86462a16c 100644 --- a/go.mod +++ b/go.mod @@ -55,9 +55,9 @@ require ( golang.org/x/sys v0.48.0 // indirect golang.org/x/text v0.42.0 // indirect golang.org/x/time v0.16.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20260918162117-cecb64721679 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20260918162117-cecb64721679 // indirect - modernc.org/libc v1.77.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260921155816-b14227669459 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260921155816-b14227669459 // indirect + modernc.org/libc v1.77.1 // indirect modernc.org/mathutil v1.7.1 // indirect modernc.org/memory v1.12.1 // indirect ) @@ -69,7 +69,7 @@ require ( github.com/coreos/go-oidc/v3 v3.21.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-jose/go-jose/v4 v4.1.4 + github.com/go-jose/go-jose/v4 v4.1.5 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 @@ -81,7 +81,7 @@ require ( github.com/samcharles93/ai-sdk v0.1.39 github.com/traefik/yaegi v0.16.1 golang.org/x/net v0.59.0 - golang.org/x/oauth2 v0.36.0 + golang.org/x/oauth2 v0.37.0 golang.org/x/term v0.46.0 google.golang.org/grpc v1.85.0-dev.0.20260825072537-93e31b48545e google.golang.org/protobuf v1.36.12 diff --git a/go.sum b/go.sum index 8def02df6..7e0705ff4 100644 --- a/go.sum +++ b/go.sum @@ -2,16 +2,21 @@ 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.23.1/go.mod h1:4DhBRcqvtljQN3dJ57qtqbib5ZGCYE5f2crfiiC2EM0= +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.35.0/go.mod h1:Yj5vHEz/aAepZGliRJsA6uvHAVAQyEwajq9ORCHPxzM= 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= @@ -20,16 +25,20 @@ 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/coreos/go-oidc/v3 v3.21.0 h1:wZo4Q9Pum8dYEj0eMUPrqR+kvuGkeUplbLpNCkBqoWM= github.com/coreos/go-oidc/v3 v3.21.0/go.mod h1:DYCf24+ncYi+XkIH97GY1+dqoRlbaSI26KVTCI9SrY4= +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= @@ -44,6 +53,10 @@ github.com/dustin/go-humanize v1.1.0 h1:dbKTrvD0klcbBV/h4AWJdMuZogJACoMlvWIWZ5b2 github.com/dustin/go-humanize v1.1.0/go.mod h1:hc1CvRkJMsgxqjmjMQF3QNRAZBwY8AXBAzKYoSX9sFI= 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.39.0/go.mod h1:5e4ylfTZO723MEEFsCpSW4ZEBWR8mwkEyXfwJBTCZ9c= +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= @@ -60,13 +73,18 @@ github.com/go-git/go-git/v6 v6.0.0-alpha.5 h1:sE+OlkHgYWNMVmN1s9sR7uyFgsWLtxcNWs 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 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA= github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= +github.com/go-jose/go-jose/v4 v4.1.5 h1:RjgjO2LOtWOJKUC5wpwY9LR3B3vwVAz6JS2YHfYU6eA= +github.com/go-jose/go-jose/v4 v4.1.5/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.27.0 h1:PG9yBDzM8O26oUerE9SZwWlHon4RpH8WcNslZ7CEZmE= github.com/go-telegram/bot v1.27.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/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= @@ -80,10 +98,14 @@ 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.21/go.mod h1:L3D/IQExI6LqEjBdXcZQ1WluSgigQmSwBboFstVPM4w= +github.com/googleapis/gax-go/v2 v2.23.0/go.mod h1:rBQKOVJCdb8IFEzg+FCwlt1LP/xMDGuqUXhUG+XMXEg= 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= @@ -111,6 +133,7 @@ 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.15.0 h1:M99yf0y05rTr46/qc/Is6ZAowI58Ryp2SjufLCUeVJc= @@ -131,15 +154,20 @@ 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.39 h1:gbNPYeA27MifReCruBiqMgb4fFSjCDi1Zv57a9bo0Vo= github.com/samcharles93/ai-sdk v0.1.39/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.8.1/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= @@ -148,6 +176,7 @@ 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.45.0/go.mod h1:VSme3o2fvSg5bVg0dRzyHaj4Z5EVhG+g2Fde6LKzmQA= 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= @@ -177,6 +206,8 @@ golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues= golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= +golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98= +golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58= golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -198,12 +229,19 @@ golang.org/x/time v0.16.0/go.mod h1:rVKOqvZeKvrDKTQiAHJ7wmwP0RzleSphoEA9RcdLA0s= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.50.0 h1:c2ifzfcuY7L90lZ2aKd8S4K2NpASF08SZx9ZuJkHmSU= golang.org/x/tools v0.50.0/go.mod h1:7ulVMw3831Mwi5EZD6RomGyffr4VFjuNYXf2BbCEAV0= +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/api v0.293.0/go.mod h1:6n5tjEB1gzwniZTepZ0g5u+wM7Bof5GeULCx/zh8ZE0= google.golang.org/genproto/googleapis/api v0.0.0-20260918162117-cecb64721679 h1:FEp7JNE32DTAwbnI/ixagnmj7Xm1eTONofGEUXFjZ4w= google.golang.org/genproto/googleapis/api v0.0.0-20260918162117-cecb64721679/go.mod h1:52bV8FLAQ9Qmcqaq9ECLmuEHZthk+6OPV45aKBBrsNw= +google.golang.org/genproto/googleapis/api v0.0.0-20260921155816-b14227669459 h1:GS9OIt/j7c8bvBjYNgnKQysVfmV7e4jM0H8ZK95G4t8= +google.golang.org/genproto/googleapis/api v0.0.0-20260921155816-b14227669459/go.mod h1:PX5/4vemwVoXtwEcRDWwcR1/r0qrosfx3qoVADMwnVE= google.golang.org/genproto/googleapis/rpc v0.0.0-20260918162117-cecb64721679 h1:KmqdJU4vrNcxy/6qdg3JduZtalEXrJLspVltnR1cE+8= google.golang.org/genproto/googleapis/rpc v0.0.0-20260918162117-cecb64721679/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260921155816-b14227669459 h1:b0xCahf3FK2m2Cv0p4vTozGPWncCvLfwV86UNg8xWU8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260921155816-b14227669459/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= google.golang.org/grpc v1.85.0-dev.0.20260825072537-93e31b48545e h1:ar+feAPij1Znzug45m6AoShUCc5AaR8FLA3I6LZd94k= google.golang.org/grpc v1.85.0-dev.0.20260825072537-93e31b48545e/go.mod h1:7aY/KlAHanMAVIWHnk8wloQsdlfwzDz/PP9vCbJG6CU= google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= @@ -222,6 +260,7 @@ modernc.org/cc/v4 v4.29.7 h1:q+NXGJ0bK3b4TXFYQQVr9pYETGnmwFWkrUzJnMya/Tg= modernc.org/cc/v4 v4.29.7/go.mod h1:OnovgIhbbMXMu1aISnJ0wvVD1KnW+cAUJkIrAWh+kVI= modernc.org/ccgo/v4 v4.36.0 h1:T5h7ZMcrw2r94oDLtBcU3YI6e1W8DiUg2SJIs2fwD2s= modernc.org/ccgo/v4 v4.36.0/go.mod h1:rrtGc2QkS239nYb/mQNuBMyjq3/y3ZXWbBjPoV3wqzA= +modernc.org/ccgo/v4 v4.36.1 h1:ZNIUZAryN0UgnJwtyxrdEzcFc3yD4Cu4AzjfPXsLsIE= modernc.org/fileutil v1.4.0 h1:j6ZzNTftVS054gi281TyLjHPp6CPHr2KCxEXjEbD6SM= modernc.org/fileutil v1.4.0/go.mod h1:EqdKFDxiByqxLk8ozOxObDSfcVOv/54xDs/DUHdvCUU= modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI= @@ -232,6 +271,8 @@ modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks= modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI= modernc.org/libc v1.77.0 h1:wV+faa9ixRoUNlakU0fHLi/1kV2YLG8D8Ksk3c2mPtY= modernc.org/libc v1.77.0/go.mod h1:BmXDCJcMkRMRbX2EI8+Zhh4fKWlHNbCCZEy0tiZevP4= +modernc.org/libc v1.77.1 h1:Ct8j47QtiZ1Enj2DtFXQtUqrPCAjdCmPjtCuvrYQ0Hs= +modernc.org/libc v1.77.1/go.mod h1:87/pZ4L6nD1zqW4nItuS12YO7hN1igAah34xjnQo/W0= modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= modernc.org/memory v1.12.1 h1:nFMiWrpStgZczNl6XI9GnIk/rWhYIyHGUaR04pGbp9g= diff --git a/internal/app/archied/chat_setup.go b/internal/app/archied/chat_setup.go index 2777ff1ec..6d3f86c8b 100644 --- a/internal/app/archied/chat_setup.go +++ b/internal/app/archied/chat_setup.go @@ -243,15 +243,15 @@ func chatRepoEnv(cfg config.Config, identity string) []gateway.RepoEnv { // and records at its own adapter (curatorLLMRunner). Anything that reaches the // runtime without recording leaves /status reporting a stale last-known // outcome, which is a /status that lies about the provider. -func sendChatTurn(ctx context.Context, llm *runtime.Runtime, chatModel string, options core.GenerateOptions, turn gateway.TurnStream, outcomes *providerOutcomeRecorder) (string, error) { - text, err := runChatTurn(ctx, llm, chatModel, options, turn) +func sendChatTurn(ctx context.Context, llm *runtime.Runtime, chatModel string, options core.GenerateOptions, turn gateway.TurnStream, outcomes *providerOutcomeRecorder, icons map[string]string) (string, error) { + text, err := runChatTurn(ctx, llm, chatModel, options, turn, icons) // record tolerates a nil recorder: a setup built without one (tests, a // deployment whose health surface is unwired) still makes its calls. outcomes.record(chatModel, err) return text, err } -func runChatTurn(ctx context.Context, llm *runtime.Runtime, chatModel string, options core.GenerateOptions, turn gateway.TurnStream) (string, error) { +func runChatTurn(ctx context.Context, llm *runtime.Runtime, chatModel string, options core.GenerateOptions, turn gateway.TurnStream, icons map[string]string) (string, error) { if turn == nil { result, err := llm.Chat(ctx, chatModel, options) if err != nil { @@ -263,7 +263,7 @@ func runChatTurn(ctx context.Context, llm *runtime.Runtime, chatModel string, op if err != nil { return "", fmt.Errorf("llm chat stream: %w", err) } - text := drainChatStream(stream.FullStream, turn) + text := drainChatStream(stream.FullStream, turn, icons) if _, err := stream.FinishReason(); err != nil { return "", fmt.Errorf("llm chat stream: %w", err) } @@ -280,7 +280,7 @@ func runChatTurn(ctx context.Context, llm *runtime.Runtime, chatModel string, op // A tool is reported on its result, never on its call: the call part carries // no outcome yet, so reporting both would show every tool twice, once with // nothing to say. -func drainChatStream(parts <-chan core.StreamPart, turn gateway.TurnStream) string { +func drainChatStream(parts <-chan core.StreamPart, turn gateway.TurnStream, icons map[string]string) string { type pendingToolCall struct { name string parameters string @@ -319,6 +319,7 @@ func drainChatStream(parts <-chan core.StreamPart, turn gateway.TurnStream) stri turn.ToolCall(gateway.ToolCallEvent{ ID: part.ToolResult.ToolCallID, Name: name, + Emoji: icons[name], Parameters: call.parameters, Output: part.ToolResult.Output, Err: part.ToolResult.Error, @@ -401,8 +402,10 @@ func (g *chatTitleGenerator) GenerateTitle(ctx context.Context, sessionID, first // caller. Sharing the process-wide recorder let a title that merely timed // out overwrite the chat-model health line with "failed", reporting a // broken provider on the strength of a call no user was waiting for. + // No tool set and no stream, so no tool call can be reported: this turn + // needs no icons. text, err := sendChatTurn(ctx, g.llm, g.chatModels.ActiveModel(), - core.GenerateOptions{Messages: messages, MaxSteps: 1}, nil, nil) + core.GenerateOptions{Messages: messages, MaxSteps: 1}, nil, nil, nil) if err != nil { if g.log != nil { g.log.Error("session title generation failed", "session", sessionID, "err", err) diff --git a/internal/app/archied/chat_stream_test.go b/internal/app/archied/chat_stream_test.go index 0f80a22df..a04eb2731 100644 --- a/internal/app/archied/chat_stream_test.go +++ b/internal/app/archied/chat_stream_test.go @@ -163,7 +163,7 @@ func TestDrainChatStream(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { sink := &recordingStream{} - text := drainChatStream(streamOf(tc.parts...), sink) + text := drainChatStream(streamOf(tc.parts...), sink, nil) if text != tc.wantText { t.Fatalf("text = %q, want %q", text, tc.wantText) @@ -204,7 +204,7 @@ func TestDrainChatStreamCorrelatesBoundsAndRedactsToolParameters(t *testing.T) { ToolName: "shell", Output: "ok", }}, - ), sink) + ), sink, nil) if len(sink.events) != 2 { t.Fatalf("events = %v, want two completed calls", sink.events) @@ -231,9 +231,43 @@ func TestDrainChatStreamWithoutASinkStillCollectsText(t *testing.T) { core.StreamPart{Type: core.StreamPartTextDelta, TextDelta: "a"}, core.StreamPart{Type: core.StreamPartToolResult, ToolResult: &core.ToolResult{ToolName: "shell", Output: "ok"}}, core.StreamPart{Type: core.StreamPartTextDelta, TextDelta: "b"}, - ), nil) + ), nil, nil) if text != "ab" { t.Fatalf("text = %q, want %q", text, "ab") } } + +// TestDrainChatStreamCarriesTheToolsRegisteredIcon pins the seam between the +// tool registry and what a chat surface renders. The icon is looked up by +// tool name at report time, so a tool that registers one gets it and a tool +// that does not is reported without one rather than with a generic stand-in. +func TestDrainChatStreamCarriesTheToolsRegisteredIcon(t *testing.T) { + sink := &iconRecordingStream{} + drainChatStream(streamOf( + core.StreamPart{Type: core.StreamPartToolResult, ToolResult: &core.ToolResult{ToolName: "shell", Output: "ok"}}, + core.StreamPart{Type: core.StreamPartToolResult, ToolResult: &core.ToolResult{ToolName: "mcp.github.search", Output: "ok"}}, + ), sink, map[string]string{"shell": "๐Ÿ’ป"}) + + want := []string{"shell:๐Ÿ’ป", "mcp.github.search:"} + if len(sink.icons) != len(want) { + t.Fatalf("icons = %v, want %v", sink.icons, want) + } + for i, w := range want { + if sink.icons[i] != w { + t.Errorf("icons[%d] = %q, want %q", i, sink.icons[i], w) + } + } +} + +type iconRecordingStream struct { + icons []string +} + +func (s *iconRecordingStream) Delta(string) {} + +func (s *iconRecordingStream) ToolCall(event gateway.ToolCallEvent) { + s.icons = append(s.icons, event.Name+":"+event.Emoji) +} + +func (s *iconRecordingStream) Media(gateway.MediaEvent) {} diff --git a/internal/app/archied/chat_turn_model.go b/internal/app/archied/chat_turn_model.go index c8584207d..31676ed98 100644 --- a/internal/app/archied/chat_turn_model.go +++ b/internal/app/archied/chat_turn_model.go @@ -60,6 +60,7 @@ func (m *chatTurnModel) Prepare( toolInfo: toolSummaries(options.Tools), toolTokens: gateway.EstimateTokens(string(toolSchema)), outcomes: m.outcomes, + icons: toolIcons(m.registry), }, nil } @@ -70,6 +71,26 @@ type preparedChatTurnModel struct { toolInfo []gateway.ToolSummary toolTokens int outcomes *providerOutcomeRecorder + // icons maps tool name to the icon that tool registered, for chat + // surfaces to render. A nil map yields "" for every lookup, which is + // the no-icon rendering. + icons map[string]string +} + +// toolIcons snapshots the icon each registered tool declares. It is taken at +// prepare time alongside the tool set itself, so a turn renders the icons of +// the tools it was actually given. +func toolIcons(registry *tools.Registry) map[string]string { + if registry == nil { + return nil + } + icons := make(map[string]string) + for _, entry := range registry.All() { + if entry.Emoji != "" { + icons[entry.Name] = entry.Emoji + } + } + return icons } func (m *preparedChatTurnModel) ToolSummaries() []gateway.ToolSummary { @@ -100,5 +121,5 @@ func (m *preparedChatTurnModel) Generate( // This is one provider response's output allowance, not a turn- // continuation budget. Tool loops remain free to continue. options.MaxTokens = request.MaxOutputTokens - return sendChatTurn(ctx, m.llm, m.model, options, stream, m.outcomes) + return sendChatTurn(ctx, m.llm, m.model, options, stream, m.outcomes, m.icons) } diff --git a/internal/app/archied/status_health_test.go b/internal/app/archied/status_health_test.go index fcc3ad68c..c2e1adb9a 100644 --- a/internal/app/archied/status_health_test.go +++ b/internal/app/archied/status_health_test.go @@ -163,7 +163,7 @@ func TestSendChatTurnRecordsEachCallOutcome(t *testing.T) { _, err := sendChatTurn(t.Context(), llm, "openai/gpt-5.6", core.GenerateOptions{ Messages: []chat.Message{{Role: chat.RoleUser, Content: "hi"}}, MaxSteps: 1, - }, nil, recorder) + }, nil, recorder, nil) if tc.wantErr == "" && err != nil { t.Fatalf("sendChatTurn = %v, want success (request path %q)", err, requestedPath) diff --git a/internal/channels/telegram/live.go b/internal/channels/telegram/live.go index b8eb5d2c1..7eb912406 100644 --- a/internal/channels/telegram/live.go +++ b/internal/channels/telegram/live.go @@ -366,14 +366,27 @@ func (l *liveReply) ToolCall(event messaging.ToolCallEvent) { l.requestRender() } +// countedToolLine marks a collapsed entry with how many calls it stands for. +// The count belongs to the status, not to the preview, so it is inserted +// before the preview separator rather than appended: "grep โ€” done ร—14 ยท 2 +// matches" counts calls, while "ยท 2 matches ร—14" reads as counting matches. +// toolLineSeparator joins tool lines. It ends each one with CommonMark's +// hard-break marker rather than a blank line: a bare "\n" is a soft break, +// which the block parser space-joins into one run-on paragraph, while a blank +// line would insert a spacer block between every pair. A hard break gives +// each line its own block AND suppresses the spacer, so a turn's activity +// reads as consecutive lines instead of a double-spaced list. +const toolLineSeparator = " \n" + func countedToolLine(line string, count int) string { if count <= 1 { return line } - if newline := strings.IndexByte(line, '\n'); newline >= 0 { - return line[:newline] + fmt.Sprintf(" ร—%d", count) + line[newline:] + marker := fmt.Sprintf(" ร—%d", count) + if cut := strings.Index(line, messaging.ToolPreviewSeparator); cut >= 0 { + return line[:cut] + marker + line[cut:] } - return line + fmt.Sprintf(" ร—%d", count) + return line + marker } // mediaSendTimeout bounds one Media delivery. It is independent of the @@ -732,7 +745,7 @@ func (l *liveReply) toolBlockWith(start int) string { if omitted := start; omitted > 0 { prefix = fmt.Sprintf("+%d earlier\n\n", omitted) } - return prefix + strings.Join(l.toolLines[start:], "\n") + return prefix + strings.Join(l.toolLines[start:], toolLineSeparator) } // clampToRunes cuts s to its last maxRunes runes, marking the cut with a @@ -766,7 +779,7 @@ func (l *liveReply) finalText(reply string) string { if len(l.toolLines) == 0 { return reply } - block := strings.Join(l.toolLines, "\n") + block := strings.Join(l.toolLines, toolLineSeparator) if reply == "" { return block + "\n\n_(no response)_" } diff --git a/internal/channels/telegram/live_test.go b/internal/channels/telegram/live_test.go index a1c4354fd..85a72b494 100644 --- a/internal/channels/telegram/live_test.go +++ b/internal/channels/telegram/live_test.go @@ -194,12 +194,12 @@ func TestLiveReplyCollapsesRepeatedSuccessfulEquivalentToolCalls(t *testing.T) { live.finalize(context.Background(), "done") got := (*calls)[len(*calls)-1].body() - want := "๐Ÿ”ง grep โ€” done ร—14\n\n2 matches\n\ndone" + want := "grep ร—14 ยท 2 matches\n\ndone" if got != want { t.Fatalf("repeated successful grep calls rendered as:\n%s\nwant:\n%s", got, want) } - if strings.Count(got, "๐Ÿ”ง grep") != 1 { - t.Fatalf("repeated successful grep calls should occupy one entry, got %d:\n%s", strings.Count(got, "๐Ÿ”ง grep"), got) + if strings.Count(got, "grep") != 1 { + t.Fatalf("repeated successful grep calls should occupy one entry, got %d:\n%s", strings.Count(got, "grep"), got) } } @@ -213,10 +213,10 @@ func TestLiveReplyDoesNotCollapseSuccessfulCallsWithDifferentResults(t *testing. live.finalize(context.Background(), "done") got := (*calls)[len(*calls)-1].body() - if strings.Count(got, "๐Ÿ”ง ") != 3 { + if strings.Count(got, " ยท ") != 3 { t.Fatalf("successful calls with different tools or summaries were collapsed:\n%s", got) } - if !strings.Contains(got, "๐Ÿ”ง grep โ€” done ร—2") || strings.Contains(got, "ร—3") { + if !strings.Contains(got, "grep ร—2") || strings.Contains(got, "ร—3") { t.Fatalf("only equivalent successful calls should be counted together:\n%s", got) } } @@ -229,7 +229,7 @@ func TestLiveReplySnapshotsToolCallVisibility(t *testing.T) { live.finalize(context.Background(), "done") last := (*calls)[len(*calls)-1] - if !strings.Contains(last.body(), "๐Ÿ”ง shell โ€” done\n\nexit 0\n\ndone") { + if !strings.Contains(last.body(), "shell ยท exit 0\n\ndone") { t.Fatalf("final reply = %q, want the visibility captured when the reply started", last.body()) } } @@ -269,10 +269,10 @@ func TestLiveReplyRendersNoisyToolTurnAsCompactTelegramText(t *testing.T) { // 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" + + want := "read ยท package gateway\n\n" + + "find ยท /home/sam/projects/unrelated/main.go\n\n" + + "shell โ€” failed ยท command_exit: exit status 2\n\n" + + "tools โ€” stopped ร—5 ยท tool-output limit reached (200000 chars); further results suppressed\n\n" + "I found the relevant renderer and stopped after the output-volume cap." if got != want { t.Fatalf("Telegram-visible text:\n%s\n\nwant:\n%s", got, want) @@ -316,8 +316,8 @@ func TestLiveReplyToolCalls(t *testing.T) { { name: "shown", showToolCalls: true, - wantLive: "๐Ÿ”ง shell โ€” done\n\nexit 0\n\nchecking โ–Œ", - wantFinal: "๐Ÿ”ง shell โ€” done\n\nexit 0\n\nchecking", + wantLive: "shell ยท exit 0\n\nchecking โ–Œ", + wantFinal: "shell ยท exit 0\n\nchecking", }, { name: "hidden", @@ -694,7 +694,7 @@ func TestLiveReplyToolLinesSurviveTheLiveClamp(t *testing.T) { live.flushRendering() last := (*calls)[len(*calls)-1] - if !strings.HasPrefix(last.body(), "๐Ÿ”ง shell โ€” done\n\nexit 0\n\n") { + if !strings.HasPrefix(last.body(), "shell ยท exit 0\n\n") { t.Fatalf("live frame lost the tool line once the answer grew past the clamp: %.60qโ€ฆ", last.body()) } if n := len([]rune(last.body())); n > 4096 { @@ -712,10 +712,10 @@ func TestLiveReplyFinalizeWithToolsAndNoReplyMarksTheAbsence(t *testing.T) { live.finalize(context.Background(), "") last := (*calls)[len(*calls)-1] - if last.body() == "๐Ÿ”ง shell โ€” done\n\nexit 0" { + if last.body() == "shell ยท exit 0" { t.Fatalf("finalize sent the bare tool line as the finished answer: %q", last.body()) } - if !strings.Contains(last.body(), "๐Ÿ”ง shell โ€” done\n\nexit 0") { + if !strings.Contains(last.body(), "shell ยท exit 0") { t.Fatalf("finalize dropped the tool activity: %q", last.body()) } if !strings.Contains(last.body(), "no response") { @@ -1197,7 +1197,7 @@ func TestLiveReplyToolBlockKeepsEveryLineThatFits(t *testing.T) { block := live.toolBlock() for _, name := range []string{"read", "grep", "find"} { - if !strings.Contains(block, "๐Ÿ”ง "+name) { + if !strings.Contains(block, name+" ยท ") { t.Errorf("tool block dropped %s while every line still fits the %d-rune budget:\n%s", name, liveToolMaxRunes, block) } @@ -1236,3 +1236,43 @@ func TestLiveReplyClampAnswerAlwaysMarksTheCut(t *testing.T) { }) } } + +// TestToolLinesRenderAsConsecutiveBlocksWithoutSpacers pins the vertical cost +// of a turn's tool activity, which is what the separator and the one-line +// render exist to control. +// +// Each call used to emit a header paragraph, a spacer, a fenced code block +// and another spacer: four rendered elements, the code block carrying a +// language header bar and a copy button, to show a word count. Each call now +// costs exactly one paragraph, and only the answer is set apart. +func TestToolLinesRenderAsConsecutiveBlocksWithoutSpacers(t *testing.T) { + live, calls := newTestLiveReply(t, true) + live.ToolCall(toolEvent("read", "package config", "")) + live.ToolCall(toolEvent("shell", "63", "")) + live.ToolCall(toolEvent("grep", "/src/a.go:12:match\n/src/b.go:40:match", "")) + live.finalize(context.Background(), "The answer.") + + blocks := (*calls)[len(*calls)-1].richBlocks + want := []string{ + "read ยท package config", + "shell ยท 63", + "grep ยท 2 matches", + "", + "The answer.", + } + if len(blocks) != len(want) { + got := make([]string, len(blocks)) + for i, b := range blocks { + got[i] = blockText(b) + } + t.Fatalf("blocks = %d %q, want %d %q", len(blocks), got, len(want), want) + } + for i, w := range want { + if got := blockText(blocks[i]); got != w { + t.Errorf("block[%d] = %q, want %q", i, got, w) + } + if blocks[i].Type != models.RichBlockTypeParagraph { + t.Errorf("block[%d] type = %q, want paragraph -- a one-line preview needs no code widget", i, blocks[i].Type) + } + } +} diff --git a/internal/domain/messaging/stream.go b/internal/domain/messaging/stream.go index 0f4702ad9..8f9258f1a 100644 --- a/internal/domain/messaging/stream.go +++ b/internal/domain/messaging/stream.go @@ -13,6 +13,10 @@ type ToolCallEvent struct { // Parameters is a bounded, redacted JSON summary of the invocation input. // It is safe for channel adapters to render directly. Parameters string + // Emoji is the icon the tool registered for itself, empty when it + // declared none. Chat surfaces render it verbatim; they do not invent + // one, so an unrecognised tool simply shows no icon. + Emoji string // Output is what the tool returned, verbatim. Output string // Err is non-empty when the tool failed, in which case Output is diff --git a/internal/domain/messaging/tool_render.go b/internal/domain/messaging/tool_render.go index 6db6bfa3d..c5eb8fd05 100644 --- a/internal/domain/messaging/tool_render.go +++ b/internal/domain/messaging/tool_render.go @@ -19,12 +19,15 @@ const ( // inputs are noisy, often contain secrets, and are not useful progress text. func RenderToolCall(e ToolCallEvent) string { if limit, ok := legacyTurnBudgetLimit(e.Err); ok { - return toolProgressBlock("tools", "stopped", fmt.Sprintf("tool-output limit reached (%s chars); further results suppressed", limit)) + return toolProgressBlock("tools", e.Emoji, "stopped", fmt.Sprintf("tool-output limit reached (%s chars); further results suppressed", limit)) } if line := cleanToolError(e.Name, e.Err); line != "" { - return toolProgressBlock(e.Name, "failed", line) + return toolProgressBlock(e.Name, e.Emoji, "failed", line) } - return toolProgressBlock(e.Name, "done", toolPreview(e.Name, e.Output)) + // Success carries no status word. Every line would read "done", so it + // distinguishes nothing; a status is printed only when the outcome is + // not the one the preview already implies. + return toolProgressBlock(e.Name, e.Emoji, "", toolPreview(e.Name, e.Output)) } // FailureKey identifies equivalent tool calls for channel adapters that @@ -39,16 +42,34 @@ func FailureKey(e ToolCallEvent) string { return "success\x00" + strings.TrimSpace(e.Name) + "\x00" + toolPreview(e.Name, e.Output) } -func toolProgressBlock(name, status, preview string) string { +// ToolPreviewSeparator joins a tool's header to its preview. The preview is +// always one line (every toolPreview path summarises to one), so it belongs +// on the header line rather than in a block of its own: Telegram renders a +// fenced block as a full code widget, and the block parser puts a spacer +// paragraph before every block, so fencing one line cost four rendered +// elements to show a word count. +// +// Keeping the preview on the line also means a fence marker in the output can +// never reach column zero, which is why the preview is passed through +// verbatim instead of having its backticks substituted away. +const ToolPreviewSeparator = " ยท " + +func toolProgressBlock(name, emoji, status, preview string) string { name = strings.TrimSpace(name) if name == "" { name = "tool" } - preview = strings.ReplaceAll(strings.TrimSpace(preview), "```", "''' ") + preview = strings.TrimSpace(preview) if preview == "" { preview = "completed" } - return "๐Ÿ”ง " + name + " โ€” " + status + "\n```text\n" + truncateRunes(preview, 180) + "\n```" + if status != "" { + name += " โ€” " + status + } + if emoji = strings.TrimSpace(emoji); emoji != "" { + name = emoji + " " + name + } + return name + ToolPreviewSeparator + truncateRunes(preview, 180) } func toolPreview(name, output string) string { diff --git a/internal/gateway/tool_render_test.go b/internal/gateway/tool_render_test.go index 241eff91e..9286c1da0 100644 --- a/internal/gateway/tool_render_test.go +++ b/internal/gateway/tool_render_test.go @@ -44,7 +44,7 @@ func TestToolCallEventRenderToolCallBoundsOutputAndPreservesFailure(t *testing.T t.Fatalf("oversized contents were not bounded: %q", got) } failed := RenderToolCall(ToolCallEvent{Name: "shell", Output: "ignored", Err: "command_exit: exit status 2"}) - if failed != "๐Ÿ”ง shell โ€” failed\n```text\ncommand_exit: exit status 2\n```" { + if failed != "shell โ€” failed ยท command_exit: exit status 2" { t.Fatalf("failure render = %q", failed) } } @@ -74,7 +74,79 @@ func TestToolCallEventFailureKeyCollapsesLegacyTurnBudget(t *testing.T) { if FailureKey(first) == "" || FailureKey(first) != FailureKey(second) { t.Fatalf("legacy output-limit failures should share one key: %q vs %q", FailureKey(first), FailureKey(second)) } - if RenderToolCall(first) != "๐Ÿ”ง tools โ€” stopped\n```text\ntool-output limit reached (200000 chars); further results suppressed\n```" { + if RenderToolCall(first) != "tools โ€” stopped ยท tool-output limit reached (200000 chars); further results suppressed" { t.Fatalf("legacy output-limit render = %q", RenderToolCall(first)) } } + +// TestRenderToolCallKeepsAOneLinePreviewOnItsOwnLine pins the shape that +// decides how much vertical space a turn's tool activity costs. +// +// Telegram renders a fenced block as a full code widget: a language header +// bar, a copy button and a panel. The block parser also inserts a spacer +// paragraph before every block, so a fenced one-line preview cost four +// rendered elements (header, spacer, panel, spacer) to display a word count. +// A single-line preview belongs on the header line. +func TestRenderToolCallKeepsAOneLinePreviewOnItsOwnLine(t *testing.T) { + got := RenderToolCall(ToolCallEvent{Name: "shell", Output: "63"}) + if want := "shell ยท 63"; got != want { + t.Fatalf("render = %q, want %q", got, want) + } + if strings.Contains(got, "```") { + t.Errorf("a one-line preview must not open a code block: %q", got) + } +} + +// TestRenderToolCallCollapsesMultiLineOutputToOneLine pins that the preview +// is always a single line, whatever the tool printed. Every toolPreview path +// already summarises to one line, which is why the fence it used to sit in +// was never wrapping more than one. +func TestRenderToolCallCollapsesMultiLineOutputToOneLine(t *testing.T) { + got := RenderToolCall(ToolCallEvent{Name: "shell", Output: `{"content":"alpha\nbeta\ngamma"}`}) + if strings.Contains(got, "\n") { + t.Fatalf("render spans several lines: %q", got) + } + if !strings.Contains(got, "alpha") { + t.Errorf("render dropped the informative line: %q", got) + } +} + +// TestRenderToolCallNeverOpensACodeBlock pins that output carrying its own +// fence cannot start one. The preview follows the header on the same line, so +// a fence marker can never reach column zero -- which is what lets the render +// pass the output through verbatim instead of substituting the backticks away +// and corrupting it. +func TestRenderToolCallNeverOpensACodeBlock(t *testing.T) { + got := RenderToolCall(ToolCallEvent{Name: "read", Output: "```go\nx := 1\n```"}) + if strings.HasPrefix(got, "```") || strings.Contains(got, "\n```") { + t.Fatalf("render opens a code block: %q", got) + } + if !strings.Contains(got, "```go") { + t.Errorf("backticks were corrupted rather than passed through: %q", got) + } +} + +// TestRenderToolCallUsesTheToolsOwnIcon pins that the icon is data carried on +// the event, not a constant in the renderer. One icon for every tool +// distinguishes nothing, and a renderer that invents one cannot be corrected +// by registering a tool. +func TestRenderToolCallUsesTheToolsOwnIcon(t *testing.T) { + got := RenderToolCall(ToolCallEvent{Name: "shell", Emoji: "๐Ÿ’ป", Output: "63"}) + if want := "๐Ÿ’ป shell ยท 63"; got != want { + t.Fatalf("render = %q, want %q", got, want) + } + failed := RenderToolCall(ToolCallEvent{Name: "shell", Emoji: "๐Ÿ’ป", Err: "command_exit: exit status 2"}) + if want := "๐Ÿ’ป shell โ€” failed ยท command_exit: exit status 2"; failed != want { + t.Fatalf("failure render = %q, want %q", failed, want) + } +} + +// TestRenderToolCallOmitsTheIconWhenTheToolDeclaresNone pins the fallback: a +// tool with no icon costs no column, rather than borrowing a generic one that +// says nothing about which tool ran. +func TestRenderToolCallOmitsTheIconWhenTheToolDeclaresNone(t *testing.T) { + got := RenderToolCall(ToolCallEvent{Name: "mcp.github.search", Output: "63"}) + if want := "mcp.github.search ยท 63"; got != want { + t.Fatalf("render = %q, want %q", got, want) + } +} diff --git a/internal/tools/builtin/edit.go b/internal/tools/builtin/edit.go index b6a18cee0..f75884a03 100644 --- a/internal/tools/builtin/edit.go +++ b/internal/tools/builtin/edit.go @@ -74,6 +74,7 @@ func NewEditTool(cwd string, mq *MutationQueue, rt *ReadTracker) Tool { return Tool{ Schema: editSchema, Source: "builtin", + Emoji: "โœ๏ธ", Execute: makeEditExecutor(cwd, mq, rt), } } diff --git a/internal/tools/builtin/find.go b/internal/tools/builtin/find.go index 8b73f395f..5211cdaaa 100644 --- a/internal/tools/builtin/find.go +++ b/internal/tools/builtin/find.go @@ -73,6 +73,7 @@ func NewFindTool(cwd string) Tool { return Tool{ Schema: findSchema, Source: "builtin", + Emoji: "๐Ÿ“", Execute: makeFindExecutor(cwd), } } diff --git a/internal/tools/builtin/grep.go b/internal/tools/builtin/grep.go index f85893159..f43477a5f 100644 --- a/internal/tools/builtin/grep.go +++ b/internal/tools/builtin/grep.go @@ -126,6 +126,7 @@ func NewGrepTool(cwd string, indexes ...GrepIndex) Tool { return Tool{ Schema: grepSchema, Source: "builtin", + Emoji: "๐Ÿ”", Execute: makeGrepExecutor(cwd, workspaceIndex), } } diff --git a/internal/tools/builtin/read.go b/internal/tools/builtin/read.go index a7e9f0513..95ef8f6a6 100644 --- a/internal/tools/builtin/read.go +++ b/internal/tools/builtin/read.go @@ -209,6 +209,7 @@ func NewReadTool(cwd string, rt *ReadTracker) Tool { return Tool{ Schema: readSchema, Source: "builtin", + Emoji: "๐Ÿ“„", Execute: makeReadExecutor(cwd, rt), } } diff --git a/internal/tools/builtin/registry.go b/internal/tools/builtin/registry.go index 4932a84bf..6900ff9f7 100644 --- a/internal/tools/builtin/registry.go +++ b/internal/tools/builtin/registry.go @@ -63,6 +63,10 @@ type Tool struct { Schema Schema Execute Executor Source string // "builtin", "extension:" + // Emoji is the icon chat surfaces show for this tool. It is deliberately + // not part of Schema: Schema is serialised to the model as the tool's + // contract, and an icon is presentation. Empty means no icon. + Emoji string } // Registry holds all registered tools and provides thread-safe access. diff --git a/internal/tools/builtin/shell.go b/internal/tools/builtin/shell.go index 522b1d42f..abf601590 100644 --- a/internal/tools/builtin/shell.go +++ b/internal/tools/builtin/shell.go @@ -74,6 +74,7 @@ func NewShellTool(cwd string, mq *MutationQueue) Tool { return Tool{ Schema: shellSchema, Source: "builtin", + Emoji: "๐Ÿ’ป", Execute: makeShellExecutor(cwd, mq), } } diff --git a/internal/tools/builtin/write.go b/internal/tools/builtin/write.go index 3c9b4a136..ec7a0f711 100644 --- a/internal/tools/builtin/write.go +++ b/internal/tools/builtin/write.go @@ -53,6 +53,7 @@ func NewWriteTool(cwd string, mq *MutationQueue, rt *ReadTracker) Tool { return Tool{ Schema: writeSchema, Source: "builtin", + Emoji: "๐Ÿ“", Execute: makeWriteExecutor(cwd, mq, rt), } } diff --git a/internal/tools/provider/builtin/provider.go b/internal/tools/provider/builtin/provider.go index db1f29284..fddce737d 100644 --- a/internal/tools/provider/builtin/provider.go +++ b/internal/tools/provider/builtin/provider.go @@ -139,6 +139,7 @@ func toEntry(tool toolsbuiltin.Tool) (tools.ToolEntry, error) { Toolset: toolset, Schema: schema, Classification: classify(tool.Schema.Name), + Emoji: tool.Emoji, Handler: handlerFor(tool), }, nil } diff --git a/internal/tools/provider/builtin/provider_test.go b/internal/tools/provider/builtin/provider_test.go index 08b997ed4..61d75f5f9 100644 --- a/internal/tools/provider/builtin/provider_test.go +++ b/internal/tools/provider/builtin/provider_test.go @@ -305,3 +305,28 @@ func TestGrepConsultsSuppliedWorkspaceIndex(t *testing.T) { t.Errorf("index asked for pattern %q, want the caller's pattern %q", pattern, "Target") } } + +// TestWorkspaceToolsCarryTheirOwnIcon pins that each builtin declares an icon +// and that the conversion carries it. A chat surface renders what the tool +// registered, so an icon missing here is an icon missing on screen. +func TestWorkspaceToolsCarryTheirOwnIcon(t *testing.T) { + p := startedProvider(t, t.TempDir()) + entries, err := p.Discover(t.Context()) + if err != nil { + t.Fatalf("Tools: %v", err) + } + if len(entries) == 0 { + t.Fatal("no workspace tools registered") + } + seen := make(map[string]bool) + for _, entry := range entries { + if entry.Emoji == "" { + t.Errorf("tool %q registered no icon", entry.Name) + continue + } + seen[entry.Emoji] = true + } + if len(seen) < 2 { + t.Errorf("icons = %v, want tools to be distinguishable by icon", seen) + } +} diff --git a/tools/go.mod b/tools/go.mod index 968458fe5..2eb96d862 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -4,12 +4,12 @@ go 1.27.0 require ( github.com/invopop/jsonschema v0.14.0 - github.com/samcharles93/archie-core v0.0.0-00010101000000-000000000000 + github.com/samcharles93/archie-core v0.0.0-20260922071806-cd2ab7f2cbfe ) require ( github.com/bahlo/generic-list-go v0.2.0 // indirect - github.com/buger/jsonparser v1.1.2 // indirect + github.com/buger/jsonparser v1.6.1 // indirect github.com/dustin/go-humanize v1.1.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/mattn/go-isatty v0.0.24 // indirect @@ -19,10 +19,10 @@ require ( github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/samcharles93/ai-sdk v0.1.39 // indirect github.com/traefik/yaegi v0.16.1 // indirect - go.yaml.in/yaml/v4 v4.0.0-rc.2 // indirect + go.yaml.in/yaml/v4 v4.0.0-rc.6 // indirect golang.org/x/sys v0.48.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - modernc.org/libc v1.77.0 // indirect + modernc.org/libc v1.77.1 // indirect modernc.org/mathutil v1.7.1 // indirect modernc.org/memory v1.12.1 // indirect modernc.org/sqlite v1.59.0 // indirect diff --git a/tools/go.sum b/tools/go.sum index ac5708be7..1805a7d0f 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -4,6 +4,8 @@ github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPn github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= github.com/buger/jsonparser v1.1.2 h1:frqHqw7otoVbk5M8LlE/L7HTnIq2v9RX6EJ48i9AxJk= github.com/buger/jsonparser v1.1.2/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= +github.com/buger/jsonparser v1.6.1 h1:I0phFv0PlbLHnM7TZAVjZ2MJ2/eWRTDyuO7GLR98IEs= +github.com/buger/jsonparser v1.6.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= 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/dustin/go-humanize v1.1.0 h1:dbKTrvD0klcbBV/h4AWJdMuZogJACoMlvWIWZ5b2xWg= @@ -36,6 +38,8 @@ github.com/traefik/yaegi v0.16.1 h1:f1De3DVJqIDKmnasUF6MwmWv1dSEEat0wcpXhD2On3E= github.com/traefik/yaegi v0.16.1/go.mod h1:4eVhbPb3LnD2VigQjhYbEJ69vDRFdT2HQNrXx8eEwUY= go.yaml.in/yaml/v4 v4.0.0-rc.2 h1:/FrI8D64VSr4HtGIlUtlFMGsm7H7pWTbj6vOLVZcA6s= go.yaml.in/yaml/v4 v4.0.0-rc.2/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0= +go.yaml.in/yaml/v4 v4.0.0-rc.6 h1:1h7H1ohdUh93/FyE4YaDa1Zh64K6VVbjF4K6WUxMtH4= +go.yaml.in/yaml/v4 v4.0.0-rc.6/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0= golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c= golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o= golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= @@ -63,6 +67,8 @@ modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks= modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI= modernc.org/libc v1.77.0 h1:wV+faa9ixRoUNlakU0fHLi/1kV2YLG8D8Ksk3c2mPtY= modernc.org/libc v1.77.0/go.mod h1:BmXDCJcMkRMRbX2EI8+Zhh4fKWlHNbCCZEy0tiZevP4= +modernc.org/libc v1.77.1 h1:Ct8j47QtiZ1Enj2DtFXQtUqrPCAjdCmPjtCuvrYQ0Hs= +modernc.org/libc v1.77.1/go.mod h1:87/pZ4L6nD1zqW4nItuS12YO7hN1igAah34xjnQo/W0= modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= modernc.org/memory v1.12.1 h1:nFMiWrpStgZczNl6XI9GnIk/rWhYIyHGUaR04pGbp9g=