Skip to content

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.

OAuth security hotfix

alaa-eddine4b1cb4418247
diff --git a/packages/app/src/backend/routes/pages/builder-sidebar.ts b/packages/app/src/backend/routes/pages/builder-sidebar.ts
index 45766eb6..366f5fae 100644
--- a/packages/app/src/backend/routes/pages/builder-sidebar.ts
+++ b/packages/app/src/backend/routes/pages/builder-sidebar.ts
@@ -94,7 +94,8 @@ const baseMenu: Menu = {
{ name: 'VisionLLM', description: 'Vision LLM', label: 'Vision LLM' },
],
- Triggers: [{ name: 'GmailTrigger', label: 'Gmail Trigger', description: '' }],
+ //hide triggers for now
+ //Triggers: [{ name: 'GmailTrigger', label: 'Gmail Trigger', description: '' }],
Integrations: [],
};
diff --git a/packages/app/src/builder-ui/components/APIEndpoint.class.ts b/packages/app/src/builder-ui/components/APIEndpoint.class.ts
index 39227f8b..a90db71e 100644
--- a/packages/app/src/builder-ui/components/APIEndpoint.class.ts
+++ b/packages/app/src/builder-ui/components/APIEndpoint.class.ts
@@ -285,11 +285,14 @@ export class APIEndpoint extends Component {
});
} else {
// Sync default values from inputs to outputs in compact mode
- this.domElement?.querySelectorAll('.input-endpoint[smt-defaultVal]:not([smt-defaultVal=""])')
+ this.domElement
+ ?.querySelectorAll('.input-endpoint[smt-defaultVal]:not([smt-defaultVal=""])')
.forEach((inputDiv: HTMLElement) => {
const inputName = inputDiv.getAttribute('smt-name');
if (!this.properties.defaultOutputs.includes(inputName)) {
- const outputDiv = this.domElement?.querySelector(`.output-endpoint[smt-name="${inputName}"]`) as HTMLElement;
+ const outputDiv = this.domElement?.querySelector(
+ `.output-endpoint[smt-name="${inputName}"]`,
+ ) as HTMLElement;
if (outputDiv) {
const defaultValue = inputDiv.getAttribute('smt-defaultVal');
this.syncDefaultValue(outputDiv, defaultValue);
@@ -464,7 +467,8 @@ export class APIEndpoint extends Component {
const inputProps = this.properties.inputProps?.find((c) => c.name === name);
// Get the default value from input properties or existing attributes
- const defaultValue = inputProperties?.defaultVal || inputDiv.getAttribute('smt-defaultVal') || '';
+ const defaultValue =
+ inputProperties?.defaultVal || inputDiv.getAttribute('smt-defaultVal') || '';
const outputDiv: any = await super.addOutput(
outputParent,
@@ -560,7 +564,6 @@ export class APIEndpoint extends Component {
);
optionalOutputs.forEach((output) => output.classList.remove('marked-optional'));
// this.settings.method.readonly = false;
-
} else {
advancedItems.forEach((item) => item.classList.add('hidden'));
// In simple mode, restore optional visual state for outputs from optional inputs
@@ -870,7 +873,7 @@ export class APIEndpoint extends Component {
maxConnections: -1,
cssClass: 'exclude-panzoom',
});
- titleWrapper.classList.add('agent-card-connection');
+ titleWrapper.classList.add('agent-card-connection', 'endpoint-connection');
// @ts-ignore
titleWrapper.endpoint = newEndpoint;
newEndpoint['_domElement'] = titleWrapper;
diff --git a/packages/app/src/builder-ui/components/AgentCard.class.ts b/packages/app/src/builder-ui/components/AgentCard.class.ts
index ce8f9ba7..f00dc54b 100644
--- a/packages/app/src/builder-ui/components/AgentCard.class.ts
+++ b/packages/app/src/builder-ui/components/AgentCard.class.ts
@@ -702,9 +702,11 @@ export class AgentCard extends EventEmitter {
}
// Trigger a custom event for React components to listen to
- window.dispatchEvent(new CustomEvent('agentAvatarUpdated', {
- detail: { agentId: this.workspace.agent?.id, avatarUrl: url }
- }));
+ window.dispatchEvent(
+ new CustomEvent('agentAvatarUpdated', {
+ detail: { agentId: this.workspace.agent?.id, avatarUrl: url },
+ }),
+ );
});
}
@@ -883,10 +885,8 @@ export class AgentCard extends EventEmitter {
static checkConnValidity(info: any) {
// if (!info.source.classList.contains('agent-card-connection')) return true;
if (
- (!info.target.classList.contains('agent-card-connection') &&
- info.source.classList.contains('agent-card-connection')) ||
- (!info.source.classList.contains('agent-card-connection') &&
- info.target.classList.contains('agent-card-connection'))
+ !info.target.classList.contains('agent-card-connection') &&
+ info.source.classList.contains('agent-card-connection')
) {
alert(
'Unsupported Connection',
diff --git a/packages/app/src/builder-ui/components/Triggers/GmailTrigger.class.ts b/packages/app/src/builder-ui/components/Triggers/GmailTrigger.class.ts
index a434b511..21db51aa 100644
--- a/packages/app/src/builder-ui/components/Triggers/GmailTrigger.class.ts
+++ b/packages/app/src/builder-ui/components/Triggers/GmailTrigger.class.ts
@@ -30,15 +30,17 @@ export class GmailTrigger extends Trigger {
// Set up component settings with OAuth configuration
this.settings = {
+ ...this.settings,
interval: {
type: 'range',
label: 'Interval',
min: 1,
max: 720,
- value: 1,
+ value: 5,
step: 1,
validate: 'min=1 max=720',
validateMessage: 'Allowed range 1 to 720',
+ desc: 'Interval in minutes',
},
...this.oauth?.configure(),
};
diff --git a/packages/app/src/builder-ui/components/Triggers/Trigger.class.ts b/packages/app/src/builder-ui/components/Triggers/Trigger.class.ts
index 93f63f35..f7384304 100644
--- a/packages/app/src/builder-ui/components/Triggers/Trigger.class.ts
+++ b/packages/app/src/builder-ui/components/Triggers/Trigger.class.ts
@@ -2,10 +2,19 @@ import { Component } from '../Component.class';
export class Trigger extends Component {
protected async init() {
- this.settings = {};
+ this.settings = {
+ triggerEndpoint: {
+ type: 'input',
+ label: 'Trigger Endpoint',
+ hint: 'Trigger Endpoint',
+ validate: `required maxlength=50 custom=isValidEndpoint`,
+ validateMessage: `Provide a valid endpoint that only contains 'a-z', 'A-Z', '0-9', '-', '_' , without leading or trailing spaces. Length should be less than 50 characters.`,
+ attributes: { 'data-template-vars': 'true' },
+ },
+ };
// #region [ I/O config ] ==================
- this.properties.defaultOutputs = ['_'];
+ this.properties.defaultOutputs = ['Payload'];
this.properties.defaultInputs = [];
// #endregion
@@ -21,4 +30,12 @@ export class Trigger extends Component {
this.drawSettings.color = '#ff00f2';
// #endregion
}
+
+ public redraw(triggerSettings?: boolean): any {
+ super.redraw(triggerSettings);
+
+ // add new connection endpoint
+ this.domElement.classList.add('Trigger');
+ this.domElement.setAttribute('smt-trigger', '');
+ }
}
diff --git a/packages/app/src/builder-ui/debugger.ts b/packages/app/src/builder-ui/debugger.ts
index 607fc410..03815c06 100644
--- a/packages/app/src/builder-ui/debugger.ts
+++ b/packages/app/src/builder-ui/debugger.ts
@@ -3191,9 +3191,9 @@ function resetComponentsState({
});
// Redraw workspace on next tick to ensure DOM updates are complete
- // requestAnimationFrame(() => {
- // workspace.redraw();
- // });
+ requestAnimationFrame(() => {
+ workspace.redraw();
+ });
}
/**
diff --git a/packages/app/src/builder-ui/workspace/Workspace.class.ts b/packages/app/src/builder-ui/workspace/Workspace.class.ts
index 2add2407..75b09886 100644
--- a/packages/app/src/builder-ui/workspace/Workspace.class.ts
+++ b/packages/app/src/builder-ui/workspace/Workspace.class.ts
@@ -1369,7 +1369,16 @@ export class Workspace extends EventEmitter {
);
}
} else {
- targetEndpoint = [...targetComponent.querySelectorAll(`.input-endpoint`)][targetEndpointID];
+ //handle the special case of triggers connecting to APIEndpoints
+
+ if (
+ sourceComponent.classList.contains('Trigger') &&
+ targetComponent.classList.contains('APIEndpoint')
+ ) {
+ targetEndpoint = targetComponent.querySelector(`.endpoint-connection`);
+ } else {
+ targetEndpoint = [...targetComponent.querySelectorAll(`.input-endpoint`)][targetEndpointID];
+ }
}
// @ts-ignore