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
remove ee components
Ahmed Essame5a0d14901f3
diff --git a/packages/app/src/backend/routes/pages/builder-sidebar.ts b/packages/app/src/backend/routes/pages/builder-sidebar.tsindex da1447d8..51c2540b 100644--- a/packages/app/src/backend/routes/pages/builder-sidebar.ts+++ b/packages/app/src/backend/routes/pages/builder-sidebar.ts@@ -37,7 +37,6 @@ const baseMenu: Menu = {{ name: 'FSleep', label: 'Sleep', description: '' },{ name: 'LLMAssistant', description: 'LLM Assistant', label: 'LLM Assistant', icon: '' },{ name: 'APICall', label: 'APICall' },- { name: 'Code', description: 'Code', label: 'Code', icon: '' },{ name: 'FileStore', label: 'File Store', description: '', icon: 'Memory' },{ name: 'JSONFilter', label: 'JSON Filter', description: '' },{ name: 'ForEach', label: 'For Each', description: '' },@@ -46,10 +45,7 @@ const baseMenu: Menu = {{ name: 'Await', label: 'Await', description: '' },],- Tools: [- { name: 'ServerlessCode', label: 'NodeJS', description: '', icon: 'Code' },- { name: 'MCPClient', label: 'MCP Client', description: '', icon: 'MCP' },- ],+ 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' },@@ -63,15 +59,7 @@ const baseMenu: Menu = {{ name: 'FSign', label: 'F:Sign', description: '' },{ name: 'FTimestamp', label: 'F:Timestamp', description: '' },],- 'RAG Data': [- {- label: 'Manage My Vector DB',- externalLink: '/data',- },- { name: 'DataSourceLookup', label: 'RAG Search', description: '' },- { name: 'DataSourceIndexer', label: 'RAG Remember', description: '' },- { name: 'DataSourceCleaner', label: 'RAG Forget', description: '' },- ],+ 'RAG Data': [],Logic: [{ name: 'LogicAND', description: 'AND', label: 'And', icon: 'LogicAND' },@@ -125,6 +113,7 @@ export const getBuilderSidebarMenu = () => {description: string;icon: string;section: string;+ externalLink?: string;};}[])@@ -137,11 +126,19 @@ export const getBuilderSidebarMenu = () => {if (!menuClone[section]) {menuClone[section] = [];}- (menuClone[section] as MenuItem[]).push({- name: item.name,- label: item.label,- description: item.description,- });++ if (item.externalLink) {+ (menuClone[section] as MenuItem[]).push({+ externalLink: item.externalLink,+ label: item.label,+ });+ } else {+ (menuClone[section] as MenuItem[]).push({+ name: item.name,+ label: item.label,+ description: item.description,+ });+ }}return menuClone;diff --git a/packages/app/src/builder-ui/components/Code.class.ts b/packages/app/src/builder-ui/components/Code.class.tsdeleted file mode 100644index 1a19bbda..00000000--- a/packages/app/src/builder-ui/components/Code.class.ts+++ /dev/null@@ -1,172 +0,0 @@-import { Component } from './Component.class';-declare var Metro;--export class Code extends Component {- public templateSupport = true;- protected async init() {- const codeSample = `-//This is a simple example of how to use the code component.-let result = _A + _B;-let message = \`The sum of \${_A} and \${_B} is \${result}\`;-_output = {result, message};--//_output variable is bound to component Output endpoint-// _output can be a json object or a primitive value---`;- this.settings = {- code_vars: {- type: 'textarea',- code: { mode: 'javascript', theme: 'chrome' },- label: 'Variables',- value: '',- validate: ``,- validateMessage: ``,- help: 'A variable stores data that can be used and modified in your code, such as numbers, text, or objects.',- tooltipClasses: 'w-56',- arrowClasses: '-ml-11',- attributes: { readonly: 'readonly' },- },- code_body: {- type: 'textarea',- code: { mode: 'javascript', theme: 'chrome' },- label: `Code`,- help: 'Code to process inputs.',- tooltipClasses: 'w-44',- arrowClasses: '-ml-11',- value: codeSample,- validate: `maxlength=500000`,- validateMessage: `The code length is limitted to 500,000 characters`,- attributes: {},- },- };-- const dataEntries = ['code_vars', 'code_body'];- for (let item of dataEntries) {- if (typeof this.data[item] === 'undefined') this.data[item] = this.settings[item].value;- }- if (this.properties.template && !this.data._templateVars) {- this.data._templateVars = {};- }-- // #region [ Output config ] ==================- //this.outputSettings = { ...this.outputSettings, description: { type: 'string', default: '', editConfig: { type: 'textarea' } } };- // #endregion-- this.properties.defaultInputs = [];- if (this.properties.inputs.length == 0) this.properties.inputs = ['A', 'B'];- this.properties.defaultOutputs = ['Output'];- if (this.properties.outputs.length == 0) this.properties.outputs = ['Output', '_error'];-- this.data.code_vars = this.generateCodeVars(JSON.parse(JSON.stringify(this.properties.inputs)));-- this.drawSettings.displayName = 'Code';-- const templateIcon = this.properties.template?.templateInfo?.icon || '';- const templateIconColor = this.properties.template?.templateInfo?.color || '#000000';- const svgIcon = templateIcon && templateIcon.startsWith('<svg');- this.drawSettings.iconCSSClass = templateIcon- ? `tpl-fa-icon ${templateIcon}`- : `svg-icon ${this.constructor.name}`;- this.drawSettings.color = templateIcon ? templateIconColor : '#00BCD4';- if (svgIcon) this.drawSettings.iconCSSClass = templateIcon;-- this.drawSettings.componentDescription = 'Process inputs with code';- this.drawSettings.shortDescription = 'Process inputs with code';- //this.drawSettings.showSettings = false;-- this._ready = true;- }- protected async run() {- this.addEventListener('endpointAdded', this.updateCodeVars.bind(this));- this.addEventListener('endpointRemoved', this.updateCodeVars.bind(this));- this.addEventListener('endpointChanged', this.updateCodeVars.bind(this));-- this.addEventListener('settingsOpened', async (sidebar, component) => {- if (component !== this) return;- console.log('settingsOpened');-- const code_vars = sidebar.querySelector('#code_vars');- if (code_vars) {- code_vars.classList.add('hidden');- const vars_editor = code_vars._editor;- if (vars_editor) {- vars_editor.session.setOption('useWorker', false);- vars_editor.clearSelection();- }- }-- const code_body = sidebar.querySelector('#code_body');- if (code_body) {- code_body.classList.add('hidden');- const body_editor = code_body._editor;-- if (body_editor) {- body_editor.clearSelection();- }- }- });-- //await delay(500);- //this.updateCodeVars();- }-- updateCodeVars() {- const inputs = [...this.domElement.querySelectorAll('.input-container .input-endpoint')].map(- (e) => e.getAttribute('smt-name'),- );- this.data.code_vars = this.generateCodeVars(inputs);-- const sidebar = this.getSettingsSidebar();- if (sidebar) {- const codeVars: any = sidebar.querySelector('#code_vars');- if (codeVars) codeVars.value = this.data.code_vars;- if (codeVars && codeVars._editor) codeVars._editor.setValue(this.data.code_vars); //ACE editor- }- }- generateCodeVars(inputs: string[]) {- let codeVars = ``;- if (inputs.length >= 1) {- codeVars = `//Use these variables to access your input values.\n`;- inputs.push(''); //add empty string to process the case of single input;- codeVars += inputs.reduce((acc, val) => {- if (!val && !acc.startsWith('const ')) return `const _${acc}={{${acc}}};`;-- if (!val) return acc;-- return acc.startsWith('const ')- ? `${acc}\nconst _${val}={{${val}}};`- : `const _${acc}={{${acc}}};\nconst _${val}={{${val}}};`;- });- }- codeVars += `\n\n//This variable determines the output of your component.\nlet _output=undefined;`;- codeVars += '\n';- return codeVars;- }-- public exportTemplate() {- // if (this.properties.template) {- // return this.properties.template;- // }- let data = JSON.parse(JSON.stringify(this.data));- const settings = {};- data.code_body = data.code_body || '';- data.code_body = this.parseTemplateString(data.code_body, settings);-- const inputs = this.properties.inputProps;- const outputs = this.properties.outputProps;-- const template = {- name: this.title,- componentName: this.constructor.name,- description: this.description,- settings,- data,- inputs,- outputs,- };-- return template;- }-}diff --git a/packages/app/src/builder-ui/components/DataSourceCleaner.class.ts b/packages/app/src/builder-ui/components/DataSourceCleaner.class.tsdeleted file mode 100644index 6956a51c..00000000--- a/packages/app/src/builder-ui/components/DataSourceCleaner.class.ts+++ /dev/null@@ -1,78 +0,0 @@-import { delay } from '../utils';-import { Component } from './Component.class';-declare var Metro;--// @ts-ignore-export class DataSourceCleaner extends Component {- private namespaces: string[] = [];-- protected async prepare(): Promise<any> {- this.updateSettings();- }-- protected async updateSettings() {- const result = await fetch(- `${this.workspace.server}/api/component/DataSourceCleaner/namespaces`,- );- const namespaces = await result.json();- this.namespaces = namespaces.map((item) => ({ value: item.id, text: item.name }));- this.settings.namespaceId.options = this.namespaces;- if (this.settingsOpen) this.refreshSettingsSidebar();- }-- protected async init() {- this.settings = {- namespaceId: {- type: 'select',- label: 'namespace',- hint: 'Select namespace',- options: this.namespaces,- },-- id: {- type: 'input',- label: `source identifier`,- hint: `Accepted characters: 'a-z', 'A-Z', '0-9', '-', '_', '.'`,- validate: `custom=isValidId`,- validateMessage: `It should contain only 'a-z', 'A-Z', '0-9', '-', '_', '.', `,- attributes: { 'data-template-vars': 'true' },- },- };-- const dataEntries = [];- for (let item of dataEntries) {- if (typeof this.data[item] === 'undefined') this.data[item] = this.settings[item].value;- }-- this.properties.defaultInputs = [];- this.properties.defaultOutputs = ['Success'];-- this.drawSettings.iconCSSClass = 'svg-icon ' + this.constructor.name;- this.drawSettings.displayName = 'Source Cleaner';- this.drawSettings.shortDescription = 'Delete data sources from data pool';- this.drawSettings.color = '#fb3464';-- this.drawSettings.showSettings = true;- }-- protected async checkSettings() {- super.checkSettings();-- if (!this.namespaces || this.namespaces.length == 0) await delay(3000);-- const namespaces = {};- this.namespaces.forEach((ns: any) => {- namespaces[ns.value] = ns.text;- });- if (this.data['namespace']) {- const nsId = this.data['namespace'];- if (!namespaces[nsId]) {- console.log('Namespace Missing', nsId);- this.addComponentMessage(- `Missing Namespace<br /><a href="/data" target="_blank" style="color:#33b;text-decoration:underline">Create one</a> then configure it for this component`,- 'alert',- );- }- }- }-}diff --git a/packages/app/src/builder-ui/components/DataSourceIndexer.class.ts b/packages/app/src/builder-ui/components/DataSourceIndexer.class.tsdeleted file mode 100644index ce34ce6d..00000000--- a/packages/app/src/builder-ui/components/DataSourceIndexer.class.ts+++ /dev/null@@ -1,101 +0,0 @@-import { delay } from '../utils';-import { Component } from './Component.class';-declare var Metro;--// @ts-ignore-export class DataSourceIndexer extends Component {- private namespaces: string[] = [];-- protected async prepare(): Promise<any> {- this.updateSettings();- }-- protected async updateSettings() {- const result = await fetch(- `${this.workspace.server}/api/component/DataSourceIndexer/namespaces`,- );- const namespaces = await result.json();- this.namespaces = namespaces.map((item) => ({ value: item.id, text: item.name }));- this.settings.namespace.options = this.namespaces;- if (this.settingsOpen) this.refreshSettingsSidebar();- }-- protected async init() {- this.settings = {- namespace: {- type: 'select',- label: 'namespace',- hint: 'Select namespace',- options: this.namespaces,- },-- id: {- type: 'input',- label: `source identifier`,- hint: `Accepted characters: 'a-z', 'A-Z', '0-9', '-', '_', '.'`,- attributes: { 'data-template-vars': 'true' },- validate: `custom=isValidId`,- validateMessage: `It should contain only 'a-z', 'A-Z', '0-9', '-', '_', '.' `,- },- name: {- type: 'input',- label: 'label',- hint: 'a human readable label for the data source',- attributes: { 'data-template-vars': 'true' },- validate: `maxlength=50`,- validateMessage: 'Enter a non-empty label, not more than 50 characters.',- },-- metadata: {- type: 'textarea',- label: 'Metadata',- value: '',- validate: `maxlength=10000`,- hint: 'Enter the source metadata, not more than 10000 characters.',- attributes: { 'data-template-vars': 'true' },- },-- // isAutoId: {- // type: 'checkbox',- // label: 'Auto generate Id',- // value: false,- // },- };-- const dataEntries = ['namespace'];- for (let item of dataEntries) {- if (typeof this.data[item] === 'undefined') this.data[item] = this.settings[item].value;- }-- this.properties.defaultInputs = ['Source'];- this.properties.defaultOutputs = ['Success'];-- this.drawSettings.iconCSSClass = 'svg-icon ' + this.constructor.name;- this.drawSettings.displayName = 'Source Indexer';- this.drawSettings.shortDescription = 'Index data sources to data pool';- this.drawSettings.color = '#fb3464';-- this.drawSettings.showSettings = true;- }-- protected async checkSettings() {- super.checkSettings();-- if (!this.namespaces || this.namespaces.length == 0) await delay(3000);-- const namespaces = {};- this.namespaces.forEach((ns: any) => {- namespaces[ns.value] = ns.text;- });- if (this.data['namespace']) {- const nsId = this.data['namespace'];- if (!namespaces[nsId]) {- console.log('Namespace Missing', nsId);- this.addComponentMessage(- `Missing Namespace<br /><a href="/data" target="_blank" style="color:#33b;text-decoration:underline">Create one</a> then configure it for this component`,- 'alert',- );- }- }- }-}diff --git a/packages/app/src/builder-ui/components/DataSourceLookup.class.ts b/packages/app/src/builder-ui/components/DataSourceLookup.class.tsdeleted file mode 100644index 06fcddbe..00000000--- a/packages/app/src/builder-ui/components/DataSourceLookup.class.ts+++ /dev/null@@ -1,97 +0,0 @@-import { delay } from '../utils';-import { Component } from './Component.class';-declare var Metro;--// @ts-ignore-export class DataSourceLookup extends Component {- private namespaces: string[] = [];-- protected async prepare(): Promise<any> {- this.updateSettings();- }-- protected async updateSettings() {- const result = await fetch(- `${this.workspace.server}/api/component/DataSourceLookup/namespaces`,- );- const namespaces = await result.json();- this.namespaces = namespaces.map((item) => ({ value: item.id, text: item.name }));- this.settings.namespace.options = this.namespaces;- if (this.settingsOpen) this.refreshSettingsSidebar();- }-- protected async init() {- this.settings = {- namespace: {- type: 'select',- label: 'namespace',- hint: 'Select namespace',- options: this.namespaces,- },- topK: {- type: 'number',- label: 'Results count',- hint: 'Number of results to return',- value: 3,- validate: `required min=0 custom=isValidInteger`,- validateMessage: `Please enter a positive number`,- },- includeMetadata: {- type: 'checkbox',- label: 'Include metadata',- value: false,- },- scoreThreshold: {- type: 'range',- label: 'Score threshold',- hint: 'Score threshold',- value: 0.5,- min: 0,- max: 1,- step: 0.01,- help: 'Score threshold for filtering results — the higher the threshold, the more restrictive the filtering.',- },- includeScore: {- type: 'checkbox',- label: 'Include score',- value: false,- },- };-- const dataEntries = ['namespace', 'topK', 'scoreThreshold', 'includeScore'];- for (let item of dataEntries) {- if (typeof this.data[item] === 'undefined') this.data[item] = this.settings[item].value;- }-- this.properties.defaultInputs = ['Query'];- this.properties.defaultOutputs = ['Results'];-- this.drawSettings.iconCSSClass = 'svg-icon ' + this.constructor.name;- this.drawSettings.displayName = 'Data Lookup';- this.drawSettings.shortDescription = 'Lookup data from data pool';- this.drawSettings.color = '#fb3464';-- this.drawSettings.showSettings = true;- }-- protected async checkSettings() {- super.checkSettings();-- if (!this.namespaces || this.namespaces.length == 0) await delay(3000);-- const namespaces = {};- this.namespaces.forEach((ns: any) => {- namespaces[ns.value] = ns.text;- });- if (this.data['namespace']) {- const nsId = this.data['namespace'];- if (!namespaces[nsId]) {- console.log('Namespace Missing', nsId);- this.addComponentMessage(- `Missing Namespace<br /><a href="/data" target="_blank" style="color:#33b;text-decoration:underline">Create one</a> then configure it for this component`,- 'alert',- );- }- }- }-}diff --git a/packages/app/src/builder-ui/components/ServerlessCode.class.ts b/packages/app/src/builder-ui/components/ServerlessCode.class.tsdeleted file mode 100644index 22a5288a..00000000--- a/packages/app/src/builder-ui/components/ServerlessCode.class.ts+++ /dev/null@@ -1,408 +0,0 @@-import { Component } from './Component.class';-import { importRegex } from '../ui/form/custom-validator-functions';-import { promptVaultInfo } from '../utils';--export class ServerlessCode extends Component {- public templateSupport = false;-- protected async init() {- const packagesImportsSample = `/*-* Enter packages imports here-*/-import dayjs from 'dayjs';`;-- const codeSample = `/*-* Enter code body here-* return value is bound to component Output endpoint-*/-return dayjs().format();`;-- this.settings = {- code_imports: {- type: 'textarea',- code: { mode: 'javascript', theme: 'chrome' },- label: 'Code Editor',- value: packagesImportsSample,- // validate: `custom=isValidImports`,- // validateMessage: `Invalid imports`,- // hint: 'Packages to be used in the code',- attributes: {- class: 'code-imports',- 'data-scroll-margin-top': 5,- 'data-scroll-margin-bottom': 5,- 'data-scroll-margin-left': 0,- 'data-scroll-margin-right': 0,- },- classOverride: 'code-imports-container',- },- function_label: {- type: 'div',- html: `- <div class="code-editor-label-container-wrapper">- <div class="code-editor-label-container" id="function-label-top-container">- <div class="code-editor-label-container-left-border"></div>- <div id="function-label-text" class="code-editor-label-container-right-border">async main() {</div>- </div>- </div>`,- label: '',- attributes: {- labelCase: 'none',- },- classOverride: 'function-label-container',- },- code_body: {- type: 'textarea',- code: { mode: 'javascript', theme: 'chrome', disableWorker: true },- label: '',- value: codeSample,- validate: `maxlength=500000`,- validateMessage: `The code length is limitted to 500,000 characters`,- attributes: {- labelCase: 'none',- class: 'code-body',- 'data-scroll-margin-top': 5,- 'data-scroll-margin-bottom': 5,- 'data-scroll-margin-left': 0,- 'data-scroll-margin-right': 0,- },- classOverride: 'code-body-container',- },- function_label_end: {- type: 'div',- html: `- <div class="code-editor-label-container">- <div class="code-editor-label-container-left-border"></div>- <div class="code-editor-label-container-right-border">}</div>- </div>`,- label: '',- attributes: {- labelCase: 'none',- },- classOverride: 'function-label-container',- },- pricing_note: {- type: 'div',- html: '<div class="pricing-note">* This component will incur cloud usage cost. Configure your custom keys in advance to avoid extra charges.</div>',- label: '',- attributes: {- class: 'pricing-note',- },- },- ...(!this.isLegacyPlan()- ? {- use_own_keys: {- type: 'toggle',- label: 'Use Custom Cloud Keys',- value: false,- // hint: 'NodeJS is executed in AWS Lambda, Bring your own keys',- display: 'inline',- events: {- change: this.useOwnKeysChangeHandler.bind(this),- },- section: `${this.isLegacyPlan() ? 'Credentials' : 'Advanced'}`,- attributes: {},- classOverride: 'use-own-keys',- },- }- : {}),- hintSelect: {- type: 'p',- html: '<small>NodeJS is executed in AWS Lambda. You can bring your own keys or use our default keys.</small>',- section: `${this.isLegacyPlan() ? 'Credentials' : 'Advanced'}`,- attributes: {- class: 'hint-select mt-[-30px]',- },- },- accessKeyId: {- type: 'input',- label: 'AWS Access Key ID',- value: '',- validate: `${this.isLegacyPlan() ? 'required' : ''} maxlength=350`,- validateMessage: `Ensure a non-empty AWS Access Key ID`,- attributes: {- placeholder: 'Select AWS Access Key ID',- 'data-vault': `All`,- 'data-vault-exclusive': true,- },- events: {- input: (event) => promptVaultInfo(event, 'AWS_ACCESS_KEY_ID'),- focus: (event) => promptVaultInfo(event, 'AWS_ACCESS_KEY_ID'),- },- section: `${this.isLegacyPlan() ? 'Credentials' : 'Advanced'}`,- },- secretAccessKey: {- type: 'input',- label: 'AWS Secret Access Key',- value: '',- validate: `${this.isLegacyPlan() ? 'required' : ''}maxlength=350`,- validateMessage: `Ensure a non-empty AWS Secret Access Key`,- attributes: {- placeholder: 'Select AWS Secret Access Key',- 'data-vault': `All`,- 'data-vault-exclusive': true,- },- events: {- input: (event) => promptVaultInfo(event, 'AWS_SECRET_ACCESS_KEY'),- focus: (event) => promptVaultInfo(event, 'AWS_SECRET_ACCESS_KEY'), // required when insert the key from vault key list- },- section: `${this.isLegacyPlan() ? 'Credentials' : 'Advanced'}`,- },- region: {- type: 'select',- label: 'Region',- value: 'us-east-1',- options: [- { text: 'US East (N. Virginia) - us-east-1', value: 'us-east-1' },- { text: 'US East (Ohio) - us-east-2', value: 'us-east-2' },- { text: 'US West (N. California) - us-west-1', value: 'us-west-1' },- { text: 'US West (Oregon) - us-west-2', value: 'us-west-2' },- { text: 'Africa (Cape Town) - af-south-1', value: 'af-south-1' },- { text: 'Asia Pacific (Hong Kong) - ap-east-1', value: 'ap-east-1' },- { text: 'Asia Pacific (Mumbai) - ap-south-1', value: 'ap-south-1' },- { text: 'Asia Pacific (Osaka) - ap-northeast-3', value: 'ap-northeast-3' },- { text: 'Asia Pacific (Seoul) - ap-northeast-2', value: 'ap-northeast-2' },- { text: 'Asia Pacific (Singapore) - ap-southeast-1', value: 'ap-southeast-1' },- { text: 'Asia Pacific (Sydney) - ap-southeast-2', value: 'ap-southeast-2' },- { text: 'Asia Pacific (Tokyo) - ap-northeast-1', value: 'ap-northeast-1' },- { text: 'Canada (Central) - ca-central-1', value: 'ca-central-1' },- { text: 'EU (Frankfurt) - eu-central-1', value: 'eu-central-1' },- { text: 'EU (Ireland) - eu-west-1', value: 'eu-west-1' },- { text: 'EU (London) - eu-west-2', value: 'eu-west-2' },- { text: 'EU (Milan) - eu-south-1', value: 'eu-south-1' },- { text: 'EU (Paris) - eu-west-3', value: 'eu-west-3' },- { text: 'EU (Stockholm) - eu-north-1', value: 'eu-north-1' },- { text: 'Middle East (Bahrain) - me-south-1', value: 'me-south-1' },- { text: 'South America (São Paulo) - sa-east-1', value: 'sa-east-1' },- ],- help: 'Select AWS Region for Lambda',- section: `${this.isLegacyPlan() ? 'Credentials' : 'Advanced'}`,- //helpUrl: '#',- //source: () => {},- },- role: {- type: 'div',- html: '<div></div>',- label: 'Assigned Role',- section: `${this.isLegacyPlan() ? 'Credentials' : 'Advanced'}`,- },- };-- const dataEntries = ['code_imports', 'code_body', 'use_own_keys'];- for (let item of dataEntries) {- if (typeof this.data[item] === 'undefined') this.data[item] = this.settings[item]?.value;- }-- this.properties.defaultInputs = [];- this.properties.defaultOutputs = ['Output'];- if (this.properties.outputs.length == 0) this.properties.outputs = ['Output', '_error'];-- this.drawSettings.displayName = 'NodeJS';-- const templateIcon = this.properties.template?.templateInfo?.icon || '';- const templateIconColor = this.properties.template?.templateInfo?.color || '#000000';- const svgIcon = templateIcon && templateIcon.startsWith('<svg');- this.drawSettings.iconCSSClass = templateIcon- ? `tpl-fa-icon ${templateIcon}`- : `svg-icon ${this.constructor.name}`;- this.drawSettings.color = templateIcon ? templateIconColor : '#00BCD4';- if (svgIcon) this.drawSettings.iconCSSClass = templateIcon;- this.data.use_own_keys = !this.doHideAWSKeys(this.data);- this.drawSettings.componentDescription = 'Execute code in a NodeJS environment';- this.drawSettings.shortDescription = 'Execute code in a NodeJS environment';- this._ready = true;- }- protected async run() {- this.addEventListener('endpointAdded', this.updateCodeVars.bind(this));- this.addEventListener('endpointRemoved', this.updateCodeVars.bind(this));- this.addEventListener('endpointChanged', this.updateCodeVars.bind(this));-- this.addEventListener('settingsOpened', async (sidebar, component) => {- if (component !== this) return;- const code_imports = sidebar.querySelector('#code_imports');- if (code_imports) {- code_imports.classList.add('hidden');- const imports_editor = code_imports._editor;- if (imports_editor) {- imports_editor.session.setOption('useWorker', false);- imports_editor.clearSelection();- }- }-- const code_body = sidebar.querySelector('#code_body');- if (code_body) {- code_body.classList.add('hidden');- const body_editor = code_body._editor;-- if (body_editor) {- body_editor.clearSelection();- }- }-- const role = document.querySelector('[data-field-name="role"]');- if (role) role.classList.add('hidden');- this.setFunctionLabelStyling();- this.setCodeBodyTitle([]);-- this.toggleAWSKeys(this.isLegacyPlan() ? false : this.doHideAWSKeys(this.data));- });- }-- private doHideAWSKeys(data) {- if (data?.use_own_keys) {- return false;- }- if (!this.isLegacyPlan() && !data?.use_own_keys) {- return true;- }- // for legacy users, we need to show the AWS keys if they have them- if (data?.accessKeyId && data?.secretAccessKey && data?.region) {- return false;- }- return true;- }-- private setFunctionLabelStyling() {- const functionLabelElement = document.querySelector('[data-field-name="function_label"]');- if (functionLabelElement) {- functionLabelElement.setAttribute(- 'style',- 'margin-top: 0 !important; margin-bottom: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important; padding-right: 0 !important;',- );- }- const functionLabelElementEnd = document.querySelector(- '[data-field-name="function_label_end"]',- );- if (functionLabelElementEnd) {- functionLabelElementEnd.setAttribute(- 'style',- 'margin-top: 0 !important; margin-bottom: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important; padding-right: 0 !important;',- );- }- }- private useOwnKeysChangeHandler(e) {- const form = e.target.closest('form');- if (!form) return;- const accessKeyId = form.querySelector('[data-field-name="accessKeyId"]');- const secretAccessKey = form.querySelector('[data-field-name="secretAccessKey"]');- const region = form.querySelector('[data-field-name="region"]');- if (!accessKeyId || !secretAccessKey || !region) return;-- if (e.target.checked) {- this.toggleAWSKeys(false);- } else {- this.toggleAWSKeys(true);- }- }-- protected async updateRole() {- const lambdaFunctionData = await this.fetchDeploymentStatus();- if (lambdaFunctionData?.data) {- const role = lambdaFunctionData.data.role;- const roleName = role.split('/').pop();- const roleUrl = `https://${this.data.region}.console.aws.amazon.com/iam/home?region=${this.data.region}#/roles/details/${roleName}?section=permissions`;- const roleLink = `- <a style="text-decoration: underline" href="${roleUrl}" target="_blank">Manage AWS Role</a>`;- const roleContainer = document.querySelector('#role');- if ((roleContainer && this.data.use_own_keys) || this.isLegacyPlan()) {- roleContainer.innerHTML = roleLink;- const roleField = document.querySelector('[data-field-name="role"]');- roleField.classList.remove('hidden');- }- }- }-- private async toggleAWSKeys(hide: boolean) {- const accessKeyId = document.querySelector('[data-field-name="accessKeyId"]');- const secretAccessKey = document.querySelector('[data-field-name="secretAccessKey"]');- const region = document.querySelector('[data-field-name="region"]');- const role = document.querySelector('[data-field-name="role"]');- const hintSelect = document.querySelector('[data-field-name="hintSelect"]');- if (!accessKeyId || !secretAccessKey || !region) return;- if (hide) {- accessKeyId.classList.add('hidden');- secretAccessKey.classList.add('hidden');- region.classList.add('hidden');- role.classList.add('hidden');- hintSelect.classList.add('hidden');- } else {- accessKeyId.classList.remove('hidden');- secretAccessKey.classList.remove('hidden');- region.classList.remove('hidden');- hintSelect.classList.remove('hidden');- await this.updateRole();- }- }-- protected validateServerlessCode(input: string) {- const lines = input.split('\n');- return lines.every((line) => line.trim() === '' || !importRegex.test(line));- }-- protected async fetchDeploymentStatus() {- const response = await fetch('/api/page/builder/serverless-code/get-deployment-status', {- method: 'POST',- headers: {- 'Content-Type': 'application/json',- },- body: JSON.stringify({- agentId: this.workspace.agent.id,- componentId: Component.curComponentSettings.uid,- awsConfigs: {- accessKeyId: this.data.accessKeyId,- secretAccessKey: this.data.secretAccessKey,- region: this.data.region,- },- }),- });- return response.json();- }-- protected setCodeBodyTitle(endpointInputs: string[]) {- // want to change code body title based on inputs- const sidebar = this.getSettingsSidebar();- if (sidebar) {- const inputs =- endpointInputs && endpointInputs.length ? endpointInputs : this.properties.inputs;-- const functionLabelText = document.querySelector('#function-label-text');- if (functionLabelText) {- functionLabelText.textContent = `async main(${inputs.join(', ')}) {`;- }- }- }-- async updateCodeVars() {- const inputs = [...this.domElement.querySelectorAll('.input-container .input-endpoint')].map(- (e) => e.getAttribute('smt-name'),- );- this.setCodeBodyTitle(inputs);- }-- public exportTemplate() {- // if (this.properties.template) {- // return this.properties.template;- // }- let data = JSON.parse(JSON.stringify(this.data));- const settings = {};- data.code_body = data.code_body || '';- data.code_body = this.parseTemplateString(data.code_body, settings);-- const inputs = this.properties.inputProps;- const outputs = this.properties.outputProps;-- const template = {- name: this.title,- componentName: this.constructor.name,- description: this.description,- settings,- data,- inputs,- outputs,- };-- return template;- }- isLegacyPlan() {- return this.workspace.teamData.isLegacyPlan;- }-}diff --git a/packages/app/src/builder-ui/components/index.ts b/packages/app/src/builder-ui/components/index.tsindex e6949046..42f115e4 100644--- a/packages/app/src/builder-ui/components/index.ts+++ b/packages/app/src/builder-ui/components/index.ts@@ -8,11 +8,7 @@ import { Async } from './Async.class';import { Await } from './Await.class';import { Base64Encoder } from './Base64Encoder.class';import { Classifier } from './Classifier.class';-import { Code } from './Code.class';import { Component } from './Component.class';-import { DataSourceCleaner } from './DataSourceCleaner.class';-import { DataSourceIndexer } from './DataSourceIndexer.class';-import { DataSourceLookup } from './DataSourceLookup.class';import { DBInsert } from './DBInsert.class';import { EmailSender } from './EmailSender.class';import { FCrypto } from './FCrypto.class';@@ -59,7 +55,6 @@ import { POST_APIEndpoint } from './POST_APIEndpoint.class';import { PromptGenerator } from './PromptGenerator.class';import { Redirect } from './Redirect.class';import { SchedulerEndpoint } from './SchedulerEndpoint.class';-import { ServerlessCode } from './ServerlessCode.class';import { SMSSender } from './SMSSender';import { TTS } from './TTS.class';import { Twitter } from './Twitter.class';@@ -73,7 +68,6 @@ const baseComponents = {//FormParser,InputSync,//EmailReader,- DataSourceLookup,GPTPlugin,EmailSender,FileExport,@@ -105,10 +99,6 @@ const baseComponents = {Note,SchedulerEndpoint,JSONFilter,- DataSourceIndexer,- DataSourceCleaner,- Code,- ServerlessCode,ForEach,VisionLLM,LLMAssistant,diff --git a/packages/app/tsconfig.json b/packages/app/tsconfig.jsonindex f65b65a0..75a3bc1f 100644--- a/packages/app/tsconfig.json+++ b/packages/app/tsconfig.json@@ -22,7 +22,7 @@"include": ["src/**/*","node_modules/@types",- "eslint.config.js", "../../../src/server/api/pages/quota.ts", "../../../src/react/features/subscriptions/utils", "../../../src/react/features/agent-settings/pages/AgentSettingsBulkCallPage.tsx", "../../../src/react/features/agent-settings/components/agent-bulk-call/BulkSkillCallForm.tsx", "../../../src/react/features/agent-settings/components/agent-bulk-call/meta/skill-calls-utils.tsx", "../../../src/react/features/agent-settings/components/agent-bulk-call/meta/UploadDataBtn.tsx", "../../../src/react/features/templates/components/AgentsPageTemplateSection.tsx", "../../../src/server/api/pages/templates.ts", "../../../src/builder-ui/features/logs_page/index.ts", "../../../src/server/routes/api/pages/logs.ts",+ "eslint.config.js", "../../../src/server/api/pages/quota.ts", "../../../src/react/features/subscriptions/utils", "../../../src/react/features/agent-settings/pages/AgentSettingsBulkCallPage.tsx", "../../../src/react/features/agent-settings/components/agent-bulk-call/BulkSkillCallForm.tsx", "../../../src/react/features/agent-settings/components/agent-bulk-call/meta/skill-calls-utils.tsx", "../../../src/react/features/agent-settings/components/agent-bulk-call/meta/UploadDataBtn.tsx", "../../../src/react/features/templates/components/AgentsPageTemplateSection.tsx", "../../../src/server/api/pages/templates.ts", "../../../src/builder-ui/features/logs_page/index.ts", "../../../src/server/routes/api/pages/logs.ts", "../../../src/builder-ui/components/ServerlessCode.class.ts",],"exclude": ["node_modules"]}