diff --git a/Taskfile.yml b/Taskfile.yml index 45a6bb9e6..b22de46fb 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -89,25 +89,32 @@ tasks: - npm test dev: - desc: "Develop: archied live-reload + Vite HMR together. Open http://localhost:5173" + desc: "Develop: archied live-reload + archie-gateway + Vite HMR together. Open http://localhost:5173" summary: | - Runs both halves of the dev loop in one terminal: + Runs the dev loop in one terminal: - * air rebuilds and restarts archied on Go changes - * vite serves the dashboard with hot reload on :5173, - proxying /api and /events through to archied on :8484 + * air rebuilds and restarts archied on Go changes + * archie-gateway serves ChatContract on 127.0.0.1:8585 (archied + dials it for chat; it does not embed a gateway) + * vite serves the dashboard with hot reload on :5173, + proxying /api and /events through to archied on :8484 Open http://localhost:5173 -- not :8484. The Vite server is the one with hot reload; :8484 serves the last built dist/ and will look stale. - Ctrl-C stops both. - deps: [dev:daemon, dev:ui] + Ctrl-C stops all three. + deps: [dev:daemon, dev:gateway, dev:ui] dev:daemon: desc: archied only, live-reloading via air (prefer `task dev`) cmds: - air + dev:gateway: + desc: archie-gateway only, no live-reload (prefer `task dev`) + cmds: + - go run ./cmd/archie-gateway + dev:ui: desc: Vite dev server only, expects archied already running (prefer `task dev`) dir: ui diff --git a/go.sum b/go.sum index fcf604c64..9bcd555ab 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.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= @@ -20,14 +25,18 @@ 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= @@ -42,6 +51,10 @@ 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= @@ -56,13 +69,17 @@ 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/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= @@ -76,10 +93,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.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= @@ -107,6 +128,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.14.6 h1:dHjEHa49lUTxIb5jrsk5kz/AmOyOQ4T9ti8djcBumDQ= @@ -127,15 +149,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.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= @@ -144,6 +171,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.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= @@ -171,6 +199,7 @@ 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= @@ -192,6 +221,8 @@ 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= diff --git a/internal/app/archied/bootstrap.go b/internal/app/archied/bootstrap.go index f30476e2e..5795dabd1 100644 --- a/internal/app/archied/bootstrap.go +++ b/internal/app/archied/bootstrap.go @@ -486,29 +486,15 @@ func (b *boot) setupContainers(ctx context.Context) func() { // setupLLMAndChat wires the runtime, tool registry, model management, // personas and the dashboard's chat service. -func (b *boot) setupLLMAndChat(ctx context.Context) error { +func (b *boot) setupLLMAndChat() error { cfg := b.cfg - // The daemon owns the local gateway in default mode: the modular - // monolith keeps serving the ChatContract in-process, with the - // standalone archie-gateway binary prepared as a remote alternative - // (mode = "remote"). The local and remote adapters both satisfy - // gateway.ChatContract; composition picks the transport. - var local gateway.ChatContract - if cfg.Services.Gateway.Mode != "remote" { - // Full local contract: router, sessions, models, personas, task - // commands and the LLM responder. The in-process task-actions - // actor applies mutations directly to the store the daemon owns - // -- no HTTP detour through webui, no NATS hop. - local = b.setupGatewayChat(ctx, taskActionsActor{b}) - } else { - // The daemon still runs its own Telegram/email routers in Phase 1, - // so the runtime objects survive even though the webui chat goes - // over gRPC to the standalone Gateway. - b.setupChatRuntime(cfg) - } + // Telegram/email keep their own in-process routers rather than going + // through ChatContract: their streaming responder is a callback, and + // ChatContract's wire-safe interface can't carry one. + b.setupChatRuntime(cfg) - contract, cleanup, err := composeChatContract(cfg.Services.Gateway, local) + contract, cleanup, err := composeChatContract(cfg.Services.Gateway) if err != nil { return err } diff --git a/internal/app/archied/chat_service.go b/internal/app/archied/chat_service.go index 981e9b7a2..86231ecae 100644 --- a/internal/app/archied/chat_service.go +++ b/internal/app/archied/chat_service.go @@ -12,30 +12,22 @@ import ( "github.com/samcharles93/archie-core/internal/infrastructure/gatewayrpc" ) -// composeChatContract selects transport without involving network discovery -// in local calls. The returned cleanup belongs to the application lifecycle. -func composeChatContract(settings config.ServiceConnection, local gateway.ChatContract, options ...grpc.DialOption) (gateway.ChatContract, func(), error) { - switch settings.Mode { - case "", "inproc": - if settings.Target != "" { - return nil, nil, fmt.Errorf("gateway target requires remote mode") - } - return local, func() {}, nil - case "remote": - if strings.TrimSpace(settings.Target) == "" { - return nil, nil, fmt.Errorf("remote gateway requires a target") - } - // The first extraction uses a loopback gRPC hop. Deployments that put - // the Gateway on a separate trust boundary supply their own transport - // credentials through options; the local process split must be usable - // without manufacturing a certificate in the config loader. - opts := append([]grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}, options...) - conn, err := grpc.NewClient(settings.Target, opts...) - if err != nil { - return nil, nil, fmt.Errorf("create gateway client: %w", err) - } - return gatewayrpc.NewClient(conn), func() { _ = conn.Close() }, nil - default: - return nil, nil, fmt.Errorf("unknown gateway service mode %q", settings.Mode) +// composeChatContract dials the standalone archie-gateway, the sole owner of +// ChatContract. +func composeChatContract(settings config.ServiceConnection, options ...grpc.DialOption) (gateway.ChatContract, func(), error) { + if settings.Mode != "remote" { + return nil, nil, fmt.Errorf("unsupported gateway service mode %q; archie-gateway is required, see deployments/README.md", settings.Mode) } + if strings.TrimSpace(settings.Target) == "" { + return nil, nil, fmt.Errorf("remote gateway requires a target") + } + // Deployments that put the Gateway on a separate trust boundary supply + // their own transport credentials through options; the default must be + // usable without manufacturing a certificate in the config loader. + opts := append([]grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}, options...) + conn, err := grpc.NewClient(settings.Target, opts...) + if err != nil { + return nil, nil, fmt.Errorf("create gateway client: %w", err) + } + return gatewayrpc.NewClient(conn), func() { _ = conn.Close() }, nil } diff --git a/internal/app/archied/chat_service_test.go b/internal/app/archied/chat_service_test.go index 28ff5be78..6a25b46b6 100644 --- a/internal/app/archied/chat_service_test.go +++ b/internal/app/archied/chat_service_test.go @@ -17,38 +17,19 @@ import ( "github.com/samcharles93/archie-core/internal/infrastructure/gatewayrpc" ) -func TestComposeChatContractLocal(t *testing.T) { - for _, mode := range []string{"", "inproc"} { - t.Run("mode="+mode, func(t *testing.T) { - local := &gateway.LocalChatAdapter{} - chat, cleanup, err := composeChatContract(config.ServiceConnection{Mode: mode}, local) - if err != nil { - t.Fatal(err) - } - if cleanup == nil { - t.Fatal("local composition returned no cleanup") - } - t.Cleanup(cleanup) - if chat != local { - t.Fatalf("local composition returned %T instead of the supplied adapter", chat) - } - }) - } -} - func TestComposeChatContractRejectsInvalidSettings(t *testing.T) { for _, tt := range []struct { name string settings config.ServiceConnection }{ {name: "unknown mode", settings: config.ServiceConnection{Mode: "automatic"}}, - {name: "default with target", settings: config.ServiceConnection{Target: "localhost:1234"}}, - {name: "inproc with target", settings: config.ServiceConnection{Mode: "inproc", Target: "localhost:1234"}}, + {name: "default mode", settings: config.ServiceConnection{Target: "localhost:1234"}}, + {name: "inproc removed", settings: config.ServiceConnection{Mode: "inproc", Target: "localhost:1234"}}, {name: "remote missing target", settings: config.ServiceConnection{Mode: "remote"}}, {name: "remote blank target", settings: config.ServiceConnection{Mode: "remote", Target: " \t\n"}}, } { t.Run(tt.name, func(t *testing.T) { - chat, cleanup, err := composeChatContract(tt.settings, &gateway.LocalChatAdapter{}) + chat, cleanup, err := composeChatContract(tt.settings) if cleanup != nil { t.Cleanup(cleanup) } @@ -76,9 +57,8 @@ func TestComposeChatContractRemoteAndCleanup(t *testing.T) { } }) - local := compositionChat{snapshot: gateway.ChatSnapshot{ActiveModel: "local-model"}} chat, cleanup, err := composeChatContract( - config.ServiceConnection{Mode: "remote", Target: "passthrough:///chat"}, local, + config.ServiceConnection{Mode: "remote", Target: "passthrough:///chat"}, grpc.WithContextDialer(func(ctx context.Context, _ string) (net.Conn, error) { return listener.DialContext(ctx) }), diff --git a/internal/app/archied/main.go b/internal/app/archied/main.go index 7195ceb55..78651d8e6 100644 --- a/internal/app/archied/main.go +++ b/internal/app/archied/main.go @@ -389,7 +389,7 @@ func Run() int { //nolint:cyclop // the composition root's setup sequence is del return 1 } - if err := b.setupLLMAndChat(ctx); err != nil { + if err := b.setupLLMAndChat(); err != nil { return 1 } if !b.setupGateways(ctx, args.cfgPath, args.overlayPath) { diff --git a/internal/app/archied/task_action_adapter_test.go b/internal/app/archied/task_action_adapter_test.go index 78cd64a31..0fa5b35cf 100644 --- a/internal/app/archied/task_action_adapter_test.go +++ b/internal/app/archied/task_action_adapter_test.go @@ -2,6 +2,7 @@ package archied import ( "context" + "fmt" "log/slog" "path/filepath" "strings" @@ -13,9 +14,25 @@ import ( "github.com/samcharles93/archie-core/internal/taskstate" ) -// newChatTaskActorForTest wires the same production chain the daemon uses in -// default (in-process) mode: chatTaskActorAdapter → LocalChatAdapter → -// taskActionsActor → taskactions.Service over the given store. +// testTaskActor formats taskactions.Service's result the same way the real +// NATS actor (infrastructure/taskactions.Client) does, so this test exercises +// the shared service through the same chatTaskActorAdapter → LocalChatAdapter +// → ChatTaskActor chain production traffic uses. +type testTaskActor struct{ b *boot } + +func (a testTaskActor) ApplyChatTaskAction( + ctx context.Context, identity string, taskID int64, action taskstate.Action, +) (gateway.TaskActionResult, error) { + if err := a.b.taskActions().Apply(ctx, &identity, taskID, action); err != nil { + return gateway.TaskActionResult{}, err + } + return gateway.TaskActionResult{ + TaskID: taskID, + Action: string(action), + Message: fmt.Sprintf("Applied %s to task %d.", action, taskID), + }, nil +} + func newChatTaskActorForTest(t *testing.T, st store.TaskStore, cfg config.Config) chatTaskActorAdapter { t.Helper() b := &boot{ @@ -23,7 +40,7 @@ func newChatTaskActorForTest(t *testing.T, st store.TaskStore, cfg config.Config cfg: cfg, log: slog.Default(), } - return chatTaskActorAdapter{contract: &gateway.LocalChatAdapter{TaskActor: taskActionsActor{b}}} + return chatTaskActorAdapter{contract: &gateway.LocalChatAdapter{TaskActor: testTaskActor{b}}} } func TestChatTaskActorAdapterCrossIdentityRefused(t *testing.T) { diff --git a/internal/app/archied/task_actions.go b/internal/app/archied/task_actions.go index fe4e55ee0..32646d11f 100644 --- a/internal/app/archied/task_actions.go +++ b/internal/app/archied/task_actions.go @@ -7,33 +7,9 @@ import ( "github.com/samcharles93/archie-core/internal/config" "github.com/samcharles93/archie-core/internal/domain/taskactions" "github.com/samcharles93/archie-core/internal/events" - "github.com/samcharles93/archie-core/internal/gateway" taskactionstore "github.com/samcharles93/archie-core/internal/infrastructure/taskactions" - "github.com/samcharles93/archie-core/internal/taskstate" ) -// taskActionsActor applies operator actions in-process for the daemon's own -// local gateway. It is the identity-scoping implementation behind the -// ChatContract's ApplyTaskAction when the daemon is the Gateway (default -// mode). The standalone Gateway instead forwards over NATS with -// taskactions.Client; both paths converge on the one taskactions.Service. -type taskActionsActor struct { - b *boot -} - -func (a taskActionsActor) ApplyChatTaskAction( - ctx context.Context, identity string, taskID int64, action taskstate.Action, -) (gateway.TaskActionResult, error) { - if err := a.b.taskActions().Apply(ctx, &identity, taskID, action); err != nil { - return gateway.TaskActionResult{}, err - } - return gateway.TaskActionResult{ - TaskID: taskID, - Action: string(action), - Message: fmt.Sprintf("Applied %s to task %d.", action, taskID), - }, nil -} - // taskActions assembles the daemon-owned operator action service. The daemon // retains execution cancellation, retry policy, forge closure and event // ownership; the dashboard's webui service and the NATS responder both build diff --git a/internal/infrastructure/configuration/defaults.go b/internal/infrastructure/configuration/defaults.go index c9fd8ecaf..6d6fa9e5f 100644 --- a/internal/infrastructure/configuration/defaults.go +++ b/internal/infrastructure/configuration/defaults.go @@ -60,7 +60,8 @@ const ( // inspected, and reasoned about independently of whether the result is valid. func (l *Loader) applyDefaults(cfg *config.Config) { if cfg.Services.Gateway.Mode == "" { - cfg.Services.Gateway.Mode = "inproc" + cfg.Services.Gateway.Mode = "remote" + cfg.Services.Gateway.Target = "127.0.0.1:8585" } l.applyGeneralDefaults(cfg) applyForgeDefaults(cfg) diff --git a/internal/infrastructure/configuration/services_test.go b/internal/infrastructure/configuration/services_test.go index f5a7e4051..58af72c9a 100644 --- a/internal/infrastructure/configuration/services_test.go +++ b/internal/infrastructure/configuration/services_test.go @@ -10,13 +10,13 @@ func TestLoadGatewayServiceMode(t *testing.T) { for _, tt := range []struct { name, section string wantError bool + wantTarget string }{ - {name: "default"}, - {name: "local", section: "[services.gateway]\nmode = 'inproc'"}, - {name: "remote", section: "[services.gateway]\nmode = 'remote'\ntarget = 'dns:///gateway:8443'"}, + {name: "default", wantTarget: "127.0.0.1:8585"}, + {name: "remote", section: "[services.gateway]\nmode = 'remote'\ntarget = 'dns:///gateway:8443'", wantTarget: "dns:///gateway:8443"}, {name: "invalid mode", section: "[services.gateway]\nmode = 'typo'", wantError: true}, + {name: "inproc removed", section: "[services.gateway]\nmode = 'inproc'", wantError: true}, {name: "remote without target", section: "[services.gateway]\nmode = 'remote'", wantError: true}, - {name: "local with ignored target", section: "[services.gateway]\nmode = 'inproc'\ntarget = 'gateway:8443'", wantError: true}, } { t.Run(tt.name, func(t *testing.T) { path := filepath.Join(t.TempDir(), "config.toml") @@ -28,15 +28,11 @@ func TestLoadGatewayServiceMode(t *testing.T) { t.Fatalf("load error = %v, want error %v", err, tt.wantError) } if err == nil { - want := "inproc" - if tt.name == "remote" { - want = "remote" - if cfg.Services.Gateway.Target != "dns:///gateway:8443" { - t.Fatalf("target = %q", cfg.Services.Gateway.Target) - } + if cfg.Services.Gateway.Mode != "remote" { + t.Fatalf("mode = %q, want %q", cfg.Services.Gateway.Mode, "remote") } - if cfg.Services.Gateway.Mode != want { - t.Fatalf("mode = %q, want %q", cfg.Services.Gateway.Mode, want) + if cfg.Services.Gateway.Target != tt.wantTarget { + t.Fatalf("target = %q, want %q", cfg.Services.Gateway.Target, tt.wantTarget) } } }) diff --git a/internal/infrastructure/configuration/validate.go b/internal/infrastructure/configuration/validate.go index 8cb9eecfb..574b92cec 100644 --- a/internal/infrastructure/configuration/validate.go +++ b/internal/infrastructure/configuration/validate.go @@ -98,16 +98,12 @@ func validate(cfg *config.Config) error { func validateGatewayService(service config.ServiceConnection) error { switch service.Mode { - case "", "inproc": - if service.Target != "" { - return fmt.Errorf("%w: services.gateway.target requires remote mode", ErrInvalidInput) - } case "remote": if strings.TrimSpace(service.Target) == "" { return fmt.Errorf("%w: services.gateway.target is required in remote mode", ErrInvalidInput) } default: - return fmt.Errorf("%w: services.gateway.mode must be inproc or remote", ErrInvalidInput) + return fmt.Errorf("%w: services.gateway.mode must be remote", ErrInvalidInput) } return nil } diff --git a/internal/infrastructure/configuration/validate_test.go b/internal/infrastructure/configuration/validate_test.go index e9739aafc..8db946071 100644 --- a/internal/infrastructure/configuration/validate_test.go +++ b/internal/infrastructure/configuration/validate_test.go @@ -26,6 +26,9 @@ func minimalValidConfig() config.Config { Containers: config.ContainerConfig{ Image: "ghcr.io/samcharles93/archie-agent:latest", }, + Services: config.Services{ + Gateway: config.ServiceConnection{Mode: "remote", Target: "127.0.0.1:8585"}, + }, } }