@memberjunction/ai-agent-manager 2.110.0 → 2.111.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.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +27 -0
- package/dist/agent-spec-sync.d.ts +78 -0
- package/dist/agent-spec-sync.d.ts.map +1 -1
- package/dist/agent-spec-sync.js +287 -1
- package/dist/agent-spec-sync.js.map +1 -1
- package/dist/agents/architect-agent.d.ts.map +1 -1
- package/dist/agents/architect-agent.js +10 -3
- package/dist/agents/architect-agent.js.map +1 -1
- package/dist/agents/builder-agent.d.ts.map +1 -1
- package/dist/agents/builder-agent.js +9 -0
- package/dist/agents/builder-agent.js.map +1 -1
- package/dist/old/agent-definition.interface.d.ts +1 -1
- package/dist/old/agent-definition.interface.d.ts.map +1 -1
- package/package.json +10 -6
- package/src/agent-spec-sync.ts +379 -1
- package/src/agents/architect-agent.ts +12 -3
- package/src/agents/builder-agent.ts +11 -0
- package/src/old/agent-definition.interface.ts +1 -1
|
@@ -308,7 +308,7 @@ export class AgentArchitectAgent extends BaseAgent {
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
if (!foundIds.has(action.ActionID)) {
|
|
311
|
-
errors.push(`❌ Action with ID "${action.ActionID}" not found in database. Please use "Find
|
|
311
|
+
errors.push(`❌ Action with ID "${action.ActionID}" not found in database. Please use "Find Candidate Actions" or "List Actions" to get valid action IDs.`);
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
|
|
@@ -406,9 +406,18 @@ export class AgentArchitectAgent extends BaseAgent {
|
|
|
406
406
|
}
|
|
407
407
|
|
|
408
408
|
// Validate related-specific fields
|
|
409
|
-
if (subAgent.Type === 'related'
|
|
409
|
+
if (subAgent.Type === 'related') {
|
|
410
410
|
// AgentRelationshipID can be empty for new relationships, it will be created on save
|
|
411
|
-
|
|
411
|
+
|
|
412
|
+
// IMPORTANT: Related agents REQUIRE existing agent ID
|
|
413
|
+
if (!subAgent.SubAgent.ID || subAgent.SubAgent.ID === '') {
|
|
414
|
+
errors.push(`❌ Related SubAgent[${i}] "${subAgent.SubAgent.Name}" must have existing agent ID. Use Find Candidate Agents to get the ID.`);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// IMPORTANT: Related agents REQUIRE mapping fields
|
|
418
|
+
if (!subAgent.SubAgentInputMapping && !subAgent.SubAgentOutputMapping) {
|
|
419
|
+
errors.push(`❌ Related SubAgent[${i}] "${subAgent.SubAgent.Name}" must have at least SubAgentInputMapping or SubAgentOutputMapping`);
|
|
420
|
+
}
|
|
412
421
|
}
|
|
413
422
|
|
|
414
423
|
// Recursively validate nested sub-agents
|
|
@@ -5,6 +5,7 @@ import { Metadata } from '@memberjunction/core';
|
|
|
5
5
|
import { AIAgentRunStepEntityExtended } from '@memberjunction/core-entities';
|
|
6
6
|
import { AgentSpecSync } from '../agent-spec-sync';
|
|
7
7
|
import { TemplateEngineServer } from '@memberjunction/templates';
|
|
8
|
+
import { AIEngineBase } from '@memberjunction/ai-engine-base';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Builder Agent - Persists validated AgentSpec to database via AgentSpecSync
|
|
@@ -54,6 +55,11 @@ export class AgentBuilderAgent extends BaseAgent {
|
|
|
54
55
|
const specSync = new AgentSpecSync(agentSpec, params.contextUser);
|
|
55
56
|
specSync.markDirty();
|
|
56
57
|
|
|
58
|
+
// If updating existing agent (ID exists), mark as loaded so delete logic runs
|
|
59
|
+
if (agentSpec.ID && agentSpec.ID !== '') {
|
|
60
|
+
specSync.markLoaded();
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
const result = await specSync.SaveToDatabase();
|
|
58
64
|
|
|
59
65
|
if (!result.success) {
|
|
@@ -71,6 +77,11 @@ export class AgentBuilderAgent extends BaseAgent {
|
|
|
71
77
|
await templateEngine.Config(true, params.contextUser);
|
|
72
78
|
console.log('✅ Builder Agent: Metadata and template caches refreshed');
|
|
73
79
|
|
|
80
|
+
// Refresh AIEngine cache so newly created agents are immediately available
|
|
81
|
+
const aiEngine = AIEngineBase.Instance;
|
|
82
|
+
await aiEngine.Config(true, params.contextUser);
|
|
83
|
+
console.log('✅ Builder Agent: AIEngine cache refreshed');
|
|
84
|
+
|
|
74
85
|
// Create AI Agent Run Step record directly
|
|
75
86
|
const agentRunId = params.parentRun?.ID || 'unknown';
|
|
76
87
|
const stepEntity = await md.GetEntityObject<AIAgentRunStepEntityExtended>(
|
|
@@ -207,7 +207,7 @@ export interface AgentManagerPayload {
|
|
|
207
207
|
changeSummary: string;
|
|
208
208
|
/** Fields that will be updated (field name -> old/new values) */
|
|
209
209
|
fieldsToUpdate?: Record<string, { old: any; new: any }>;
|
|
210
|
-
/** Actions to add (with action IDs from Find
|
|
210
|
+
/** Actions to add (with action IDs from Find Candidate Actions) */
|
|
211
211
|
actionsToAdd?: Array<{ id: string; name: string; reason: string }>;
|
|
212
212
|
/** Action IDs to remove from the agent */
|
|
213
213
|
actionsToRemove?: string[];
|