@memberjunction/ai-agent-manager 2.108.0 → 2.110.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 +35 -0
- package/dist/agent-spec-sync.d.ts +117 -7
- package/dist/agent-spec-sync.d.ts.map +1 -1
- package/dist/agent-spec-sync.js +599 -50
- package/dist/agent-spec-sync.js.map +1 -1
- package/dist/agents/architect-agent.d.ts +52 -0
- package/dist/agents/architect-agent.d.ts.map +1 -0
- package/dist/agents/architect-agent.js +384 -0
- package/dist/agents/architect-agent.js.map +1 -0
- package/dist/agents/builder-agent.d.ts +31 -0
- package/dist/agents/builder-agent.d.ts.map +1 -0
- package/dist/agents/builder-agent.js +131 -0
- package/dist/agents/builder-agent.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/dist/old/agent-definition.interface.d.ts +64 -0
- package/dist/old/agent-definition.interface.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/agent-spec-sync.ts +784 -56
- package/src/agents/architect-agent.ts +447 -0
- package/src/agents/builder-agent.ts +151 -0
- package/src/index.ts +21 -2
- package/src/old/agent-definition.interface.ts +59 -0
- package/tsconfig.json +3 -1
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @memberjunction/ai-agent-manager
|
|
2
2
|
|
|
3
|
+
## 2.110.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c8b9aca: Migration
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [02d72ff]
|
|
12
|
+
- Updated dependencies [d2d7ab9]
|
|
13
|
+
- Updated dependencies [c8b9aca]
|
|
14
|
+
- Updated dependencies [8f1384a]
|
|
15
|
+
- @memberjunction/core-entities@2.110.0
|
|
16
|
+
- @memberjunction/ai-core-plus@2.110.0
|
|
17
|
+
- @memberjunction/ai-agents@2.110.0
|
|
18
|
+
- @memberjunction/core@2.110.0
|
|
19
|
+
- @memberjunction/global@2.110.0
|
|
20
|
+
|
|
21
|
+
## 2.109.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- a38989b: Migration
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [6e45c17]
|
|
30
|
+
- Updated dependencies [e2a6338]
|
|
31
|
+
- Updated dependencies [a38989b]
|
|
32
|
+
- @memberjunction/core-entities@2.109.0
|
|
33
|
+
- @memberjunction/ai-agents@2.109.0
|
|
34
|
+
- @memberjunction/ai-core-plus@2.109.0
|
|
35
|
+
- @memberjunction/core@2.109.0
|
|
36
|
+
- @memberjunction/global@2.109.0
|
|
37
|
+
|
|
3
38
|
## 2.108.0
|
|
4
39
|
|
|
5
40
|
### Minor Changes
|
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
import { UserInfo } from '@memberjunction/core';
|
|
2
2
|
import { AgentSpec } from '@memberjunction/ai-core-plus';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a single database mutation performed by AgentSpecSync
|
|
5
|
+
*/
|
|
6
|
+
export interface AgentSpecSyncMutation {
|
|
7
|
+
/** Entity name (e.g., "AI Agents", "AI Prompts", "AIAgentAction") */
|
|
8
|
+
Entity: string;
|
|
9
|
+
/** Operation type */
|
|
10
|
+
Operation: 'Create' | 'Update' | 'Delete';
|
|
11
|
+
/** Record ID */
|
|
12
|
+
ID: string;
|
|
13
|
+
/** Human-readable description of what was done */
|
|
14
|
+
Description: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Result of SaveToDatabase operation including all mutations performed
|
|
18
|
+
*/
|
|
19
|
+
export interface AgentSpecSyncResult {
|
|
20
|
+
/** ID of the saved agent */
|
|
21
|
+
agentId: string;
|
|
22
|
+
/** Whether the operation succeeded */
|
|
23
|
+
success: boolean;
|
|
24
|
+
/** Array of all database mutations performed */
|
|
25
|
+
mutations: AgentSpecSyncMutation[];
|
|
26
|
+
}
|
|
3
27
|
/**
|
|
4
28
|
* AgentSpecSync provides a high-level interface for working with AI Agent metadata in MemberJunction.
|
|
5
29
|
*
|
|
@@ -70,6 +94,11 @@ export declare class AgentSpecSync {
|
|
|
70
94
|
* @private
|
|
71
95
|
*/
|
|
72
96
|
private _contextUser?;
|
|
97
|
+
/**
|
|
98
|
+
* Tracks all database mutations performed during save operations
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
101
|
+
private _mutations;
|
|
73
102
|
/**
|
|
74
103
|
* Create a new AgentSpecSync instance.
|
|
75
104
|
*
|
|
@@ -82,6 +111,20 @@ export declare class AgentSpecSync {
|
|
|
82
111
|
* @param contextUser - Optional context user (required for server-side operations)
|
|
83
112
|
*/
|
|
84
113
|
constructor(spec?: Partial<AgentSpec>, contextUser?: UserInfo);
|
|
114
|
+
/**
|
|
115
|
+
* Track a database mutation performed during save operation
|
|
116
|
+
* @private
|
|
117
|
+
*/
|
|
118
|
+
private trackMutation;
|
|
119
|
+
/**
|
|
120
|
+
* Get all mutations tracked during the last save operation
|
|
121
|
+
* @returns Array of mutations
|
|
122
|
+
*/
|
|
123
|
+
getMutations(): AgentSpecSyncMutation[];
|
|
124
|
+
/**
|
|
125
|
+
* Clear all tracked mutations
|
|
126
|
+
*/
|
|
127
|
+
clearMutations(): void;
|
|
85
128
|
/**
|
|
86
129
|
* Load an agent and its complete hierarchy from the database by ID.
|
|
87
130
|
*
|
|
@@ -174,6 +217,10 @@ export declare class AgentSpecSync {
|
|
|
174
217
|
* @param actions - Array of agent action entities
|
|
175
218
|
* @param childAgents - Array of child agent entities (ParentID-based)
|
|
176
219
|
* @param relatedAgents - Array of related agent relationship entities
|
|
220
|
+
* @param agentPrompts - Array of agent prompt junction entities
|
|
221
|
+
* @param fullPrompts - Array of full AI Prompt entities with PromptText, PromptRole, PromptPosition
|
|
222
|
+
* @param steps - Array of agent step entities (for Flow agents)
|
|
223
|
+
* @param paths - Array of step path entities (for Flow agents)
|
|
177
224
|
* @returns Fully populated AgentSpec object
|
|
178
225
|
*/
|
|
179
226
|
private mapEntitiesToRawSpec;
|
|
@@ -201,6 +248,31 @@ export declare class AgentSpecSync {
|
|
|
201
248
|
* @returns Mapped sub-agent spec
|
|
202
249
|
*/
|
|
203
250
|
private mapRelatedAgentToSpec;
|
|
251
|
+
/**
|
|
252
|
+
* Map AIAgentPromptEntity junction to AgentPromptSpec format.
|
|
253
|
+
*
|
|
254
|
+
* @private
|
|
255
|
+
* @param agentPrompt - The agent prompt junction entity (has PromptID, ExecutionOrder)
|
|
256
|
+
* @param fullPrompts - Array of full AI Prompt entities
|
|
257
|
+
* @returns Mapped prompt spec
|
|
258
|
+
*/
|
|
259
|
+
private mapPromptEntityToSpec;
|
|
260
|
+
/**
|
|
261
|
+
* Map AIAgentStepEntity to AgentStep format.
|
|
262
|
+
*
|
|
263
|
+
* @private
|
|
264
|
+
* @param step - The agent step entity
|
|
265
|
+
* @returns Mapped step spec
|
|
266
|
+
*/
|
|
267
|
+
private mapStepEntityToSpec;
|
|
268
|
+
/**
|
|
269
|
+
* Map AIAgentStepPathEntity to AgentStepPath format.
|
|
270
|
+
*
|
|
271
|
+
* @private
|
|
272
|
+
* @param path - The agent step path entity
|
|
273
|
+
* @returns Mapped path spec
|
|
274
|
+
*/
|
|
275
|
+
private mapPathEntityToSpec;
|
|
204
276
|
/**
|
|
205
277
|
* Save the current spec to the database.
|
|
206
278
|
*
|
|
@@ -211,7 +283,7 @@ export declare class AgentSpecSync {
|
|
|
211
283
|
* database schema are executed, and any failures will prevent the save.
|
|
212
284
|
*
|
|
213
285
|
* @param validate - Whether to validate before saving (default: true)
|
|
214
|
-
* @returns Promise resolving to
|
|
286
|
+
* @returns Promise resolving to result with agent ID, success flag, and all mutations performed
|
|
215
287
|
* @throws {Error} If validation fails or save operation fails
|
|
216
288
|
*
|
|
217
289
|
* @example
|
|
@@ -221,11 +293,12 @@ export declare class AgentSpecSync {
|
|
|
221
293
|
* InvocationMode: 'Any'
|
|
222
294
|
* }, contextUser);
|
|
223
295
|
*
|
|
224
|
-
* const
|
|
225
|
-
* console.log('Saved with ID:', agentId);
|
|
296
|
+
* const result = await spec.SaveToDatabase();
|
|
297
|
+
* console.log('Saved with ID:', result.agentId);
|
|
298
|
+
* console.log('Mutations:', result.mutations.length);
|
|
226
299
|
* ```
|
|
227
300
|
*/
|
|
228
|
-
SaveToDatabase(validate?: boolean): Promise<
|
|
301
|
+
SaveToDatabase(validate?: boolean): Promise<AgentSpecSyncResult>;
|
|
229
302
|
/**
|
|
230
303
|
* Save the main AIAgent entity.
|
|
231
304
|
*
|
|
@@ -263,13 +336,16 @@ export declare class AgentSpecSync {
|
|
|
263
336
|
* Save a child sub-agent (ParentID-based relationship).
|
|
264
337
|
*
|
|
265
338
|
* For child agents, the relationship is established by setting the ParentID field
|
|
266
|
-
* on the child agent entity. If the
|
|
267
|
-
* child agent
|
|
339
|
+
* on the child agent entity. If the SubAgent.ID is empty, this creates a new
|
|
340
|
+
* child agent recursively using AgentSpecSync.
|
|
341
|
+
*
|
|
342
|
+
* This enables creating complete agent hierarchies in one call - sub-agents are
|
|
343
|
+
* created first (depth-first), then parent references them via ParentID.
|
|
268
344
|
*
|
|
269
345
|
* @private
|
|
270
346
|
* @param parentId - The parent agent ID
|
|
271
347
|
* @param SubAgentSpec - The sub-agent specification
|
|
272
|
-
* @throws {Error} If child agent
|
|
348
|
+
* @throws {Error} If child agent save fails
|
|
273
349
|
*/
|
|
274
350
|
private saveChildSubAgent;
|
|
275
351
|
/**
|
|
@@ -284,6 +360,40 @@ export declare class AgentSpecSync {
|
|
|
284
360
|
* @throws {Error} If relationship save fails
|
|
285
361
|
*/
|
|
286
362
|
private saveRelatedSubAgent;
|
|
363
|
+
/**
|
|
364
|
+
* Save all prompts for this agent.
|
|
365
|
+
*
|
|
366
|
+
* Creates AIPrompt records (with template) and AIAgentPrompt junction records.
|
|
367
|
+
* Supports simplified prompt format from Architect Agent with just PromptText,
|
|
368
|
+
* PromptRole, and PromptPosition.
|
|
369
|
+
*
|
|
370
|
+
* @private
|
|
371
|
+
* @param agentId - The parent agent ID
|
|
372
|
+
* @throws {Error} If any prompt save fails
|
|
373
|
+
*/
|
|
374
|
+
private savePrompts;
|
|
375
|
+
/**
|
|
376
|
+
* Save all steps for this agent (Flow agents only).
|
|
377
|
+
*
|
|
378
|
+
* Creates AIAgentStep records for each step in the spec. Steps define the nodes
|
|
379
|
+
* in a Flow agent's execution graph.
|
|
380
|
+
*
|
|
381
|
+
* @private
|
|
382
|
+
* @param agentId - The parent agent ID
|
|
383
|
+
* @throws {Error} If any step save fails
|
|
384
|
+
*/
|
|
385
|
+
private saveSteps;
|
|
386
|
+
/**
|
|
387
|
+
* Save all step paths for this agent (Flow agents only).
|
|
388
|
+
*
|
|
389
|
+
* Creates AIAgentStepPath records that define the edges in a Flow agent's
|
|
390
|
+
* execution graph, including conditional branching logic.
|
|
391
|
+
*
|
|
392
|
+
* @private
|
|
393
|
+
* @param agentId - The parent agent ID
|
|
394
|
+
* @throws {Error} If any path save fails
|
|
395
|
+
*/
|
|
396
|
+
private saveStepPaths;
|
|
287
397
|
/**
|
|
288
398
|
* Parse a JSON string field, returning undefined if null/empty.
|
|
289
399
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-spec-sync.d.ts","sourceRoot":"","sources":["../src/agent-spec-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,QAAQ,EAEX,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-spec-sync.d.ts","sourceRoot":"","sources":["../src/agent-spec-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,QAAQ,EAEX,MAAM,sBAAsB,CAAC;AAQ9B,OAAO,EACH,SAAS,EAGZ,MAAM,8BAA8B,CAA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