@memberjunction/aiengine 2.57.0 → 2.59.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/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './AIEngine';
2
- export * from './agent-types';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -15,5 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./AIEngine"), exports);
18
- __exportStar(require("./agent-types"), exports);
19
18
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,gDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/aiengine",
3
- "version": "2.57.0",
3
+ "version": "2.59.0",
4
4
  "description": "MemberJunction: AI Engine Package - handles automatic execution of Entity AI Actions using AI Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,12 +15,13 @@
15
15
  "author": "MemberJunction.com",
16
16
  "license": "ISC",
17
17
  "dependencies": {
18
- "@memberjunction/core": "2.57.0",
19
- "@memberjunction/global": "2.57.0",
20
- "@memberjunction/core-entities": "2.57.0",
21
- "@memberjunction/actions-base": "2.57.0",
22
- "@memberjunction/ai": "2.57.0",
23
- "@memberjunction/ai-engine-base": "2.57.0",
18
+ "@memberjunction/core": "2.59.0",
19
+ "@memberjunction/global": "2.59.0",
20
+ "@memberjunction/core-entities": "2.59.0",
21
+ "@memberjunction/actions-base": "2.59.0",
22
+ "@memberjunction/ai": "2.59.0",
23
+ "@memberjunction/ai-core-plus": "2.59.0",
24
+ "@memberjunction/ai-engine-base": "2.59.0",
24
25
  "dotenv": "^16.4.1",
25
26
  "rxjs": "^7.8.1"
26
27
  },
@@ -1,188 +0,0 @@
1
- /// <reference types="node" />
2
- import { AIPromptRunResult } from '@memberjunction/ai';
3
- import { AIAgentRunEntity, AIAgentRunStepEntity, AIAgentTypeEntity, AIPromptEntity } from '@memberjunction/core-entities';
4
- import { ActionResult, ActionResultSimple } from '@memberjunction/actions-base';
5
- import { ChatMessage } from '@memberjunction/ai';
6
- import { AIAgentEntity } from '@memberjunction/core-entities';
7
- import { UserInfo } from '@memberjunction/core';
8
- export type AgentAction = {
9
- id: string;
10
- name: string;
11
- params: Record<string, unknown>;
12
- };
13
- export type AgentSubAgentRequest<TContext = any> = {
14
- id: string;
15
- name: string;
16
- message: string;
17
- terminateAfter: boolean;
18
- templateParameters?: Record<string, string>;
19
- context?: TContext;
20
- };
21
- export type BaseAgentNextStep<R = any, TContext = any> = {
22
- terminate: boolean;
23
- step: 'success' | 'failed' | 'retry' | 'sub-agent' | 'actions' | 'chat';
24
- returnValue?: R;
25
- errorMessage?: string;
26
- retryReason?: string;
27
- retryInstructions?: string;
28
- subAgent?: AgentSubAgentRequest<TContext>;
29
- actions?: AgentAction[];
30
- userMessage?: string;
31
- };
32
- export type ExecuteAgentResult<T = any> = {
33
- success: boolean;
34
- finalStep: BaseAgentNextStep['step'];
35
- returnValue?: T;
36
- errorMessage?: string;
37
- cancelled?: boolean;
38
- cancellationReason?: 'user_requested' | 'timeout' | 'system';
39
- agentRun: AIAgentRunEntity;
40
- executionTree: ExecutionNode[];
41
- };
42
- export type ExecutionChainStep<T = any> = {
43
- stepEntity: AIAgentRunStepEntity;
44
- executionType: 'prompt' | 'action' | 'sub-agent' | 'decision' | 'chat' | 'validation';
45
- executionResult: StepExecutionResult<T>;
46
- nextStepDecision: NextStepDecision;
47
- startTime: Date;
48
- endTime?: Date;
49
- durationMs?: number;
50
- };
51
- export type StepExecutionResult<T = any> = PromptExecutionResult | ActionExecutionResult | SubAgentExecutionResult<T> | DecisionExecutionResult | ChatExecutionResult | ValidationExecutionResult;
52
- export type ExecutionNode = {
53
- step: AIAgentRunStepEntity;
54
- inputData: any;
55
- outputData: any;
56
- executionType: 'prompt' | 'action' | 'sub-agent' | 'decision' | 'chat' | 'validation';
57
- startTime: Date;
58
- endTime?: Date;
59
- durationMs?: number;
60
- nextStepDecision?: NextStepDecision;
61
- children?: ExecutionNode[];
62
- depth: number;
63
- parentStepId?: string;
64
- agentHierarchy: string[];
65
- };
66
- export type PromptExecutionResult = {
67
- type: 'prompt';
68
- promptId: string;
69
- promptName: string;
70
- result: AIPromptRunResult;
71
- };
72
- export type ActionExecutionResult = {
73
- type: 'action';
74
- actionId: string;
75
- actionName: string;
76
- result: ActionResult | ActionResultSimple;
77
- };
78
- export type SubAgentExecutionResult<T = any> = {
79
- type: 'sub-agent';
80
- subAgentId: string;
81
- subAgentName: string;
82
- result: ExecuteAgentResult<T>;
83
- };
84
- export type DecisionExecutionResult = {
85
- type: 'decision';
86
- decisionLogic: string;
87
- inputContext: any;
88
- result: BaseAgentNextStep;
89
- };
90
- export type ChatExecutionResult = {
91
- type: 'chat';
92
- userMessage: string;
93
- userResponse?: string;
94
- result: {
95
- success: boolean;
96
- continueExecution: boolean;
97
- };
98
- };
99
- export type ValidationExecutionResult = {
100
- type: 'validation';
101
- validationTarget: string;
102
- result: {
103
- valid: boolean;
104
- errors?: string[];
105
- };
106
- };
107
- export type NextStepDecision = {
108
- decision: BaseAgentNextStep['step'];
109
- reasoning?: string;
110
- nextStepDetails?: NextStepDetails;
111
- };
112
- export type NextStepDetails = {
113
- type: 'prompt';
114
- promptId: string;
115
- promptName: string;
116
- } | {
117
- type: 'action';
118
- actions: AgentAction[];
119
- } | {
120
- type: 'sub-agent';
121
- subAgent: AgentSubAgentRequest;
122
- } | {
123
- type: 'retry';
124
- retryReason: string;
125
- retryInstructions: string;
126
- } | {
127
- type: 'chat';
128
- message: string;
129
- } | {
130
- type: 'complete';
131
- returnValue?: any;
132
- };
133
- export type AgentExecutionProgressCallback = (progress: {
134
- step: 'initialization' | 'validation' | 'prompt_execution' | 'action_execution' | 'subagent_execution' | 'decision_processing' | 'finalization';
135
- percentage: number;
136
- message: string;
137
- metadata?: Record<string, unknown>;
138
- displayMode?: 'live' | 'historical' | 'both';
139
- }) => void;
140
- export type AgentExecutionStreamingCallback = (chunk: {
141
- content: string;
142
- isComplete: boolean;
143
- stepType?: 'prompt' | 'action' | 'subagent' | 'chat';
144
- stepEntityId?: string;
145
- modelName?: string;
146
- }) => void;
147
- export type ExecuteAgentParams<TContext = any> = {
148
- agent: AIAgentEntity;
149
- conversationMessages: ChatMessage[];
150
- contextUser?: UserInfo;
151
- cancellationToken?: AbortSignal;
152
- onProgress?: AgentExecutionProgressCallback;
153
- onStreaming?: AgentExecutionStreamingCallback;
154
- parentAgentHierarchy?: string[];
155
- parentDepth?: number;
156
- parentRun?: AIAgentRunEntity;
157
- data?: Record<string, any>;
158
- context?: TContext;
159
- override?: {
160
- modelId?: string;
161
- vendorId?: string;
162
- };
163
- };
164
- export type AgentContextData = {
165
- agentName: string | null;
166
- agentDescription: string | null;
167
- subAgentCount: number;
168
- subAgentDetails: string;
169
- actionCount: number;
170
- actionDetails: string;
171
- };
172
- export type AgentConfiguration = {
173
- success: boolean;
174
- errorMessage?: string;
175
- agentType?: AIAgentTypeEntity;
176
- systemPrompt?: AIPromptEntity;
177
- childPrompt?: AIPromptEntity;
178
- };
179
- export type AgentRunContext = {
180
- currentStepIndex: number;
181
- parentRunStack: string[];
182
- agentHierarchy: string[];
183
- depth: number;
184
- conversationId?: string;
185
- userId?: string;
186
- agentState: Record<string, any>;
187
- };
188
- //# sourceMappingURL=agent-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-types.d.ts","sourceRoot":"","sources":["../src/agent-types.ts"],"names":[],"mappings":";AAYA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC1H,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAWhD,MAAM,MAAM,WAAW,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAA;AAwCD,MAAM,MAAM,oBAAoB,CAAC,QAAQ,GAAG,GAAG,IAAI;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,OAAO,CAAC,EAAE,QAAQ,CAAC;CACtB,CAAA;AAiCD,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG,GAAG,EAAE,QAAQ,GAAG,GAAG,IAAI;IACrD,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;IAC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B,CAAC;CACL,CAAA;AAiBD,MAAM,MAAM,gBAAgB,GAAG;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACzB,CAAA;AAYD,MAAM,MAAM,kBAAkB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,WAAW,CAAC,EAAE,cAAc,CAAC;CAChC,CAAA;AAkBD,MAAM,MAAM,eAAe,GAAG;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACnC,CAAA"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=agent-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-types.js","sourceRoot":"","sources":["../src/agent-types.ts"],"names":[],"mappings":""}