diff --git a/commands/access/claim.go b/commands/access/claim.go index e671123..74a4e8c 100644 --- a/commands/access/claim.go +++ b/commands/access/claim.go @@ -8,4 +8,4 @@ type ClaimArguments = commands.Unit // Claim can be invoked by an agent to claim a set of delegations from the // account. -var Claim = commands.MustParse[*ClaimArguments]("/access/claim") +var Claim = commands.MustParse[*ClaimArguments, *ClaimOK]("/access/claim") diff --git a/commands/access/confirm.go b/commands/access/confirm.go index c07f4f5..b7f2105 100644 --- a/commands/access/confirm.go +++ b/commands/access/confirm.go @@ -17,7 +17,7 @@ type ConfirmOK = ClaimOK const ConfirmMetaKey = "accessConfirm" // Confirm can be invoked by an agent to confirm an access request. -var Confirm = commands.MustParse[*ConfirmArguments]("/access/confirm") +var Confirm = commands.MustParse[*ConfirmArguments, *ConfirmOK]("/access/confirm") const ( InvalidAccessConfirmSubjectErrorName = "InvalidAccessConfirmSubject" diff --git a/commands/access/delegate.go b/commands/access/delegate.go index 07d9a01..6560eeb 100644 --- a/commands/access/delegate.go +++ b/commands/access/delegate.go @@ -8,7 +8,7 @@ type DelegateOK = commands.Unit // Delegate can be invoked by an agent to delegate a set of capabilities that // may be subsequently claimed by another agent. -var Delegate = commands.MustParse[*DelegateArguments]("/access/delegate") +var Delegate = commands.MustParse[*DelegateArguments, *DelegateOK]("/access/delegate") const ( DelegationNotFoundErrorName = "DelegationNotFound" diff --git a/commands/access/grant.go b/commands/access/grant.go index a03037f..70a8975 100644 --- a/commands/access/grant.go +++ b/commands/access/grant.go @@ -18,7 +18,7 @@ type GrantOK = ClaimOK // Grant can be invoked by an agent to request that a set of capabilities be // granted directly. Unlike Request -> Confirm, Grant is one-shot: the // executor decides immediately whether to issue the delegation. -var Grant = commands.MustParse[*GrantArguments](GrantCommand) +var Grant = commands.MustParse[*GrantArguments, *GrantOK](GrantCommand) const ( UnknownAbilityErrorName = "UnknownAbility" diff --git a/commands/access/request.go b/commands/access/request.go index 265fd58..6f962cd 100644 --- a/commands/access/request.go +++ b/commands/access/request.go @@ -11,7 +11,7 @@ const RequestMetaKey = "accessRequest" // Request can be invoked by an agent to request set of capabilities from the // account. -var Request = commands.MustParse[*RequestArguments]("/access/request") +var Request = commands.MustParse[*RequestArguments, *RequestOK]("/access/request") const ( InvalidAuthorizationAccountErrorName = "InvalidAuthorizationAccount" diff --git a/commands/assert/equals.go b/commands/assert/equals.go index cbfcadd..272c2b8 100644 --- a/commands/assert/equals.go +++ b/commands/assert/equals.go @@ -7,4 +7,4 @@ import "github.com/fil-forge/libforge/commands" type EqualsOK = commands.Unit // Equals claims data is referred to by another CID e.g CAR CID & Piece CID -var Equals = commands.MustParse[*EqualsArguments]("/assert/equals") +var Equals = commands.MustParse[*EqualsArguments, *EqualsOK]("/assert/equals") diff --git a/commands/assert/index.go b/commands/assert/index.go index a0684c5..d54055d 100644 --- a/commands/assert/index.go +++ b/commands/assert/index.go @@ -8,4 +8,4 @@ type IndexOK = commands.Unit // Index claims that a content graph can be found in blob(s) that are identified // and indexed in the given index CID. -var Index = commands.MustParse[*IndexArguments]("/assert/index") +var Index = commands.MustParse[*IndexArguments, *IndexOK]("/assert/index") diff --git a/commands/assert/location.go b/commands/assert/location.go index 5e8e27d..7f8da13 100644 --- a/commands/assert/location.go +++ b/commands/assert/location.go @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands" type LocationOK = commands.Unit -var Location = commands.MustParse[*LocationArguments]("/assert/location") +var Location = commands.MustParse[*LocationArguments, *LocationOK]("/assert/location") diff --git a/commands/bind.go b/commands/bind.go index ab1fc5e..4af9ef5 100644 --- a/commands/bind.go +++ b/commands/bind.go @@ -1,14 +1,17 @@ package commands -import "github.com/fil-forge/ucantone/validator/bindcom" +import ( + "github.com/fil-forge/ucantone/bind" + "github.com/fil-forge/ucantone/ucan" +) -// MustParse is like [bindcom.Parse] but panics if the command cannot be +// MustParse is like [bind.Parse] but panics if the command cannot be // constructed. It exists for package-level command declarations where the // command and options are static — any error indicates a programming bug // (malformed command string, invalid option) and should fail loudly at init // rather than be silently dropped with `, _`. -func MustParse[A bindcom.Arguments](cmd string) bindcom.Command[A] { - c, err := bindcom.Parse[A](cmd) +func MustParse[Args, OK ucan.CBORValue](cmd string) bind.Binding[Args, OK] { + c, err := bind.Parse[Args, OK](cmd) if err != nil { panic(err) } diff --git a/commands/blob/accept.go b/commands/blob/accept.go index d9f7e26..71c627e 100644 --- a/commands/blob/accept.go +++ b/commands/blob/accept.go @@ -4,4 +4,4 @@ package blob import "github.com/fil-forge/libforge/commands" -var Accept = commands.MustParse[*AcceptArguments]("/blob/accept") +var Accept = commands.MustParse[*AcceptArguments, *AcceptOK]("/blob/accept") diff --git a/commands/blob/add.go b/commands/blob/add.go index 7856b38..53ce8cf 100644 --- a/commands/blob/add.go +++ b/commands/blob/add.go @@ -4,4 +4,4 @@ package blob import "github.com/fil-forge/libforge/commands" -var Add = commands.MustParse[*AddArguments]("/blob/add") +var Add = commands.MustParse[*AddArguments, *AddOK]("/blob/add") diff --git a/commands/blob/allocate.go b/commands/blob/allocate.go index 5bd10af..d730224 100644 --- a/commands/blob/allocate.go +++ b/commands/blob/allocate.go @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands" const MaxBlobSize = 268_435_456 -var Allocate = commands.MustParse[*AllocateArguments]("/blob/allocate") +var Allocate = commands.MustParse[*AllocateArguments, *AllocateOK]("/blob/allocate") diff --git a/commands/blob/list.go b/commands/blob/list.go index dc2a71d..a1b620b 100644 --- a/commands/blob/list.go +++ b/commands/blob/list.go @@ -4,4 +4,4 @@ package blob import "github.com/fil-forge/libforge/commands" -var List = commands.MustParse[*ListArguments]("/blob/list") +var List = commands.MustParse[*ListArguments, *ListOK]("/blob/list") diff --git a/commands/blob/remove.go b/commands/blob/remove.go index 6432b01..8a05bde 100644 --- a/commands/blob/remove.go +++ b/commands/blob/remove.go @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands" type RemoveOK = commands.Unit -var Remove = commands.MustParse[*RemoveArguments]("/blob/remove") +var Remove = commands.MustParse[*RemoveArguments, *RemoveOK]("/blob/remove") diff --git a/commands/blob/replica/allocate.go b/commands/blob/replica/allocate.go index 8edbfe8..cdf5f74 100644 --- a/commands/blob/replica/allocate.go +++ b/commands/blob/replica/allocate.go @@ -4,4 +4,4 @@ package replica import "github.com/fil-forge/libforge/commands" -var Allocate = commands.MustParse[*AllocateArguments]("/blob/replica/allocate") +var Allocate = commands.MustParse[*AllocateArguments, *AllocateOK]("/blob/replica/allocate") diff --git a/commands/blob/replica/transfer.go b/commands/blob/replica/transfer.go index 8ab0da5..cd28da5 100644 --- a/commands/blob/replica/transfer.go +++ b/commands/blob/replica/transfer.go @@ -4,4 +4,4 @@ package replica import "github.com/fil-forge/libforge/commands" -var Transfer = commands.MustParse[*TransferArguments]("/blob/replica/transfer") +var Transfer = commands.MustParse[*TransferArguments, *TransferOK]("/blob/replica/transfer") diff --git a/commands/blob/replicate.go b/commands/blob/replicate.go index eebba2c..e17e2ba 100644 --- a/commands/blob/replicate.go +++ b/commands/blob/replicate.go @@ -18,4 +18,4 @@ import "github.com/fil-forge/libforge/commands" // transferred and stored the blob. The number of `/blob/replica/allocate` and // `/blob/replica/transfer` tasks corresponds directly to number of replicas // requested. -var Replicate = commands.MustParse[*ReplicateArguments]("/blob/replicate") +var Replicate = commands.MustParse[*ReplicateArguments, *ReplicateOK]("/blob/replicate") diff --git a/commands/blob/retrieve.go b/commands/blob/retrieve.go index e6f45e7..4b7a038 100644 --- a/commands/blob/retrieve.go +++ b/commands/blob/retrieve.go @@ -12,4 +12,4 @@ import "github.com/fil-forge/libforge/commands" // For user-facing retrieval that requires an allocation in a specific space // see `libforge/commands/content.Retrieve` (the `/content/retrieve` // capability). -var Retrieve = commands.MustParse[*RetrieveArguments]("/blob/retrieve") +var Retrieve = commands.MustParse[*RetrieveArguments, *RetrieveOK]("/blob/retrieve") diff --git a/commands/claim/cache.go b/commands/claim/cache.go index b2539ba..df6b87f 100644 --- a/commands/claim/cache.go +++ b/commands/claim/cache.go @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands" type CacheOK = commands.Unit -var Cache = commands.MustParse[*CacheArguments]("/claim/cache") +var Cache = commands.MustParse[*CacheArguments, *CacheOK]("/claim/cache") diff --git a/commands/content/retrieve.go b/commands/content/retrieve.go index aecb622..7af91b3 100644 --- a/commands/content/retrieve.go +++ b/commands/content/retrieve.go @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands" type RetrieveOK = commands.Unit -var Retrieve = commands.MustParse[*RetrieveArguments]("/content/retrieve") +var Retrieve = commands.MustParse[*RetrieveArguments, *RetrieveOK]("/content/retrieve") diff --git a/commands/debug/echo.go b/commands/debug/echo.go index 4827f25..d448fad 100644 --- a/commands/debug/echo.go +++ b/commands/debug/echo.go @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands" type EchoOK = EchoArguments -var Echo = commands.MustParse[*EchoArguments]("/debug/echo") +var Echo = commands.MustParse[*EchoArguments, *EchoOK]("/debug/echo") diff --git a/commands/http/put.go b/commands/http/put.go index aff6151..c68485c 100644 --- a/commands/http/put.go +++ b/commands/http/put.go @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands" type PutOK = commands.Unit -var Put = commands.MustParse[*PutArguments]("/http/put") +var Put = commands.MustParse[*PutArguments, *PutOK]("/http/put") diff --git a/commands/index/add.go b/commands/index/add.go index 763aedc..47797b4 100644 --- a/commands/index/add.go +++ b/commands/index/add.go @@ -9,7 +9,7 @@ import ( type AddOK = commands.Unit -var Add = commands.MustParse[*AddArguments]("/index/add") +var Add = commands.MustParse[*AddArguments, *AddOK]("/index/add") const IndexNotFoundErrorName = "IndexNotFound" diff --git a/commands/pdp/accept.go b/commands/pdp/accept.go index 91df730..a729010 100644 --- a/commands/pdp/accept.go +++ b/commands/pdp/accept.go @@ -4,4 +4,4 @@ package pdp import "github.com/fil-forge/libforge/commands" -var Accept = commands.MustParse[*AcceptArguments]("/pdp/accept") +var Accept = commands.MustParse[*AcceptArguments, *AcceptOK]("/pdp/accept") diff --git a/commands/pdp/info.go b/commands/pdp/info.go index 31d694a..5b4a359 100644 --- a/commands/pdp/info.go +++ b/commands/pdp/info.go @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands" const InfoCommand = "/pdp/info" -var Info = commands.MustParse[*InfoArguments]("/pdp/info") +var Info = commands.MustParse[*InfoArguments, *InfoOK]("/pdp/info") diff --git a/commands/provider/add.go b/commands/provider/add.go index ff6bd1b..880caed 100644 --- a/commands/provider/add.go +++ b/commands/provider/add.go @@ -7,7 +7,7 @@ import ( "github.com/fil-forge/ucantone/errors" ) -var Add = commands.MustParse[*AddArguments]("/provider/add") +var Add = commands.MustParse[*AddArguments, *AddOK]("/provider/add") const ( InvalidAccountErrorName = "InvalidAccount" diff --git a/commands/space/egress/track.go b/commands/space/egress/track.go index 3cb2127..e41c664 100644 --- a/commands/space/egress/track.go +++ b/commands/space/egress/track.go @@ -9,4 +9,4 @@ import "github.com/fil-forge/libforge/commands" // `/content/retrieve` receipts. The tracking service responds by forking // a `/space/egress/consolidate` sub-invocation onto the receipt's // effects; the typed OK return is empty. -var Track = commands.MustParse[*TrackArguments]("/space/egress/track") +var Track = commands.MustParse[*TrackArguments, *TrackOK]("/space/egress/track") diff --git a/commands/space/info.go b/commands/space/info.go index c97a3e5..e289c17 100644 --- a/commands/space/info.go +++ b/commands/space/info.go @@ -6,6 +6,6 @@ import "github.com/fil-forge/libforge/commands" type InfoArguments = commands.Unit -var Info = commands.MustParse[*InfoArguments]("/space/info") +var Info = commands.MustParse[*InfoArguments, *InfoOK]("/space/info") const UnknownSpaceErrorName = "UnknownSpace" diff --git a/commands/ucan/attest/proof.go b/commands/ucan/attest/proof.go index cf64a8c..378806e 100644 --- a/commands/ucan/attest/proof.go +++ b/commands/ucan/attest/proof.go @@ -8,4 +8,4 @@ type ProofOK = commands.Unit // Issued by a trusted authority (usually the one handling invocation) that // attests a specific UCAN delegation has been considered authentic. -var Proof = commands.MustParse[*ProofArguments]("/ucan/attest/proof") +var Proof = commands.MustParse[*ProofArguments, *ProofOK]("/ucan/attest/proof") diff --git a/commands/ucan/conclude.go b/commands/ucan/conclude.go index 2b9b216..5605f69 100644 --- a/commands/ucan/conclude.go +++ b/commands/ucan/conclude.go @@ -9,7 +9,7 @@ import ( type ConcludeOK = commands.Unit -var Conclude = commands.MustParse[*ConcludeArguments]("/ucan/conclude") +var Conclude = commands.MustParse[*ConcludeArguments, *ConcludeOK]("/ucan/conclude") const ConclusionReceiptNotFoundErrorName = "ConclusionReceiptNotFound" diff --git a/commands/upload/add.go b/commands/upload/add.go index 59d08b2..c94bf1a 100644 --- a/commands/upload/add.go +++ b/commands/upload/add.go @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands" type AddOK = commands.Unit -var Add = commands.MustParse[*AddArguments]("/upload/add") +var Add = commands.MustParse[*AddArguments, *AddOK]("/upload/add") diff --git a/commands/upload/list.go b/commands/upload/list.go index 780da8d..8007502 100644 --- a/commands/upload/list.go +++ b/commands/upload/list.go @@ -4,4 +4,4 @@ package upload import "github.com/fil-forge/libforge/commands" -var List = commands.MustParse[*ListArguments]("/upload/list") +var List = commands.MustParse[*ListArguments, *ListOK]("/upload/list") diff --git a/commands/upload/remove.go b/commands/upload/remove.go index 875791a..d5ea142 100644 --- a/commands/upload/remove.go +++ b/commands/upload/remove.go @@ -6,4 +6,4 @@ import "github.com/fil-forge/libforge/commands" type RemoveOK = commands.Unit -var Remove = commands.MustParse[*RemoveArguments]("/upload/remove") +var Remove = commands.MustParse[*RemoveArguments, *RemoveOK]("/upload/remove") diff --git a/commands/upload/shard/list.go b/commands/upload/shard/list.go index 0e9fb9d..814e4ba 100644 --- a/commands/upload/shard/list.go +++ b/commands/upload/shard/list.go @@ -4,4 +4,4 @@ package shard import "github.com/fil-forge/libforge/commands" -var List = commands.MustParse[*ListArguments]("/upload/shard/list") +var List = commands.MustParse[*ListArguments, *ListOK]("/upload/shard/list") diff --git a/go.mod b/go.mod index f93e16d..dfa7511 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.25.3 require ( github.com/alanshaw/dag-json-gen v0.0.5 github.com/fil-forge/automobile v0.0.1 - github.com/fil-forge/ucantone v0.0.0-20260519193222-ad31490eaa10 + github.com/fil-forge/ucantone v0.0.0-20260520204404-e2ce81a7ec06 github.com/filecoin-project/go-data-segment v0.0.1 github.com/gobwas/glob v0.2.3 github.com/ipfs/go-cid v0.6.1 diff --git a/go.sum b/go.sum index 7a817f3..64e163a 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ 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/fil-forge/automobile v0.0.1 h1:9xB3yc4l5b9EdRJSJcNwudgBFNHoMPEAdcb7GfobLhA= github.com/fil-forge/automobile v0.0.1/go.mod h1:TsO7jlO8ykJZY5tF8j4GsUcu3F02lEzxO7ULoB61hRA= -github.com/fil-forge/ucantone v0.0.0-20260519193222-ad31490eaa10 h1:ApgWAIpXjCYjZw/yDxLn8IA9WrH/ENPRWCWPT/MoCvU= -github.com/fil-forge/ucantone v0.0.0-20260519193222-ad31490eaa10/go.mod h1:vqgVEsy6LEEsY24Zyjxem0vSofj1XTIx29GbV635f+I= +github.com/fil-forge/ucantone v0.0.0-20260520204404-e2ce81a7ec06 h1:s7WcrsieqhOBYmQwTjdwIF/nMtgISRuSxTwki6tiS4A= +github.com/fil-forge/ucantone v0.0.0-20260520204404-e2ce81a7ec06/go.mod h1:vqgVEsy6LEEsY24Zyjxem0vSofj1XTIx29GbV635f+I= github.com/filecoin-project/go-data-segment v0.0.1 h1:1wmDxOG4ubWQm3ZC1XI5nCon5qgSq7Ra3Rb6Dbu10Gs= github.com/filecoin-project/go-data-segment v0.0.1/go.mod h1:H0/NKbsRxmRFBcLibmABv+yFNHdmtl5AyplYLnb0Zv4= github.com/filecoin-project/go-fil-commcid v0.1.0 h1:3R4ds1A9r6cr8mvZBfMYxTS88OqLYEo6roi+GiIeOh8= diff --git a/ucan/retrieval/server_test.go b/ucan/retrieval/server_test.go index 9b02d3b..d25d6f0 100644 --- a/ucan/retrieval/server_test.go +++ b/ucan/retrieval/server_test.go @@ -8,18 +8,18 @@ import ( "net/url" "testing" + "github.com/fil-forge/ucantone/bind" "github.com/fil-forge/ucantone/execution" "github.com/fil-forge/ucantone/ipld/datamodel" "github.com/fil-forge/ucantone/testutil" "github.com/fil-forge/ucantone/ucan/container" "github.com/fil-forge/ucantone/ucan/invocation" - "github.com/fil-forge/ucantone/validator/bindcom" "github.com/stretchr/testify/require" "github.com/fil-forge/libforge/ucan/retrieval" ) -var contentRetrieve, _ = bindcom.Parse[*datamodel.Map]("/content/retrieve") +var contentRetrieve, _ = bind.Parse[*datamodel.Map, *datamodel.Map]("/content/retrieve") func TestServer(t *testing.T) { service := testutil.RandomSigner(t)