@memberjunction/ai-agents 2.48.0 → 2.49.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/AgentRunner.d.ts +5 -0
- package/dist/AgentRunner.d.ts.map +1 -0
- package/dist/AgentRunner.js +36 -0
- package/dist/AgentRunner.js.map +1 -0
- package/dist/agent-types/LoopAgentType.d.ts +9 -0
- package/dist/agent-types/LoopAgentType.d.ts.map +1 -0
- package/dist/agent-types/LoopAgentType.js +134 -0
- package/dist/agent-types/LoopAgentType.js.map +1 -0
- package/dist/agent-types/index.d.ts +2 -0
- package/dist/agent-types/index.d.ts.map +1 -0
- package/dist/agent-types/index.js +20 -0
- package/dist/agent-types/index.js.map +1 -0
- package/dist/base-agent-type.d.ts +6 -0
- package/dist/base-agent-type.d.ts.map +1 -0
- package/dist/base-agent-type.js +7 -0
- package/dist/base-agent-type.js.map +1 -0
- package/dist/base-agent.d.ts +5 -55
- package/dist/base-agent.d.ts.map +1 -1
- package/dist/base-agent.js +120 -221
- package/dist/base-agent.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +34 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +9 -9
- package/dist/agent-factory.d.ts +0 -19
- package/dist/agent-factory.d.ts.map +0 -1
- package/dist/agent-factory.js +0 -137
- package/dist/agent-factory.js.map +0 -1
- package/dist/agent-runner.d.ts +0 -36
- package/dist/agent-runner.d.ts.map +0 -1
- package/dist/agent-runner.js +0 -509
- package/dist/agent-runner.js.map +0 -1
- package/dist/base-agent-original.d.ts +0 -205
- package/dist/base-agent-original.d.ts.map +0 -1
- package/dist/base-agent-original.js +0 -1243
- package/dist/base-agent-original.js.map +0 -1
- package/dist/conductor-agent.d.ts +0 -93
- package/dist/conductor-agent.d.ts.map +0 -1
- package/dist/conductor-agent.js +0 -319
- package/dist/conductor-agent.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentRunner.d.ts","sourceRoot":"","sources":["../src/AgentRunner.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAqBjE,qBAAa,WAAW;IAcP,QAAQ,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAwCjF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentRunner = void 0;
|
|
4
|
+
const core_1 = require("@memberjunction/core");
|
|
5
|
+
const global_1 = require("@memberjunction/global");
|
|
6
|
+
const aiengine_1 = require("@memberjunction/aiengine");
|
|
7
|
+
const base_agent_1 = require("./base-agent");
|
|
8
|
+
class AgentRunner {
|
|
9
|
+
async RunAgent(params) {
|
|
10
|
+
try {
|
|
11
|
+
(0, core_1.LogStatus)(`AgentRunner: Starting execution for agent: ${params.agent.Name} (ID: ${params.agent.ID})`);
|
|
12
|
+
await aiengine_1.AIEngine.Instance.Config(false, params.contextUser);
|
|
13
|
+
const agentType = aiengine_1.AIEngine.Instance.AgentTypes.find(at => at.ID === params.agent.TypeID);
|
|
14
|
+
if (!agentType) {
|
|
15
|
+
throw new Error(`Agent type not found for ID: ${params.agent.TypeID}`);
|
|
16
|
+
}
|
|
17
|
+
const driverClass = params.agent.DriverClass || agentType.DriverClass;
|
|
18
|
+
(0, core_1.LogStatus)(`AgentRunner: Using driver class: ${driverClass}`);
|
|
19
|
+
const agentInstance = global_1.MJGlobal.Instance.ClassFactory.CreateInstance(base_agent_1.BaseAgent, driverClass);
|
|
20
|
+
if (!agentInstance) {
|
|
21
|
+
throw new Error(`Failed to create agent instance for driver class: ${driverClass}`);
|
|
22
|
+
}
|
|
23
|
+
return await agentInstance.Execute(params);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
27
|
+
(0, core_1.LogError)(`AgentRunner execution failed: ${errorMessage}`, undefined, error);
|
|
28
|
+
return {
|
|
29
|
+
nextStep: 'failed',
|
|
30
|
+
errorMessage
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.AgentRunner = AgentRunner;
|
|
36
|
+
//# sourceMappingURL=AgentRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentRunner.js","sourceRoot":"","sources":["../src/AgentRunner.ts"],"names":[],"mappings":";;;AAYA,+CAA2D;AAC3D,mDAAkD;AAClD,uDAAoD;AACpD,6CAAyC;AAsBzC,MAAa,WAAW;IAcb,KAAK,CAAC,QAAQ,CAAC,MAA0B;QAC5C,IAAI,CAAC;YACD,IAAA,gBAAS,EAAC,8CAA8C,MAAM,CAAC,KAAK,CAAC,IAAI,SAAS,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;YAGtG,MAAM,mBAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;YAG1D,MAAM,SAAS,GAAG,mBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACzF,IAAI,CAAC,SAAS,EAAE,CAAC;gBACb,MAAM,IAAI,KAAK,CAAC,gCAAgC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;YAC3E,CAAC;YAGD,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,IAAI,SAAS,CAAC,WAAW,CAAC;YACtE,IAAA,gBAAS,EAAC,oCAAoC,WAAW,EAAE,CAAC,CAAC;YAE7D,MAAM,aAAa,GAAG,iBAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,cAAc,CAC/D,sBAAS,EACT,WAAW,CACd,CAAC;YAEF,IAAI,CAAC,aAAa,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,qDAAqD,WAAW,EAAE,CAAC,CAAC;YACxF,CAAC;YAGD,OAAO,MAAM,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAE/C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;YACvF,IAAA,eAAQ,EAAC,iCAAiC,YAAY,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;YAG5E,OAAO;gBACH,QAAQ,EAAE,QAAQ;gBAClB,YAAY;aACf,CAAC;QACN,CAAC;IACL,CAAC;CACJ;AAtDD,kCAsDC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseAgentType } from '../base-agent-type';
|
|
2
|
+
import { BaseAgentNextStep } from '../types';
|
|
3
|
+
import { AIPromptRunResult } from '@memberjunction/ai-prompts';
|
|
4
|
+
export declare class LoopAgentType extends BaseAgentType {
|
|
5
|
+
DetermineNextStep(promptResult: AIPromptRunResult): Promise<BaseAgentNextStep>;
|
|
6
|
+
private isValidLoopResponse;
|
|
7
|
+
}
|
|
8
|
+
export declare function LoadLoopAgentType(): void;
|
|
9
|
+
//# sourceMappingURL=LoopAgentType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoopAgentType.d.ts","sourceRoot":"","sources":["../../src/agent-types/LoopAgentType.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AA4D/D,qBACa,aAAc,SAAQ,aAAa;IAa/B,iBAAiB,CAAC,YAAY,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAkH3F,OAAO,CAAC,mBAAmB;CAoC9B;AAKD,wBAAgB,iBAAiB,SAEhC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.LoadLoopAgentType = exports.LoopAgentType = void 0;
|
|
10
|
+
const global_1 = require("@memberjunction/global");
|
|
11
|
+
const base_agent_type_1 = require("../base-agent-type");
|
|
12
|
+
const core_1 = require("@memberjunction/core");
|
|
13
|
+
let LoopAgentType = class LoopAgentType extends base_agent_type_1.BaseAgentType {
|
|
14
|
+
async DetermineNextStep(promptResult) {
|
|
15
|
+
try {
|
|
16
|
+
if (!promptResult.success || !promptResult.result) {
|
|
17
|
+
return {
|
|
18
|
+
step: 'failed',
|
|
19
|
+
errorMessage: promptResult.errorMessage || 'Prompt execution failed'
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const response = promptResult.result;
|
|
23
|
+
if (!this.isValidLoopResponse(response)) {
|
|
24
|
+
return {
|
|
25
|
+
step: 'failed',
|
|
26
|
+
errorMessage: 'Invalid response structure from loop agent prompt'
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
(0, core_1.LogStatus)(`🔄 Loop Agent Reasoning: ${response.reasoning}`);
|
|
30
|
+
if (response.progress) {
|
|
31
|
+
(0, core_1.LogStatus)(`📊 Progress: ${response.progress.percentage}% - ${response.progress.message}`);
|
|
32
|
+
}
|
|
33
|
+
if (response.error?.occurred) {
|
|
34
|
+
return {
|
|
35
|
+
step: 'failed',
|
|
36
|
+
errorMessage: response.error.message || 'Agent reported an error'
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (response.taskComplete) {
|
|
40
|
+
(0, core_1.LogStatus)('✅ Loop Agent: Task completed successfully');
|
|
41
|
+
return {
|
|
42
|
+
step: 'success',
|
|
43
|
+
returnValue: response.result || response
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
switch (response.nextStep.type) {
|
|
47
|
+
case 'sub-agent':
|
|
48
|
+
if (!response.nextStep.target) {
|
|
49
|
+
return {
|
|
50
|
+
step: 'failed',
|
|
51
|
+
errorMessage: 'Sub-agent target not specified'
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
step: 'sub-agent',
|
|
56
|
+
subAgentName: response.nextStep.target,
|
|
57
|
+
subAgentInstructions: response.nextStep.parameters
|
|
58
|
+
};
|
|
59
|
+
case 'action':
|
|
60
|
+
if (!response.nextStep.target) {
|
|
61
|
+
return {
|
|
62
|
+
step: 'failed',
|
|
63
|
+
errorMessage: 'Action target not specified'
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
step: 'action',
|
|
68
|
+
actionName: response.nextStep.target,
|
|
69
|
+
actionParameters: response.nextStep.parameters
|
|
70
|
+
};
|
|
71
|
+
case 'continue':
|
|
72
|
+
return {
|
|
73
|
+
step: 'retry',
|
|
74
|
+
retryReason: 'Agent requested continuation',
|
|
75
|
+
retryInstructions: response.reasoning
|
|
76
|
+
};
|
|
77
|
+
case 'none':
|
|
78
|
+
(0, core_1.LogStatus)('⚠️ Loop Agent: No next step but task not complete');
|
|
79
|
+
return {
|
|
80
|
+
step: 'retry',
|
|
81
|
+
retryReason: 'No action specified but task incomplete'
|
|
82
|
+
};
|
|
83
|
+
default:
|
|
84
|
+
return {
|
|
85
|
+
step: 'failed',
|
|
86
|
+
errorMessage: `Unknown next step type: ${response.nextStep.type}`
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
(0, core_1.LogError)(`Error in LoopAgentType.DetermineNextStep: ${error.message}`);
|
|
92
|
+
return {
|
|
93
|
+
step: 'failed',
|
|
94
|
+
errorMessage: `Failed to parse loop agent response: ${error.message}`
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
isValidLoopResponse(response) {
|
|
99
|
+
if (typeof response !== 'object' || response === null) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if (typeof response.taskComplete !== 'boolean') {
|
|
103
|
+
(0, core_1.LogError)('LoopAgentResponse missing required field: taskComplete');
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (typeof response.reasoning !== 'string') {
|
|
107
|
+
(0, core_1.LogError)('LoopAgentResponse missing required field: reasoning');
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
if (!response.nextStep || typeof response.nextStep !== 'object') {
|
|
111
|
+
(0, core_1.LogError)('LoopAgentResponse missing required field: nextStep');
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
const validStepTypes = ['action', 'sub-agent', 'continue', 'none'];
|
|
115
|
+
if (!validStepTypes.includes(response.nextStep.type)) {
|
|
116
|
+
(0, core_1.LogError)(`LoopAgentResponse has invalid nextStep.type: ${response.nextStep.type}`);
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
if ((response.nextStep.type === 'action' || response.nextStep.type === 'sub-agent') &&
|
|
120
|
+
!response.nextStep.target) {
|
|
121
|
+
(0, core_1.LogError)(`LoopAgentResponse requires target for nextStep.type: ${response.nextStep.type}`);
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
exports.LoopAgentType = LoopAgentType;
|
|
128
|
+
exports.LoopAgentType = LoopAgentType = __decorate([
|
|
129
|
+
(0, global_1.RegisterClass)(base_agent_type_1.BaseAgentType, "LoopAgentType")
|
|
130
|
+
], LoopAgentType);
|
|
131
|
+
function LoadLoopAgentType() {
|
|
132
|
+
}
|
|
133
|
+
exports.LoadLoopAgentType = LoadLoopAgentType;
|
|
134
|
+
//# sourceMappingURL=LoopAgentType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoopAgentType.js","sourceRoot":"","sources":["../../src/agent-types/LoopAgentType.ts"],"names":[],"mappings":";;;;;;;;;AAYA,mDAAuD;AACvD,wDAAmD;AAGnD,+CAA2D;AA4DpD,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,+BAAa;IAarC,KAAK,CAAC,iBAAiB,CAAC,YAA+B;QAC1D,IAAI,CAAC;YAED,IAAI,CAAC,YAAY,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;gBAChD,OAAO;oBACH,IAAI,EAAE,QAAQ;oBACd,YAAY,EAAE,YAAY,CAAC,YAAY,IAAI,yBAAyB;iBACvE,CAAC;YACN,CAAC;YAGD,MAAM,QAAQ,GAAG,YAAY,CAAC,MAA2B,CAAC;YAG1D,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACtC,OAAO;oBACH,IAAI,EAAE,QAAQ;oBACd,YAAY,EAAE,mDAAmD;iBACpE,CAAC;YACN,CAAC;YAGD,IAAA,gBAAS,EAAC,4BAA4B,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;YAG5D,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;gBACpB,IAAA,gBAAS,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;QACjB,CAAC;QAED,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QACnE,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACnD,IAAA,eAAQ,EAAC,gDAAgD,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;YACnF,OAAO,KAAK,CAAC;QACjB,CAAC;QAGD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,WAAW,CAAC;YAC/E,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC5B,IAAA,eAAQ,EAAC,wDAAwD,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;YAC3F,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAnKY,sCAAa;wBAAb,aAAa;IADzB,IAAA,sBAAa,EAAC,+BAAa,EAAE,eAAe,CAAC;GACjC,aAAa,CAmKzB;AAKD,SAAgB,iBAAiB;AAEjC,CAAC;AAFD,8CAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent-types/index.ts"],"names":[],"mappings":"AAYA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./LoopAgentType"), exports);
|
|
18
|
+
const LoopAgentType_1 = require("./LoopAgentType");
|
|
19
|
+
(0, LoopAgentType_1.LoadLoopAgentType)();
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent-types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAYA,kDAAgC;AAGhC,mDAAoD;AACpD,IAAA,iCAAiB,GAAE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AIPromptRunResult } from '@memberjunction/ai-prompts';
|
|
2
|
+
import { BaseAgentNextStep } from './types';
|
|
3
|
+
export declare abstract class BaseAgentType {
|
|
4
|
+
abstract DetermineNextStep(promptResult: AIPromptRunResult): Promise<BaseAgentNextStep>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=base-agent-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-agent-type.d.ts","sourceRoot":"","sources":["../src/base-agent-type.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAoC5C,8BAAsB,aAAa;aA4Bf,iBAAiB,CAAC,YAAY,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CACjG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-agent-type.js","sourceRoot":"","sources":["../src/base-agent-type.ts"],"names":[],"mappings":";;;AAkDA,MAAsB,aAAa;CA6BlC;AA7BD,sCA6BC"}
|
package/dist/base-agent.d.ts
CHANGED
|
@@ -1,59 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { UserInfo, Metadata } from '@memberjunction/core';
|
|
3
|
-
import { AIAgentEntityExtended, AIPromptEntity } from '@memberjunction/core-entities';
|
|
4
|
-
import { AIPromptRunner } from '@memberjunction/ai-prompts';
|
|
5
|
-
import { ChatMessage } from '@memberjunction/ai';
|
|
6
|
-
export interface AgentExecutionParams {
|
|
7
|
-
contextUser?: UserInfo;
|
|
8
|
-
data?: Record<string, unknown>;
|
|
9
|
-
conversationMessages?: ChatMessage[];
|
|
10
|
-
cancellationToken?: AbortSignal;
|
|
11
|
-
onProgress?: (progress: AgentProgressUpdate) => void;
|
|
12
|
-
onStreaming?: (chunk: AgentStreamingUpdate) => void;
|
|
13
|
-
}
|
|
14
|
-
export interface AgentProgressUpdate {
|
|
15
|
-
step: 'initialization' | 'prompt_execution' | 'completion';
|
|
16
|
-
percentage: number;
|
|
17
|
-
message: string;
|
|
18
|
-
metadata?: Record<string, unknown>;
|
|
19
|
-
}
|
|
20
|
-
export interface AgentStreamingUpdate {
|
|
21
|
-
content: string;
|
|
22
|
-
isComplete: boolean;
|
|
23
|
-
sourceId?: string;
|
|
24
|
-
sourceName?: string;
|
|
25
|
-
}
|
|
26
|
-
export interface AgentExecutionResult {
|
|
27
|
-
success: boolean;
|
|
28
|
-
result?: unknown;
|
|
29
|
-
errorMessage?: string;
|
|
30
|
-
executionTimeMS?: number;
|
|
31
|
-
metadata?: Record<string, unknown>;
|
|
32
|
-
cancelled?: boolean;
|
|
33
|
-
conversationMessages?: ChatMessage[];
|
|
34
|
-
}
|
|
35
|
-
export interface IAgentFactory {
|
|
36
|
-
CreateAgentFromEntity(agentEntity: AIAgentEntityExtended, key?: string, ...additionalParams: any[]): BaseAgent;
|
|
37
|
-
CreateAgent(agentName: string, key?: string, contextUser?: UserInfo, ...additionalParams: any[]): Promise<BaseAgent>;
|
|
38
|
-
}
|
|
1
|
+
import { ExecuteAgentParams, ExecuteAgentResult } from './types';
|
|
39
2
|
export declare class BaseAgent {
|
|
40
|
-
private _agent;
|
|
41
|
-
private _factory;
|
|
42
3
|
private _promptRunner;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
protected get factory(): IAgentFactory;
|
|
48
|
-
protected get promptRunner(): AIPromptRunner;
|
|
49
|
-
protected get contextUser(): UserInfo;
|
|
50
|
-
Execute(params: AgentExecutionParams): Promise<AgentExecutionResult>;
|
|
51
|
-
private executeAgentPrompts;
|
|
52
|
-
protected loadAgentPrompts(): Promise<AIPromptEntity[]>;
|
|
53
|
-
private getPromptCount;
|
|
54
|
-
private compressContext;
|
|
55
|
-
private sendProgress;
|
|
56
|
-
private createCancelledResult;
|
|
4
|
+
Execute(params: ExecuteAgentParams): Promise<ExecuteAgentResult>;
|
|
5
|
+
private gatherContextData;
|
|
6
|
+
private getAgentTypeInstance;
|
|
7
|
+
private getAgentInstanceWithDriverClass;
|
|
57
8
|
}
|
|
58
|
-
export declare function LoadBaseAgent(): void;
|
|
59
9
|
//# sourceMappingURL=base-agent.d.ts.map
|
package/dist/base-agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-agent.d.ts","sourceRoot":"","sources":["../src/base-agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-agent.d.ts","sourceRoot":"","sources":["../src/base-agent.ts"],"names":[],"mappings":"AAoBA,OAAO,EACH,kBAAkB,EAClB,kBAAkB,EAGrB,MAAM,SAAS,CAAC;AA+BjB,qBAAa,SAAS;IAKlB,OAAO,CAAC,aAAa,CAAwC;IA2BhD,OAAO,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAwJ/D,iBAAiB;YA0DjB,oBAAoB;YAiBpB,+BAA+B;CAShD"}
|