github.com/storacha/go-ucanto@v0.7.2/core/message/datamodel/agentmessage.go (about) 1 package datamodel 2 3 import ( 4 _ "embed" 5 "fmt" 6 "sync" 7 8 "github.com/ipld/go-ipld-prime" 9 "github.com/ipld/go-ipld-prime/schema" 10 ) 11 12 //go:embed agentmessage.ipldsch 13 var agentmessage []byte 14 15 var ( 16 once sync.Once 17 ts *schema.TypeSystem 18 err error 19 ) 20 21 func mustLoadSchema() *schema.TypeSystem { 22 once.Do(func() { 23 ts, err = ipld.LoadSchemaBytes(agentmessage) 24 }) 25 if err != nil { 26 panic(fmt.Errorf("failed to load IPLD schema: %w", err)) 27 } 28 return ts 29 } 30 31 func Type() schema.Type { 32 return mustLoadSchema().TypeByName("AgentMessage") 33 } 34 35 type AgentMessageModel struct { 36 UcantoMessage7 *DataModel 37 } 38 39 // Describes ucanto@7 message data format send between (client/server) agents. 40 type DataModel struct { 41 // Set of (invocation) delegation links to be executed by the agent. 42 Execute []ipld.Link 43 // Map of receipts keyed by the (invocation) delegation. 44 Report *ReportModel 45 } 46 47 type ReportModel struct { 48 Keys []string 49 Values map[string]ipld.Link 50 }