SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
Adds Memory components
alaa-eddine7ae5e952243f
diff --git a/packages/app/src/backend/routes/pages/builder-sidebar.ts b/packages/app/src/backend/routes/pages/builder-sidebar.tsindex 366f5fae..8844eadd 100644--- a/packages/app/src/backend/routes/pages/builder-sidebar.ts+++ b/packages/app/src/backend/routes/pages/builder-sidebar.ts@@ -47,11 +47,10 @@ const baseMenu: Menu = {Tools: [{ name: 'MCPClient', label: 'MCP Client', description: '', icon: 'MCP' }],Memory: [- { name: 'MemoryWriteInput', label: 'Memory Slot Write', icon: 'Memory' },- { name: 'MemoryWriteKeyVal', label: 'Memory Key Write', icon: 'Memory' },- { name: 'MemoryReadOutput', label: 'Memory Slot Read', icon: 'Memory' },- { name: 'MemoryReadKeyVal', label: 'Memory Key Read', icon: 'Memory' },- { name: 'MemoryDeleteKey', label: 'Memory Delete Key', icon: 'Memory' },+ { name: 'MemoryWriteKeyVal', label: 'Memory Write', icon: 'Memory' },+ { name: 'MemoryReadKeyVal', label: 'Memory Read', icon: 'Memory' },+ { name: 'MemoryDeleteKey', label: 'Memory Delete', icon: 'Memory' },+ { name: 'MemoryWriteObject', label: 'Memory Write Multi', icon: 'Memory' },],Crypto: [{ name: 'FHash', label: 'F:Hash', description: '' },@@ -101,7 +100,7 @@ const baseMenu: Menu = {if (config.env.NODE_ENV === 'PROD') {//remove memory section- delete baseMenu.Memory;+ //delete baseMenu.Memory;delete baseMenu.Triggers;}diff --git a/packages/app/src/builder-ui/components/Memory.class.ts b/packages/app/src/builder-ui/components/Memory.class.tsdeleted file mode 100644index 5eb3cd83..00000000--- a/packages/app/src/builder-ui/components/Memory.class.ts+++ /dev/null@@ -1,131 +0,0 @@-import { Component } from './Component.class';-declare var Metro;-export class Memory extends Component {- protected async init() {- // #region [ Settings config ] ==================- this.settings = {- name: {- type: 'input',- label: 'name',- value: '',- hint: 'Enter memory name',- },- scope: {- type: 'select',- label: 'Scope',- hint: 'Memory Scope',- value: 'Session',- options: ['Session'],- },- // prompt_select:{- // type:'input-selector',- // options:['Input'],- // rel:'prompt'- // }- };-- // const dataEntries = ['ttl'];- // for (let item of dataEntries) {- // if (typeof this.data[item] === 'undefined') this.data[item] = this.settings[item].value;- // }-- this.data = {};- // #endregion-- // #region [ I/O config ] ==================- this.properties.defaultOutputs = ['_list'];- this.properties.defaultInputs = ['_reset'];- // #endregion-- // #region [ Draw config ] ==================- this.drawSettings.showSettings = false;- this.drawSettings.iconCSSClass = 'svg-icon ' + this.constructor.name;- // this.drawSettings.addOutputButton = null;- // this.drawSettings.addInputButton = ' + Entry';- this.drawSettings.addInputButton = null;- this.drawSettings.addOutputButton = ' + Mem Entry';- // #endregion- }- // public inputNameAvailable(name) {- // const input = this.inputContainer.querySelector(`.input-endpoint[smt-name="${name}"]`);- // if (input) return false;- // // //find if there is an output with the same name- // const outputEP = this.outputContainer.querySelector(`.output-endpoint[smt-name="${name}"]`);- // if (!outputEP) return true;-- // console.log('outputEP', outputEP);- // if (outputEP._inputDivElement == input) return false;-- // return true;- // }- public outputNameExists(name) {- const output = this.outputContainer.querySelector(`.output-endpoint[smt-name="${name}"]`);- if (output) return true;- // //find if there is an output with the same name- const inputEP = this.inputContainer.querySelector(`.input-endpoint[smt-name="${name}"]`);- if (inputEP) return true;-- return false;- }-- public async addOutput(parent: any, name: any): Promise<any> {- if (this.properties.defaultInputs.includes(name)) return super.addOutput(parent, name);-- const outputDiv: any = await super.addOutput(parent, name);- const inputParent = parent.parentElement.querySelector('.input-container');- const inputDiv: any = await super.addInput(inputParent, name);-- outputDiv.querySelector('.ep').setAttribute('smt-con-thickness', '8');- outputDiv.querySelector('.ep').setAttribute('smt-con-hide-overlays', 'true');-- outputDiv._inputDivElement = inputDiv;- inputDiv._outputDivElement = outputDiv;-- this.repaint();- return outputDiv;- }-- public async addInput(parent: any, name: any): Promise<any> {- if (this.properties.defaultInputs.includes(name)) return super.addInput(parent, name);-- return null;- }- public async deleteEndpoint(endpointElement) {- console.log('deleting');- super.deleteEndpoint(endpointElement);- const otherEntry = endpointElement._inputDivElement || endpointElement._outputDivElement;-- if (endpointElement._inputDivElement) endpointElement.inputDivElement = null;- if (endpointElement._outputDivElement) endpointElement.outputDivElement = null;-- if (otherEntry) {- super.deleteEndpoint(otherEntry);- }- }- protected async run() {- this.addEventListener('endpointNameChanged', (endPoint, oldName, newName) => {- console.log('endpointNameChanged', endPoint, oldName, newName);- const inputDiv: any = endPoint.classList.contains('input-endpoint')- ? endPoint- : endPoint._inputDivElement;- const outputDiv: any = endPoint.classList.contains('output-endpoint')- ? endPoint- : endPoint._outputDivElement;-- const inputName = inputDiv.getAttribute('smt-name');- const outputName = outputDiv.getAttribute('smt-name');-- if (inputName != newName) {- inputDiv.setAttribute('smt-name', newName);- inputDiv.querySelector('.name').innerText = newName;- }-- if (outputName != newName) {- outputDiv.setAttribute('smt-name', newName);- outputDiv.querySelector('.name').innerText = newName;- }- });-- return true;- }-}diff --git a/packages/app/src/builder-ui/components/MemoryDeleteKey.class.ts b/packages/app/src/builder-ui/components/MemoryDeleteKey.class.tsindex 22286245..a1885a4a 100644--- a/packages/app/src/builder-ui/components/MemoryDeleteKey.class.ts+++ b/packages/app/src/builder-ui/components/MemoryDeleteKey.class.ts@@ -4,20 +4,13 @@ export class MemoryDeleteKey extends Component {protected async init() {// #region [ Settings config ] ==================this.settings = {- name: {+ memoryName: {type: 'input',label: 'name',value: '',hint: 'Enter memory name',- validate: `maxlength=50`,- validateMessage: 'Enter a non-empty name, not more than 50 characters.',- },- scope: {- type: 'select',- label: 'Scope',- hint: 'Memory Scope',- value: 'Session',- options: ['Session'],+ validate: `required maxlength=100`,+ validateMessage: 'Enter a non-empty name, not more than 100 characters.',},};@@ -26,11 +19,11 @@ export class MemoryDeleteKey extends Component {// if (typeof this.data[item] === 'undefined') this.data[item] = this.settings[item].value;// }- this.data = {};+ //this.data = {};// #endregion// #region [ I/O config ] ==================- this.properties.defaultOutputs = [];+ this.properties.defaultOutputs = ['Key'];this.properties.defaultInputs = ['Key'];// #endregiondiff --git a/packages/app/src/builder-ui/components/MemoryReadKeyVal.class.ts b/packages/app/src/builder-ui/components/MemoryReadKeyVal.class.tsindex 08c93761..b61e9592 100644--- a/packages/app/src/builder-ui/components/MemoryReadKeyVal.class.ts+++ b/packages/app/src/builder-ui/components/MemoryReadKeyVal.class.ts@@ -4,21 +4,25 @@ export class MemoryReadKeyVal extends Component {protected async init() {// #region [ Settings config ] ==================this.settings = {- name: {+ memoryName: {type: 'input',label: 'name',value: '',hint: 'Enter memory name',- validate: `maxlength=50`,- validateMessage: 'Enter a non-empty name, not more than 50 characters.',- },- scope: {- type: 'select',- label: 'Scope',- hint: 'Memory Scope',- value: 'Session',- options: ['Session'],+ validate: `required maxlength=100`,+ validateMessage: 'Enter a non-empty name, not more than 100 characters.',},+ // scope: {+ // type: 'select',+ // label: 'Scope',+ // hint: 'Memory Scope',+ // value: 'Session',+ // options: [+ // { value: 'session', text: 'Session' },+ // { value: 'workflow', text: 'Workflow' },+ // { value: 'ttl', text: 'TTL' },+ // ],+ // },};// const dataEntries = ['ttl'];@@ -26,7 +30,7 @@ export class MemoryReadKeyVal extends Component {// if (typeof this.data[item] === 'undefined') this.data[item] = this.settings[item].value;// }- this.data = {};+ //this.data = {};// #endregion// #region [ I/O config ] ==================diff --git a/packages/app/src/builder-ui/components/MemoryReadOutput.class.ts b/packages/app/src/builder-ui/components/MemoryReadOutput.class.tsdeleted file mode 100644index 17ac189c..00000000--- a/packages/app/src/builder-ui/components/MemoryReadOutput.class.ts+++ /dev/null@@ -1,47 +0,0 @@-import { Component } from './Component.class';--export class MemoryReadOutput extends Component {- protected async init() {- // #region [ Settings config ] ==================- this.settings = {- name: {- type: 'input',- label: 'name',- value: '',- hint: 'Enter memory name',- validate: `maxlength=50`,- validateMessage: 'Enter a non-empty name, not more than 50 characters.',- },- scope: {- type: 'select',- label: 'Scope',- hint: 'Memory Scope',- value: 'Session',- options: ['Session'],- },- };-- // const dataEntries = ['ttl'];- // for (let item of dataEntries) {- // if (typeof this.data[item] === 'undefined') this.data[item] = this.settings[item].value;- // }-- this.data = {};- // #endregion-- // #region [ I/O config ] ==================- this.properties.defaultOutputs = [];- this.properties.defaultInputs = [];- // #endregion-- // #region [ Draw config ] ==================- this.drawSettings.showSettings = false;- this.drawSettings.iconCSSClass = 'svg-icon Memory ' + this.constructor.name;- //this.drawSettings.addOutputButton = null;- // this.drawSettings.addInputButton = ' + Entry';- this.drawSettings.addInputButton = null;- this.drawSettings.addOutputButton = 'Mem Slot';- this.drawSettings.addInputButtonLabel = ' ';- // #endregion- }-}diff --git a/packages/app/src/builder-ui/components/MemoryWriteInput.class.ts b/packages/app/src/builder-ui/components/MemoryWriteInput.class.tsdeleted file mode 100644index 2b75cbc8..00000000--- a/packages/app/src/builder-ui/components/MemoryWriteInput.class.ts+++ /dev/null@@ -1,49 +0,0 @@-import { Component } from './Component.class';--export class MemoryWriteInput extends Component {- protected async init() {- // #region [ Settings config ] ==================- this.settings = {- name: {- type: 'input',- label: 'name',- value: '',- hint: 'Enter memory name',- validate: `maxlength=50`,- validateMessage: 'Enter a non-empty name, not more than 50 characters.',- },- scope: {- type: 'select',- label: 'Scope',- hint: 'Memory Scope',- value: 'Session',- options: ['Session'],- },- };-- // const dataEntries = ['ttl'];- // for (let item of dataEntries) {- // if (typeof this.data[item] === 'undefined') this.data[item] = this.settings[item].value;- // }-- this.data = {};- // #endregion-- // #region [ I/O config ] ==================- this.properties.defaultOutputs = [];- this.properties.defaultInputs = [];- // #endregion-- // #region [ Draw config ] ==================- this.drawSettings.displayName = 'Memory Slot Write';- this.drawSettings.shortDescription = 'Write to memory by slot name';-- this.drawSettings.showSettings = false;- this.drawSettings.iconCSSClass = 'svg-icon Memory ' + this.constructor.name;- this.drawSettings.addOutputButton = null;- // this.drawSettings.addInputButton = ' + Entry';- this.drawSettings.addInputButton = 'Mem Slot';- this.drawSettings.addOutputButtonLabel = ' ';- // #endregion- }-}diff --git a/packages/app/src/builder-ui/components/MemoryWriteKeyVal.class.ts b/packages/app/src/builder-ui/components/MemoryWriteKeyVal.class.tsindex ffc718d8..7e598559 100644--- a/packages/app/src/builder-ui/components/MemoryWriteKeyVal.class.ts+++ b/packages/app/src/builder-ui/components/MemoryWriteKeyVal.class.ts@@ -9,13 +9,13 @@ export class MemoryWriteKeyVal extends Component {label: 'Memory Name',value: '',hint: 'Enter memory name',- validate: `maxlength=50`,- validateMessage: 'Enter a non-empty name, not more than 50 characters.',+ validate: `required maxlength=100`,+ validateMessage: 'Enter a non-empty name, not more than 100 characters.',},key: {type: 'textarea',label: 'Key',- value: '{{key}}',+ value: '{{Key}}',hint: 'Enter key',validate: `maxlength=50`,attributes: { 'data-template-vars': 'true' },@@ -23,16 +23,49 @@ export class MemoryWriteKeyVal extends Component {value: {type: 'textarea',label: 'Value',- value: '{{value}}',- hint: 'Enter value',+ value: '{{Value}}',+ hint: 'Text value to store in memory',attributes: { 'data-template-vars': 'true' },},scope: {type: 'select',label: 'Scope',hint: 'Memory Scope',- value: 'Session',- options: ['Session'],+ value: 'ttl',+ options: [+ { value: 'ttl', text: 'TTL' },+ //{ value: 'session', text: 'Session' },+ { value: 'request', text: 'Request' },+ ],+ events: {+ change: (event) => {+ console.log('change', event);+ const target = event.target as HTMLSelectElement;+ const form = target.closest('form');+ const ttl = form?.querySelector('[data-field-name="ttl"]');+ if (target.value === 'ttl') ttl?.classList.remove('hidden');+ else ttl?.classList.add('hidden');+ },+ },+ },+ ttl: {+ type: 'select',+ label: 'TTL',+ hint: 'Time to live',+ value: '300',+ options: [+ { value: '300', text: '5 minutes' },+ { value: '600', text: '10 minutes' },+ { value: '900', text: '15 minutes' },+ { value: '1800', text: '30 minutes' },+ { value: '3600', text: '1 hour' },+ { value: '7200', text: '2 hours' },+ { value: '14400', text: '4 hours' },+ { value: '28800', text: '8 hours' },+ { value: '43200', text: '12 hours' },+ { value: '86400', text: '1 day' },+ { value: '604800', text: '1 week' },+ ],},};@@ -41,11 +74,10 @@ export class MemoryWriteKeyVal extends Component {if (typeof this.data[item] === 'undefined') this.data[item] = this.settings[item].value;}- this.data = {};// #endregion// #region [ I/O config ] ==================- this.properties.defaultOutputs = ['Key', 'Value'];+ this.properties.defaultOutputs = ['Key'];this.properties.defaultInputs = [];if (this.properties.inputs.length == 0) this.properties.inputs = ['Key', 'Value'];// #endregion@@ -59,4 +91,19 @@ export class MemoryWriteKeyVal extends Component {this.drawSettings.addOutputButtonLabel = ' ';// #endregion}++ protected async run(): Promise<any> {+ this.addEventListener('settingsOpened', async (sidebar) => {+ const ttl = sidebar.querySelector('[data-field-name="ttl"]');+ if (ttl) ttl.classList.add('hidden');+ const scope = sidebar.querySelector('[data-field-name="scope"]');+ const scopeValue = scope?.value;+ if (scopeValue === 'ttl') ttl?.classList.remove('hidden');+ else ttl?.classList.add('hidden');+ });++ this.addEventListener('settingsSaved', (settingsValues) => {+ //console.log(settingsValues);+ });+ }}diff --git a/packages/app/src/builder-ui/components/MemoryWriteObject.class.ts b/packages/app/src/builder-ui/components/MemoryWriteObject.class.tsnew file mode 100644index 00000000..e14cafcd--- /dev/null+++ b/packages/app/src/builder-ui/components/MemoryWriteObject.class.ts@@ -0,0 +1,94 @@+import { Component } from './Component.class';++export class MemoryWriteObject extends Component {+ protected async init() {+ // #region [ Settings config ] ==================+ this.settings = {+ memoryName: {+ type: 'input',+ label: 'Memory Name',+ value: '',+ hint: 'Enter memory name',+ validate: `required maxlength=100`,+ validateMessage: 'Enter a non-empty name, not more than 100 characters.',+ },+ scope: {+ type: 'select',+ label: 'Scope',+ hint: 'Memory Scope',+ value: 'ttl',+ options: [+ { value: 'ttl', text: 'TTL' },+ //{ value: 'session', text: 'Session' },+ { value: 'request', text: 'Request' },+ ],+ events: {+ change: (event) => {+ console.log('change', event);+ const target = event.target as HTMLSelectElement;+ const form = target.closest('form');+ const ttl = form?.querySelector('[data-field-name="ttl"]');+ if (target.value === 'ttl') ttl?.classList.remove('hidden');+ else ttl?.classList.add('hidden');+ },+ },+ },+ ttl: {+ type: 'select',+ label: 'TTL',+ hint: 'Time to live',+ value: '300',+ options: [+ { value: '300', text: '5 minutes' },+ { value: '600', text: '10 minutes' },+ { value: '900', text: '15 minutes' },+ { value: '1800', text: '30 minutes' },+ { value: '3600', text: '1 hour' },+ { value: '7200', text: '2 hours' },+ { value: '14400', text: '4 hours' },+ { value: '28800', text: '8 hours' },+ { value: '43200', text: '12 hours' },+ { value: '86400', text: '1 day' },+ { value: '604800', text: '1 week' },+ ],+ },+ };++ // const dataEntries = ['key', 'value'];+ // for (let item of dataEntries) {+ // if (typeof this.data[item] === 'undefined') this.data[item] = this.settings[item].value;+ // }++ // #endregion++ // #region [ I/O config ] ==================+ this.properties.defaultOutputs = ['Key'];+ this.properties.defaultInputs = [];+ if (this.properties.inputs.length == 0) this.properties.inputs = ['Data'];+ // #endregion++ // #region [ Draw config ] ==================+ //this.drawSettings.showSettings = false;+ this.drawSettings.iconCSSClass = 'svg-icon Memory ' + this.constructor.name;+ this.drawSettings.addOutputButton = ' ';+ // this.drawSettings.addInputButton = ' + Entry';+ this.drawSettings.addInputButton = 'Mem Entry';+ this.drawSettings.addOutputButtonLabel = ' ';+ // #endregion+ }++ protected async run(): Promise<any> {+ this.addEventListener('settingsOpened', async (sidebar) => {+ const ttl = sidebar.querySelector('[data-field-name="ttl"]');+ if (ttl) ttl.classList.add('hidden');+ const scope = sidebar.querySelector('[data-field-name="scope"]');+ const scopeValue = scope?.value;+ if (scopeValue === 'ttl') ttl?.classList.remove('hidden');+ else ttl?.classList.add('hidden');+ });++ this.addEventListener('settingsSaved', (settingsValues) => {+ //console.log(settingsValues);+ });+ }+}diff --git a/packages/app/src/builder-ui/components/index.ts b/packages/app/src/builder-ui/components/index.tsindex cbd70cea..3d89a3d1 100644--- a/packages/app/src/builder-ui/components/index.ts+++ b/packages/app/src/builder-ui/components/index.ts@@ -43,12 +43,10 @@ import { LogicAtMost } from './LogicAtMost.class';import { LogicOR } from './LogicOR.class';import { LogicXOR } from './LogicXOR.class';import { MCPClient } from './MCPClient.class';-import { Memory } from './Memory.class';import { MemoryDeleteKey } from './MemoryDeleteKey.class';import { MemoryReadKeyVal } from './MemoryReadKeyVal.class';-import { MemoryReadOutput } from './MemoryReadOutput.class';-import { MemoryWriteInput } from './MemoryWriteInput.class';import { MemoryWriteKeyVal } from './MemoryWriteKeyVal.class';+import { MemoryWriteObject } from './MemoryWriteObject.class';import { MultimodalLLM } from './MultimodalLLM.class';import { Note } from './Note.class';import { POST_APIEndpoint } from './POST_APIEndpoint.class';@@ -80,7 +78,6 @@ const baseComponents = {//GmailReader,//GmailSender,APICall,- Memory,Twitter,LinkedIn,//GoogleSheet,@@ -94,10 +91,10 @@ const baseComponents = {HuggingFace,AgentPlugin,ZapierAction,- MemoryWriteInput,+ MemoryWriteObject,MemoryWriteKeyVal,- MemoryReadOutput,MemoryReadKeyVal,+ MemoryDeleteKey,Note,SchedulerEndpoint,JSONFilter,@@ -114,7 +111,6 @@ const baseComponents = {FTimestamp,Await,POST_APIEndpoint,- MemoryDeleteKey,MultimodalLLM,GenAILLM,FileStore,