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.

remove planInfo footprint

Forhad Hosaind8c1659da867
diff --git a/packages/runtime/src/core/connectors/SmythOSSAgentDataConnector.class.ts b/packages/runtime/src/core/connectors/SmythOSSAgentDataConnector.class.ts
index 07aa94df..13e20980 100644
--- a/packages/runtime/src/core/connectors/SmythOSSAgentDataConnector.class.ts
+++ b/packages/runtime/src/core/connectors/SmythOSSAgentDataConnector.class.ts
@@ -112,9 +112,6 @@ export class SmythOSSAgentDataConnector extends AgentDataConnector {
agentObj.data = this.migrateAgentData(agentObj.data);
- // add plan info to the agent data
- agentObj.data.planInfo = this.parsePlanData(agentObj);
-
return agentObj;
} catch (error: any) {
console.error(error.response?.data, error.message);
@@ -315,49 +312,4 @@ export class SmythOSSAgentDataConnector extends AgentDataConnector {
return data;
}
-
- private parsePlanData(agentData) {
- // free plans cannot register a domain
- //FIXME : this check is probably weak, we need to make sure that it's always accurate or implement a better way to check.
- const planId = agentData?.team?.subscription?.plan?.id;
- const planName = agentData?.team?.subscription?.plan?.name;
- const isFreePlan = agentData?.team?.subscription?.plan?.isDefaultPlan;
- let tasksQuota =
- (agentData?.team?.subscription?.properties?.tasks || 0) +
- (agentData?.team?.subscription?.properties?.bonusTasks || 0);
- //exception for early adopters
- tasksQuota =
- agentData?.team?.subscription?.plan?.name == "Early Adopters"
- ? Infinity
- : tasksQuota;
-
- let usedTasks = agentData.taskData.tasks;
- let remainingTasks = Math.max(tasksQuota - usedTasks, 0);
- // apply latency to free plans with no paid tasks in order to preserve resources
- const maxLatency =
- isFreePlan && remainingTasks <= 0
- ? process.env.MAX_LATENCY_FREE_USER || 100
- : process.env.MAX_LATENCY_PAID_USER || 10;
- const maxParellelRequests =
- isFreePlan && remainingTasks <= 0 ? 1 : Infinity;
-
- const flags = agentData?.team?.subscription?.plan?.properties?.flags || {};
- const properties = agentData?.team?.subscription?.properties || {};
- const isDefaultPlan =
- agentData?.team?.subscription?.plan?.isDefaultPlan || false;
-
- return {
- planId,
- planName,
- isFreePlan,
- tasksQuota,
- usedTasks,
- remainingTasks,
- maxLatency,
- maxParellelRequests,
- flags,
- properties,
- isDefaultPlan,
- };
- }
}
diff --git a/packages/runtime/src/core/types/agent.types.ts b/packages/runtime/src/core/types/agent.types.ts
deleted file mode 100644
index b24fd833..00000000
--- a/packages/runtime/src/core/types/agent.types.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-// **********************************************************************************
-//* Until now, the agent.types.ts file is identical across sre-builder-debugger, sre-agent-server, and sre-embodiment-server.
-//* Any changes made here should also be applied to the corresponding files in all three services.
-// **********************************************************************************
-
-export type PLAN_NAMES =
- | 'v4_Enterprise_T1'
- | 'v4_Enterprise_T2'
- | 'v4_Enterprise_T3'
- | 'v4_Enterprise_T4'
- | 'v4_Scaleup'
- | 'v4_Builder'
- | 'v4_Startup'
- | 'SmythOS Free'
- | 'Early Adopters'
- | 'Premium'
- | 'Enterprise'; // v3 enterprise
-
-export type PlanInfo = {
- planName: PLAN_NAMES;
- isDefaultPlan?: boolean;
- flags: {
- hasBuiltinModels: boolean;
- };
- properties: {
- freeCredits: number;
- };
-};
-
-export type ComponentConfig = {
- id: string;
- name: string;
- title?: string;
- displayName?: string;
- eventId?: string;
- data?: {
- model?: string;
- [key: string]: any;
- };
-};
-
-export type Agent = {
- agentRequest: {
- req: {
- _agent: {
- planInfo: PlanInfo;
- parentTeamId: string;
- teamId: string;
- };
- };
- };
-};
-
-// **********************************************************************************
-//* Until now, the agent.types.ts file is identical across sre-builder-debugger, sre-agent-server, and sre-embodiment-server.
-//* Any changes made here should also be applied to the corresponding files in all three services.
-// **********************************************************************************
diff --git a/packages/runtime/src/modules/agent-runner/middlewares/agentLoader.mw.ts b/packages/runtime/src/modules/agent-runner/middlewares/agentLoader.mw.ts
index cad6b5fe..330e0e8e 100644
--- a/packages/runtime/src/modules/agent-runner/middlewares/agentLoader.mw.ts
+++ b/packages/runtime/src/modules/agent-runner/middlewares/agentLoader.mw.ts
@@ -98,18 +98,7 @@ export default async function agentLoader(req, res, next) {
// clean up agent data
cleanAgentData(agentData);
- req._plan = agentData.data.planInfo;
-
req._agent = agentData.data;
- req._agent.planInfo = req._plan || {
- planId: undefined,
- planName: undefined,
- isFreePlan: true,
- tasksQuota: 0,
- usedTasks: 0,
- remainingTasks: 0,
- maxLatency: 100,
- };
req._agent.usingTestDomain = isTestDomain;
req._agent.domain = agentDomain || (await getAgentDomainById(agentId));
diff --git a/packages/runtime/src/modules/agent-runner/types/agent.types.ts b/packages/runtime/src/modules/agent-runner/types/agent.types.ts
deleted file mode 100644
index b24fd833..00000000
--- a/packages/runtime/src/modules/agent-runner/types/agent.types.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-// **********************************************************************************
-//* Until now, the agent.types.ts file is identical across sre-builder-debugger, sre-agent-server, and sre-embodiment-server.
-//* Any changes made here should also be applied to the corresponding files in all three services.
-// **********************************************************************************
-
-export type PLAN_NAMES =
- | 'v4_Enterprise_T1'
- | 'v4_Enterprise_T2'
- | 'v4_Enterprise_T3'
- | 'v4_Enterprise_T4'
- | 'v4_Scaleup'
- | 'v4_Builder'
- | 'v4_Startup'
- | 'SmythOS Free'
- | 'Early Adopters'
- | 'Premium'
- | 'Enterprise'; // v3 enterprise
-
-export type PlanInfo = {
- planName: PLAN_NAMES;
- isDefaultPlan?: boolean;
- flags: {
- hasBuiltinModels: boolean;
- };
- properties: {
- freeCredits: number;
- };
-};
-
-export type ComponentConfig = {
- id: string;
- name: string;
- title?: string;
- displayName?: string;
- eventId?: string;
- data?: {
- model?: string;
- [key: string]: any;
- };
-};
-
-export type Agent = {
- agentRequest: {
- req: {
- _agent: {
- planInfo: PlanInfo;
- parentTeamId: string;
- teamId: string;
- };
- };
- };
-};
-
-// **********************************************************************************
-//* Until now, the agent.types.ts file is identical across sre-builder-debugger, sre-agent-server, and sre-embodiment-server.
-//* Any changes made here should also be applied to the corresponding files in all three services.
-// **********************************************************************************
diff --git a/packages/runtime/src/modules/debugger/middlewares/agentLoader.mw.ts b/packages/runtime/src/modules/debugger/middlewares/agentLoader.mw.ts
index ea5235ed..ff1c8a87 100644
--- a/packages/runtime/src/modules/debugger/middlewares/agentLoader.mw.ts
+++ b/packages/runtime/src/modules/debugger/middlewares/agentLoader.mw.ts
@@ -103,17 +103,7 @@ export default async function agentLoader(req, res, next) {
// clean up agent data
cleanAgentData(agentData);
- req._plan = agentData.data.planInfo;
req._agent = agentData.data;
- req._agent.planInfo = req._plan || {
- planId: undefined,
- planName: undefined,
- isFreePlan: true,
- tasksQuota: 0,
- usedTasks: 0,
- remainingTasks: 0,
- maxLatency: 100,
- };
if (!isTestDomain && req._agent.debugSessionEnabled && debugHeader) {
console.log(
diff --git a/packages/runtime/src/modules/embodiment/middlewares/agentLoader.mw.ts b/packages/runtime/src/modules/embodiment/middlewares/agentLoader.mw.ts
index 3f408484..ba908792 100644
--- a/packages/runtime/src/modules/embodiment/middlewares/agentLoader.mw.ts
+++ b/packages/runtime/src/modules/embodiment/middlewares/agentLoader.mw.ts
@@ -107,22 +107,11 @@ export default async function agentLoader(req, res, next) {
// clean up agent data
cleanAgentData(agentData);
- req._plan = agentData.data.planInfo;
-
// req._agent = agentData.data;
const agentSettings = new AgentSettings(agentId);
const agentRequest = new AgentRequest(req);
req._agent = new Agent(agentId, agentData, agentSettings, agentRequest);
req._rawAgent = agentData;
- req._agent.planInfo = req._plan || {
- planId: undefined,
- planName: undefined,
- isFreePlan: true,
- tasksQuota: 0,
- usedTasks: 0,
- remainingTasks: 0,
- maxLatency: 100,
- };
req.socket.on("close", () => {
// console.log('Client socket closed, killing agent');