Add delegated notes operations for Oficina API CLI and MCP
17 files changed,
+985
−9
Makefile+2 −2cmd/memoria-contract/main.go+23 −0cmd/memoria/main.go+4 −0docs/superpowers/specs/2026-09-03-memoria-design.md+37 −0go.mod+14 −0go.sum+42 −0internal/memoria/agent_access.go+207 −0internal/memoria/agent_access_test.go+360 −0internal/memoria/agent_integration_test.go+151 −0internal/memoria/agent_migrations.go+19 −0internal/memoria/agent_migrations/migrations/0001_note_receipts.sql+6 −0internal/memoria/config.go+6 −0internal/memoria/credits/notices.json+99 −0internal/memoria/credits_inventory_test.go+1 −1internal/memoria/custody_test.go+2 −0internal/memoria/handlers.go+8 −6internal/memoriatest/routes_test.go+4 −0
CI passed — run details
Intent
Human
Maybe crack on with own-rolled and coalesce on a later Rastrillo update?
diff --git a/Makefile b/Makefile| index 8a69a01..de7580b 100644 |
| --- a/Makefile |
| +++ b/Makefile |
| @@ -1,5 +1,5 @@ |
| export GOTOOLCHAIN := go1.26.5 |
| -export GOPRIVATE := $(GOPRIVATE),amadan.net/oficina/estilo.git |
| +export GOPRIVATE := $(GOPRIVATE),amadan.net/oficina/estilo.git,amadan.net/oficina/agent-access.git |
| APP := memoria |
| @@ -129,6 +129,6 @@ credits: |
| go build -o "$$notices_tmp/notices" amadan.net/oficina/estilo.git/cmd/oficina-notices; \ |
| GOOS=linux GOARCH=arm64 CGO_ENABLED=0 "$$notices_tmp/notices" \ |
| -package ./cmd/memoria -lucide -onest \ |
| - -exclude amadan.net/oficina/estilo.git,amadan.net/oficina/home/connect,amadan.net/oficina/home/handoff,amadan.net/oficina/suite,amadan.net/rastrillo/native/server \ |
| + -exclude amadan.net/oficina/agent-access.git,amadan.net/oficina/estilo.git,amadan.net/oficina/home/connect,amadan.net/oficina/home/handoff,amadan.net/oficina/suite,amadan.net/rastrillo/native/server \ |
| > "$$notices_tmp/notices.json"; \ |
| mv "$$notices_tmp/notices.json" internal/memoria/credits/notices.json |
diff --git a/cmd/memoria-contract/main.go b/cmd/memoria-contract/main.go| new file mode 100644 |
| index 0000000..cb7e797 |
| --- /dev/null |
| +++ b/cmd/memoria-contract/main.go |
| @@ -0,0 +1,23 @@ |
| +// Command memoria-contract exports the live agent operation schemas as JSON. |
| +package main |
| + |
| +import ( |
| + "encoding/json" |
| + "fmt" |
| + "os" |
| + |
| + "amadan.net/oficina/memoria/internal/memoria" |
| +) |
| + |
| +func main() { |
| + ops, err := memoria.AgentContracts() |
| + if err != nil { |
| + fmt.Fprintln(os.Stderr, "Could not export operation contracts.") |
| + os.Exit(1) |
| + } |
| + encoder := json.NewEncoder(os.Stdout) |
| + encoder.SetIndent("", " ") |
| + if encoder.Encode(ops) != nil { |
| + os.Exit(1) |
| + } |
| +} |
diff --git a/cmd/memoria/main.go b/cmd/memoria/main.go| index c5423d0..56c8ce6 100644 |
| --- a/cmd/memoria/main.go |
| +++ b/cmd/memoria/main.go |
| @@ -89,6 +89,10 @@ func main() { |
| logger.Error("Home sign-in unavailable") |
| os.Exit(1) |
| } |
| + if err := app.WireAgentAccess(mux, cfg); err != nil { |
| + logger.Error("Agent access unavailable") |
| + os.Exit(1) |
| + } |
| app.MountAuth(mux, cfg.Origin) |
| // The apps of record memoria may ask about passages (§4.1). |
diff --git a/docs/superpowers/specs/2026-09-03-memoria-design.md b/docs/superpowers/specs/2026-09-03-memoria-design.md| index 1b59056..9d462b9 100644 |
| --- a/docs/superpowers/specs/2026-09-03-memoria-design.md |
| +++ b/docs/superpowers/specs/2026-09-03-memoria-design.md |
| @@ -5367,3 +5367,40 @@ returned passages, and presents the result as an AI draft with source links. |
| Unsupported devices retain search and notes. Queries, results and answers stay |
| out of logs and persisted app state; the session alone is stored in Keychain. |
| The app requires online retrieval even though answer generation is local. |
| + |
| +## Agent access (Paul's scope, 2026-10-24) |
| + |
| +The optional delegated API adds GET `/api/v1/operations` and POST |
| +`/api/v1/operations/{name}`. Both mounts use bearer authentication independently |
| +of browser sessions. Enable with `MEMORIA_AGENT_ISSUER` (trusted HTTPS connection |
| +service) and `MEMORIA_AGENT_TEAM` (this instance's team), with Home configured. |
| +Partial configuration refuses startup. No cookie or caller-supplied address can |
| +authorize an operation. Every request verifies the audience-bound credential |
| +online and resolves its opaque Home subject to an existing linked local account; |
| +current local admission still applies. Input team must equal this instance's |
| +configured team and be covered by the grant. |
| + |
| +`notes_search` requires `notes:read` and uses `SearchWithoutFacts`, with the linked |
| +local address as the sibling asker. Sibling visibility is checked on every query; |
| +the operation cannot read unfiltered bodies or summaries. No model is called. |
| +`notes_create` requires `notes:write` and creates a team-shared paste note, with |
| +a nonzero UUID `client_id`. Retrying the same request returns its receipt; |
| +reusing the key with different content returns a conflict. Receipts bind the |
| +Home subject, client and team using purpose-separated keyed fingerprints; |
| +they contain no readable title, body or address. A completed receipt survives |
| +note deletion and never recreates the note on replay. Notes use the existing |
| +sealed Ingest store. The shared HTTP adapter caps requests and masks internal |
| +errors; queries, arguments, credentials and returned content stay out of logs. |
| + |
| + |
| +Independent review: GPT-5.6 Sol approved the scoped implementation and final |
| +contract-export/integration delta on 2026-10-24; the findings, fixes and mutation |
| +evidence are recorded in Memoria discussion 30 and agent-access discussion 1. |
| +`make ci` and focused agent race tests pass. This is branch implementation, not |
| +production deployment or suite-wide completion. |
| + |
| +`go run ./cmd/memoria-contract` exports the live operation descriptors without |
| +opening storage or reading deployment secrets. The connection service pins that |
| +array into its configured team/app route. Its API, CLI and MCP all reach these |
| +same checked operations. The integration fixture proves real HTTPS forwarding, |
| +local account resolution, note storage/search, retries and parent revocation. |
diff --git a/go.mod b/go.mod| index ac69207..4261381 100644 |
| --- a/go.mod |
| +++ b/go.mod |
| @@ -5,6 +5,7 @@ go 1.26 |
| toolchain go1.26.5 |
| require ( |
| + amadan.net/oficina/agent-access.git v0.0.0-20261024224328-3966c68144d1 |
| amadan.net/oficina/estilo.git v0.0.0-20261001093750-530cb932e768 |
| amadan.net/oficina/home/connect v0.0.0-20261001093757-2bec942ddd0c |
| amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489 |
| @@ -15,8 +16,10 @@ require ( |
| github.com/chromedp/chromedp v0.14.2 |
| github.com/go-chi/chi/v5 v5.3.2 |
| github.com/google/uuid v1.6.0 |
| + github.com/modelcontextprotocol/go-sdk v1.7.0 |
| golang.org/x/crypto v0.55.0 |
| golang.org/x/net v0.57.0 |
| + golang.org/x/oauth2 v0.35.0 |
| gorm.io/gorm v1.31.2 |
| modernc.org/sqlite v1.55.0 |
| ) |
| @@ -30,19 +33,30 @@ require ( |
| amadan.net/rastrillo/rastrillo/money v0.1.0 // indirect |
| github.com/BurntSushi/toml v1.6.0 // indirect |
| github.com/chromedp/sysutil v1.1.0 // indirect |
| + github.com/danieljoos/wincred v1.2.3 // indirect |
| github.com/dustin/go-humanize v1.0.1 // indirect |
| github.com/gobwas/httphead v0.1.0 // indirect |
| github.com/gobwas/pool v0.2.1 // indirect |
| github.com/gobwas/ws v1.4.0 // indirect |
| + github.com/godbus/dbus/v5 v5.2.2 // indirect |
| + github.com/gofrs/flock v0.12.1 // indirect |
| + github.com/google/jsonschema-go v0.4.3 // indirect |
| github.com/jinzhu/inflection v1.0.0 // indirect |
| github.com/jinzhu/now v1.1.5 // indirect |
| github.com/keymaildev/signin v0.1.1 // indirect |
| github.com/mattn/go-isatty v0.0.20 // indirect |
| github.com/ncruces/go-strftime v1.0.0 // indirect |
| github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect |
| + github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 // indirect |
| + github.com/segmentio/asm v1.1.3 // indirect |
| + github.com/segmentio/encoding v0.5.4 // indirect |
| + github.com/yosida95/uritemplate/v3 v3.0.2 // indirect |
| + github.com/zalando/go-keyring v0.2.8 // indirect |
| golang.org/x/mod v0.38.0 // indirect |
| + golang.org/x/sync v0.22.0 // indirect |
| golang.org/x/sys v0.47.0 // indirect |
| golang.org/x/text v0.41.0 // indirect |
| + golang.org/x/time v0.15.0 // indirect |
| gorm.io/plugin/dbresolver v1.6.2 // indirect |
| modernc.org/libc v1.74.1 // indirect |
| modernc.org/mathutil v1.7.1 // indirect |
diff --git a/go.sum b/go.sum| index 55f5156..e0eec23 100644 |
| --- a/go.sum |
| +++ b/go.sum |
| @@ -1,3 +1,5 @@ |
| +amadan.net/oficina/agent-access.git v0.0.0-20261024224328-3966c68144d1 h1:GknXgICfFlRNJTwXrZRdeTRS6DtQ37b3e7COQX/IxAs= |
| +amadan.net/oficina/agent-access.git v0.0.0-20261024224328-3966c68144d1/go.mod h1:Ph9PIa3VE1IEaUzZiQH6D+IQ6HThWWGfVr0ecMMgrFA= |
| amadan.net/oficina/estilo.git v0.0.0-20261001093750-530cb932e768 h1:bVscoa9fH5LdLDjlyecZhrX7JzWPT0blb57MH0FIm2U= |
| amadan.net/oficina/estilo.git v0.0.0-20261001093750-530cb932e768/go.mod h1:4u0jNBtIdMLOsJyrScfqoEuYDJF7BBM3qM9YWbzt6aw= |
| amadan.net/oficina/home/connect v0.0.0-20261001093757-2bec942ddd0c h1:3yxO2D8BxDLMGfFV2o6Sp9Z91yLnjDCIuRKHVWORa8A= |
| @@ -22,6 +24,12 @@ github.com/chromedp/chromedp v0.14.2 h1:r3b/WtwM50RsBZHMUm9fsNhhzRStTHrKdr2zmwbZ |
| github.com/chromedp/chromedp v0.14.2/go.mod h1:rHzAv60xDE7VNy/MYtTUrYreSc0ujt2O1/C3bzctYBo= |
| github.com/chromedp/sysutil v1.1.0 h1:PUFNv5EcprjqXZD9nJb9b/c9ibAbxiYo4exNWZyipwM= |
| github.com/chromedp/sysutil v1.1.0/go.mod h1:WiThHUdltqCNKGc4gaU50XgYjwjYIhKWoHGPTUfWTJ8= |
| +github.com/danieljoos/wincred v1.2.3 h1:v7dZC2x32Ut3nEfRH+vhoZGvN72+dQ/snVXo/vMFLdQ= |
| +github.com/danieljoos/wincred v1.2.3/go.mod h1:6qqX0WNrS4RzPZ1tnroDzq9kY3fu1KwE7MRLQK4X0bs= |
| +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/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= |
| +github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= |
| github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= |
| github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= |
| github.com/go-chi/chi/v5 v5.3.2 h1:5YQkICvTCSZ25hoRsyJazN0scjzKGiu4VAUc7H1o1nY= |
| @@ -36,6 +44,16 @@ github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og= |
| github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= |
| github.com/gobwas/ws v1.4.0 h1:CTaoG1tojrh4ucGPcoJFiAQUAsEWekEWvLy7GsVNqGs= |
| github.com/gobwas/ws v1.4.0/go.mod h1:G3gNqMNtPppf5XUz7O4shetPpcZ1VJ7zt18dlUeakrc= |
| +github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ= |
| +github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c= |
| +github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= |
| +github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= |
| +github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= |
| +github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= |
| +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= |
| +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= |
| +github.com/google/jsonschema-go v0.4.3 h1:/DBOLZTfDow7pe2GmaJNhltueGTtDKICi8V8p+DQPd0= |
| +github.com/google/jsonschema-go v0.4.3/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE= |
| github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs= |
| github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= |
| github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= |
| @@ -54,20 +72,40 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE |
| github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= |
| github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= |
| github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= |
| +github.com/modelcontextprotocol/go-sdk v1.7.0 h1:yqjY2dsbKAC0LSuWZVBMrHgiG8ukXv6NRo0JiALay44= |
| +github.com/modelcontextprotocol/go-sdk v1.7.0/go.mod h1:dL7u98E/zjJTGzEq+j30jQ8K2k1mb6LeAH4inEcSGts= |
| github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w= |
| github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= |
| github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde h1:x0TT0RDC7UhAVbbWWBzr41ElhJx5tXPWkIHA2HWPRuw= |
| github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0= |
| +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= |
| +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= |
| github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= |
| github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= |
| +github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 h1:1EYB5IzjZawrrnELUi78f9fPu57HuXjmddZPjrls/28= |
| +github.com/santhosh-tekuri/jsonschema/v6 v6.0.3/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU= |
| +github.com/segmentio/asm v1.1.3 h1:WM03sfUOENvvKexOLp+pCqgb/WDjsi7EK8gIsICtzhc= |
| +github.com/segmentio/asm v1.1.3/go.mod h1:Ld3L4ZXGNcSLRg4JBsZ3//1+f/TjYl0Mzen/DQy1EJg= |
| +github.com/segmentio/encoding v0.5.4 h1:OW1VRern8Nw6ITAtwSZ7Idrl3MXCFwXHPgqESYfvNt0= |
| +github.com/segmentio/encoding v0.5.4/go.mod h1:HS1ZKa3kSN32ZHVZ7ZLPLXWvOVIiZtyJnO1gPH1sKt0= |
| github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0= |
| github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M= |
| +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= |
| +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= |
| +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= |
| +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= |
| +github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4= |
| +github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4= |
| +github.com/zalando/go-keyring v0.2.8 h1:6sD/Ucpl7jNq10rM2pgqTs0sZ9V3qMrqfIIy5YPccHs= |
| +github.com/zalando/go-keyring v0.2.8/go.mod h1:tsMo+VpRq5NGyKfxoBVjCuMrG47yj8cmakZDO5QGii0= |
| golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M= |
| golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis= |
| golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk= |
| golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40= |
| golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= |
| golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= |
| +golang.org/x/oauth2 v0.35.0 h1:Mv2mzuHuZuY2+bkyWXIHMfhNdJAdwW3FuWeCPYN5GVQ= |
| +golang.org/x/oauth2 v0.35.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= |
| 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.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= |
| @@ -75,8 +113,12 @@ golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= |
| golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= |
| golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= |
| golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= |
| +golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= |
| +golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= |
| golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE= |
| golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk= |
| +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= |
| +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
| gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo= |
| gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM= |
| gorm.io/driver/sqlite v1.6.0 h1:WHRRrIiulaPiPFmDcod6prc4l2VGVWHz80KspNsxSfQ= |
diff --git a/internal/memoria/agent_access.go b/internal/memoria/agent_access.go| new file mode 100644 |
| index 0000000..0657d39 |
| --- /dev/null |
| +++ b/internal/memoria/agent_access.go |
| @@ -0,0 +1,207 @@ |
| +package memoria |
| + |
| +import ( |
| + "context" |
| + "database/sql" |
| + "encoding/json" |
| + "errors" |
| + "net/http" |
| + "strings" |
| + |
| + access "amadan.net/oficina/agent-access.git" |
| + "amadan.net/oficina/home/connect/linkstore" |
| + "amadan.net/oficina/suite" |
| + "amadan.net/rastrillo/rastrillo/migrate" |
| + "github.com/google/uuid" |
| +) |
| + |
| +// WireAgentAccess mounts a bearer-only API outside browser sessions and CSRF. |
| +// Home linking and the instance's admission policy remain mandatory. |
| +func (a *app) WireAgentAccess(mux *http.ServeMux, cfg Config) error { |
| + if cfg.AgentIssuer == "" && cfg.AgentTeam == "" { |
| + return nil |
| + } |
| + if a.home == nil || cfg.AgentTeam == "" || mux == nil { |
| + return errors.New("memoria: agent access requires Home and a team") |
| + } |
| + v, err := access.NewRemoteVerifier(cfg.AgentIssuer, cfg.Origin+"/api/v1") |
| + if err != nil { |
| + return errors.New("memoria: invalid agent access configuration") |
| + } |
| + return a.mountAgentAccess(mux, cfg.AgentTeam, v) |
| +} |
| + |
| +func (a *app) mountAgentAccess(mux *http.ServeMux, team string, verifier access.Verifier) error { |
| + if _, err := migrate.Apply(context.Background(), a.db, agentSchema); err != nil { |
| + return err |
| + } |
| + registry, err := access.NewRegistry(a.agentOperations(team)...) |
| + if err != nil { |
| + return err |
| + } |
| + checked := access.VerifyFunc(func(ctx context.Context, token string) (access.Principal, error) { |
| + p, err := verifier.Verify(ctx, token) |
| + if err != nil { |
| + return access.Principal{}, err |
| + } |
| + if _, err = a.agentAddress(ctx, p, team); err != nil { |
| + return access.Principal{}, err |
| + } |
| + return p, nil |
| + }) |
| + h := registry.HTTP(checked) |
| + mux.Handle("/api/v1/operations", h) |
| + mux.Handle("/api/v1/operations/", h) |
| + return nil |
| +} |
| + |
| +func (a *app) agentAddress(ctx context.Context, p access.Principal, team string) (string, error) { |
| + allowed := false |
| + for _, t := range p.Teams { |
| + allowed = allowed || t == team |
| + } |
| + if !allowed || p.Client == "" || p.Grant == "" || p.Subject == "" || a.home == nil { |
| + return "", access.Fail("forbidden", "This connection cannot access this app.") |
| + } |
| + person, err := a.home.bridge.Resolve(ctx, p.Subject) |
| + if errors.Is(err, linkstore.ErrStorage) { |
| + return "", access.Fail("unavailable", "Account verification is temporarily unavailable.") |
| + } |
| + if err != nil || person.Label == "" || !a.Admit(person.Label) { |
| + return "", access.Fail("forbidden", "Link an admitted Memoria account to Home first.") |
| + } |
| + return person.Label, nil |
| +} |
| + |
| +func (a *app) agentOperations(team string) []access.Operation { |
| + guard := func(scope string, fn func(context.Context, access.Principal, json.RawMessage, string) (any, error)) func(context.Context, access.Principal, json.RawMessage) (any, error) { |
| + return func(ctx context.Context, p access.Principal, raw json.RawMessage) (any, error) { |
| + var in struct { |
| + Team string `json:"team"` |
| + } |
| + if json.Unmarshal(raw, &in) != nil || in.Team != team || !p.Allows(team, scope) { |
| + return nil, access.Fail("forbidden", "This connection cannot access this team.") |
| + } |
| + address, err := a.agentAddress(ctx, p, team) |
| + if err != nil { |
| + return nil, err |
| + } |
| + return fn(ctx, p, raw, address) |
| + } |
| + } |
| + return []access.Operation{ |
| + {Name: "notes_search", Description: "Search currently visible Memoria passages for a team. Sibling apps check access on every query.", Scope: "notes:read", ReadOnly: true, Idempotent: true, |
| + Input: json.RawMessage(`{"type":"object","required":["team","query"],"additionalProperties":false,"properties":{"team":{"type":"string","minLength":1},"query":{"type":"string","minLength":1,"maxLength":2048}}}`), |
| + Output: json.RawMessage(`{"type":"object","required":["results","notices"],"additionalProperties":false,"properties":{"results":{"type":"array","items":{"type":"object","required":["id","document_id","title","text","source"],"properties":{"id":{"type":"integer"},"document_id":{"type":"integer"},"title":{"type":"string"},"text":{"type":"string"},"source":{"type":"string"}}}},"notices":{"type":"array","items":{"type":"string"}}}}`), |
| + Invoke: guard("notes:read", a.agentSearch)}, |
| + {Name: "notes_create", Description: "Create a team-shared note. Reuse client_id only to retry the same title and body.", Scope: "notes:write", Idempotent: true, |
| + Input: json.RawMessage(`{"type":"object","required":["team","title","body","client_id"],"additionalProperties":false,"properties":{"team":{"type":"string","minLength":1},"title":{"type":"string","minLength":1,"maxLength":512},"body":{"type":"string","minLength":1,"maxLength":1048576},"client_id":{"type":"string","minLength":36,"maxLength":36}}}`), |
| + Output: json.RawMessage(`{"type":"object","required":["id","indexed"],"additionalProperties":false,"properties":{"id":{"type":"integer","minimum":1},"indexed":{"type":"boolean"}}}`), |
| + Invoke: guard("notes:write", a.agentCreate)}, |
| + } |
| +} |
| + |
| +func (a *app) agentSearch(ctx context.Context, _ access.Principal, raw json.RawMessage, address string) (any, error) { |
| + var in struct { |
| + Query string `json:"query"` |
| + } |
| + if json.Unmarshal(raw, &in) != nil || strings.TrimSpace(in.Query) == "" || len(in.Query) > 2048 { |
| + return nil, access.Fail("invalid", "Enter a query of at most 2048 bytes.") |
| + } |
| + found, err := a.store.SearchWithoutFacts(ctx, suite.Subject{Kind: suite.SubjectAddress, Value: address}, strings.TrimSpace(in.Query), 25) |
| + if err != nil { |
| + return nil, access.Fail("unavailable", "Search is unavailable. Try again.") |
| + } |
| + type result struct { |
| + ID int64 `json:"id"` |
| + DocumentID int64 `json:"document_id"` |
| + Title string `json:"title"` |
| + Text string `json:"text"` |
| + Source string `json:"source"` |
| + } |
| + out := make([]result, 0, len(found.Results)) |
| + for _, v := range found.Results { |
| + out = append(out, result{v.ChunkID, v.DocumentID, v.Title, strings.NewReplacer("<mark>", "", "</mark>", "").Replace(v.Snippet), v.Source}) |
| + } |
| + notices := found.Notices |
| + if notices == nil { |
| + notices = []string{} |
| + } |
| + return map[string]any{"results": out, "notices": notices}, nil |
| +} |
| + |
| +type agentNoteResult struct { |
| + ID int64 `json:"id"` |
| + Indexed bool `json:"indexed"` |
| +} |
| + |
| +func (a *app) agentCreate(ctx context.Context, p access.Principal, raw json.RawMessage, _ string) (any, error) { |
| + var in struct { |
| + Team, Title, Body string |
| + ClientID string `json:"client_id"` |
| + } |
| + if json.Unmarshal(raw, &in) != nil { |
| + return nil, access.Fail("invalid", "Invalid note.") |
| + } |
| + uid, err := uuid.Parse(in.ClientID) |
| + if err != nil || len(in.ClientID) != 36 || uid == uuid.Nil || strings.TrimSpace(in.Title) == "" || strings.TrimSpace(in.Body) == "" || len(in.Title) > 512 || len(in.Body) > 1<<20 { |
| + return nil, access.Fail("invalid", "Supply a title, a note up to 1 MiB, and a nonzero UUID client_id.") |
| + } |
| + // Fingerprint both the request and its coordinate. Neither a readable |
| + // passage nor a dictionary-testable content hash belongs in the bucket. |
| + coordinate, _ := json.Marshal([]string{p.Subject, p.Client, in.Team, uid.String()}) |
| + key, err := a.store.sealer.Fingerprint("agent.note.coordinate.v1", coordinate) |
| + if err != nil { |
| + return nil, err |
| + } |
| + content, _ := json.Marshal([]string{in.Title, in.Body}) |
| + fingerprint, err := a.store.sealer.Fingerprint("agent.note.content.v1", content) |
| + if err != nil { |
| + return nil, err |
| + } |
| + // Serialize pending retries through Ingest and receipt completion. The DB |
| + // reservation also survives a restart between these two commits. |
| + a.agentNotes.Lock() |
| + defer a.agentNotes.Unlock() |
| + if _, err = a.db.Writer().ExecContext(ctx, "INSERT INTO memoria_agent_notes(coordinate,content) VALUES(?,?) ON CONFLICT(coordinate) DO NOTHING", key, fingerprint); err != nil { |
| + return nil, err |
| + } |
| + var saved string |
| + var id sql.NullInt64 |
| + var indexed bool |
| + if err = a.db.Writer().QueryRowContext(ctx, "SELECT content,document_id,indexed FROM memoria_agent_notes WHERE coordinate=?", key).Scan(&saved, &id, &indexed); err != nil { |
| + return nil, err |
| + } |
| + if saved != fingerprint { |
| + return nil, access.Fail("conflict", "This client_id was already used with different note content.") |
| + } |
| + if id.Valid { |
| + return agentNoteResult{id.Int64, indexed}, nil |
| + } |
| + noteID, err := a.store.Ingest(ctx, IngestSpec{Source: "paste", Key: "agent-" + key, Title: in.Title, Body: in.Body}) |
| + if err != nil && !errors.Is(err, ErrIndexLag) { |
| + return nil, err |
| + } |
| + indexed = err == nil |
| + if _, err = a.db.Writer().ExecContext(context.WithoutCancel(ctx), "UPDATE memoria_agent_notes SET document_id=?,indexed=? WHERE coordinate=?", noteID, indexed, key); err != nil { |
| + return nil, err |
| + } |
| + return agentNoteResult{noteID, indexed}, nil |
| +} |
| + |
| +// AgentContracts exports the same descriptors used by the live app, without |
| +// opening a database or reading deployment credentials. The connection service |
| +// consumes these descriptors as operator-reviewed routing configuration. |
| +func AgentContracts() ([]access.Operation, error) { |
| + a := &app{} |
| + operations := a.agentOperations("contract") |
| + scopes := make([]string, 0, len(operations)) |
| + for _, op := range operations { |
| + scopes = append(scopes, op.Scope) |
| + } |
| + registry, err := access.NewRegistry(operations...) |
| + if err != nil { |
| + return nil, err |
| + } |
| + return registry.List(access.Principal{Subject: "contract", Teams: []string{"contract"}, Scopes: scopes}), nil |
| +} |
diff --git a/internal/memoria/agent_access_test.go b/internal/memoria/agent_access_test.go| new file mode 100644 |
| index 0000000..82a84f7 |
| --- /dev/null |
| +++ b/internal/memoria/agent_access_test.go |
| @@ -0,0 +1,360 @@ |
| +package memoria |
| + |
| +import ( |
| + "bytes" |
| + "context" |
| + "encoding/json" |
| + "net/http" |
| + "net/http/httptest" |
| + "os" |
| + "path/filepath" |
| + "slices" |
| + "strings" |
| + "sync" |
| + "testing" |
| + |
| + access "amadan.net/oficina/agent-access.git" |
| + "amadan.net/oficina/suite" |
| +) |
| + |
| +// The account link goes through both real browser proofs and confirmation; |
| +// a verifier alone must never provision a Memoria identity. |
| +func linkedAgentFixture(t *testing.T) (*homeRouterFixture, access.Principal) { |
| + t.Helper() |
| + f := newHomeRouterFixture(t) |
| + f.local(t) |
| + if w := f.do("GET", "/account/home", ""); w.Code != 200 { |
| + t.Fatal("link page", w.Code) |
| + } |
| + start := homeRedirect(t, f.do("POST", "/account/home", "")) |
| + if homeRedirect(t, f.exchange(t, start, "opaque-home-alice")) != "/account/home/confirm" { |
| + t.Fatal("wrong link landing") |
| + } |
| + homeRedirect(t, f.do("POST", "/account/home/confirm", "")) |
| + return f, access.Principal{Subject: "opaque-home-alice", Client: "test-agent", Grant: "grant-1", Teams: []string{"acme"}, Scopes: []string{"notes:read", "notes:write"}} |
| +} |
| + |
| +func mountAgentFixture(t *testing.T, f *homeRouterFixture, p *access.Principal, active *bool) http.Handler { |
| + t.Helper() |
| + mux := http.NewServeMux() |
| + err := f.app.mountAgentAccess(mux, "acme", access.VerifyFunc(func(context.Context, string) (access.Principal, error) { |
| + if !*active { |
| + return access.Principal{}, access.Fail("unauthenticated", "Revoked.") |
| + } |
| + return *p, nil |
| + })) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + return mux |
| +} |
| + |
| +func agentCall(h http.Handler, name, body string) *httptest.ResponseRecorder { |
| + r := httptest.NewRequest("POST", homeTestOrigin+"/api/v1/operations/"+name, strings.NewReader(body)) |
| + r.Header.Set("Content-Type", "application/json") |
| + r.Header.Set("Authorization", "Bearer test-token") |
| + w := httptest.NewRecorder() |
| + h.ServeHTTP(w, r) |
| + return w |
| +} |
| + |
| +const agentTitleCanary = "title_canary_7f360f42e2ab4a52b47a" |
| +const agentBodyCanary = "body_canary_358efd1ec48c4db9b01e" |
| +const agentNoteInput = `{"team":"acme","title":"Nebula agent note ` + agentTitleCanary + `","body":"nebula private note passage ` + agentBodyCanary + `","client_id":"a8d99147-249b-40df-a8a6-c311d425e03b"}` |
| + |
| +func TestAgentNoteAdmissionScopeAndRetries(t *testing.T) { |
| + f, p := linkedAgentFixture(t) |
| + active := true |
| + h := mountAgentFixture(t, f, &p, &active) |
| + first := agentCall(h, "notes_create", agentNoteInput) |
| + if first.Code != 200 { |
| + t.Fatal(first.Code, first.Body.String()) |
| + } |
| + var result agentNoteResult |
| + if json.Unmarshal(first.Body.Bytes(), &result) != nil || result.ID <= 0 || !result.Indexed { |
| + t.Fatal("invalid receipt") |
| + } |
| + var wg sync.WaitGroup |
| + for range 5 { |
| + wg.Go(func() { |
| + w := agentCall(h, "notes_create", agentNoteInput) |
| + if w.Code != 200 || w.Body.String() != first.Body.String() { |
| + t.Errorf("retry: %d", w.Code) |
| + } |
| + }) |
| + } |
| + wg.Wait() |
| + if w := agentCall(h, "notes_create", strings.Replace(agentNoteInput, "private note passage", "different passage", 1)); w.Code != 409 { |
| + t.Fatal("mismatched retry", w.Code) |
| + } |
| + if w := agentCall(h, "notes_create", strings.Replace(agentNoteInput, "Nebula agent note", "Different title", 1)); w.Code != 409 { |
| + t.Fatal("title mismatch retry", w.Code) |
| + } |
| + var count int |
| + if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM documents").Scan(&count); err != nil || count != 1 { |
| + t.Fatal("duplicate created", count, err) |
| + } |
| + var sealedBody []byte |
| + if err := f.app.db.Writer().QueryRow("SELECT sealed_body FROM documents WHERE id=?", result.ID).Scan(&sealedBody); err != nil { |
| + t.Fatal(err) |
| + } |
| + if strings.Contains(string(sealedBody), "private note") { |
| + t.Fatal("body stored unsealed") |
| + } |
| + var coordinate, content string |
| + if err := f.app.db.Writer().QueryRow("SELECT coordinate,content FROM memoria_agent_notes").Scan(&coordinate, &content); err != nil { |
| + t.Fatal(err) |
| + } |
| + if len(coordinate) != 64 || len(content) != 64 || strings.Contains(coordinate+content, p.Subject) { |
| + t.Fatal("receipt is not fingerprinted") |
| + } |
| + |
| + checks := []struct { |
| + name string |
| + change func() |
| + restore func() |
| + }{ |
| + {"read-only grant", func() { p.Scopes = []string{"notes:read"} }, func() { p.Scopes = []string{"notes:read", "notes:write"} }}, |
| + {"wrong instance team", func() { p.Teams = []string{"other"} }, func() { p.Teams = []string{"acme"} }}, |
| + {"unlinked subject", func() { p.Subject = "unlinked-home-bob" }, func() { p.Subject = "opaque-home-alice" }}, |
| + {"local removal", func() { f.app.SetOwners([]string{"bob@example.test"}) }, func() { f.app.SetOwners([]string{"alice@example.test"}) }}, |
| + {"revoked grant", func() { active = false }, func() { active = true }}, |
| + } |
| + for _, tc := range checks { |
| + t.Run(tc.name, func(t *testing.T) { |
| + tc.change() |
| + defer tc.restore() |
| + var identitiesBefore, linksBefore, identitiesAfter, linksAfter int |
| + if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM memoria_home_local_identities").Scan(&identitiesBefore); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM home_identity_links").Scan(&linksBefore); err != nil { |
| + t.Fatal(err) |
| + } |
| + w := agentCall(h, "notes_create", strings.Replace(agentNoteInput, "a8d99147", "b8d99147", 1)) |
| + if w.Code != 401 && w.Code != 403 { |
| + t.Fatal(w.Code, w.Body.String()) |
| + } |
| + if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM documents").Scan(&count); err != nil || count != 1 { |
| + t.Fatal("denial changed documents", count, err) |
| + } |
| + if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM memoria_home_local_identities").Scan(&identitiesAfter); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM home_identity_links").Scan(&linksAfter); err != nil { |
| + t.Fatal(err) |
| + } |
| + if identitiesBefore != identitiesAfter || linksBefore != linksAfter { |
| + t.Fatal("denial provisioned identity or link") |
| + } |
| + }) |
| + } |
| + // A cookie may authorize the browser UI, but cannot replace a bearer. |
| + r := httptest.NewRequest("POST", homeTestOrigin+"/api/v1/operations/notes_create", strings.NewReader(agentNoteInput)) |
| + for _, cookie := range f.cookies { |
| + r.AddCookie(cookie) |
| + } |
| + w := httptest.NewRecorder() |
| + h.ServeHTTP(w, r) |
| + if w.Code != 401 { |
| + t.Fatal("cookie authorized delegated API", w.Code) |
| + } |
| + p.Teams = []string{"other"} |
| + r = httptest.NewRequest("GET", homeTestOrigin+"/api/v1/operations", nil) |
| + r.Header.Set("Authorization", "Bearer test-token") |
| + w = httptest.NewRecorder() |
| + h.ServeHTTP(w, r) |
| + if w.Code != 403 { |
| + t.Fatal("wrong instance team discovered operations", w.Code) |
| + } |
| + p.Teams = []string{"acme"} |
| + assertAgentContentSealed(t, f) |
| + if err := f.app.store.Delete(t.Context(), result.ID); err != nil { |
| + t.Fatal(err) |
| + } |
| + w = agentCall(h, "notes_create", agentNoteInput) |
| + if w.Code != 200 || w.Body.String() != first.Body.String() { |
| + t.Fatal("completed receipt changed after deletion", w.Code) |
| + } |
| + if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM documents").Scan(&count); err != nil || count != 0 { |
| + t.Fatal("replay recreated deleted note", count, err) |
| + } |
| +} |
| + |
| +func TestAgentSearchRechecksSiblingPermission(t *testing.T) { |
| + f, p := linkedAgentFixture(t) |
| + active := true |
| + h := mountAgentFixture(t, f, &p, &active) |
| + custody := &fixedCustody{apps: docsRoster(), give: suite.VISIBLE} |
| + f.app.store.custody = custody |
| + if w := agentCall(h, "notes_create", agentNoteInput); w.Code != 200 { |
| + t.Fatal(w.Code) |
| + } |
| + if _, err := f.app.store.Ingest(t.Context(), IngestSpec{Source: "Docs", Key: "agent-sibling", Title: "Sibling nebula", Body: "nebula sibling secret", ItemID: "docs-one", SiblingRevision: 1}); err != nil { |
| + t.Fatal(err) |
| + } |
| + input := `{"team":"acme","query":"nebula"}` |
| + w := agentCall(h, "notes_search", input) |
| + if w.Code != 200 || !strings.Contains(w.Body.String(), "sibling secret") || !strings.Contains(w.Body.String(), "private note passage") { |
| + t.Fatal("positive search", w.Code, w.Body.String()) |
| + } |
| + if custody.asker.Kind != suite.SubjectAddress || custody.asker.Value != "alice@example.test" { |
| + t.Fatal("wrong sibling asker", custody.asker) |
| + } |
| + custody.give = suite.NOT_VISIBLE |
| + w = agentCall(h, "notes_search", input) |
| + if w.Code != 200 || strings.Contains(w.Body.String(), "sibling secret") || strings.Contains(w.Body.String(), "Sibling nebula") || !strings.Contains(w.Body.String(), "private note passage") { |
| + t.Fatal("sibling refusal not enforced", w.Code, w.Body.String()) |
| + } |
| + if custody.calls != 2 { |
| + t.Fatal("did not ask sibling on each query", custody.calls) |
| + } |
| + // A grant for two teams still cannot select the other instance's team. |
| + p.Teams = []string{"acme", "other"} |
| + if w = agentCall(h, "notes_search", `{"team":"other","query":"nebula"}`); w.Code != 403 { |
| + t.Fatal("cross-instance team", w.Code) |
| + } |
| +} |
| + |
| +// Review-selected gate: scanning complete database files catches a newly added |
| +// plaintext column that selected-column assertions would miss. Existing local |
| +// auth sessions predate this API and contain addresses; the new content canaries |
| +// must be absent from every file, including WAL and temporary files. |
| +func assertAgentContentSealed(t *testing.T, f *homeRouterFixture) { |
| + t.Helper() |
| + var dbPath string |
| + if err := f.app.db.Writer().QueryRow("SELECT file FROM pragma_database_list WHERE name='main'").Scan(&dbPath); err != nil { |
| + t.Fatal(err) |
| + } |
| + scan := func() { |
| + err := filepath.WalkDir(filepath.Dir(dbPath), func(path string, entry os.DirEntry, err error) error { |
| + if err != nil { |
| + return err |
| + } |
| + if entry.IsDir() { |
| + return nil |
| + } |
| + data, err := os.ReadFile(path) |
| + if err != nil { |
| + return err |
| + } |
| + for _, canary := range []string{agentTitleCanary, agentBodyCanary} { |
| + if bytes.Contains(data, []byte(canary)) { |
| + t.Error("readable content persisted in database files") |
| + } |
| + } |
| + return nil |
| + }) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + scan() |
| + if _, err := f.app.db.Writer().Exec("PRAGMA wal_checkpoint(TRUNCATE)"); err != nil { |
| + t.Fatal(err) |
| + } |
| + scan() |
| +} |
| + |
| +func TestAgentIdentityStorageFailureIsUnavailable(t *testing.T) { |
| + f, p := linkedAgentFixture(t) |
| + active := true |
| + h := mountAgentFixture(t, f, &p, &active) |
| + f.app.db.Close() |
| + if w := agentCall(h, "notes_create", agentNoteInput); w.Code != 503 { |
| + t.Fatal("storage failure misreported", w.Code) |
| + } |
| +} |
| + |
| +func TestAgentAccessConfigurationFailsClosed(t *testing.T) { |
| + f := newHomeRouterFixture(t) |
| + for _, cfg := range []Config{ |
| + {Origin: homeTestOrigin, AgentTeam: "acme"}, |
| + {Origin: homeTestOrigin, AgentIssuer: "https://connect.example.test"}, |
| + {Origin: homeTestOrigin, AgentTeam: "acme", AgentIssuer: "http://insecure.example.test"}, |
| + } { |
| + if f.app.WireAgentAccess(http.NewServeMux(), cfg) == nil { |
| + t.Fatal("accepted invalid configuration") |
| + } |
| + } |
| + mux := http.NewServeMux() |
| + if err := f.app.WireAgentAccess(mux, Config{}); err != nil { |
| + t.Fatal(err) |
| + } |
| + if w := agentCall(mux, "notes_create", agentNoteInput); w.Code != 404 { |
| + t.Fatal("disabled endpoint mounted", w.Code) |
| + } |
| + f.app.home = nil |
| + if f.app.WireAgentAccess(mux, Config{Origin: homeTestOrigin, AgentTeam: "acme", AgentIssuer: "https://connect.example.test"}) == nil { |
| + t.Fatal("enabled without Home") |
| + } |
| +} |
| + |
| +// Review-selected 2026-10-24: bind every coordinate field and distinguish |
| +// independent clients reusing the same UUID. Deleting any field must go red. |
| +func TestAgentReceiptCoordinateAndSchema(t *testing.T) { |
| + f, p := linkedAgentFixture(t) |
| + active := true |
| + h := mountAgentFixture(t, f, &p, &active) |
| + for _, client := range []string{"first-agent", "second-agent"} { |
| + p.Client = client |
| + w := agentCall(h, "notes_create", agentNoteInput) |
| + if w.Code != 200 { |
| + t.Fatal(w.Code, w.Body.String()) |
| + } |
| + coordinate, _ := json.Marshal([]string{p.Subject, client, "acme", "a8d99147-249b-40df-a8a6-c311d425e03b"}) |
| + expected, err := f.app.store.sealer.Fingerprint("agent.note.coordinate.v1", coordinate) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + var count int |
| + if err = f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM memoria_agent_notes WHERE coordinate=?", expected).Scan(&count); err != nil || count != 1 { |
| + t.Fatal("coordinate binding", count, err) |
| + } |
| + } |
| + var count int |
| + if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM documents").Scan(&count); err != nil || count != 2 { |
| + t.Fatal("independent client receipts collided", count, err) |
| + } |
| + rows, err := f.app.db.Writer().Query("SELECT name FROM pragma_table_info('memoria_agent_notes') ORDER BY cid") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer rows.Close() |
| + var columns []string |
| + for rows.Next() { |
| + var name string |
| + if err = rows.Scan(&name); err != nil { |
| + t.Fatal(err) |
| + } |
| + columns = append(columns, name) |
| + } |
| + if err = rows.Err(); err != nil { |
| + t.Fatal(err) |
| + } |
| + if !slices.Equal(columns, []string{"coordinate", "content", "document_id", "indexed"}) { |
| + t.Fatal("receipt schema retains extra data", columns) |
| + } |
| +} |
| + |
| +func TestAgentRechecksDeletedLocalIdentity(t *testing.T) { |
| + f, p := linkedAgentFixture(t) |
| + active := true |
| + h := mountAgentFixture(t, f, &p, &active) |
| + if w := agentCall(h, "notes_create", agentNoteInput); w.Code != 200 { |
| + t.Fatal(w.Code) |
| + } |
| + if _, err := f.app.db.Writer().Exec("DELETE FROM memoria_home_local_identities"); err != nil { |
| + t.Fatal(err) |
| + } |
| + if w := agentCall(h, "notes_create", strings.Replace(agentNoteInput, "a8d99147", "b8d99147", 1)); w.Code != 403 { |
| + t.Fatal("removed identity authorized", w.Code) |
| + } |
| + var count int |
| + if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM memoria_home_local_identities").Scan(&count); err != nil || count != 0 { |
| + t.Fatal("identity recreated", count, err) |
| + } |
| + if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM documents").Scan(&count); err != nil || count != 1 { |
| + t.Fatal("denial changed documents", count, err) |
| + } |
| +} |
diff --git a/internal/memoria/agent_integration_test.go b/internal/memoria/agent_integration_test.go| new file mode 100644 |
| index 0000000..10f8ab0 |
| --- /dev/null |
| +++ b/internal/memoria/agent_integration_test.go |
| @@ -0,0 +1,151 @@ |
| +package memoria |
| + |
| +import ( |
| + "context" |
| + "crypto/sha256" |
| + "database/sql" |
| + "encoding/base64" |
| + "encoding/json" |
| + "net/http" |
| + "net/http/httptest" |
| + "path/filepath" |
| + "strings" |
| + "testing" |
| + |
| + access "amadan.net/oficina/agent-access.git" |
| + "amadan.net/oficina/agent-access.git/client" |
| + "amadan.net/oficina/agent-access.git/grant" |
| + "github.com/modelcontextprotocol/go-sdk/mcp" |
| + "golang.org/x/oauth2" |
| +) |
| + |
| +type agentCredentials struct{ value client.Credentials } |
| + |
| +func (m *agentCredentials) Load() (client.Credentials, error) { return m.value, nil } |
| +func (m *agentCredentials) Save(v client.Credentials) error { m.value = v; return nil } |
| +func (m *agentCredentials) Delete() error { m.value = client.Credentials{}; return nil } |
| + |
| +type agentBearer struct { |
| + base http.RoundTripper |
| + token string |
| +} |
| + |
| +func (b agentBearer) RoundTrip(r *http.Request) (*http.Response, error) { |
| + copy := r.Clone(r.Context()) |
| + copy.Header.Set("Authorization", "Bearer "+b.token) |
| + return b.base.RoundTrip(copy) |
| +} |
| + |
| +// This fixture crosses real HTTPS boundaries from the shared CLI/MCP gateway |
| +// into Memoria's own operation handlers, linked identity, sealer and index. |
| +// The signed Home/browser/PKCE flow is exercised in the connection module. |
| +func TestAgentGatewayToRealMemoria(t *testing.T) { |
| + f, p := linkedAgentFixture(t) |
| + ctx := t.Context() |
| + var appHandler, httpHandler http.Handler |
| + appServer := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { appHandler.ServeHTTP(w, r) })) |
| + defer appServer.Close() |
| + issuer := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { httpHandler.ServeHTTP(w, r) })) |
| + defer issuer.Close() |
| + database, err := sql.Open("sqlite", filepath.Join(t.TempDir(), "grants.db")) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer database.Close() |
| + database.SetMaxOpenConns(1) |
| + store, err := grant.NewStore(ctx, database) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + teams := func(context.Context, string) ([]grant.Team, error) { |
| + return []grant.Team{{ID: "acme", Name: "Acme"}}, nil |
| + } |
| + grants, err := grant.NewServer(grant.Config{Origin: issuer.URL, Resource: issuer.URL + "/mcp", Store: store, ConsentKey: []byte(strings.Repeat("k", 32)), Clients: []grant.Client{{ID: client.ClientID, Name: "Oficina CLI", Loopback: true}}, Scopes: map[string]string{"notes:read": "Read notes", "notes:write": "Create notes"}, Subject: func(*http.Request) string { return "" }, Teams: teams, ResourceTeams: func(ctx context.Context, subject, resource string) ([]grant.Team, error) { |
| + if resource != appServer.URL+"/api/v1" { |
| + return nil, nil |
| + } |
| + return teams(ctx, subject) |
| + }, SignInPath: "/signin"}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + remote, err := access.NewRemoteVerifier(issuer.URL, appServer.URL+"/api/v1") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + remote.Client.Transport = issuer.Client().Transport |
| + mux := http.NewServeMux() |
| + if err = f.app.mountAgentAccess(mux, "acme", remote); err != nil { |
| + t.Fatal(err) |
| + } |
| + appHandler = mux |
| + contracts, err := AgentContracts() |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + gateway, err := access.Gateway([]access.Route{{Team: "acme", Resource: appServer.URL + "/api/v1", Operations: contracts}}, store, appServer.Client().Transport) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + serviceMux := http.NewServeMux() |
| + serviceMux.Handle("/mcp", gateway.MCP(grants)) |
| + serviceMux.Handle("/api/v1/operations", gateway.HTTP(grants)) |
| + serviceMux.Handle("/api/v1/operations/", gateway.HTTP(grants)) |
| + serviceMux.Handle("/", grants.Handler()) |
| + httpHandler = serviceMux |
| + verifier := oauth2.GenerateVerifier() |
| + challenge := sha256.Sum256([]byte(verifier)) |
| + redirect := "http://127.0.0.1:43210/callback" |
| + code, err := store.CreateCode(ctx, grant.Grant{Subject: p.Subject, ClientID: client.ClientID, Teams: p.Teams, Scopes: p.Scopes}, grant.Code{Redirect: redirect, Challenge: base64.RawURLEncoding.EncodeToString(challenge[:]), Resource: issuer.URL + "/mcp"}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + token, err := store.Exchange(ctx, code, client.ClientID, redirect, issuer.URL+"/mcp", verifier) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + credentials := &agentCredentials{client.Credentials{Server: issuer.URL, Resource: issuer.URL + "/mcp", TokenEndpoint: issuer.URL + "/oauth/token", Token: &oauth2.Token{AccessToken: token.AccessToken, TokenType: "Bearer"}}} |
| + cli := client.New(credentials) |
| + cli.HTTP = issuer.Client() |
| + result, err := cli.Call(ctx, "notes_create", json.RawMessage(agentNoteInput)) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + encoded, _ := json.Marshal(result) |
| + var note agentNoteResult |
| + if json.Unmarshal(encoded, ¬e) != nil || note.ID <= 0 { |
| + t.Fatal("invalid note receipt") |
| + } |
| + mcpClient := mcp.NewClient(&mcp.Implementation{Name: "Memoria integration", Version: "1"}, nil) |
| + session, err := mcpClient.Connect(ctx, &mcp.StreamableClientTransport{Endpoint: issuer.URL + "/mcp", HTTPClient: &http.Client{Transport: agentBearer{issuer.Client().Transport, token.AccessToken}}}, nil) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer session.Close() |
| + retry, err := session.CallTool(ctx, &mcp.CallToolParams{Name: "notes_create", Arguments: json.RawMessage(agentNoteInput)}) |
| + if err != nil || retry.IsError { |
| + t.Fatal("MCP retry", retry, err) |
| + } |
| + search, err := session.CallTool(ctx, &mcp.CallToolParams{Name: "notes_search", Arguments: map[string]any{"team": "acme", "query": "nebula"}}) |
| + if err != nil || search.IsError { |
| + t.Fatal("MCP search", search, err) |
| + } |
| + text, _ := json.Marshal(search.Content) |
| + if !strings.Contains(string(text), agentTitleCanary) { |
| + t.Fatal("MCP could not see created note") |
| + } |
| + var count int |
| + if err = f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM documents").Scan(&count); err != nil || count != 1 { |
| + t.Fatal("transport retry duplicated note", count, err) |
| + } |
| + assertAgentContentSealed(t, f) |
| + if err = cli.Logout(ctx); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err = session.CallTool(ctx, &mcp.CallToolParams{Name: "notes_create", Arguments: json.RawMessage(strings.Replace(agentNoteInput, "a8d99147", "b8d99147", 1))}); err == nil { |
| + t.Fatal("MCP survived CLI revocation") |
| + } |
| + if err = f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM documents").Scan(&count); err != nil || count != 1 { |
| + t.Fatal("revoked call wrote note", count, err) |
| + } |
| +} |
diff --git a/internal/memoria/agent_migrations.go b/internal/memoria/agent_migrations.go| new file mode 100644 |
| index 0000000..da702d6 |
| --- /dev/null |
| +++ b/internal/memoria/agent_migrations.go |
| @@ -0,0 +1,19 @@ |
| +package memoria |
| + |
| +import ( |
| + "embed" |
| + "io/fs" |
| + |
| + "amadan.net/rastrillo/rastrillo/migrate" |
| +) |
| + |
| +//go:embed agent_migrations/migrations/*.sql |
| +var agentMigrationFS embed.FS |
| + |
| +var agentSchema = func() *migrate.Set { |
| + sub, err := fs.Sub(agentMigrationFS, "agent_migrations") |
| + if err != nil { |
| + panic(err) |
| + } |
| + return migrate.MustFromFS(sub, "memoria_agent_access") |
| +}() |
diff --git a/internal/memoria/agent_migrations/migrations/0001_note_receipts.sql b/internal/memoria/agent_migrations/migrations/0001_note_receipts.sql| new file mode 100644 |
| index 0000000..35b7441 |
| --- /dev/null |
| +++ b/internal/memoria/agent_migrations/migrations/0001_note_receipts.sql |
| @@ -0,0 +1,6 @@ |
| +CREATE TABLE memoria_agent_notes ( |
| + coordinate TEXT PRIMARY KEY, |
| + content TEXT NOT NULL, |
| + document_id INTEGER, |
| + indexed INTEGER NOT NULL DEFAULT 0 |
| +); |
diff --git a/internal/memoria/config.go b/internal/memoria/config.go| index b027eca..16239e6 100644 |
| --- a/internal/memoria/config.go |
| +++ b/internal/memoria/config.go |
| @@ -25,6 +25,8 @@ type Config struct { |
| Owners []string |
| Sealer *seal.Sealer |
| Home *connect.DecodedCredentials |
| + AgentIssuer string |
| + AgentTeam string |
| // AllowLoggedMail permits booting with no SMTP, which makes |
| // rastrillo substitute mail.Logged — and mail.Logged writes the |
| // magic link, a live credential, into the process log at Warn. |
| @@ -143,6 +145,10 @@ func LoadConfig(getenv func(string) string) (Config, error) { |
| return c, err |
| } |
| } |
| + c.AgentIssuer, c.AgentTeam = getenv("MEMORIA_AGENT_ISSUER"), getenv("MEMORIA_AGENT_TEAM") |
| + if (c.AgentIssuer != "" || c.AgentTeam != "") && (c.AgentIssuer == "" || c.AgentTeam == "" || c.Home == nil) { |
| + return c, errors.New("memoria: agent access requires MEMORIA_AGENT_ISSUER, MEMORIA_AGENT_TEAM and Home") |
| + } |
| return c, nil |
| } |
diff --git a/internal/memoria/credits/notices.json b/internal/memoria/credits/notices.json| index 683e00f..b237262 100644 |
| --- a/internal/memoria/credits/notices.json |
| +++ b/internal/memoria/credits/notices.json |
| @@ -107,6 +107,17 @@ |
| } |
| ] |
| }, |
| + { |
| + "Name": "github.com/google/jsonschema-go", |
| + "Version": "v0.4.3", |
| + "SourceURL": "https://pkg.go.dev/github.com/google/jsonschema-go@v0.4.3", |
| + "Notices": [ |
| + { |
| + "Name": "LICENSE", |
| + "Text": "MIT License\n\nCopyright (c) 2025 JSON Schema Go Project Authors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" |
| + } |
| + ] |
| + }, |
| { |
| "Name": "github.com/google/uuid", |
| "Version": "v1.6.0", |
| @@ -146,6 +157,17 @@ |
| "SourceURL": "https://pkg.go.dev/github.com/keymaildev/signin@v0.1.1", |
| "Notices": [] |
| }, |
| + { |
| + "Name": "github.com/modelcontextprotocol/go-sdk", |
| + "Version": "v1.7.0", |
| + "SourceURL": "https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk@v1.7.0", |
| + "Notices": [ |
| + { |
| + "Name": "LICENSE", |
| + "Text": "The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 (\"Apache-2.0\"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.\n\nContributions for which relicensing consent has been obtained are licensed under Apache-2.0. Contributions made by authors who originally licensed their work under the MIT License and who have not yet granted explicit permission to relicense remain licensed under the MIT License.\n\nNo rights beyond those granted by the applicable original license are conveyed for such contributions.\n\n---\n\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright\n owner or by an individual or Legal Entity authorized to submit on behalf\n of the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n---\n\nMIT License\n\nCopyright (c) 2024-2025 Model Context Protocol a Series of LF Projects, LLC.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n---\n\nCreative Commons Attribution 4.0 International (CC-BY-4.0)\n\nDocumentation in this project (excluding specifications) is licensed under\nCC-BY-4.0. See https://creativecommons.org/licenses/by/4.0/legalcode for\nthe full license text.\n" |
| + } |
| + ] |
| + }, |
| { |
| "Name": "github.com/remyoudompheng/bigfft", |
| "Version": "v0.0.0-20230129092748-24d4a6f8daec", |
| @@ -157,6 +179,50 @@ |
| } |
| ] |
| }, |
| + { |
| + "Name": "github.com/santhosh-tekuri/jsonschema/v6", |
| + "Version": "v6.0.3", |
| + "SourceURL": "https://pkg.go.dev/github.com/santhosh-tekuri/jsonschema/v6@v6.0.3", |
| + "Notices": [ |
| + { |
| + "Name": "LICENSE", |
| + "Text": "\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability." |
| + } |
| + ] |
| + }, |
| + { |
| + "Name": "github.com/segmentio/asm", |
| + "Version": "v1.1.3", |
| + "SourceURL": "https://pkg.go.dev/github.com/segmentio/asm@v1.1.3", |
| + "Notices": [ |
| + { |
| + "Name": "LICENSE", |
| + "Text": "MIT License\n\nCopyright (c) 2021 Segment\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" |
| + } |
| + ] |
| + }, |
| + { |
| + "Name": "github.com/segmentio/encoding", |
| + "Version": "v0.5.4", |
| + "SourceURL": "https://pkg.go.dev/github.com/segmentio/encoding@v0.5.4", |
| + "Notices": [ |
| + { |
| + "Name": "LICENSE", |
| + "Text": "MIT License\n\nCopyright (c) 2019 Segment.io, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" |
| + } |
| + ] |
| + }, |
| + { |
| + "Name": "github.com/yosida95/uritemplate/v3", |
| + "Version": "v3.0.2", |
| + "SourceURL": "https://pkg.go.dev/github.com/yosida95/uritemplate/v3@v3.0.2", |
| + "Notices": [ |
| + { |
| + "Name": "LICENSE", |
| + "Text": "Copyright (C) 2016, Kohei YOSHIDA \u003chttps://yosida95.com/\u003e. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n * Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" |
| + } |
| + ] |
| + }, |
| { |
| "Name": "golang.org/x/crypto", |
| "Version": "v0.55.0", |
| @@ -168,6 +234,28 @@ |
| } |
| ] |
| }, |
| + { |
| + "Name": "golang.org/x/oauth2", |
| + "Version": "v0.35.0", |
| + "SourceURL": "https://pkg.go.dev/golang.org/x/oauth2@v0.35.0", |
| + "Notices": [ |
| + { |
| + "Name": "LICENSE", |
| + "Text": "Copyright 2009 The Go Authors.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the name of Google LLC nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" |
| + } |
| + ] |
| + }, |
| + { |
| + "Name": "golang.org/x/sync", |
| + "Version": "v0.22.0", |
| + "SourceURL": "https://pkg.go.dev/golang.org/x/sync@v0.22.0", |
| + "Notices": [ |
| + { |
| + "Name": "LICENSE", |
| + "Text": "Copyright 2009 The Go Authors.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the name of Google LLC nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" |
| + } |
| + ] |
| + }, |
| { |
| "Name": "golang.org/x/sys", |
| "Version": "v0.47.0", |
| @@ -190,6 +278,17 @@ |
| } |
| ] |
| }, |
| + { |
| + "Name": "golang.org/x/time", |
| + "Version": "v0.15.0", |
| + "SourceURL": "https://pkg.go.dev/golang.org/x/time@v0.15.0", |
| + "Notices": [ |
| + { |
| + "Name": "LICENSE", |
| + "Text": "Copyright 2009 The Go Authors.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the name of Google LLC nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" |
| + } |
| + ] |
| + }, |
| { |
| "Name": "gorm.io/gorm", |
| "Version": "v1.31.2", |
diff --git a/internal/memoria/credits_inventory_test.go b/internal/memoria/credits_inventory_test.go| index d20022d..3d8a111 100644 |
| --- a/internal/memoria/credits_inventory_test.go |
| +++ b/internal/memoria/credits_inventory_test.go |
| @@ -35,7 +35,7 @@ func TestCreditsMatchProductionDependencies(t *testing.T) { |
| if err != nil { |
| t.Fatal("production dependency graph unavailable", err) |
| } |
| - inventory, err := catalog.Collect(bytes.NewReader(raw), map[string]bool{"amadan.net/oficina/estilo.git": true, "amadan.net/oficina/home/handoff": true, "amadan.net/oficina/home/connect": true, "amadan.net/oficina/suite": true, "amadan.net/rastrillo/native/server": true}) |
| + inventory, err := catalog.Collect(bytes.NewReader(raw), map[string]bool{"amadan.net/oficina/agent-access.git": true, "amadan.net/oficina/estilo.git": true, "amadan.net/oficina/home/handoff": true, "amadan.net/oficina/home/connect": true, "amadan.net/oficina/suite": true, "amadan.net/rastrillo/native/server": true}) |
| if err != nil { |
| t.Fatal(err) |
| } |
diff --git a/internal/memoria/custody_test.go b/internal/memoria/custody_test.go| index 591aad9..37e2181 100644 |
| --- a/internal/memoria/custody_test.go |
| +++ b/internal/memoria/custody_test.go |
| @@ -24,6 +24,7 @@ import ( |
| // asked. It is the seam that lets §4.1's table be exercised end to end |
| // without a live sibling. |
| type fixedCustody struct { |
| + calls int |
| // apps is the configured roster. A source not in it does not resolve. |
| apps map[string]sibling.Sibling |
| give suite.Authorization |
| @@ -38,6 +39,7 @@ func (f *fixedCustody) Sibling(source string) (sibling.Sibling, bool) { |
| } |
| func (f *fixedCustody) Rule(ctx context.Context, asker suite.Subject, cands []sibling.Candidate) []sibling.Disposition { |
| + f.calls++ |
| f.asker = asker |
| out := make([]sibling.Disposition, len(cands)) |
| for i, c := range cands { |
diff --git a/internal/memoria/handlers.go b/internal/memoria/handlers.go| index 0b53fd2..95b4634 100644 |
| --- a/internal/memoria/handlers.go |
| +++ b/internal/memoria/handlers.go |
| @@ -12,6 +12,7 @@ import ( |
| "net/url" |
| "strconv" |
| "strings" |
| + "sync" |
| "time" |
| "amadan.net/oficina/estilo.git/chrome" |
| @@ -84,12 +85,13 @@ func dropLimit() string { return strconv.Itoa(maxDropBytes>>20) + " MiB" } |
| func fileLimit() string { return strconv.Itoa(maxDropFiles) } |
| type app struct { |
| - native *nativeauth.Auth |
| - db *db.DB |
| - logger *slog.Logger |
| - store *Store |
| - auth *auth.Auth |
| - home *homeIntegration |
| + agentNotes sync.Mutex |
| + native *nativeauth.Auth |
| + db *db.DB |
| + logger *slog.Logger |
| + store *Store |
| + auth *auth.Auth |
| + home *homeIntegration |
| // sess reads the session cookie auth mints (the same table, the same |
| // cookie name), for the pages that want to know who is signed in |
| // without requiring anybody: the error pages, the sign-in page's |
diff --git a/internal/memoriatest/routes_test.go b/internal/memoriatest/routes_test.go| index 1501722..935d145 100644 |
| --- a/internal/memoriatest/routes_test.go |
| +++ b/internal/memoriatest/routes_test.go |
| @@ -60,6 +60,10 @@ func TestNoUndeclaredRoutes(t *testing.T) { |
| // http.ServeMux patterns, verbatim — these are mounts, and the method |
| // (where there is one) lives inside the string. |
| declaredMux := map[string]bool{ |
| + // Delegated API: independent bearer verifier and current Home/local |
| + // admission. Spec's Agent access addendum declares both mounts. |
| + "/api/v1/operations": true, |
| + "/api/v1/operations/": true, |
| "GET /static/credits.css": true, |
| "GET /static/": true, |
| "GET /static/estilo/fonts/v1/": true, |