oficina / meet Public

Add delegated meeting operations with atomic retries and current Home authority

codex agent, operated by paul@keymail.dev pushed by paul@keymail.dev c998bba90a415e4524b9e425ee14fadcab00dc1e parent 39eb304
19 files changed, +1,000 −6
  • Makefile +2 −2
  • cmd/calls-contract/main.go +17 −0
  • cmd/calls/main.go +2 −0
  • docs/superpowers/specs/2026-09-07-meet-design.md +55 −0
  • go.mod +11 −1
  • go.sum +24 −0
  • internal/calls/agents.go +3 −0
  • internal/calls/app.go +10 −0
  • internal/calls/config.go +6 −1
  • internal/calls/credits/notices.json +99 −0
  • internal/calls/credits_inventory_test.go +1 −1
  • internal/calls/delegated.go +119 −0
  • internal/calls/delegated_boundaries_test.go +158 −0
  • internal/calls/delegated_create.go +126 −0
  • internal/calls/delegated_migrations/migrations/0001_connections.sql +2 −0
  • internal/calls/delegated_operations.go +42 −0
  • internal/calls/delegated_read.go +100 −0
  • internal/calls/delegated_test.go +222 −0
  • internal/calls/store.go +1 −1

CI failed — run details

diff --git a/Makefile b/Makefile
index 3ebbc25..55347a0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-export GOPRIVATE := $(GOPRIVATE),amadan.net/oficina/estilo.git
+export GOPRIVATE := $(GOPRIVATE),amadan.net/oficina/estilo.git,amadan.net/oficina/agent-access.git
APP := calls
@@ -223,6 +223,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/calls -lucide -onest \
- -exclude amadan.net/oficina/estilo.git,amadan.net/oficina/home/connect,amadan.net/oficina/home/handoff \
+ -exclude amadan.net/oficina/agent-access.git,amadan.net/oficina/estilo.git,amadan.net/oficina/home/connect,amadan.net/oficina/home/handoff \
> "$$notices_tmp/notices.json"; \
mv "$$notices_tmp/notices.json" internal/calls/credits/notices.json
diff --git a/cmd/calls-contract/main.go b/cmd/calls-contract/main.go
new file mode 100644
index 0000000..7075253
--- /dev/null
+++ b/cmd/calls-contract/main.go
@@ -0,0 +1,17 @@
+package main
+
+import (
+ "amadan.net/oficina/calls/internal/calls"
+ "encoding/json"
+ "os"
+)
+
+func main() {
+ ops, err := calls.AgentContracts()
+ if err != nil {
+ os.Exit(1)
+ }
+ if json.NewEncoder(os.Stdout).Encode(ops) != nil {
+ os.Exit(1)
+ }
+}
diff --git a/cmd/calls/main.go b/cmd/calls/main.go
index c3695d0..c0dfaaf 100644
--- a/cmd/calls/main.go
+++ b/cmd/calls/main.go
@@ -74,6 +74,8 @@ func run(logger, reportLogger *slog.Logger) error {
cfg := calls.Config{
Home: connect.CredentialsFromEnv("CALLS"),
+ AgentIssuer: os.Getenv("CALLS_AGENT_ISSUER"),
+ AgentTeam: os.Getenv("CALLS_AGENT_TEAM"),
Env: *env,
Origin: os.Getenv("CALLS_ORIGIN"),
InstanceKey: os.Getenv("CALLS_INSTANCE_KEY"),
diff --git a/docs/superpowers/specs/2026-09-07-meet-design.md b/docs/superpowers/specs/2026-09-07-meet-design.md
index 1ec1e1a..8f15b9e 100644
--- a/docs/superpowers/specs/2026-09-07-meet-design.md
+++ b/docs/superpowers/specs/2026-09-07-meet-design.md
@@ -2978,3 +2978,58 @@ that costs it once the browser and the server are new.
**Not done.** WebKit's slow start (its screen starts at 480×310 where
Chromium's starts at full size, the same before and after) is WebKit's
bandwidth estimate, and is left alone.
+
+## Delegated Oficina connection — implementation draft, 2026-10-24
+
+The suite connection is an additional opt-in machine surface. Set both
+`CALLS_AGENT_ISSUER` and `CALLS_AGENT_TEAM` with Home configured; incomplete
+configuration refuses startup. `/api/v1/operations` and its named operations
+use app-audience credentials verified online by the Oficina connection service.
+They do not accept browser cookies or the existing `mt_` tokens. The existing
+meeting API and native browser authentication retain their current contracts.
+
+Each request resolves the opaque Home subject to an already linked person and
+rechecks member standing, selected team, and operation scope. It provisions no
+person or local agent credential. Membership remains team-wide for meetings,
+as on the existing API. The existing per-agent request budget also applies,
+keyed by a purpose-separated digest of Home subject and client.
+
+`calls_list_meetings` and `calls_get_meeting` require `calls:read`; lists use a
+bounded ID cursor, and neither exposes a guest invitation. `calls_create_meeting`
+requires `calls:write`, an explicit title and nonzero UUID `client_id`, with an
+optional RFC3339 start including its offset. It returns the member room URL and
+`invitations_sent: false`. Calendar events remain Calendar's responsibility.
+
+Creation uses the existing meeting store and defaults. Meeting, sealed invitation,
+creator attribution and retry receipt commit in one transaction. Receipt keys
+bind Home subject, client, team and UUID using a purpose-separated keyed digest;
+the request fingerprint is also keyed. A changed retry conflicts; a deleted
+meeting is never recreated by replay. Retrying an ended meeting returns its
+existing room ID without reopening it. Receipts contain no plaintext content.
+
+`connection:<digest>` is an additional attribution kind: the mapping contains
+an existing operator person ID and a sealed client label, never an access token.
+The meeting UI uses its existing agent badge and displays client~operator.
+It does not mint an `agents` row or reinterpret a Home subject as an address.
+
+`calls_get_join_link` requires the separate `calls:share` scope. It retrieves
+only a live invitation whose token is already sealed; it never mints or replaces
+one and does not revive an ended meeting. Legacy hash-only invitations remain
+available through their existing sharing flow. A join URL conveys invitation
+access, so tool descriptions state that it is for intended recipients. No tool
+joins call media, sends mail, ends a meeting, or replaces an invitation in this
+initial adapter. These remain explicit capability gaps.
+
+`go run ./cmd/calls-contract` exports the same operation contracts consumed by
+the suite API, CLI and MCP gateway. The temporary transport lives in the
+Oficina agent-access module and will converge with Rastrillo; this amendment
+does not claim upstream MCP compatibility or production deployment. Independent
+review and the repository's release checks remain required before merge.
+
+GPT-6 Astra approved the adapter and this amendment after correcting cursor
+integer overflow and moving content opening behind the store. Focused race
+checks pass. Nine effective adverse mutations fail for the intended reason:
+sharing scope, ended/revoked/hash-only invitation predicates, ignored creation
+failure, retry fingerprint, transactional operator check, cursor decoding, and
+bypassed Home linkage after unlink. Full CI and canary review remain release
+gates; this is source approval only.
diff --git a/go.mod b/go.mod
index d260432..1cab735 100644
--- a/go.mod
+++ b/go.mod
@@ -3,11 +3,13 @@ module amadan.net/oficina/calls
go 1.26.0
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
amadan.net/rastrillo/rastrillo v0.27.1-0.20261006204347-fb806a287060
github.com/go-chi/chi/v5 v5.3.2
+ github.com/google/uuid v1.6.0
github.com/keymaildev/signin v0.1.1
golang.org/x/crypto v0.56.0
gorm.io/gorm v1.31.2
@@ -19,15 +21,23 @@ require (
github.com/carlosframework/rastrillo v0.23.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/go-json-experiment/json v0.0.0-20250725192818-e39067aee2d2 // indirect
- github.com/google/uuid v1.6.0 // 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/mattn/go-isatty v0.0.20 // indirect
+ github.com/modelcontextprotocol/go-sdk v1.7.0 // 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
golang.org/x/mod v0.38.0 // indirect
+ golang.org/x/oauth2 v0.35.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 ed9096b..f2e428c 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=
@@ -18,6 +20,8 @@ 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/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=
@@ -32,6 +36,12 @@ 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/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=
@@ -48,16 +58,28 @@ 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/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/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=
golang.org/x/crypto v0.56.0 h1:GUh5Ii4J5jtcseSMiRqr1jXCNHoxjeV9Fmekc2oLy6Y=
golang.org/x/crypto v0.56.0/go.mod h1:OMW5y6CY9l38uPLmxU6l6pwcXp1obtLo3e6gT7gQR2I=
golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk=
golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40=
+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=
@@ -65,6 +87,8 @@ 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=
gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo=
diff --git a/internal/calls/agents.go b/internal/calls/agents.go
index 7513e9f..e9b814c 100644
--- a/internal/calls/agents.go
+++ b/internal/calls/agents.go
@@ -213,6 +213,9 @@ func (s *store) withOperator(ctx context.Context, ag Agent, err error) (Agent, P
// the raw actor string rather than failing the whole list, logged the
// way store.title logs an unreadable title.
func (s *store) creatorLabel(ctx context.Context, actor string) string {
+ if strings.HasPrefix(actor, "connection:") {
+ return s.delegatedCreator(ctx, strings.TrimPrefix(actor, "connection:"))
+ }
kind, rest, found := strings.Cut(actor, ":")
if !found {
return actor
diff --git a/internal/calls/app.go b/internal/calls/app.go
index 76ac871..c77adc9 100644
--- a/internal/calls/app.go
+++ b/internal/calls/app.go
@@ -38,6 +38,7 @@ type app struct {
logger *slog.Logger
auth *rauth.Auth
home *homeIntegration
+ delegated http.Handler
nativeAuth *nativeAuthorization
linkBudget *budget
outsiderBudget *budget
@@ -461,6 +462,11 @@ func build(ctx context.Context, d *db.DB, cfg Config) (*http.ServeMux, *app, err
return nil, nil, err
}
+ if err := a.wireDelegated(); err != nil {
+ a.signinMail.close()
+ return nil, nil, err
+ }
+
if err := a.wireNativeAuth(); err != nil {
a.signinMail.close()
return nil, nil, err
@@ -489,6 +495,10 @@ func build(ctx context.Context, d *db.DB, cfg Config) (*http.ServeMux, *app, err
// page. apiRoutes says why that is safe — this surface honours no
// cookie, so there is no ambient credential for CSRF to protect.
r.Group(a.apiRoutes)
+ if a.delegated != nil {
+ r.Handle("/api/v1/operations", a.delegated)
+ r.Handle("/api/v1/operations/*", a.delegated)
+ }
r.Post("/native/request", a.nativeRequest)
r.Post("/native/exchange", a.nativeExchange)
diff --git a/internal/calls/config.go b/internal/calls/config.go
index 6f93536..db5eb34 100644
--- a/internal/calls/config.go
+++ b/internal/calls/config.go
@@ -24,7 +24,9 @@ const EnvDevelopment = "development"
// secret or a boundary is a startup refusal when it is missing outside
// development, per spec §7.1.
type Config struct {
- Home *connect.Credentials
+ Home *connect.Credentials
+ AgentIssuer string
+ AgentTeam string
// Env is "development" or anything else (treated as production).
Env string
// Origin is the app's external origin, scheme included
@@ -109,6 +111,9 @@ type resolved struct {
}
func resolve(cfg Config) (resolved, error) {
+ if err := validateDelegatedConfig(cfg); err != nil {
+ return resolved{}, err
+ }
if cfg.Logger == nil {
cfg.Logger = slog.Default()
}
diff --git a/internal/calls/credits/notices.json b/internal/calls/credits/notices.json
index 9eb07c9..6ea672c 100644
--- a/internal/calls/credits/notices.json
+++ b/internal/calls/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.56.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/calls/credits_inventory_test.go b/internal/calls/credits_inventory_test.go
index ec91635..4d21daa 100644
--- a/internal/calls/credits_inventory_test.go
+++ b/internal/calls/credits_inventory_test.go
@@ -60,7 +60,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})
+ 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})
if err != nil {
t.Fatal(err)
}
diff --git a/internal/calls/delegated.go b/internal/calls/delegated.go
new file mode 100644
index 0000000..944e719
--- /dev/null
+++ b/internal/calls/delegated.go
@@ -0,0 +1,119 @@
+package calls
+
+import (
+ "context"
+ "embed"
+ "encoding/json"
+ "errors"
+ "io/fs"
+
+ access "amadan.net/oficina/agent-access.git"
+ "amadan.net/oficina/home/connect/linkstore"
+ "amadan.net/rastrillo/rastrillo/migrate"
+)
+
+//go:embed delegated_migrations/migrations/*.sql
+var delegatedFiles embed.FS
+var delegatedSchema = func() *migrate.Set {
+ sub, _ := fs.Sub(delegatedFiles, "delegated_migrations")
+ return migrate.MustFromFS(sub, "calls_agent_access")
+}()
+
+func validateDelegatedConfig(cfg Config) error {
+ if cfg.AgentIssuer == "" && cfg.AgentTeam == "" {
+ return nil
+ }
+ if cfg.Home == nil || cfg.AgentIssuer == "" || cfg.AgentTeam == "" || len(cfg.AgentTeam) > 64 {
+ return errors.New("calls: incomplete agent configuration")
+ }
+ _, err := access.NewRemoteVerifier(cfg.AgentIssuer, cfg.Origin+"/api/v1")
+ return err
+}
+func (a *app) wireDelegated() error {
+ if a.cfg.AgentIssuer == "" {
+ return nil
+ }
+ v, err := access.NewRemoteVerifier(a.cfg.AgentIssuer, a.cfg.Origin+"/api/v1")
+ if err != nil {
+ return err
+ }
+ return a.mountDelegated(v, a.cfg.AgentTeam)
+}
+func (a *app) mountDelegated(v access.Verifier, team string) error {
+ if _, err := migrate.Apply(context.Background(), a.db, delegatedSchema); err != nil {
+ return err
+ }
+ reg, err := access.NewRegistry(a.delegatedOperations(team)...)
+ if err != nil {
+ return err
+ }
+ a.delegated = reg.HTTP(access.VerifyFunc(func(ctx context.Context, token string) (access.Principal, error) {
+ p, err := v.Verify(ctx, token)
+ if err != nil {
+ return access.Principal{}, err
+ }
+ if _, err = a.delegatedPerson(ctx, p, team); err != nil {
+ return access.Principal{}, err
+ }
+ coordinate, _ := json.Marshal([]string{p.Subject, p.Client})
+ key, err := a.sealer.Fingerprint("connection.rate.v1", string(coordinate))
+ if err != nil {
+ return access.Principal{}, err
+ }
+ if ok, _ := a.apiLimiter.allow("connection:"+key, a.store.now()); !ok {
+ return access.Principal{}, access.Fail("rate_limited", "Calls request limit reached. Try again later.")
+ }
+ return p, nil
+ }))
+ return nil
+}
+func (a *app) delegatedPerson(ctx context.Context, p access.Principal, team string) (Person, error) {
+ allowed := false
+ for _, t := range p.Teams {
+ allowed = allowed || t == team
+ }
+ if !allowed || p.Subject == "" || p.Client == "" || len(p.Client) > 256 || p.Grant == "" || a.home == nil {
+ return Person{}, access.Fail("forbidden", "This connection cannot access Calls.")
+ }
+ linked, err := a.home.bridge.Resolve(ctx, p.Subject)
+ if errors.Is(err, linkstore.ErrStorage) {
+ return Person{}, access.Fail("unavailable", "Account verification is unavailable.")
+ }
+ if err != nil {
+ return Person{}, access.Fail("forbidden", "Link an admitted Calls account to Home first.")
+ }
+ person, ok, err := a.store.personByID(ctx, linked.ID)
+ if err != nil {
+ return Person{}, access.Fail("unavailable", "Account verification is unavailable.")
+ }
+ if !ok || person.Email != linked.Label || !a.isMember(person) {
+ return Person{}, access.Fail("forbidden", "This account cannot access Calls.")
+ }
+ return person, nil
+}
+func delegatedFailure(err error) error {
+ if err == nil {
+ return nil
+ }
+ var f access.Failure
+ if errors.As(err, &f) {
+ return f
+ }
+ return access.Fail("unavailable", "Calls is unavailable. Try again.")
+}
+func (a *app) delegatedGuard(team, scope string, fn func(context.Context, access.Principal, Person, json.RawMessage) (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 that team.")
+ }
+ person, err := a.delegatedPerson(ctx, p, team)
+ if err != nil {
+ return nil, err
+ }
+ out, err := fn(ctx, p, person, raw)
+ return out, delegatedFailure(err)
+ }
+}
diff --git a/internal/calls/delegated_boundaries_test.go b/internal/calls/delegated_boundaries_test.go
new file mode 100644
index 0000000..7637177
--- /dev/null
+++ b/internal/calls/delegated_boundaries_test.go
@@ -0,0 +1,158 @@
+package calls
+
+import (
+ "encoding/json"
+ "net/http/httptest"
+ "strings"
+ "testing"
+)
+
+func TestDelegatedPaginationAndClientIsolation(t *testing.T) {
+ f, p := linkedDelegated(t)
+ input := delegatedInputForTest()
+ for _, client := range []string{"one", "two", "three"} {
+ p.Client = client
+ if w := delegatedCall(f.app, "calls_create_meeting", input); w.Code != 200 {
+ t.Fatal(w.Code, w.Body.String())
+ }
+ }
+ var after int64
+ seen := map[string]bool{}
+ for i := 0; i < 3; i++ {
+ w := delegatedCall(f.app, "calls_list_meetings", map[string]any{"team": "acme", "limit": 1, "after": after})
+ if w.Code != 200 {
+ t.Fatal(w.Code, w.Body.String())
+ }
+ var out struct {
+ Meetings []struct {
+ Sqid string `json:"sqid"`
+ } `json:"meetings"`
+ Next int64 `json:"next_after"`
+ More bool `json:"has_more"`
+ }
+ if json.Unmarshal(w.Body.Bytes(), &out) != nil || len(out.Meetings) != 1 || out.More != (i < 2) || out.Next <= after || seen[out.Meetings[0].Sqid] {
+ t.Fatal("bad pagination", w.Body.String())
+ }
+ seen[out.Meetings[0].Sqid] = true
+ after = out.Next
+ }
+ if w := delegatedCall(f.app, "calls_get_meeting", map[string]any{"team": "acme", "sqid": "23456789ab"}); w.Code != 404 {
+ t.Fatal("missing meeting", w.Code)
+ }
+ for id := range seen {
+ w := delegatedCall(f.app, "calls_get_meeting", map[string]any{"team": "acme", "sqid": id})
+ if w.Code != 200 || !strings.Contains(w.Body.String(), input["title"].(string)) {
+ t.Fatal("read missing content", w.Code, w.Body.String())
+ }
+ }
+}
+func TestDelegatedRateAndStorageFailure(t *testing.T) {
+ f, _ := linkedDelegated(t)
+ rate := false
+ for i := 0; i < 65; i++ {
+ w := delegatedCall(f.app, "calls_list_meetings", map[string]any{"team": "acme"})
+ if w.Code == 429 {
+ rate = true
+ break
+ }
+ if w.Code != 200 {
+ t.Fatal(w.Code)
+ }
+ }
+ if !rate {
+ t.Fatal("no rate limit")
+ }
+ if err := f.app.db.Close(); err != nil {
+ t.Fatal(err)
+ }
+ if w := delegatedCall(f.app, "calls_list_meetings", map[string]any{"team": "acme"}); w.Code != 503 {
+ t.Fatal("storage failure misreported", w.Code)
+ }
+}
+func TestDelegatedProductionRoutesStayOutsideBrowserAndLegacyAuth(t *testing.T) {
+ f := newHomeRouterFixture(t)
+ cfg := f.app.cfg.Config
+ cfg.AgentIssuer = "https://connect.example.test"
+ cfg.AgentTeam = "acme"
+ mux, _, err := buildForTest(t, f.app.db, cfg)
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, method := range []string{"GET", "POST"} {
+ path := "/api/v1/operations"
+ if method == "POST" {
+ path += "/calls_create_meeting"
+ }
+ r := httptest.NewRequest(method, homeTestOrigin+path, strings.NewReader(`{}`))
+ w := httptest.NewRecorder()
+ mux.ServeHTTP(w, r)
+ if w.Code != 401 || !strings.Contains(w.Body.String(), `"code":"unauthenticated"`) {
+ t.Fatal("delegated route intercepted", w.Code, w.Body.String())
+ }
+ }
+ r := httptest.NewRequest("GET", homeTestOrigin+"/api/v1/meetings", nil)
+ w := httptest.NewRecorder()
+ mux.ServeHTTP(w, r)
+ if w.Code != 401 || !strings.Contains(w.Body.String(), `"error":"unauthorized"`) {
+ t.Fatal("legacy route changed", w.Code, w.Body.String())
+ }
+ cfg.AgentTeam = ""
+ if _, err := resolve(cfg); err == nil {
+ t.Fatal("partial config accepted")
+ }
+}
+
+func TestDelegatedCursorRejectsIntegerOverflow(t *testing.T) {
+ f, _ := linkedDelegated(t)
+ w := delegatedCall(f.app, "calls_list_meetings", map[string]any{"team": "acme", "after": json.Number("9223372036854775808")})
+ if w.Code != 422 {
+ t.Fatal("overflow silently reset cursor", w.Code, w.Body.String())
+ }
+}
+func TestDelegatedCreationRechecksOperatorInTransaction(t *testing.T) {
+ f, _ := linkedDelegated(t)
+ if _, err := f.app.db.Writer().Exec("CREATE TRIGGER change_operator BEFORE INSERT ON calls_agent_meetings BEGIN UPDATE persons SET anonymous=1; END"); err != nil {
+ t.Fatal(err)
+ }
+ if w := delegatedCall(f.app, "calls_create_meeting", delegatedInputForTest()); w.Code != 403 {
+ t.Fatal("stale operator admitted", w.Code, w.Body.String())
+ }
+ for _, table := range []string{"meetings", "calls_agent_meetings", "calls_connections"} {
+ var n int
+ if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM " + table).Scan(&n); err != nil || n != 0 {
+ t.Fatal("partial effect", table, n, err)
+ }
+ }
+ var anon bool
+ if err := f.app.db.Writer().QueryRow("SELECT anonymous FROM persons").Scan(&anon); err != nil || anon {
+ t.Fatal("transaction not rolled back", err)
+ }
+}
+func TestDelegatedJoinLinkRechecksCurrentInvitation(t *testing.T) {
+ f, _ := linkedDelegated(t)
+ w := delegatedCall(f.app, "calls_create_meeting", delegatedInputForTest())
+ if w.Code != 200 {
+ t.Fatal(w.Code)
+ }
+ var m struct {
+ Sqid string `json:"sqid"`
+ }
+ _ = json.Unmarshal(w.Body.Bytes(), &m)
+ input := map[string]any{"team": "acme", "sqid": m.Sqid}
+ if _, err := f.app.db.Writer().Exec("UPDATE meeting_links SET revoked_at=CURRENT_TIMESTAMP"); err != nil {
+ t.Fatal(err)
+ }
+ if w := delegatedCall(f.app, "calls_get_join_link", input); w.Code != 404 {
+ t.Fatal("revoked invitation disclosed", w.Code, w.Body.String())
+ }
+ if _, err := f.app.db.Writer().Exec("UPDATE meeting_links SET revoked_at=NULL,token_sealed=NULL"); err != nil {
+ t.Fatal(err)
+ }
+ if w := delegatedCall(f.app, "calls_get_join_link", input); w.Code != 404 {
+ t.Fatal("hash-only invitation fabricated", w.Code, w.Body.String())
+ }
+ var count int
+ if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM meeting_links").Scan(&count); err != nil || count != 1 {
+ t.Fatal("read created invitation", count, err)
+ }
+}
diff --git a/internal/calls/delegated_create.go b/internal/calls/delegated_create.go
new file mode 100644
index 0000000..397b936
--- /dev/null
+++ b/internal/calls/delegated_create.go
@@ -0,0 +1,126 @@
+package calls
+
+import (
+ "context"
+ "database/sql"
+ "encoding/json"
+ "strconv"
+ "strings"
+ "time"
+
+ access "amadan.net/oficina/agent-access.git"
+ "github.com/google/uuid"
+ "gorm.io/gorm"
+)
+
+type delegatedCreateInput struct {
+ Team string `json:"team"`
+ ClientID string `json:"client_id"`
+ Title string `json:"title"`
+ StartsAt string `json:"starts_at"`
+}
+
+func (a *app) delegatedCreate(ctx context.Context, p access.Principal, person Person, raw json.RawMessage) (any, error) {
+ var in delegatedCreateInput
+ if json.Unmarshal(raw, &in) != nil {
+ return nil, access.Fail("invalid", "Invalid meeting input.")
+ }
+ id, err := uuid.Parse(in.ClientID)
+ if err != nil || id == uuid.Nil || len(in.ClientID) != 36 {
+ return nil, access.Fail("invalid", "Supply a nonzero UUID client_id.")
+ }
+ if strings.TrimSpace(in.Title) == "" || titleTooLong(in.Title) {
+ return nil, access.Fail("invalid", "Supply a meeting title within the length limit.")
+ }
+ var starts *time.Time
+ if in.StartsAt != "" {
+ v, err := time.Parse(time.RFC3339, in.StartsAt)
+ if err != nil {
+ return nil, access.Fail("invalid", "Supply starts_at as RFC3339 with an explicit offset.")
+ }
+ v = v.UTC()
+ starts = &v
+ }
+ in.ClientID = id.String()
+ coordinates, _ := json.Marshal([]string{p.Subject, p.Client, in.Team, in.ClientID})
+ payload, _ := json.Marshal(in)
+ key, err := a.sealer.Fingerprint("connection.receipt.v1", string(coordinates))
+ if err != nil {
+ return nil, err
+ }
+ content, err := a.sealer.Fingerprint("connection.content.v1", string(payload))
+ if err != nil {
+ return nil, err
+ }
+ var meeting Meeting
+ err = a.store.g.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
+ if err := tx.Exec("INSERT INTO calls_agent_meetings(coordinate,content) VALUES(?,?) ON CONFLICT(coordinate) DO NOTHING", key, content).Error; err != nil {
+ return err
+ }
+ current := *a.store
+ current.g = tx
+ operator, ok, err := current.personByID(ctx, person.ID)
+ if err != nil {
+ return err
+ }
+ if !ok || operator.Email != person.Email || !a.isMember(operator) {
+ return access.Fail("forbidden", "This account cannot access Calls.")
+ }
+ var saved string
+ var mid sql.NullInt64
+ if err = tx.Raw("SELECT content,meeting_id FROM calls_agent_meetings WHERE coordinate=?", key).Row().Scan(&saved, &mid); err != nil {
+ return err
+ }
+ if saved != content {
+ return access.Fail("conflict", "This client_id was already used with different meeting fields.")
+ }
+ if mid.Valid {
+ if err = tx.Where("id=?", mid.Int64).Take(&meeting).Error; err == gorm.ErrRecordNotFound {
+ return access.Fail("not_found", "This meeting is unavailable.")
+ }
+ return err
+ }
+ actor, err := current.delegatedActor(ctx, p, in.Team, operator)
+ if err != nil {
+ return err
+ }
+ meeting, _, err = current.createMeeting(ctx, strings.TrimSpace(in.Title), starts, actor)
+ if err != nil {
+ return err
+ }
+ return tx.Exec("UPDATE calls_agent_meetings SET meeting_id=? WHERE coordinate=?", meeting.ID, key).Error
+ })
+ if err != nil {
+ return nil, err
+ }
+ return map[string]any{"sqid": meeting.Sqid, "url": a.cfg.Origin + "/m/" + meeting.Sqid, "invitations_sent": false}, nil
+}
+func (s *store) delegatedActor(ctx context.Context, p access.Principal, team string, operator Person) (string, error) {
+ raw, _ := json.Marshal([]string{p.Subject, p.Client, team, strconv.FormatInt(operator.ID, 10)})
+ key, err := s.sealer.Fingerprint("connection.actor.v1", string(raw))
+ if err != nil {
+ return "", err
+ }
+ label, err := s.sealer.SealString("connection.client.v1", p.Client)
+ if err != nil {
+ return "", err
+ }
+ err = s.g.WithContext(ctx).Exec("INSERT INTO calls_connections(coordinate,operator_person_id,client_sealed) VALUES(?,?,?) ON CONFLICT(coordinate) DO NOTHING", key, operator.ID, label).Error
+ return "connection:" + key, err
+}
+func (s *store) delegatedCreator(ctx context.Context, key string) string {
+ var operatorID int64
+ var sealed []byte
+ if err := s.g.WithContext(ctx).Raw("SELECT operator_person_id,client_sealed FROM calls_connections WHERE coordinate=?", key).Row().Scan(&operatorID, &sealed); err != nil {
+ return "Oficina agent"
+ }
+ label, err := s.sealer.OpenString("connection.client.v1", sealed)
+ if err != nil {
+ return "Oficina agent"
+ }
+ operator, ok, err := s.personByID(ctx, operatorID)
+ if err != nil || !ok {
+ return "Oficina agent"
+ }
+ return label + "~" + operator.Email
+}
diff --git a/internal/calls/delegated_migrations/migrations/0001_connections.sql b/internal/calls/delegated_migrations/migrations/0001_connections.sql
new file mode 100644
index 0000000..929f044
--- /dev/null
+++ b/internal/calls/delegated_migrations/migrations/0001_connections.sql
@@ -0,0 +1,2 @@
+CREATE TABLE calls_connections (coordinate TEXT PRIMARY KEY, operator_person_id INTEGER NOT NULL, client_sealed BLOB NOT NULL);
+CREATE TABLE calls_agent_meetings (coordinate TEXT PRIMARY KEY, content TEXT NOT NULL, meeting_id INTEGER);
diff --git a/internal/calls/delegated_operations.go b/internal/calls/delegated_operations.go
new file mode 100644
index 0000000..48b579c
--- /dev/null
+++ b/internal/calls/delegated_operations.go
@@ -0,0 +1,42 @@
+package calls
+
+import (
+ access "amadan.net/oficina/agent-access.git"
+ "encoding/json"
+)
+
+func delegatedObject(props map[string]any, required ...string) json.RawMessage {
+ b, _ := json.Marshal(map[string]any{"type": "object", "properties": props, "required": required, "additionalProperties": false})
+ return b
+}
+func delegatedString(max int) map[string]any {
+ return map[string]any{"type": "string", "maxLength": max}
+}
+func delegatedInput(props map[string]any, required ...string) json.RawMessage {
+ props["team"] = map[string]any{"type": "string", "minLength": 1, "maxLength": 64}
+ return delegatedObject(props, append([]string{"team"}, required...)...)
+}
+
+var delegatedMeetingSchema = delegatedObject(map[string]any{"sqid": delegatedString(10), "title": delegatedString(200), "starts_at": map[string]any{"type": []string{"string", "null"}}, "ended_at": map[string]any{"type": []string{"string", "null"}}, "created_by": delegatedString(1024), "url": delegatedString(2048)}, "sqid", "title", "starts_at", "ended_at", "created_by", "url")
+
+func (a *app) delegatedOperations(team string) []access.Operation {
+ return []access.Operation{
+ {Name: "calls_list_meetings", Description: "List this team's meetings visible to a current member. Page with after/next_after; has_more says whether more remain. No invitation tokens or call media are returned.", Scope: "calls:read", ReadOnly: true, Idempotent: true, Input: delegatedInput(map[string]any{"after": map[string]any{"type": "integer", "minimum": 0, "maximum": int64(9223372036854775807)}, "limit": map[string]any{"type": "integer", "minimum": 1, "maximum": 100}}), Output: delegatedObject(map[string]any{"meetings": map[string]any{"type": "array", "items": delegatedMeetingSchema}, "next_after": map[string]any{"type": "integer", "minimum": 0}, "has_more": map[string]any{"type": "boolean"}}, "meetings", "next_after", "has_more"), Invoke: a.delegatedGuard(team, "calls:read", a.delegatedList)},
+ {Name: "calls_get_meeting", Description: "Read a meeting and its member room URL. Does not disclose a guest invitation or grant access to call media.", Scope: "calls:read", ReadOnly: true, Idempotent: true, Input: delegatedInput(map[string]any{"sqid": delegatedString(10)}, "sqid"), Output: delegatedMeetingSchema, Invoke: a.delegatedGuard(team, "calls:read", a.delegatedGet)},
+ {Name: "calls_create_meeting", Description: "Create a meeting, optionally with an RFC3339 starts_at including an explicit offset. Reuse a nonzero UUID client_id only for retries with identical fields. Returns the member room URL; creates no Calendar event and sends no invitations.", Scope: "calls:write", Idempotent: true, Input: delegatedInput(map[string]any{"client_id": map[string]any{"type": "string", "minLength": 36, "maxLength": 36}, "title": delegatedString(200), "starts_at": delegatedString(35)}, "client_id", "title"), Output: delegatedObject(map[string]any{"sqid": delegatedString(10), "url": delegatedString(2048), "invitations_sent": map[string]any{"const": false}}, "sqid", "url", "invitations_sent"), Invoke: a.delegatedGuard(team, "calls:write", a.delegatedCreate)},
+ {Name: "calls_get_join_link", Description: "Retrieve an existing live guest invitation URL. This URL grants invitation access: share only with intended recipients. Requires calls:share. Never creates, replaces or sends a link; unavailable for ended meetings or old invitations without a recoverable token.", Scope: "calls:share", ReadOnly: true, Idempotent: true, Input: delegatedInput(map[string]any{"sqid": delegatedString(10)}, "sqid"), Output: delegatedObject(map[string]any{"sqid": delegatedString(10), "join_url": delegatedString(2048)}, "sqid", "join_url"), Invoke: a.delegatedGuard(team, "calls:share", a.delegatedJoinLink)},
+ }
+}
+func AgentContracts() ([]access.Operation, error) {
+ a := &app{}
+ ops := a.delegatedOperations("contract")
+ scopes := []string{}
+ for _, o := range ops {
+ scopes = append(scopes, o.Scope)
+ }
+ r, err := access.NewRegistry(ops...)
+ if err != nil {
+ return nil, err
+ }
+ return r.List(access.Principal{Subject: "contract", Teams: []string{"contract"}, Scopes: scopes}), nil
+}
diff --git a/internal/calls/delegated_read.go b/internal/calls/delegated_read.go
new file mode 100644
index 0000000..14f8d13
--- /dev/null
+++ b/internal/calls/delegated_read.go
@@ -0,0 +1,100 @@
+package calls
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+
+ access "amadan.net/oficina/agent-access.git"
+ "amadan.net/oficina/calls/internal/calls/seal"
+ "gorm.io/gorm"
+)
+
+func (a *app) delegatedList(ctx context.Context, _ access.Principal, _ Person, raw json.RawMessage) (any, error) {
+ var in struct {
+ After int64 `json:"after"`
+ Limit int `json:"limit"`
+ }
+ if json.Unmarshal(raw, &in) != nil {
+ return nil, access.Fail("invalid", "Invalid pagination fields.")
+ }
+ if in.Limit == 0 {
+ in.Limit = 50
+ }
+ var meetings []Meeting
+ if err := a.store.g.WithContext(ctx).Where("id>?", in.After).Order("id ASC").Limit(in.Limit + 1).Find(&meetings).Error; err != nil {
+ return nil, err
+ }
+ more := len(meetings) > in.Limit
+ if more {
+ meetings = meetings[:in.Limit]
+ }
+ out := []any{}
+ var next int64
+ for _, m := range meetings {
+ body, err := a.delegatedMeeting(ctx, m)
+ if err != nil {
+ return nil, err
+ }
+ out = append(out, body)
+ next = m.ID
+ }
+ return map[string]any{"meetings": out, "next_after": next, "has_more": more}, nil
+}
+func (a *app) delegatedMeeting(ctx context.Context, m Meeting) (any, error) {
+ title, err := a.store.delegatedTitle(m)
+ if err != nil {
+ return nil, err
+ }
+ return map[string]any{"sqid": m.Sqid, "title": title, "starts_at": apiTime(m.StartsAt), "ended_at": apiTime(m.EndedAt), "created_by": a.store.creatorLabel(ctx, m.CreatedBy), "url": a.cfg.Origin + "/m/" + m.Sqid}, nil
+}
+func (a *app) delegatedLookup(ctx context.Context, raw json.RawMessage) (Meeting, error) {
+ var in struct {
+ Sqid string `json:"sqid"`
+ }
+ _ = json.Unmarshal(raw, &in)
+ if !validSqid(in.Sqid) {
+ return Meeting{}, access.Fail("not_found", "This meeting is unavailable.")
+ }
+ m, ok, err := a.store.meetingBySqid(ctx, in.Sqid)
+ if err != nil {
+ return m, err
+ }
+ if !ok {
+ return m, access.Fail("not_found", "This meeting is unavailable.")
+ }
+ return m, nil
+}
+func (a *app) delegatedGet(ctx context.Context, _ access.Principal, _ Person, raw json.RawMessage) (any, error) {
+ m, err := a.delegatedLookup(ctx, raw)
+ if err != nil {
+ return nil, err
+ }
+ return a.delegatedMeeting(ctx, m)
+}
+func (a *app) delegatedJoinLink(ctx context.Context, _ access.Principal, _ Person, raw json.RawMessage) (any, error) {
+ m, err := a.delegatedLookup(ctx, raw)
+ if err != nil {
+ return nil, err
+ }
+ // One query rechecks the meeting and link together. Reading never mints or
+ // replaces a legacy hash-only invitation. An ended meeting has no live link.
+ var link MeetingLink
+ err = a.store.g.WithContext(ctx).Table("meeting_links").Select("meeting_links.*").Joins("JOIN meetings ON meetings.id=meeting_links.meeting_id").Where("meetings.id=? AND meetings.ended_at IS NULL AND meeting_links.revoked_at IS NULL AND length(meeting_links.token_sealed)>0", m.ID).Order("meeting_links.id DESC").Take(&link).Error
+ if errors.Is(err, gorm.ErrRecordNotFound) {
+ return nil, access.Fail("not_found", "No current shareable invitation is available.")
+ }
+ if err != nil {
+ return nil, err
+ }
+ token, err := a.sealer.OpenString(seal.PurposeMeetingLink, link.TokenSealed)
+ if err != nil {
+ return nil, err
+ }
+ return map[string]any{"sqid": m.Sqid, "join_url": a.linkURL(token)}, nil
+}
+
+// delegatedTitle keeps content opening in the store and refuses corrupt ciphertext.
+func (s *store) delegatedTitle(m Meeting) (string, error) {
+ return s.sealer.OpenString(seal.PurposeMeetingTitle, m.TitleSealed)
+}
diff --git a/internal/calls/delegated_test.go b/internal/calls/delegated_test.go
new file mode 100644
index 0000000..07a83f9
--- /dev/null
+++ b/internal/calls/delegated_test.go
@@ -0,0 +1,222 @@
+package calls
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "strings"
+ "sync"
+ "testing"
+
+ access "amadan.net/oficina/agent-access.git"
+)
+
+func linkedDelegated(t *testing.T) (*homeRouterFixture, *access.Principal) {
+ t.Helper()
+ f := newHomeRouterFixture(t)
+ f.link(t)
+ p := &access.Principal{Subject: "opaque-home-alice", Client: "integration-agent-251a75", Grant: "grant-one", Teams: []string{"acme"}, Scopes: []string{"calls:read", "calls:write", "calls:share"}}
+ if err := f.app.mountDelegated(access.VerifyFunc(func(context.Context, string) (access.Principal, error) { return *p, nil }), "acme"); err != nil {
+ t.Fatal(err)
+ }
+ return f, p
+}
+func delegatedCall(a *app, name string, input any) *httptest.ResponseRecorder {
+ raw, _ := json.Marshal(input)
+ r := httptest.NewRequest("POST", homeTestOrigin+"/api/v1/operations/"+name, bytes.NewReader(raw))
+ r.Header.Set("Authorization", "Bearer fixture")
+ r.Header.Set("Content-Type", "application/json")
+ w := httptest.NewRecorder()
+ a.delegated.ServeHTTP(w, r)
+ return w
+}
+func delegatedInputForTest() map[string]any {
+ return map[string]any{"team": "acme", "client_id": "3395dd82-455b-46ae-a758-a7fb1484f3e6", "title": "delegated_title_5405cbdca192", "starts_at": "2026-11-01T10:00:00+00:00"}
+}
+func TestDelegatedMeetingAtomicRetryAndSealing(t *testing.T) {
+ f, p := linkedDelegated(t)
+ input := delegatedInputForTest()
+ w := delegatedCall(f.app, "calls_create_meeting", input)
+ if w.Code != 200 {
+ t.Fatal(w.Code, w.Body.String())
+ }
+ var result struct {
+ Sqid string `json:"sqid"`
+ }
+ if json.Unmarshal(w.Body.Bytes(), &result) != nil || !validSqid(result.Sqid) {
+ t.Fatal(w.Body.String())
+ }
+ var wg sync.WaitGroup
+ for i := 0; i < 5; i++ {
+ wg.Add(1)
+ go func() {
+ defer wg.Done()
+ r := delegatedCall(f.app, "calls_create_meeting", input)
+ if r.Code != 200 || r.Body.String() != w.Body.String() {
+ t.Errorf("retry: %d %s", r.Code, r.Body.String())
+ }
+ }()
+ }
+ wg.Wait()
+ for _, table := range []string{"meetings", "meeting_links", "calls_agent_meetings", "calls_connections"} {
+ var n int
+ if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM " + table).Scan(&n); err != nil || n != 1 {
+ t.Fatal(table, n, err)
+ }
+ }
+ input["title"] = "changed"
+ if r := delegatedCall(f.app, "calls_create_meeting", input); r.Code != 409 {
+ t.Fatal("changed retry", r.Code)
+ }
+ input["title"] = "delegated_title_5405cbdca192"
+ m, ok, err := f.app.store.meetingBySqid(t.Context(), result.Sqid)
+ if err != nil || !ok {
+ t.Fatal(err)
+ }
+ view, err := f.app.store.meetingViewOf(t.Context(), m)
+ if err != nil || !view.ByAgent || view.CreatedByPrincipal != p.Client+"~alice@example.test" {
+ t.Fatal("lost agent attribution", view, err)
+ }
+ r := delegatedCall(f.app, "calls_get_join_link", map[string]any{"team": "acme", "sqid": m.Sqid})
+ if r.Code != 200 {
+ t.Fatal(r.Code, r.Body.String())
+ }
+ var invitation struct {
+ URL string `json:"join_url"`
+ }
+ _ = json.Unmarshal(r.Body.Bytes(), &invitation)
+ token := invitation.URL[strings.LastIndex(invitation.URL, "/")+1:]
+ if _, _, ok, err := f.app.store.liveLink(t.Context(), token); err != nil || !ok {
+ t.Fatal("invalid invitation", err)
+ }
+ coords, _ := json.Marshal([]string{p.Subject, p.Client, "acme", input["client_id"].(string)})
+ want, err := f.app.sealer.Fingerprint("connection.receipt.v1", string(coords))
+ if err != nil {
+ t.Fatal(err)
+ }
+ var saved string
+ if err = f.app.db.Writer().QueryRow("SELECT coordinate FROM calls_agent_meetings").Scan(&saved); err != nil || saved != want {
+ t.Fatal("receipt binding", err)
+ }
+ var names string
+ if err = f.app.db.Writer().QueryRow("SELECT group_concat(name,',') FROM pragma_table_info('calls_agent_meetings')").Scan(&names); err != nil || names != "coordinate,content,meeting_id" {
+ t.Fatal("receipt stores extra data", names, err)
+ }
+ var seq int
+ var dbName, path string
+ if err = f.app.db.Writer().QueryRow("PRAGMA database_list").Scan(&seq, &dbName, &path); err != nil {
+ t.Fatal(err)
+ }
+ check := func() {
+ for _, suffix := range []string{"", "-wal"} {
+ raw, err := os.ReadFile(path + suffix)
+ if os.IsNotExist(err) {
+ continue
+ }
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, canary := range []string{input["title"].(string), token, p.Client} {
+ if bytes.Contains(raw, []byte(canary)) {
+ t.Fatal("plaintext in SQLite", suffix)
+ }
+ }
+ }
+ }
+ check()
+ if _, err = f.app.db.Writer().Exec("PRAGMA wal_checkpoint(TRUNCATE)"); err != nil {
+ t.Fatal(err)
+ }
+ check()
+ if _, err = f.app.store.endMeeting(t.Context(), m.ID, actorFor(Person{ID: 1})); err != nil {
+ t.Fatal(err)
+ }
+ // A stale unrevoked invitation must not bypass the meeting ended check.
+ if _, err = f.app.db.Writer().Exec("UPDATE meeting_links SET revoked_at=NULL"); err != nil {
+ t.Fatal(err)
+ }
+ if r := delegatedCall(f.app, "calls_get_join_link", map[string]any{"team": "acme", "sqid": m.Sqid}); r.Code != 404 {
+ t.Fatal("ended invitation", r.Code)
+ }
+ if r := delegatedCall(f.app, "calls_create_meeting", input); r.Code != 200 {
+ t.Fatal("ended retry", r.Code)
+ }
+ if err = f.app.db.G.Delete(&Meeting{}, m.ID).Error; err != nil {
+ t.Fatal(err)
+ }
+ if r := delegatedCall(f.app, "calls_create_meeting", input); r.Code != 404 {
+ t.Fatal("deleted retry", r.Code)
+ }
+}
+func TestDelegatedIdentityScopeAndCurrentMembership(t *testing.T) {
+ f, p := linkedDelegated(t)
+ original := *p
+ input := delegatedInputForTest()
+ for _, change := range []func(){func() { p.Subject = "unknown" }, func() { p.Client = "" }, func() { p.Grant = "" }, func() { p.Teams = []string{"other"} }, func() { p.Scopes = []string{"calls:read"} }, func() { f.app.cfg.allow = allowlist{} }} {
+ change()
+ if w := delegatedCall(f.app, "calls_create_meeting", input); w.Code != 403 {
+ t.Fatal("unauthorized creation", w.Code, w.Body.String())
+ }
+ *p = original
+ f.app.cfg.allow = allowlist{addrs: map[string]struct{}{"alice@example.test": {}}}
+ }
+ var n int
+ if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM meetings").Scan(&n); err != nil || n != 0 {
+ t.Fatal("denial wrote", n, err)
+ }
+ p.Teams = []string{"acme", "other"}
+ input["team"] = "other"
+ if w := delegatedCall(f.app, "calls_create_meeting", input); w.Code != 403 {
+ t.Fatal("other configured team", w.Code)
+ }
+ *p = original
+ input["team"] = "acme"
+ w := delegatedCall(f.app, "calls_create_meeting", input)
+ if w.Code != 200 {
+ t.Fatal(w.Code)
+ }
+ var m struct {
+ Sqid string `json:"sqid"`
+ }
+ _ = json.Unmarshal(w.Body.Bytes(), &m)
+ p.Scopes = []string{"calls:read", "calls:write"}
+ if w := delegatedCall(f.app, "calls_get_join_link", map[string]any{"team": "acme", "sqid": m.Sqid}); w.Code != 403 {
+ t.Fatal("sharing scope bypass", w.Code)
+ }
+ r := httptest.NewRequest("GET", homeTestOrigin+"/api/v1/operations", nil)
+ for _, c := range f.cookies {
+ r.AddCookie(c)
+ }
+ w = httptest.NewRecorder()
+ f.app.delegated.ServeHTTP(w, r)
+ if w.Code != http.StatusUnauthorized {
+ t.Fatal("cookie authorized", w.Code)
+ }
+ if _, err := f.app.db.Writer().Exec("DELETE FROM home_identity_links"); err != nil {
+ t.Fatal(err)
+ }
+ if w := delegatedCall(f.app, "calls_list_meetings", map[string]any{"team": "acme"}); w.Code != 403 {
+ t.Fatal("unlink did not revoke", w.Code)
+ }
+ if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM persons").Scan(&n); err != nil || n != 1 {
+ t.Fatal("auto-provisioned", n, err)
+ }
+}
+func TestDelegatedLinkFailureRollsBackEverything(t *testing.T) {
+ f, _ := linkedDelegated(t)
+ if _, err := f.app.db.Writer().Exec("CREATE TRIGGER reject_link BEFORE INSERT ON meeting_links BEGIN SELECT RAISE(ABORT,'fixture'); END"); err != nil {
+ t.Fatal(err)
+ }
+ if w := delegatedCall(f.app, "calls_create_meeting", delegatedInputForTest()); w.Code != 503 {
+ t.Fatal(w.Code, w.Body.String())
+ }
+ for _, table := range []string{"meetings", "meeting_links", "calls_agent_meetings", "calls_connections"} {
+ var n int
+ if err := f.app.db.Writer().QueryRow("SELECT COUNT(*) FROM " + table).Scan(&n); err != nil || n != 0 {
+ t.Fatal("partial transaction", table, n, err)
+ }
+ }
+}
diff --git a/internal/calls/store.go b/internal/calls/store.go
index f2d3d0e..e366c74 100644
--- a/internal/calls/store.go
+++ b/internal/calls/store.go
@@ -209,7 +209,7 @@ func (s *store) meetingViewOfCached(ctx context.Context, m Meeting, labels map[s
Title: s.title(m),
LinkPresent: n > 0,
CreatedByPrincipal: by,
- ByAgent: strings.HasPrefix(m.CreatedBy, "agent:"),
+ ByAgent: strings.HasPrefix(m.CreatedBy, "agent:") || strings.HasPrefix(m.CreatedBy, "connection:"),
}, nil
}