The chat responses are generated using Generative AI technology for intuitive search and may not be entirely accurate. They are not intended as professional advice. For full details, including our use rights, privacy practices and potential export control restrictions, please refer to our Generative AI Service Terms of Use and Generative AI Service Privacy Information. As this is a test version, please let us know if something irritating comes up. Like you get recommended a chocolate fudge ice cream instead of an energy managing application. If that occurs, please use the feedback button in our contact form!
The agents need to manage their state information over time. This state information consists of
agent secrets
agent configuration
agent mappings
history of agent secrets
list of uploaded files and corresponding eTags (so that agents can overwrite the files if necessary)
This information needs to be persisted over time.
Info
The agents store the eTag of the file so that they can overwrite these files in the future. This will change once agents can read the eTags of the files.
Storing the data using different storage provider¶
If you need to store the data in a different or more secure fashion you can provide your own implementation of the StorageProvider. You need to implement the following interface
/** * Per default, the library stores the agent settings in the directory .mc * You can pass a class which implements a ConfigurationStorage in the constructor if you want to store * the settings somewhere else. (e.g. database, encrypted file system etc) * @export * @interface ConfigurationStorage */exportinterfaceIConfigurationStorage{GetConfig(config:IMindConnectConfiguration):IMindConnectConfiguration;SaveConfig(config:IMindConnectConfiguration):Promise<IMindConnectConfiguration>;}
The GetConfig method should check if the config has changed and return no value so that the agent can be onboarded again
if(_.isEqual(json.content,configuration.content)){returnjson;}else{log("The configuration has changed we will onboard again.");}
exportclassMySecureStorageimplementsIConfigurationStorage{privatelock:AsyncLock;privateencrypt():string{//... your secure implementation}privatedecrypt():string{//... your secure implementation}publicGetConfig(configuration:IMindConnectConfiguration):IMindConnectConfiguration{try{constjson=<IMindConnectConfiguration>(constresult=fs.readFileSync(path.resolve(`${this._basePath}/${configuration.content.clientId}.bin`));returnthis.decrypt(result););if(_.isEqual(json.content,configuration.content)){returnjson;}else{log("The configuration has changed we will onboard again.");}}catch(err){log(`There is no configuration stored yet for agent with id ${configuration.content.clientId}`);}returnconfiguration;}publicasyncSaveConfig(config:IMindConnectConfiguration):Promise<IMindConnectConfiguration>{constfileName=`${this._basePath}/${config.content.clientId}.bin`;returnawaitthis.lock.acquire(fileName,()=>{constdata=JSON.stringify(config);fs.writeFileSync(fileName,this.encrypt(data));returnconfig;});}constructor(private_basePath:string){if(!fs.existsSync(this._basePath)){fs.mkdirSync(this._basePath);}this.lock=newAsyncLock({});}}