@memberjunction/ai-agent-manager 4.4.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,11 +5,11 @@ import {
5
5
  LogError
6
6
  } from '@memberjunction/core';
7
7
  import {
8
- AIAgentEntity,
9
- AIAgentActionEntity,
10
- AIAgentRelationshipEntity,
11
- AIAgentStepEntity,
12
- AIAgentStepPathEntity
8
+ MJAIAgentEntity,
9
+ MJAIAgentActionEntity,
10
+ MJAIAgentRelationshipEntity,
11
+ MJAIAgentStepEntity,
12
+ MJAIAgentStepPathEntity
13
13
  } from '@memberjunction/core-entities';
14
14
  import {
15
15
  AgentSpec,
@@ -21,7 +21,7 @@ import {
21
21
  * Represents a single database mutation performed by AgentSpecSync
22
22
  */
23
23
  export interface AgentSpecSyncMutation {
24
- /** Entity name (e.g., "AI Agents", "AI Prompts", "AIAgentAction") */
24
+ /** Entity name (e.g., "MJ: AI Agents", "MJ: AI Prompts", "AIAgentAction") */
25
25
  Entity: string;
26
26
  /** Operation type */
27
27
  Operation: 'Create' | 'Update' | 'Delete';
@@ -49,12 +49,12 @@ export interface AgentSpecSyncResult {
49
49
  * @private
50
50
  */
51
51
  interface DatabaseState {
52
- actions: AIAgentActionEntity[];
53
- prompts: any[]; // AIAgentPromptEntity (junction records)
54
- relationships: AIAgentRelationshipEntity[];
55
- steps: AIAgentStepEntity[];
56
- paths: AIAgentStepPathEntity[];
57
- childAgents: AIAgentEntity[];
52
+ actions: MJAIAgentActionEntity[];
53
+ prompts: any[]; // MJAIAgentPromptEntity (junction records)
54
+ relationships: MJAIAgentRelationshipEntity[];
55
+ steps: MJAIAgentStepEntity[];
56
+ paths: MJAIAgentStepPathEntity[];
57
+ childAgents: MJAIAgentEntity[];
58
58
  }
59
59
 
60
60
  /**
@@ -63,12 +63,12 @@ interface DatabaseState {
63
63
  * @private
64
64
  */
65
65
  interface Orphans {
66
- actions: AIAgentActionEntity[];
67
- prompts: any[]; // AIAgentPromptEntity junctions (NOT the AIPrompt entities themselves)
68
- relationships: AIAgentRelationshipEntity[];
69
- steps: AIAgentStepEntity[];
70
- paths: AIAgentStepPathEntity[];
71
- childAgents: AIAgentEntity[]; // Will be orphaned (ParentID = NULL) not deleted
66
+ actions: MJAIAgentActionEntity[];
67
+ prompts: any[]; // MJAIAgentPromptEntity junctions (NOT the AIPrompt entities themselves)
68
+ relationships: MJAIAgentRelationshipEntity[];
69
+ steps: MJAIAgentStepEntity[];
70
+ paths: MJAIAgentStepPathEntity[];
71
+ childAgents: MJAIAgentEntity[]; // Will be orphaned (ParentID = NULL) not deleted
72
72
  }
73
73
 
74
74
  /**
@@ -76,9 +76,9 @@ interface Orphans {
76
76
  *
77
77
  * This class serves as a bi-directional bridge between the simple, serializable {@link AgentSpec}
78
78
  * format and the complex MemberJunction database metadata across three core entities:
79
- * - {@link AIAgentEntity} - Core agent configuration
80
- * - {@link AIAgentActionEntity} - Agent-action relationships
81
- * - {@link AIAgentRelationshipEntity} - Parent-child agent relationships
79
+ * - {@link MJAIAgentEntity} - Core agent configuration
80
+ * - {@link MJAIAgentActionEntity} - Agent-action relationships
81
+ * - {@link MJAIAgentRelationshipEntity} - Parent-child agent relationships
82
82
  *
83
83
  * ## Key Features
84
84
  *
@@ -274,8 +274,8 @@ export class AgentSpecSync {
274
274
  ): Promise<AgentSpecSync> {
275
275
  // Find agent by name
276
276
  const rv = new RunView();
277
- const result = await rv.RunView<AIAgentEntity>({
278
- EntityName: 'AI Agents',
277
+ const result = await rv.RunView<MJAIAgentEntity>({
278
+ EntityName: 'MJ: AI Agents',
279
279
  ExtraFilter: `Name='${agentName.replace(/'/g, "''")}'`,
280
280
  ResultType: 'entity_object'
281
281
  }, contextUser);
@@ -343,8 +343,8 @@ export class AgentSpecSync {
343
343
  const rv = new RunView();
344
344
 
345
345
  // Step 1: Load the main agent entity
346
- const agentEntity = await md.GetEntityObject<AIAgentEntity>(
347
- 'AI Agents',
346
+ const agentEntity = await md.GetEntityObject<MJAIAgentEntity>(
347
+ 'MJ: AI Agents',
348
348
  this._contextUser
349
349
  );
350
350
  const loaded = await agentEntity.Load(agentId);
@@ -356,13 +356,13 @@ export class AgentSpecSync {
356
356
  // Note: Load paths separately after steps to avoid hardcoded view name in subquery
357
357
  const [actionsResult, childAgentsResult, relatedAgentsResult, promptsResult, stepsResult] = await rv.RunViews([
358
358
  {
359
- EntityName: 'AI Agent Actions',
359
+ EntityName: 'MJ: AI Agent Actions',
360
360
  ExtraFilter: `AgentID='${agentId}'`,
361
361
  OrderBy: 'Status, ActionID',
362
362
  ResultType: 'entity_object'
363
363
  },
364
364
  {
365
- EntityName: 'AI Agents',
365
+ EntityName: 'MJ: AI Agents',
366
366
  ExtraFilter: `ParentID='${agentId}'`,
367
367
  OrderBy: 'ExecutionOrder, Name',
368
368
  ResultType: 'entity_object'
@@ -408,8 +408,8 @@ export class AgentSpecSync {
408
408
  let pathsResult;
409
409
  const steps = stepsResult.Results || [];
410
410
  if (steps.length > 0) {
411
- const stepIds = steps.map((s: AIAgentStepEntity) => `'${s.ID}'`).join(',');
412
- pathsResult = await rv.RunView<AIAgentStepPathEntity>({
411
+ const stepIds = steps.map((s: MJAIAgentStepEntity) => `'${s.ID}'`).join(',');
412
+ pathsResult = await rv.RunView<MJAIAgentStepPathEntity>({
413
413
  EntityName: 'MJ: AI Agent Step Paths',
414
414
  ExtraFilter: `OriginStepID IN (${stepIds})`,
415
415
  OrderBy: 'Priority DESC',
@@ -434,7 +434,7 @@ export class AgentSpecSync {
434
434
  if (agentPrompts.length > 0) {
435
435
  const promptIds = agentPrompts.map((p: any) => `'${p.PromptID}'`).join(',');
436
436
  fullPromptsResult = await rv.RunView({
437
- EntityName: 'AI Prompts',
437
+ EntityName: 'MJ: AI Prompts',
438
438
  ExtraFilter: `ID IN (${promptIds})`,
439
439
  OrderBy: 'Name',
440
440
  ResultType: 'entity_object'
@@ -516,14 +516,14 @@ export class AgentSpecSync {
516
516
  * @returns Fully populated AgentSpec object
517
517
  */
518
518
  private mapEntitiesToRawSpec(
519
- agent: AIAgentEntity,
520
- actions: AIAgentActionEntity[],
521
- childAgents: AIAgentEntity[],
522
- relatedAgents: AIAgentRelationshipEntity[],
519
+ agent: MJAIAgentEntity,
520
+ actions: MJAIAgentActionEntity[],
521
+ childAgents: MJAIAgentEntity[],
522
+ relatedAgents: MJAIAgentRelationshipEntity[],
523
523
  agentPrompts: any[],
524
524
  fullPrompts: any[],
525
- steps: AIAgentStepEntity[],
526
- paths: AIAgentStepPathEntity[]
525
+ steps: MJAIAgentStepEntity[],
526
+ paths: MJAIAgentStepPathEntity[]
527
527
  ): AgentSpec {
528
528
  // Map all agent fields to spec
529
529
  const spec: AgentSpec = {
@@ -597,13 +597,13 @@ export class AgentSpecSync {
597
597
  }
598
598
 
599
599
  /**
600
- * Map AIAgentActionEntity to AgentActionSpec format.
600
+ * Map MJAIAgentActionEntity to AgentActionSpec format.
601
601
  *
602
602
  * @private
603
603
  * @param action - The agent action entity from the database
604
604
  * @returns Mapped action spec
605
605
  */
606
- private mapActionEntityToSpec(action: AIAgentActionEntity): AgentActionSpec {
606
+ private mapActionEntityToSpec(action: MJAIAgentActionEntity): AgentActionSpec {
607
607
  return {
608
608
  AgentActionID: action.ID,
609
609
  ActionID: action.ActionID || '',
@@ -624,7 +624,7 @@ export class AgentSpecSync {
624
624
  * @param childAgent - The child agent entity
625
625
  * @returns Mapped sub-agent spec
626
626
  */
627
- private mapChildAgentToSpec(childAgent: AIAgentEntity): SubAgentSpec {
627
+ private mapChildAgentToSpec(childAgent: MJAIAgentEntity): SubAgentSpec {
628
628
  return {
629
629
  Type: 'child',
630
630
  SubAgent: {
@@ -642,7 +642,7 @@ export class AgentSpecSync {
642
642
  * @param relationship - The agent relationship entity
643
643
  * @returns Mapped sub-agent spec
644
644
  */
645
- private mapRelatedAgentToSpec(relationship: AIAgentRelationshipEntity): SubAgentSpec {
645
+ private mapRelatedAgentToSpec(relationship: MJAIAgentRelationshipEntity): SubAgentSpec {
646
646
  return {
647
647
  Type: 'related',
648
648
  SubAgent: {
@@ -658,7 +658,7 @@ export class AgentSpecSync {
658
658
  }
659
659
 
660
660
  /**
661
- * Map AIAgentPromptEntity junction to AgentPromptSpec format.
661
+ * Map MJAIAgentPromptEntity junction to AgentPromptSpec format.
662
662
  *
663
663
  * @private
664
664
  * @param agentPrompt - The agent prompt junction entity (has PromptID, ExecutionOrder)
@@ -690,13 +690,13 @@ export class AgentSpecSync {
690
690
  }
691
691
 
692
692
  /**
693
- * Map AIAgentStepEntity to AgentStep format.
693
+ * Map MJAIAgentStepEntity to AgentStep format.
694
694
  *
695
695
  * @private
696
696
  * @param step - The agent step entity
697
697
  * @returns Mapped step spec
698
698
  */
699
- private mapStepEntityToSpec(step: AIAgentStepEntity): any {
699
+ private mapStepEntityToSpec(step: MJAIAgentStepEntity): any {
700
700
  return {
701
701
  ID: step.ID,
702
702
  Name: step.Name,
@@ -712,13 +712,13 @@ export class AgentSpecSync {
712
712
  }
713
713
 
714
714
  /**
715
- * Map AIAgentStepPathEntity to AgentStepPath format.
715
+ * Map MJAIAgentStepPathEntity to AgentStepPath format.
716
716
  *
717
717
  * @private
718
718
  * @param path - The agent step path entity
719
719
  * @returns Mapped path spec
720
720
  */
721
- private mapPathEntityToSpec(path: AIAgentStepPathEntity): any {
721
+ private mapPathEntityToSpec(path: MJAIAgentStepPathEntity): any {
722
722
  return {
723
723
  ID: path.ID,
724
724
  OriginStepID: path.OriginStepID,
@@ -830,8 +830,8 @@ export class AgentSpecSync {
830
830
  */
831
831
  private async saveAgentEntity(validate: boolean): Promise<string> {
832
832
  const md = new Metadata();
833
- const agentEntity = await md.GetEntityObject<AIAgentEntity>(
834
- 'AI Agents',
833
+ const agentEntity = await md.GetEntityObject<MJAIAgentEntity>(
834
+ 'MJ: AI Agents',
835
835
  this._contextUser
836
836
  );
837
837
 
@@ -939,7 +939,7 @@ export class AgentSpecSync {
939
939
 
940
940
  // Track the mutation
941
941
  this.trackMutation(
942
- 'AI Agents',
942
+ 'MJ: AI Agents',
943
943
  isUpdate ? 'Update' : 'Create',
944
944
  agentEntity.ID,
945
945
  `${isUpdate ? 'Updated' : 'Created'} agent: ${this.spec.Name}`
@@ -967,8 +967,8 @@ export class AgentSpecSync {
967
967
  const md = new Metadata();
968
968
 
969
969
  for (const actionSpec of this.spec.Actions) {
970
- const actionEntity = await md.GetEntityObject<AIAgentActionEntity>(
971
- 'AI Agent Actions',
970
+ const actionEntity = await md.GetEntityObject<MJAIAgentActionEntity>(
971
+ 'MJ: AI Agent Actions',
972
972
  this._contextUser
973
973
  );
974
974
 
@@ -1001,7 +1001,7 @@ export class AgentSpecSync {
1001
1001
 
1002
1002
  // Track the mutation
1003
1003
  this.trackMutation(
1004
- 'AI Agent Actions',
1004
+ 'MJ: AI Agent Actions',
1005
1005
  isUpdate ? 'Update' : 'Create',
1006
1006
  actionEntity.ID,
1007
1007
  `${isUpdate ? 'Updated' : 'Created'} action junction for action ${actionSpec.ActionID}`
@@ -1105,7 +1105,7 @@ export class AgentSpecSync {
1105
1105
  */
1106
1106
  private async saveRelatedSubAgent(agentId: string, SubAgentSpec: SubAgentSpec): Promise<void> {
1107
1107
  const md = new Metadata();
1108
- const relationshipEntity = await md.GetEntityObject<AIAgentRelationshipEntity>(
1108
+ const relationshipEntity = await md.GetEntityObject<MJAIAgentRelationshipEntity>(
1109
1109
  'MJ: AI Agent Relationships',
1110
1110
  this._contextUser
1111
1111
  );
@@ -1186,7 +1186,7 @@ export class AgentSpecSync {
1186
1186
 
1187
1187
  // Check if this is an update (has PromptID) or create (no PromptID)
1188
1188
  let promptEntity = await md.GetEntityObject<any>(
1189
- 'AI Prompts',
1189
+ 'MJ: AI Prompts',
1190
1190
  this._contextUser
1191
1191
  );
1192
1192
 
@@ -1237,7 +1237,7 @@ export class AgentSpecSync {
1237
1237
 
1238
1238
  // Track mutation
1239
1239
  this.trackMutation(
1240
- 'AI Prompts',
1240
+ 'MJ: AI Prompts',
1241
1241
  isUpdate ? 'Update' : 'Create',
1242
1242
  promptEntity.ID,
1243
1243
  `${isUpdate ? 'Updated' : 'Created'} prompt: ${promptEntity.Name}`
@@ -1286,7 +1286,7 @@ export class AgentSpecSync {
1286
1286
 
1287
1287
  // Track mutation
1288
1288
  this.trackMutation(
1289
- 'AI Agent Prompts',
1289
+ 'MJ: AI Agent Prompts',
1290
1290
  isJunctionUpdate ? 'Update' : 'Create',
1291
1291
  agentPromptEntity.ID,
1292
1292
  `${isJunctionUpdate ? 'Updated' : 'Created'} agent-prompt junction for prompt ${promptEntity.ID}`
@@ -1320,7 +1320,7 @@ export class AgentSpecSync {
1320
1320
  const md = new Metadata();
1321
1321
 
1322
1322
  for (const stepSpec of this.spec.Steps) {
1323
- const stepEntity = await md.GetEntityObject<AIAgentStepEntity>(
1323
+ const stepEntity = await md.GetEntityObject<MJAIAgentStepEntity>(
1324
1324
  'MJ: AI Agent Steps',
1325
1325
  this._contextUser
1326
1326
  );
@@ -1349,7 +1349,7 @@ export class AgentSpecSync {
1349
1349
 
1350
1350
  // Create AIPrompt entity (using any type for TemplateText dynamic property)
1351
1351
  const promptEntity = await md.GetEntityObject<any>(
1352
- 'AI Prompts',
1352
+ 'MJ: AI Prompts',
1353
1353
  this._contextUser
1354
1354
  );
1355
1355
 
@@ -1368,7 +1368,7 @@ export class AgentSpecSync {
1368
1368
 
1369
1369
  // Track mutation
1370
1370
  this.trackMutation(
1371
- 'AI Prompts',
1371
+ 'MJ: AI Prompts',
1372
1372
  'Create',
1373
1373
  promptEntity.ID,
1374
1374
  `Created inline prompt: ${promptEntity.Name}`
@@ -1460,7 +1460,7 @@ export class AgentSpecSync {
1460
1460
  }
1461
1461
 
1462
1462
  for (const pathSpec of this.spec.Paths) {
1463
- const pathEntity = await md.GetEntityObject<AIAgentStepPathEntity>(
1463
+ const pathEntity = await md.GetEntityObject<MJAIAgentStepPathEntity>(
1464
1464
  'MJ: AI Agent Step Paths',
1465
1465
  this._contextUser
1466
1466
  );
@@ -1691,7 +1691,7 @@ export class AgentSpecSync {
1691
1691
  // Batch load all related records for this agent
1692
1692
  const [actions, prompts, relationships, steps, childAgents] = await rv.RunViews([
1693
1693
  {
1694
- EntityName: 'AI Agent Actions',
1694
+ EntityName: 'MJ: AI Agent Actions',
1695
1695
  ExtraFilter: `AgentID='${agentId}'`,
1696
1696
  ResultType: 'entity_object'
1697
1697
  },
@@ -1711,7 +1711,7 @@ export class AgentSpecSync {
1711
1711
  ResultType: 'entity_object'
1712
1712
  },
1713
1713
  {
1714
- EntityName: 'AI Agents',
1714
+ EntityName: 'MJ: AI Agents',
1715
1715
  ExtraFilter: `ParentID='${agentId}'`,
1716
1716
  ResultType: 'entity_object'
1717
1717
  }
@@ -1731,8 +1731,8 @@ export class AgentSpecSync {
1731
1731
  let pathsResult;
1732
1732
  const stepRecords = steps.Results || [];
1733
1733
  if (stepRecords.length > 0) {
1734
- const stepIds = stepRecords.map((s: AIAgentStepEntity) => `'${s.ID}'`).join(',');
1735
- pathsResult = await rv.RunView<AIAgentStepPathEntity>({
1734
+ const stepIds = stepRecords.map((s: MJAIAgentStepEntity) => `'${s.ID}'`).join(',');
1735
+ pathsResult = await rv.RunView<MJAIAgentStepPathEntity>({
1736
1736
  EntityName: 'MJ: AI Agent Step Paths',
1737
1737
  ExtraFilter: `OriginStepID IN (${stepIds})`,
1738
1738
  ResultType: 'entity_object'
@@ -1832,7 +1832,7 @@ export class AgentSpecSync {
1832
1832
 
1833
1833
  for (const path of orphans.paths) {
1834
1834
  console.log(`🗑️ deleteOrphans: Deleting path ${path.ID}...`);
1835
- const entity = await md.GetEntityObject<AIAgentStepPathEntity>(
1835
+ const entity = await md.GetEntityObject<MJAIAgentStepPathEntity>(
1836
1836
  'MJ: AI Agent Step Paths',
1837
1837
  this._contextUser
1838
1838
  );
@@ -1847,13 +1847,13 @@ export class AgentSpecSync {
1847
1847
  continue;
1848
1848
  }
1849
1849
  console.log(`✅ deleteOrphans: Deleted path ${path.ID}`);
1850
- this.trackMutation('AI Agent Step Paths', 'Delete', path.ID, `Deleted orphaned path`);
1850
+ this.trackMutation('MJ: AI Agent Step Paths', 'Delete', path.ID, `Deleted orphaned path`);
1851
1851
  }
1852
1852
 
1853
1853
  for (const action of orphans.actions) {
1854
1854
  console.log(`🗑️ deleteOrphans: Deleting action junction ${action.ID} (ActionID: ${action.ActionID})...`);
1855
- const entity = await md.GetEntityObject<AIAgentActionEntity>(
1856
- 'AI Agent Actions',
1855
+ const entity = await md.GetEntityObject<MJAIAgentActionEntity>(
1856
+ 'MJ: AI Agent Actions',
1857
1857
  this._contextUser
1858
1858
  );
1859
1859
  const loaded = await entity.Load(action.ID);
@@ -1867,7 +1867,7 @@ export class AgentSpecSync {
1867
1867
  continue;
1868
1868
  }
1869
1869
  console.log(`✅ deleteOrphans: Deleted action junction ${action.ID}`);
1870
- this.trackMutation('AI Agent Actions', 'Delete', action.ID, `Deleted orphaned action junction`);
1870
+ this.trackMutation('MJ: AI Agent Actions', 'Delete', action.ID, `Deleted orphaned action junction`);
1871
1871
  }
1872
1872
 
1873
1873
  // Phase 2: Mid-level entities (Steps, Prompt Junctions, Relationships)
@@ -1875,7 +1875,7 @@ export class AgentSpecSync {
1875
1875
 
1876
1876
  for (const step of orphans.steps) {
1877
1877
  console.log(`🗑️ deleteOrphans: Deleting step ${step.ID} (${step.Name})...`);
1878
- const entity = await md.GetEntityObject<AIAgentStepEntity>(
1878
+ const entity = await md.GetEntityObject<MJAIAgentStepEntity>(
1879
1879
  'MJ: AI Agent Steps',
1880
1880
  this._contextUser
1881
1881
  );
@@ -1890,7 +1890,7 @@ export class AgentSpecSync {
1890
1890
  continue;
1891
1891
  }
1892
1892
  console.log(`✅ deleteOrphans: Deleted step ${step.ID}`);
1893
- this.trackMutation('AI Agent Steps', 'Delete', step.ID, `Deleted orphaned step`);
1893
+ this.trackMutation('MJ: AI Agent Steps', 'Delete', step.ID, `Deleted orphaned step`);
1894
1894
  }
1895
1895
 
1896
1896
  for (const promptJunction of orphans.prompts) {
@@ -1910,13 +1910,13 @@ export class AgentSpecSync {
1910
1910
  continue;
1911
1911
  }
1912
1912
  console.log(`✅ deleteOrphans: Deleted prompt junction ${promptJunction.ID}`);
1913
- this.trackMutation('AI Agent Prompts', 'Delete', promptJunction.ID, `Deleted orphaned prompt junction`);
1913
+ this.trackMutation('MJ: AI Agent Prompts', 'Delete', promptJunction.ID, `Deleted orphaned prompt junction`);
1914
1914
  // NOTE: We do NOT delete the AIPrompt itself - it's a shared resource
1915
1915
  }
1916
1916
 
1917
1917
  for (const relationship of orphans.relationships) {
1918
1918
  console.log(`🗑️ deleteOrphans: Deleting relationship ${relationship.ID} (SubAgentID: ${relationship.SubAgentID})...`);
1919
- const entity = await md.GetEntityObject<AIAgentRelationshipEntity>(
1919
+ const entity = await md.GetEntityObject<MJAIAgentRelationshipEntity>(
1920
1920
  'MJ: AI Agent Relationships',
1921
1921
  this._contextUser
1922
1922
  );
@@ -1931,7 +1931,7 @@ export class AgentSpecSync {
1931
1931
  continue;
1932
1932
  }
1933
1933
  console.log(`✅ deleteOrphans: Deleted relationship ${relationship.ID}`);
1934
- this.trackMutation('AI Agent Relationships', 'Delete', relationship.ID, `Deleted orphaned relationship`);
1934
+ this.trackMutation('MJ: AI Agent Relationships', 'Delete', relationship.ID, `Deleted orphaned relationship`);
1935
1935
  }
1936
1936
 
1937
1937
  // Phase 3: Orphan child agents (set ParentID = NULL)
@@ -1939,7 +1939,7 @@ export class AgentSpecSync {
1939
1939
 
1940
1940
  for (const childAgent of orphans.childAgents) {
1941
1941
  await this.orphanChildAgent(childAgent.ID);
1942
- this.trackMutation('AI Agents', 'Update', childAgent.ID, `Orphaned child agent: ${childAgent.Name} (set ParentID = NULL)`);
1942
+ this.trackMutation('MJ: AI Agents', 'Update', childAgent.ID, `Orphaned child agent: ${childAgent.Name} (set ParentID = NULL)`);
1943
1943
  }
1944
1944
  }
1945
1945
 
@@ -1962,7 +1962,7 @@ export class AgentSpecSync {
1962
1962
  console.log(`🔗 orphanChildAgent: Orphaning child agent ${childAgentId}...`);
1963
1963
 
1964
1964
  const md = new Metadata();
1965
- const childAgent = await md.GetEntityObject<AIAgentEntity>('AI Agents', this._contextUser);
1965
+ const childAgent = await md.GetEntityObject<MJAIAgentEntity>('MJ: AI Agents', this._contextUser);
1966
1966
 
1967
1967
  const loaded = await childAgent.Load(childAgentId);
1968
1968
  if (!loaded) {
@@ -1,6 +1,6 @@
1
1
  import { BaseAgent, PayloadManager } from '@memberjunction/ai-agents';
2
2
  import { ExecuteAgentParams, BaseAgentNextStep, AgentSpec, AIAgentRunEntityExtended, AIAgentRunStepEntityExtended } from '@memberjunction/ai-core-plus';
3
- import { ActionEntity } from "@memberjunction/core-entities";
3
+ import { MJActionEntity } from "@memberjunction/core-entities";
4
4
  import { RunView } from '@memberjunction/core';
5
5
  import { RegisterClass } from '@memberjunction/global';
6
6
 
@@ -294,8 +294,8 @@ export class AgentArchitectAgent extends BaseAgent {
294
294
 
295
295
  // Query database for these action IDs
296
296
  const filter = actionIds.map(id => `ID='${id}'`).join(' OR ');
297
- const result = await rv.RunView<ActionEntity>({
298
- EntityName: 'Actions',
297
+ const result = await rv.RunView<MJActionEntity>({
298
+ EntityName: 'MJ: Actions',
299
299
  ExtraFilter: filter,
300
300
  ResultType: 'entity_object'
301
301
  }, params.contextUser);