@jterrazz/intelligence 1.0.0 → 1.1.1
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/README.md +111 -14
- package/dist/adapters/agents/chat-agent.adapter.d.ts +20 -26
- package/dist/adapters/agents/chat-agent.adapter.js +99 -129
- package/dist/adapters/agents/chat-agent.adapter.js.map +1 -1
- package/dist/adapters/agents/query-agent.adapter.d.ts +26 -0
- package/dist/adapters/agents/query-agent.adapter.js +303 -0
- package/dist/adapters/agents/query-agent.adapter.js.map +1 -0
- package/dist/adapters/models/openrouter-model.adapter.d.ts +16 -6
- package/dist/adapters/models/openrouter-model.adapter.js +7 -4
- package/dist/adapters/models/openrouter-model.adapter.js.map +1 -1
- package/dist/adapters/prompts/__tests__/__snapshots__/presets.test.ts.snap +73 -103
- package/dist/adapters/prompts/__tests__/presets.test.js +1 -1
- package/dist/adapters/prompts/__tests__/presets.test.js.map +1 -1
- package/dist/adapters/prompts/library/categories/domain.d.ts +8 -8
- package/dist/adapters/prompts/library/categories/domain.js +8 -8
- package/dist/adapters/prompts/library/categories/domain.js.map +1 -1
- package/dist/adapters/prompts/library/categories/format.d.ts +7 -6
- package/dist/adapters/prompts/library/categories/format.js +7 -6
- package/dist/adapters/prompts/library/categories/format.js.map +1 -1
- package/dist/adapters/prompts/library/categories/foundations.d.ts +11 -0
- package/dist/adapters/prompts/library/categories/foundations.js +12 -0
- package/dist/adapters/prompts/library/categories/foundations.js.map +1 -0
- package/dist/adapters/prompts/library/categories/language.d.ts +8 -8
- package/dist/adapters/prompts/library/categories/language.js +8 -8
- package/dist/adapters/prompts/library/categories/language.js.map +1 -1
- package/dist/adapters/prompts/library/categories/persona.d.ts +9 -8
- package/dist/adapters/prompts/library/categories/persona.js +9 -8
- package/dist/adapters/prompts/library/categories/persona.js.map +1 -1
- package/dist/adapters/prompts/library/categories/response.d.ts +9 -0
- package/dist/adapters/prompts/library/categories/response.js +10 -0
- package/dist/adapters/prompts/library/categories/response.js.map +1 -0
- package/dist/adapters/prompts/library/categories/tone.d.ts +5 -5
- package/dist/adapters/prompts/library/categories/tone.js +5 -5
- package/dist/adapters/prompts/library/categories/tone.js.map +1 -1
- package/dist/adapters/prompts/library/categories/verbosity.d.ts +3 -3
- package/dist/adapters/prompts/library/categories/verbosity.js +3 -3
- package/dist/adapters/prompts/library/categories/verbosity.js.map +1 -1
- package/dist/adapters/prompts/library/index.d.ts +50 -50
- package/dist/adapters/prompts/library/index.js +15 -17
- package/dist/adapters/prompts/library/index.js.map +1 -1
- package/dist/adapters/prompts/library/presets.d.ts +5 -5
- package/dist/adapters/prompts/library/presets.js +27 -33
- package/dist/adapters/prompts/library/presets.js.map +1 -1
- package/dist/adapters/prompts/system-prompt.adapter.d.ts +2 -2
- package/dist/adapters/prompts/system-prompt.adapter.js.map +1 -1
- package/dist/adapters/prompts/user-prompt.adapter.d.ts +2 -2
- package/dist/adapters/prompts/user-prompt.adapter.js.map +1 -1
- package/dist/adapters/tools/safe-tool.adapter.d.ts +2 -2
- package/dist/adapters/tools/safe-tool.adapter.js.map +1 -1
- package/dist/index.cjs +517 -258
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/ports/agent.port.d.ts +3 -3
- package/dist/ports/agent.port.js.map +1 -1
- package/dist/ports/model.port.d.ts +1 -1
- package/dist/ports/model.port.js.map +1 -1
- package/dist/ports/prompt.port.d.ts +1 -1
- package/dist/ports/prompt.port.js.map +1 -1
- package/dist/ports/tool.port.d.ts +1 -1
- package/dist/ports/tool.port.js.map +1 -1
- package/package.json +1 -1
- package/dist/adapters/prompts/library/categories/agent-logic.d.ts +0 -8
- package/dist/adapters/prompts/library/categories/agent-logic.js +0 -9
- package/dist/adapters/prompts/library/categories/agent-logic.js.map +0 -1
- package/dist/adapters/prompts/library/categories/agent-skills.d.ts +0 -8
- package/dist/adapters/prompts/library/categories/agent-skills.js +0 -9
- package/dist/adapters/prompts/library/categories/agent-skills.js.map +0 -1
- package/dist/adapters/prompts/library/categories/directives.d.ts +0 -9
- package/dist/adapters/prompts/library/categories/directives.js +0 -10
- package/dist/adapters/prompts/library/categories/directives.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -18,7 +18,7 @@ function _call_super(_this, derived, args) {
|
|
|
18
18
|
derived = _get_prototype_of(derived);
|
|
19
19
|
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
20
20
|
}
|
|
21
|
-
function _class_call_check$
|
|
21
|
+
function _class_call_check$7(instance, Constructor) {
|
|
22
22
|
if (!(instance instanceof Constructor)) {
|
|
23
23
|
throw new TypeError("Cannot call a class as a function");
|
|
24
24
|
}
|
|
@@ -40,7 +40,7 @@ function _construct(Parent, args, Class) {
|
|
|
40
40
|
}
|
|
41
41
|
return _construct.apply(null, arguments);
|
|
42
42
|
}
|
|
43
|
-
function _define_property$
|
|
43
|
+
function _define_property$7(obj, key, value) {
|
|
44
44
|
if (key in obj) {
|
|
45
45
|
Object.defineProperty(obj, key, {
|
|
46
46
|
value: value,
|
|
@@ -76,7 +76,7 @@ function _is_native_function(fn) {
|
|
|
76
76
|
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
77
77
|
}
|
|
78
78
|
function _possible_constructor_return(self, call) {
|
|
79
|
-
if (call && (_type_of$
|
|
79
|
+
if (call && (_type_of$1(call) === "object" || typeof call === "function")) {
|
|
80
80
|
return call;
|
|
81
81
|
}
|
|
82
82
|
return _assert_this_initialized(self);
|
|
@@ -88,7 +88,7 @@ function _set_prototype_of(o, p) {
|
|
|
88
88
|
};
|
|
89
89
|
return _set_prototype_of(o, p);
|
|
90
90
|
}
|
|
91
|
-
function _type_of$
|
|
91
|
+
function _type_of$1(obj) {
|
|
92
92
|
"@swc/helpers - typeof";
|
|
93
93
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
94
94
|
}
|
|
@@ -129,11 +129,11 @@ function _is_native_reflect_construct() {
|
|
|
129
129
|
var AIResponseParserError = /*#__PURE__*/ function(Error1) {
|
|
130
130
|
_inherits(AIResponseParserError, Error1);
|
|
131
131
|
function AIResponseParserError(message, cause, text) {
|
|
132
|
-
_class_call_check$
|
|
132
|
+
_class_call_check$7(this, AIResponseParserError);
|
|
133
133
|
var _this;
|
|
134
134
|
_this = _call_super(this, AIResponseParserError, [
|
|
135
135
|
message
|
|
136
|
-
]), _define_property$
|
|
136
|
+
]), _define_property$7(_this, "cause", void 0), _define_property$7(_this, "text", void 0), _this.cause = cause, _this.text = text;
|
|
137
137
|
_this.name = 'AIResponseParserError';
|
|
138
138
|
return _this;
|
|
139
139
|
}
|
|
@@ -148,12 +148,12 @@ function _array_like_to_array(arr, len) {
|
|
|
148
148
|
function _array_with_holes(arr) {
|
|
149
149
|
if (Array.isArray(arr)) return arr;
|
|
150
150
|
}
|
|
151
|
-
function _class_call_check$
|
|
151
|
+
function _class_call_check$6(instance, Constructor) {
|
|
152
152
|
if (!(instance instanceof Constructor)) {
|
|
153
153
|
throw new TypeError("Cannot call a class as a function");
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
function _defineProperties$
|
|
156
|
+
function _defineProperties$6(target, props) {
|
|
157
157
|
for(var i = 0; i < props.length; i++){
|
|
158
158
|
var descriptor = props[i];
|
|
159
159
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -162,11 +162,11 @@ function _defineProperties$5(target, props) {
|
|
|
162
162
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
function _create_class$
|
|
166
|
-
if (protoProps) _defineProperties$
|
|
165
|
+
function _create_class$6(Constructor, protoProps, staticProps) {
|
|
166
|
+
if (protoProps) _defineProperties$6(Constructor.prototype, protoProps);
|
|
167
167
|
return Constructor;
|
|
168
168
|
}
|
|
169
|
-
function _define_property$
|
|
169
|
+
function _define_property$6(obj, key, value) {
|
|
170
170
|
if (key in obj) {
|
|
171
171
|
Object.defineProperty(obj, key, {
|
|
172
172
|
value: value,
|
|
@@ -179,7 +179,7 @@ function _define_property$5(obj, key, value) {
|
|
|
179
179
|
}
|
|
180
180
|
return obj;
|
|
181
181
|
}
|
|
182
|
-
function _instanceof$
|
|
182
|
+
function _instanceof$3(left, right) {
|
|
183
183
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
184
184
|
return !!right[Symbol.hasInstance](left);
|
|
185
185
|
} else {
|
|
@@ -216,7 +216,7 @@ function _non_iterable_rest() {
|
|
|
216
216
|
function _sliced_to_array(arr, i) {
|
|
217
217
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
218
218
|
}
|
|
219
|
-
function _type_of
|
|
219
|
+
function _type_of(obj) {
|
|
220
220
|
"@swc/helpers - typeof";
|
|
221
221
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
222
222
|
}
|
|
@@ -232,11 +232,11 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
232
232
|
* Parses AI response text into structured data based on Zod schema
|
|
233
233
|
*/ var AIResponseParser = /*#__PURE__*/ function() {
|
|
234
234
|
function AIResponseParser(schema) {
|
|
235
|
-
_class_call_check$
|
|
236
|
-
_define_property$
|
|
235
|
+
_class_call_check$6(this, AIResponseParser);
|
|
236
|
+
_define_property$6(this, "schema", void 0);
|
|
237
237
|
this.schema = schema;
|
|
238
238
|
}
|
|
239
|
-
_create_class$
|
|
239
|
+
_create_class$6(AIResponseParser, [
|
|
240
240
|
{
|
|
241
241
|
key: "parse",
|
|
242
242
|
value: /**
|
|
@@ -248,7 +248,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
248
248
|
var unescapedJson = this.unescapeJsonValues(json);
|
|
249
249
|
return this.schema.parse(unescapedJson);
|
|
250
250
|
} catch (error) {
|
|
251
|
-
if (_instanceof$
|
|
251
|
+
if (_instanceof$3(error, v4.z.ZodError)) {
|
|
252
252
|
throw new AIResponseParserError('Failed to validate response against schema', error, text);
|
|
253
253
|
}
|
|
254
254
|
throw error;
|
|
@@ -288,16 +288,16 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
288
288
|
value: /**
|
|
289
289
|
* Converts value to appropriate primitive type based on schema
|
|
290
290
|
*/ function convertToPrimitive(value, schema) {
|
|
291
|
-
if (_instanceof$
|
|
291
|
+
if (_instanceof$3(schema, v4.z.ZodString)) {
|
|
292
292
|
return String(value);
|
|
293
293
|
}
|
|
294
|
-
if (_instanceof$
|
|
294
|
+
if (_instanceof$3(schema, v4.z.ZodNumber)) {
|
|
295
295
|
return Number(value);
|
|
296
296
|
}
|
|
297
|
-
if (_instanceof$
|
|
297
|
+
if (_instanceof$3(schema, v4.z.ZodBoolean)) {
|
|
298
298
|
return Boolean(value);
|
|
299
299
|
}
|
|
300
|
-
if (_instanceof$
|
|
300
|
+
if (_instanceof$3(schema, v4.z.ZodNull)) {
|
|
301
301
|
return null;
|
|
302
302
|
}
|
|
303
303
|
return value;
|
|
@@ -340,13 +340,13 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
340
340
|
value: /**
|
|
341
341
|
* Extracts and parses JSON from text based on schema type
|
|
342
342
|
*/ function extractJsonFromText(text) {
|
|
343
|
-
if (_instanceof$
|
|
343
|
+
if (_instanceof$3(this.schema, v4.z.ZodArray)) {
|
|
344
344
|
return this.extractArray(text);
|
|
345
345
|
}
|
|
346
|
-
if (_instanceof$
|
|
346
|
+
if (_instanceof$3(this.schema, v4.z.ZodObject)) {
|
|
347
347
|
return this.extractObject(text);
|
|
348
348
|
}
|
|
349
|
-
if (_instanceof$
|
|
349
|
+
if (_instanceof$3(this.schema, v4.z.ZodString) || _instanceof$3(this.schema, v4.z.ZodNumber) || _instanceof$3(this.schema, v4.z.ZodBoolean) || _instanceof$3(this.schema, v4.z.ZodNull)) {
|
|
350
350
|
return this.extractPrimitive(text, this.schema);
|
|
351
351
|
}
|
|
352
352
|
throw new AIResponseParserError('Unsupported schema type', undefined, text);
|
|
@@ -438,7 +438,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
438
438
|
return _this.unescapeJsonValues(item);
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
|
-
if ((typeof json === "undefined" ? "undefined" : _type_of
|
|
441
|
+
if ((typeof json === "undefined" ? "undefined" : _type_of(json)) === 'object' && json !== null) {
|
|
442
442
|
return Object.fromEntries(Object.entries(json).map(function(param) {
|
|
443
443
|
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
444
444
|
return [
|
|
@@ -469,7 +469,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
469
469
|
return AIResponseParser;
|
|
470
470
|
}();
|
|
471
471
|
|
|
472
|
-
function asyncGeneratorStep$
|
|
472
|
+
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
473
473
|
try {
|
|
474
474
|
var info = gen[key](arg);
|
|
475
475
|
var value = info.value;
|
|
@@ -483,27 +483,27 @@ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
483
483
|
Promise.resolve(value).then(_next, _throw);
|
|
484
484
|
}
|
|
485
485
|
}
|
|
486
|
-
function _async_to_generator$
|
|
486
|
+
function _async_to_generator$2(fn) {
|
|
487
487
|
return function() {
|
|
488
488
|
var self = this, args = arguments;
|
|
489
489
|
return new Promise(function(resolve, reject) {
|
|
490
490
|
var gen = fn.apply(self, args);
|
|
491
491
|
function _next(value) {
|
|
492
|
-
asyncGeneratorStep$
|
|
492
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
|
|
493
493
|
}
|
|
494
494
|
function _throw(err) {
|
|
495
|
-
asyncGeneratorStep$
|
|
495
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
|
|
496
496
|
}
|
|
497
497
|
_next(undefined);
|
|
498
498
|
});
|
|
499
499
|
};
|
|
500
500
|
}
|
|
501
|
-
function _class_call_check$
|
|
501
|
+
function _class_call_check$5(instance, Constructor) {
|
|
502
502
|
if (!(instance instanceof Constructor)) {
|
|
503
503
|
throw new TypeError("Cannot call a class as a function");
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
|
-
function _defineProperties$
|
|
506
|
+
function _defineProperties$5(target, props) {
|
|
507
507
|
for(var i = 0; i < props.length; i++){
|
|
508
508
|
var descriptor = props[i];
|
|
509
509
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -512,11 +512,11 @@ function _defineProperties$4(target, props) {
|
|
|
512
512
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
|
-
function _create_class$
|
|
516
|
-
if (protoProps) _defineProperties$
|
|
515
|
+
function _create_class$5(Constructor, protoProps, staticProps) {
|
|
516
|
+
if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
|
|
517
517
|
return Constructor;
|
|
518
518
|
}
|
|
519
|
-
function _define_property$
|
|
519
|
+
function _define_property$5(obj, key, value) {
|
|
520
520
|
if (key in obj) {
|
|
521
521
|
Object.defineProperty(obj, key, {
|
|
522
522
|
value: value,
|
|
@@ -529,18 +529,14 @@ function _define_property$4(obj, key, value) {
|
|
|
529
529
|
}
|
|
530
530
|
return obj;
|
|
531
531
|
}
|
|
532
|
-
function _instanceof$
|
|
532
|
+
function _instanceof$2(left, right) {
|
|
533
533
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
534
534
|
return !!right[Symbol.hasInstance](left);
|
|
535
535
|
} else {
|
|
536
536
|
return left instanceof right;
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
function
|
|
540
|
-
"@swc/helpers - typeof";
|
|
541
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
542
|
-
}
|
|
543
|
-
function _ts_generator$1(thisArg, body) {
|
|
539
|
+
function _ts_generator$2(thisArg, body) {
|
|
544
540
|
var f, y, t, _ = {
|
|
545
541
|
label: 0,
|
|
546
542
|
sent: function() {
|
|
@@ -631,84 +627,88 @@ function _ts_generator$1(thisArg, body) {
|
|
|
631
627
|
};
|
|
632
628
|
}
|
|
633
629
|
}
|
|
634
|
-
|
|
635
|
-
var AgentResponseSchema = v4.z.object({
|
|
636
|
-
message: v4.z.string().optional(),
|
|
637
|
-
reason: v4.z.string().optional(),
|
|
638
|
-
shouldRespond: v4.z["boolean"]()
|
|
639
|
-
});
|
|
640
|
-
// LangChain-specific framework rules (internal to this adapter)
|
|
641
|
-
var LANGCHAIN_FRAMEWORK_RULES = '\n<AGENT_FRAMEWORK>\nYou are a chat agent piloted by the LangChain framework.\n\nYou have access to the following tools: {tools}\nTool names: {tool_names}\nAgent scratchpad: {agent_scratchpad}\n\nWhen you want to provide your final response, you MUST format it exactly like this:\n\n```json\n{{"action": "Final Answer", "action_input": {{"shouldRespond": false, "reason": "<your reason>"}}}}\n```\n\nOR \n\n```json\n{{"action": "Final Answer", "action_input": {{"shouldRespond": true, "message": "<your response message>"}}}}\n```\n\n"shouldRespond" set to true means the message will be sent to the user.\n"shouldRespond" set to false means the message will not be sent to the user.\n\nALWAYS use this exact format with markdown code blocks and the action/action_input structure.\n</AGENT_FRAMEWORK>';
|
|
630
|
+
var SYSTEM_PROMPT_TEMPLATE = '\n<OBJECTIVE>\n{mission_prompt}\n</OBJECTIVE>\n\n<OUTPUT_FORMAT>\nCRITICAL: The format instructions in this section are the ONLY valid way to structure your response. Any formatting guidelines within the <OBJECTIVE> section (like message templates) apply ONLY to the content that goes inside the "RESPOND: " part of your final answer.\n\nYou have two ways to respond:\n\n1. **Call a tool** to gather information. For this, you MUST output a JSON blob with the tool\'s name and its input.\n *Valid tool names are: {tool_names}*\n ```json\n {{\n "action": "tool_name_to_use",\n "action_input": "the input for the tool, or an empty object {{}} if no input is needed"\n }}\n ```\n\n2. **Provide the Final Answer** once you have enough information. For this, you MUST output a JSON blob with the "Final Answer" action. The input must start with "RESPOND: " or "SILENT: ".\n - To send a message:\n ```json\n {{\n "action": "Final Answer",\n "action_input": "RESPOND: <your response message>"\n }}\n ```\n - To stay silent:\n ```json\n {{\n "action": "Final Answer",\n "action_input": "SILENT: <your reason for staying silent>"\n }}\n ```\n</OUTPUT_FORMAT>\n\n<EXECUTION_CONTEXT>\nThis is internal data for your reference.\n\n<TOOLS>\n{tools}\n</TOOLS>\n\n<WORKING_MEMORY>\nThis is your internal thought process and previous tool usage.\n{agent_scratchpad}\n</WORKING_MEMORY>\n</EXECUTION_CONTEXT>\n';
|
|
642
631
|
/**
|
|
643
|
-
*
|
|
632
|
+
* An advanced agent that uses tools and a structured prompt to engage in conversational chat.
|
|
633
|
+
* It can decide whether to respond or remain silent and supports schema-validated responses.
|
|
644
634
|
*/ var ChatAgentAdapter = /*#__PURE__*/ function() {
|
|
645
|
-
function ChatAgentAdapter(name,
|
|
646
|
-
_class_call_check$
|
|
647
|
-
_define_property$
|
|
648
|
-
_define_property$
|
|
649
|
-
_define_property$4(this, "name", void 0);
|
|
650
|
-
_define_property$4(this, "responseParser", void 0);
|
|
635
|
+
function ChatAgentAdapter(name, options) {
|
|
636
|
+
_class_call_check$5(this, ChatAgentAdapter);
|
|
637
|
+
_define_property$5(this, "name", void 0);
|
|
638
|
+
_define_property$5(this, "options", void 0);
|
|
651
639
|
this.name = name;
|
|
652
|
-
this.
|
|
653
|
-
this.responseParser = new AIResponseParser(AgentResponseSchema);
|
|
654
|
-
this.executorPromise = this.createExecutor(systemPrompt, options);
|
|
640
|
+
this.options = options;
|
|
655
641
|
}
|
|
656
|
-
_create_class$
|
|
642
|
+
_create_class$5(ChatAgentAdapter, [
|
|
657
643
|
{
|
|
658
644
|
key: "run",
|
|
659
645
|
value: function run(userPrompt) {
|
|
660
|
-
return _async_to_generator$
|
|
661
|
-
var
|
|
662
|
-
return _ts_generator$
|
|
646
|
+
return _async_to_generator$2(function() {
|
|
647
|
+
var _this_options_logger, _this_options_logger1, executor, userInput, result, agentResponse, _this_options_logger2, _agentResponse_message, message, _this_options_logger3, _this_options_logger4, error, _this_options_logger5;
|
|
648
|
+
return _ts_generator$2(this, function(_state) {
|
|
663
649
|
switch(_state.label){
|
|
664
650
|
case 0:
|
|
651
|
+
(_this_options_logger = this.options.logger) === null || _this_options_logger === void 0 ? void 0 : _this_options_logger.debug("[".concat(this.name, "] Starting chat execution."));
|
|
652
|
+
_state.label = 1;
|
|
653
|
+
case 1:
|
|
665
654
|
_state.trys.push([
|
|
666
|
-
|
|
667
|
-
|
|
655
|
+
1,
|
|
656
|
+
4,
|
|
668
657
|
,
|
|
669
|
-
|
|
658
|
+
5
|
|
670
659
|
]);
|
|
671
660
|
return [
|
|
672
661
|
4,
|
|
673
|
-
this.
|
|
662
|
+
this.createExecutor()
|
|
674
663
|
];
|
|
675
|
-
case
|
|
664
|
+
case 2:
|
|
676
665
|
executor = _state.sent();
|
|
677
|
-
|
|
666
|
+
userInput = this.resolveUserInput(userPrompt);
|
|
678
667
|
return [
|
|
679
668
|
4,
|
|
680
669
|
executor.invoke({
|
|
681
|
-
input:
|
|
670
|
+
input: userInput
|
|
682
671
|
})
|
|
683
672
|
];
|
|
684
|
-
case
|
|
673
|
+
case 3:
|
|
685
674
|
result = _state.sent();
|
|
686
|
-
(
|
|
687
|
-
|
|
688
|
-
hasOutput: 'output' in result,
|
|
689
|
-
hasUserPrompt: !!userPrompt,
|
|
690
|
-
outputType: _type_of(result.output)
|
|
675
|
+
(_this_options_logger1 = this.options.logger) === null || _this_options_logger1 === void 0 ? void 0 : _this_options_logger1.debug("[".concat(this.name, "] Agent execution completed."), {
|
|
676
|
+
hasOutput: 'output' in result
|
|
691
677
|
});
|
|
692
|
-
if (!result || typeof result.output
|
|
693
|
-
throw new Error('Agent returned invalid result structure');
|
|
678
|
+
if (!result || typeof result.output !== 'string') {
|
|
679
|
+
throw new Error('Agent returned an invalid result structure.');
|
|
680
|
+
}
|
|
681
|
+
agentResponse = this.parseAgentOutput(result.output);
|
|
682
|
+
if (!agentResponse.shouldRespond) {
|
|
683
|
+
(_this_options_logger2 = this.options.logger) === null || _this_options_logger2 === void 0 ? void 0 : _this_options_logger2.info("[".concat(this.name, "] Agent chose to remain silent."), {
|
|
684
|
+
reason: agentResponse.reason
|
|
685
|
+
});
|
|
686
|
+
return [
|
|
687
|
+
2,
|
|
688
|
+
null
|
|
689
|
+
];
|
|
690
|
+
}
|
|
691
|
+
message = (_agentResponse_message = agentResponse.message) !== null && _agentResponse_message !== void 0 ? _agentResponse_message : '';
|
|
692
|
+
if (this.options.schema) {
|
|
693
|
+
this.validateResponseContent(message, this.options.schema);
|
|
694
|
+
(_this_options_logger3 = this.options.logger) === null || _this_options_logger3 === void 0 ? void 0 : _this_options_logger3.info("[".concat(this.name, "] Execution finished; response content validated."));
|
|
695
|
+
} else {
|
|
696
|
+
(_this_options_logger4 = this.options.logger) === null || _this_options_logger4 === void 0 ? void 0 : _this_options_logger4.info("[".concat(this.name, "] Execution finished."));
|
|
694
697
|
}
|
|
695
|
-
response = this.parseAgentResponse(result.output);
|
|
696
698
|
return [
|
|
697
699
|
2,
|
|
698
|
-
|
|
700
|
+
message
|
|
699
701
|
];
|
|
700
|
-
case
|
|
702
|
+
case 4:
|
|
701
703
|
error = _state.sent();
|
|
702
|
-
(
|
|
703
|
-
|
|
704
|
-
error: _instanceof$1(error, Error) ? error.message : 'Unknown error',
|
|
705
|
-
userPrompt: userPrompt ? 'Prompt object' : 'none'
|
|
704
|
+
(_this_options_logger5 = this.options.logger) === null || _this_options_logger5 === void 0 ? void 0 : _this_options_logger5.error("[".concat(this.name, "] Chat execution failed."), {
|
|
705
|
+
error: _instanceof$2(error, Error) ? error.message : 'Unknown error'
|
|
706
706
|
});
|
|
707
707
|
return [
|
|
708
708
|
2,
|
|
709
709
|
null
|
|
710
710
|
];
|
|
711
|
-
case
|
|
711
|
+
case 5:
|
|
712
712
|
return [
|
|
713
713
|
2
|
|
714
714
|
];
|
|
@@ -719,31 +719,32 @@ var LANGCHAIN_FRAMEWORK_RULES = '\n<AGENT_FRAMEWORK>\nYou are a chat agent pilot
|
|
|
719
719
|
},
|
|
720
720
|
{
|
|
721
721
|
key: "createExecutor",
|
|
722
|
-
value: function createExecutor(
|
|
723
|
-
return _async_to_generator$
|
|
724
|
-
var model,
|
|
725
|
-
return _ts_generator$
|
|
722
|
+
value: function createExecutor() {
|
|
723
|
+
return _async_to_generator$2(function() {
|
|
724
|
+
var model, tools, prompt, agent;
|
|
725
|
+
return _ts_generator$2(this, function(_state) {
|
|
726
726
|
switch(_state.label){
|
|
727
727
|
case 0:
|
|
728
|
-
model = options.model.getModel();
|
|
729
|
-
|
|
730
|
-
dynamicTools = options.tools.map(function(tool) {
|
|
728
|
+
model = this.options.model.getModel();
|
|
729
|
+
tools = this.options.tools.map(function(tool) {
|
|
731
730
|
return tool.getDynamicTool();
|
|
732
731
|
});
|
|
733
|
-
// Combine LangChain framework rules with user-provided system prompts
|
|
734
|
-
systemPromptText = "".concat(LANGCHAIN_FRAMEWORK_RULES, "\n\n").concat(systemPrompt.generate());
|
|
735
|
-
systemTemplate = prompts.SystemMessagePromptTemplate.fromTemplate(systemPromptText);
|
|
736
|
-
humanTemplate = prompts.HumanMessagePromptTemplate.fromTemplate('{input}');
|
|
737
732
|
prompt = prompts.ChatPromptTemplate.fromMessages([
|
|
738
|
-
|
|
739
|
-
|
|
733
|
+
[
|
|
734
|
+
'system',
|
|
735
|
+
SYSTEM_PROMPT_TEMPLATE.replace('{mission_prompt}', this.options.systemPrompt.generate())
|
|
736
|
+
],
|
|
737
|
+
[
|
|
738
|
+
'human',
|
|
739
|
+
'{input}'
|
|
740
|
+
]
|
|
740
741
|
]);
|
|
741
742
|
return [
|
|
742
743
|
4,
|
|
743
744
|
agents.createStructuredChatAgent({
|
|
744
745
|
llm: model,
|
|
745
746
|
prompt: prompt,
|
|
746
|
-
tools:
|
|
747
|
+
tools: tools
|
|
747
748
|
})
|
|
748
749
|
];
|
|
749
750
|
case 1:
|
|
@@ -752,102 +753,365 @@ var LANGCHAIN_FRAMEWORK_RULES = '\n<AGENT_FRAMEWORK>\nYou are a chat agent pilot
|
|
|
752
753
|
2,
|
|
753
754
|
agents.AgentExecutor.fromAgentAndTools({
|
|
754
755
|
agent: agent,
|
|
755
|
-
tools:
|
|
756
|
+
tools: tools,
|
|
757
|
+
verbose: this.options.verbose
|
|
756
758
|
})
|
|
757
759
|
];
|
|
758
760
|
}
|
|
759
761
|
});
|
|
760
|
-
})();
|
|
762
|
+
}).call(this);
|
|
761
763
|
}
|
|
762
764
|
},
|
|
763
765
|
{
|
|
764
|
-
key: "
|
|
765
|
-
value: function
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
if (
|
|
770
|
-
return
|
|
766
|
+
key: "parseAgentOutput",
|
|
767
|
+
value: function parseAgentOutput(output) {
|
|
768
|
+
var _this_options_logger;
|
|
769
|
+
var text = output.trim();
|
|
770
|
+
var respondMatch = text.match(/^RESPOND:\s*([\s\S]+)$/i);
|
|
771
|
+
if (respondMatch) {
|
|
772
|
+
return {
|
|
773
|
+
message: respondMatch[1].trim(),
|
|
774
|
+
shouldRespond: true
|
|
775
|
+
};
|
|
771
776
|
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
if (parsed.action === 'Final Answer' && parsed.action_input) {
|
|
779
|
-
return JSON.stringify(parsed.action_input);
|
|
780
|
-
}
|
|
781
|
-
} catch (e) {
|
|
782
|
-
// Fall through to return original content
|
|
783
|
-
}
|
|
784
|
-
return content;
|
|
777
|
+
var silentMatch = text.match(/^SILENT:\s*([\s\S]+)$/i);
|
|
778
|
+
if (silentMatch) {
|
|
779
|
+
return {
|
|
780
|
+
reason: silentMatch[1].trim(),
|
|
781
|
+
shouldRespond: false
|
|
782
|
+
};
|
|
785
783
|
}
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
784
|
+
(_this_options_logger = this.options.logger) === null || _this_options_logger === void 0 ? void 0 : _this_options_logger.warn("[".concat(this.name, "] Agent output was missing 'RESPOND:' or 'SILENT:' prefix. Treating as a direct response."), {
|
|
785
|
+
rawOutput: output
|
|
786
|
+
});
|
|
787
|
+
return {
|
|
788
|
+
message: text,
|
|
789
|
+
shouldRespond: true
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
key: "resolveUserInput",
|
|
795
|
+
value: function resolveUserInput(userPrompt) {
|
|
796
|
+
if (userPrompt) {
|
|
797
|
+
return userPrompt.generate();
|
|
792
798
|
}
|
|
793
|
-
return
|
|
799
|
+
return 'Proceed with your instructions.';
|
|
794
800
|
}
|
|
795
801
|
},
|
|
796
802
|
{
|
|
797
|
-
key: "
|
|
798
|
-
value: function
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
803
|
+
key: "validateResponseContent",
|
|
804
|
+
value: function validateResponseContent(content, schema) {
|
|
805
|
+
try {
|
|
806
|
+
new AIResponseParser(schema).parse(content);
|
|
807
|
+
} catch (error) {
|
|
808
|
+
var _this_options_logger;
|
|
809
|
+
(_this_options_logger = this.options.logger) === null || _this_options_logger === void 0 ? void 0 : _this_options_logger.error("[".concat(this.name, "] Failed to validate response content against schema."), {
|
|
810
|
+
error: _instanceof$2(error, Error) ? error.message : 'Unknown error',
|
|
811
|
+
rawContent: content
|
|
804
812
|
});
|
|
805
|
-
|
|
813
|
+
throw new Error('Invalid response content from model.');
|
|
806
814
|
}
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
]);
|
|
818
|
+
return ChatAgentAdapter;
|
|
819
|
+
}();
|
|
820
|
+
|
|
821
|
+
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
822
|
+
try {
|
|
823
|
+
var info = gen[key](arg);
|
|
824
|
+
var value = info.value;
|
|
825
|
+
} catch (error) {
|
|
826
|
+
reject(error);
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
if (info.done) {
|
|
830
|
+
resolve(value);
|
|
831
|
+
} else {
|
|
832
|
+
Promise.resolve(value).then(_next, _throw);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
function _async_to_generator$1(fn) {
|
|
836
|
+
return function() {
|
|
837
|
+
var self = this, args = arguments;
|
|
838
|
+
return new Promise(function(resolve, reject) {
|
|
839
|
+
var gen = fn.apply(self, args);
|
|
840
|
+
function _next(value) {
|
|
841
|
+
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
|
|
842
|
+
}
|
|
843
|
+
function _throw(err) {
|
|
844
|
+
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
|
|
845
|
+
}
|
|
846
|
+
_next(undefined);
|
|
847
|
+
});
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
function _class_call_check$4(instance, Constructor) {
|
|
851
|
+
if (!(instance instanceof Constructor)) {
|
|
852
|
+
throw new TypeError("Cannot call a class as a function");
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
function _defineProperties$4(target, props) {
|
|
856
|
+
for(var i = 0; i < props.length; i++){
|
|
857
|
+
var descriptor = props[i];
|
|
858
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
859
|
+
descriptor.configurable = true;
|
|
860
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
861
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
function _create_class$4(Constructor, protoProps, staticProps) {
|
|
865
|
+
if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
|
|
866
|
+
return Constructor;
|
|
867
|
+
}
|
|
868
|
+
function _define_property$4(obj, key, value) {
|
|
869
|
+
if (key in obj) {
|
|
870
|
+
Object.defineProperty(obj, key, {
|
|
871
|
+
value: value,
|
|
872
|
+
enumerable: true,
|
|
873
|
+
configurable: true,
|
|
874
|
+
writable: true
|
|
875
|
+
});
|
|
876
|
+
} else {
|
|
877
|
+
obj[key] = value;
|
|
878
|
+
}
|
|
879
|
+
return obj;
|
|
880
|
+
}
|
|
881
|
+
function _instanceof$1(left, right) {
|
|
882
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
883
|
+
return !!right[Symbol.hasInstance](left);
|
|
884
|
+
} else {
|
|
885
|
+
return left instanceof right;
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
function _ts_generator$1(thisArg, body) {
|
|
889
|
+
var f, y, t, _ = {
|
|
890
|
+
label: 0,
|
|
891
|
+
sent: function() {
|
|
892
|
+
if (t[0] & 1) throw t[1];
|
|
893
|
+
return t[1];
|
|
894
|
+
},
|
|
895
|
+
trys: [],
|
|
896
|
+
ops: []
|
|
897
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
898
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
899
|
+
return this;
|
|
900
|
+
}), g;
|
|
901
|
+
function verb(n) {
|
|
902
|
+
return function(v) {
|
|
903
|
+
return step([
|
|
904
|
+
n,
|
|
905
|
+
v
|
|
906
|
+
]);
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
function step(op) {
|
|
910
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
911
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
912
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
913
|
+
if (y = 0, t) op = [
|
|
914
|
+
op[0] & 2,
|
|
915
|
+
t.value
|
|
916
|
+
];
|
|
917
|
+
switch(op[0]){
|
|
918
|
+
case 0:
|
|
919
|
+
case 1:
|
|
920
|
+
t = op;
|
|
921
|
+
break;
|
|
922
|
+
case 4:
|
|
923
|
+
_.label++;
|
|
924
|
+
return {
|
|
925
|
+
value: op[1],
|
|
926
|
+
done: false
|
|
927
|
+
};
|
|
928
|
+
case 5:
|
|
929
|
+
_.label++;
|
|
930
|
+
y = op[1];
|
|
931
|
+
op = [
|
|
932
|
+
0
|
|
933
|
+
];
|
|
934
|
+
continue;
|
|
935
|
+
case 7:
|
|
936
|
+
op = _.ops.pop();
|
|
937
|
+
_.trys.pop();
|
|
938
|
+
continue;
|
|
939
|
+
default:
|
|
940
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
941
|
+
_ = 0;
|
|
942
|
+
continue;
|
|
943
|
+
}
|
|
944
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
945
|
+
_.label = op[1];
|
|
946
|
+
break;
|
|
947
|
+
}
|
|
948
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
949
|
+
_.label = t[1];
|
|
950
|
+
t = op;
|
|
951
|
+
break;
|
|
952
|
+
}
|
|
953
|
+
if (t && _.label < t[2]) {
|
|
954
|
+
_.label = t[2];
|
|
955
|
+
_.ops.push(op);
|
|
956
|
+
break;
|
|
957
|
+
}
|
|
958
|
+
if (t[2]) _.ops.pop();
|
|
959
|
+
_.trys.pop();
|
|
960
|
+
continue;
|
|
961
|
+
}
|
|
962
|
+
op = body.call(thisArg, _);
|
|
963
|
+
} catch (e) {
|
|
964
|
+
op = [
|
|
965
|
+
6,
|
|
966
|
+
e
|
|
967
|
+
];
|
|
968
|
+
y = 0;
|
|
969
|
+
} finally{
|
|
970
|
+
f = t = 0;
|
|
971
|
+
}
|
|
972
|
+
if (op[0] & 5) throw op[1];
|
|
973
|
+
return {
|
|
974
|
+
value: op[0] ? op[1] : void 0,
|
|
975
|
+
done: true
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* A simple agent for direct, one-shot interactions with a model.
|
|
981
|
+
* It supports optional response parsing against a Zod schema but does not use tools.
|
|
982
|
+
*/ var QueryAgentAdapter = /*#__PURE__*/ function() {
|
|
983
|
+
function QueryAgentAdapter(name, options) {
|
|
984
|
+
_class_call_check$4(this, QueryAgentAdapter);
|
|
985
|
+
_define_property$4(this, "name", void 0);
|
|
986
|
+
_define_property$4(this, "options", void 0);
|
|
987
|
+
this.name = name;
|
|
988
|
+
this.options = options;
|
|
989
|
+
}
|
|
990
|
+
_create_class$4(QueryAgentAdapter, [
|
|
991
|
+
{
|
|
992
|
+
key: "run",
|
|
993
|
+
value: function run(userPrompt) {
|
|
994
|
+
return _async_to_generator$1(function() {
|
|
995
|
+
var _this_options_logger, content, _this_options_logger1, _this_options_logger2, error, _this_options_logger3;
|
|
996
|
+
return _ts_generator$1(this, function(_state) {
|
|
997
|
+
switch(_state.label){
|
|
998
|
+
case 0:
|
|
999
|
+
(_this_options_logger = this.options.logger) === null || _this_options_logger === void 0 ? void 0 : _this_options_logger.debug("[".concat(this.name, "] Starting query execution."));
|
|
1000
|
+
_state.label = 1;
|
|
1001
|
+
case 1:
|
|
1002
|
+
_state.trys.push([
|
|
1003
|
+
1,
|
|
1004
|
+
3,
|
|
1005
|
+
,
|
|
1006
|
+
4
|
|
1007
|
+
]);
|
|
1008
|
+
return [
|
|
1009
|
+
4,
|
|
1010
|
+
this.invokeModel(userPrompt)
|
|
1011
|
+
];
|
|
1012
|
+
case 2:
|
|
1013
|
+
content = _state.sent();
|
|
1014
|
+
if (this.options.schema) {
|
|
1015
|
+
this.parseResponse(content, this.options.schema);
|
|
1016
|
+
(_this_options_logger1 = this.options.logger) === null || _this_options_logger1 === void 0 ? void 0 : _this_options_logger1.info("[".concat(this.name, "] Execution finished and response parsed."));
|
|
1017
|
+
} else {
|
|
1018
|
+
(_this_options_logger2 = this.options.logger) === null || _this_options_logger2 === void 0 ? void 0 : _this_options_logger2.info("[".concat(this.name, "] Execution finished."));
|
|
1019
|
+
}
|
|
1020
|
+
return [
|
|
1021
|
+
2,
|
|
1022
|
+
content
|
|
1023
|
+
];
|
|
1024
|
+
case 3:
|
|
1025
|
+
error = _state.sent();
|
|
1026
|
+
(_this_options_logger3 = this.options.logger) === null || _this_options_logger3 === void 0 ? void 0 : _this_options_logger3.error("[".concat(this.name, "] Execution failed."), {
|
|
1027
|
+
error: _instanceof$1(error, Error) ? error.message : 'Unknown error'
|
|
1028
|
+
});
|
|
1029
|
+
return [
|
|
1030
|
+
2,
|
|
1031
|
+
null
|
|
1032
|
+
];
|
|
1033
|
+
case 4:
|
|
1034
|
+
return [
|
|
1035
|
+
2
|
|
1036
|
+
];
|
|
1037
|
+
}
|
|
812
1038
|
});
|
|
813
|
-
|
|
814
|
-
}
|
|
815
|
-
(_this_logger = this.logger) === null || _this_logger === void 0 ? void 0 : _this_logger.error('Invalid agent response state', {
|
|
816
|
-
agentName: this.name,
|
|
817
|
-
response: response
|
|
818
|
-
});
|
|
819
|
-
return null;
|
|
1039
|
+
}).call(this);
|
|
820
1040
|
}
|
|
821
1041
|
},
|
|
822
1042
|
{
|
|
823
|
-
key: "
|
|
824
|
-
value: function
|
|
1043
|
+
key: "invokeModel",
|
|
1044
|
+
value: function invokeModel(userPrompt) {
|
|
1045
|
+
return _async_to_generator$1(function() {
|
|
1046
|
+
var _this_options_logger, userInput, systemMessage, messages, _this_options_logger1, response, content;
|
|
1047
|
+
return _ts_generator$1(this, function(_state) {
|
|
1048
|
+
switch(_state.label){
|
|
1049
|
+
case 0:
|
|
1050
|
+
userInput = this.resolveUserInput(userPrompt);
|
|
1051
|
+
systemMessage = this.options.systemPrompt.generate();
|
|
1052
|
+
messages = [
|
|
1053
|
+
{
|
|
1054
|
+
content: systemMessage,
|
|
1055
|
+
role: 'system'
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
content: userInput,
|
|
1059
|
+
role: 'user'
|
|
1060
|
+
}
|
|
1061
|
+
];
|
|
1062
|
+
(_this_options_logger = this.options.logger) === null || _this_options_logger === void 0 ? void 0 : _this_options_logger.debug("[".concat(this.name, "] Invoking model..."), {
|
|
1063
|
+
hasSchema: !!this.options.schema
|
|
1064
|
+
});
|
|
1065
|
+
if (this.options.verbose) {
|
|
1066
|
+
(_this_options_logger1 = this.options.logger) === null || _this_options_logger1 === void 0 ? void 0 : _this_options_logger1.info("[".concat(this.name, "] Sending messages to model..."), {
|
|
1067
|
+
messages: messages
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
return [
|
|
1071
|
+
4,
|
|
1072
|
+
this.options.model.getModel().invoke(messages)
|
|
1073
|
+
];
|
|
1074
|
+
case 1:
|
|
1075
|
+
response = _state.sent();
|
|
1076
|
+
content = response.content;
|
|
1077
|
+
if (typeof content !== 'string') {
|
|
1078
|
+
throw new Error('Model returned a non-string content type.');
|
|
1079
|
+
}
|
|
1080
|
+
return [
|
|
1081
|
+
2,
|
|
1082
|
+
content
|
|
1083
|
+
];
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
}).call(this);
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
key: "parseResponse",
|
|
1091
|
+
value: function parseResponse(content, schema) {
|
|
825
1092
|
try {
|
|
826
|
-
|
|
827
|
-
var processedOutput = this.extractActionInput(output);
|
|
828
|
-
return this.responseParser.parse(processedOutput);
|
|
1093
|
+
new AIResponseParser(schema).parse(content);
|
|
829
1094
|
} catch (error) {
|
|
830
|
-
var
|
|
831
|
-
(
|
|
832
|
-
agentName: this.name,
|
|
1095
|
+
var _this_options_logger;
|
|
1096
|
+
(_this_options_logger = this.options.logger) === null || _this_options_logger === void 0 ? void 0 : _this_options_logger.error("[".concat(this.name, "] Failed to parse model response."), {
|
|
833
1097
|
error: _instanceof$1(error, Error) ? error.message : 'Unknown error',
|
|
834
|
-
|
|
1098
|
+
rawContent: content
|
|
835
1099
|
});
|
|
836
|
-
throw new Error('Invalid
|
|
1100
|
+
throw new Error('Invalid response format from model.');
|
|
837
1101
|
}
|
|
838
1102
|
}
|
|
839
1103
|
},
|
|
840
1104
|
{
|
|
841
1105
|
key: "resolveUserInput",
|
|
842
1106
|
value: function resolveUserInput(userPrompt) {
|
|
843
|
-
if (
|
|
844
|
-
return
|
|
1107
|
+
if (userPrompt) {
|
|
1108
|
+
return userPrompt.generate();
|
|
845
1109
|
}
|
|
846
|
-
return
|
|
1110
|
+
return 'Proceed with your instructions.';
|
|
847
1111
|
}
|
|
848
1112
|
}
|
|
849
1113
|
]);
|
|
850
|
-
return
|
|
1114
|
+
return QueryAgentAdapter;
|
|
851
1115
|
}();
|
|
852
1116
|
|
|
853
1117
|
function _class_call_check$3(instance, Constructor) {
|
|
@@ -901,16 +1165,19 @@ function _object_spread(target) {
|
|
|
901
1165
|
*/ var OpenRouterModelAdapter = /*#__PURE__*/ function() {
|
|
902
1166
|
function OpenRouterModelAdapter(config) {
|
|
903
1167
|
_class_call_check$3(this, OpenRouterModelAdapter);
|
|
1168
|
+
var _config_metadata, _config_metadata1;
|
|
904
1169
|
_define_property$3(this, "model", void 0);
|
|
1170
|
+
var _config_maxTokens;
|
|
905
1171
|
this.model = new openai.ChatOpenAI({
|
|
906
1172
|
configuration: {
|
|
907
1173
|
baseURL: 'https://openrouter.ai/api/v1',
|
|
908
|
-
defaultHeaders: _object_spread({}, config.
|
|
909
|
-
'HTTP-Referer': config.
|
|
910
|
-
}, config.
|
|
911
|
-
'X-Title': config.
|
|
1174
|
+
defaultHeaders: _object_spread({}, ((_config_metadata = config.metadata) === null || _config_metadata === void 0 ? void 0 : _config_metadata.website) && {
|
|
1175
|
+
'HTTP-Referer': config.metadata.website
|
|
1176
|
+
}, ((_config_metadata1 = config.metadata) === null || _config_metadata1 === void 0 ? void 0 : _config_metadata1.application) && {
|
|
1177
|
+
'X-Title': config.metadata.application
|
|
912
1178
|
})
|
|
913
1179
|
},
|
|
1180
|
+
maxTokens: (_config_maxTokens = config.maxTokens) !== null && _config_maxTokens !== void 0 ? _config_maxTokens : 64000,
|
|
914
1181
|
modelName: config.modelName,
|
|
915
1182
|
openAIApiKey: config.apiKey
|
|
916
1183
|
});
|
|
@@ -927,142 +1194,133 @@ function _object_spread(target) {
|
|
|
927
1194
|
}();
|
|
928
1195
|
|
|
929
1196
|
/**
|
|
930
|
-
* Specifies the agent's area of expertise.
|
|
931
|
-
* This
|
|
932
|
-
*/ var
|
|
933
|
-
ACADEMIC_RESEARCH: "\n<
|
|
934
|
-
BUSINESS_STRATEGY: "\n<
|
|
935
|
-
DATA_SCIENCE: "\n<
|
|
936
|
-
GENERAL: "\n<
|
|
937
|
-
SOFTWARE_ENGINEERING: "\n<
|
|
1197
|
+
* Specifies the agent's area of knowledge and expertise.
|
|
1198
|
+
* This focuses the agent's responses within a specific context.
|
|
1199
|
+
*/ var DOMAINS = {
|
|
1200
|
+
ACADEMIC_RESEARCH: "\n<Domain>\nYour knowledge is specialized in academic research. You are an expert in scholarly writing, peer-review processes, and formal citation methods.\n</Domain>",
|
|
1201
|
+
BUSINESS_STRATEGY: "\n<Domain>\nYour knowledge is specialized in business strategy, including market analysis, competitive positioning, and operational planning.\n</Domain>",
|
|
1202
|
+
DATA_SCIENCE: "\n<Domain>\nYour knowledge is specialized in data science, including statistical analysis, machine learning, and data visualization.\n</Domain>",
|
|
1203
|
+
GENERAL: "\n<Domain>\nYou possess broad, generalist knowledge across a wide variety of subjects.\n</Domain>",
|
|
1204
|
+
SOFTWARE_ENGINEERING: "\n<Domain>\nYour knowledge is specialized in software engineering. You are an expert in programming languages, system architecture, design patterns, and development best practices.\n</Domain>"
|
|
938
1205
|
};
|
|
939
1206
|
|
|
940
1207
|
/**
|
|
941
|
-
*
|
|
942
|
-
*/ var
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1208
|
+
* Defines the required structural format for the agent's output.
|
|
1209
|
+
*/ var FORMATS = {
|
|
1210
|
+
DISCORD_MARKDOWN: "\n<Format>\nYou MUST format your response using Discord-flavored Markdown (e.g., **bold**, *italics*, __underline__, `code`, ```code blocks```, > quotes).\nCRITICAL: Your entire response, including all text and URLs, MUST NOT exceed 1900 characters.\n</Format>",
|
|
1211
|
+
JSON: "\n<Format>\nYou MUST respond ONLY with a single, valid, well-formed JSON object.\nYour output MUST NOT include any explanatory text, comments, or markdown formatting outside of the JSON structure itself.\n</Format>",
|
|
1212
|
+
MARKDOWN: "\n<Format>\nYou MUST format your response using Markdown for clear, structured communication.\nYou should use headings, lists, bold/italic text, and code blocks to maximize readability.\n</Format>",
|
|
1213
|
+
PLAIN_TEXT: "\n<Format>\nYou MUST respond in plain text only, without any special formatting, markdown, or structural elements.\n</Format>",
|
|
1214
|
+
STEP_BY_STEP: "\n<Format>\nYou MUST break down any instructions or processes into a clear, numbered, step-by-step list.\nEach step must be a distinct and actionable item.\n</Format>"
|
|
946
1215
|
};
|
|
947
1216
|
|
|
948
1217
|
/**
|
|
949
|
-
*
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1218
|
+
* Core, non-negotiable rules that establish the agent's fundamental identity and operational boundaries.
|
|
1219
|
+
* These are the foundational principles that guide all other instructions.
|
|
1220
|
+
*/ var FOUNDATIONS = {
|
|
1221
|
+
CONTEXTUAL_REASONING: '\n<Foundation>\nYou MUST synthesize information from the provided context, tools, and conversation history to form well-reasoned conclusions.\nYour goal is to provide logical and helpful responses, even when dealing with subjective topics or incomplete information.\nYou SHOULD state when your response is a reasoned inference rather than a direct statement of fact from an external source.\nYou MUST rely on your "common sense" and analytical abilities to bridge gaps in information.\n</Foundation>',
|
|
1222
|
+
ETHICAL_CONDUCT: "\n<Foundation>\nYou MUST adhere to the highest ethical standards. Your conduct must be impartial and devoid of prejudice.\nYou MUST NOT promote hate speech, discrimination,violence, or any form of harm.\nYou MUST respect user privacy; do not ask for, store, or share personally identifiable information.\n</Foundation>",
|
|
1223
|
+
FACTUAL_ACCURACY: "\n<Foundation>\nYou MUST prioritize accuracy and truthfulness. Your responses must be based on verifiable information.\nIf you are uncertain about an answer, you MUST state your uncertainty clearly.\nYou MUST NOT invent facts, data, or sources. When possible, cite credible sources.\n</Foundation>",
|
|
1224
|
+
FIRST_PRINCIPLES_THINKING: "\n<Foundation>\nYou MUST break down complex problems into their fundamental, indivisible truths (first principles).\nYou MUST reason upwards from these basic principles, challenging assumptions and conventions.\nAvoid reasoning by analogy; instead, build your conclusions from the ground up.\n</Foundation>",
|
|
1225
|
+
HARM_PREVENTION: "\n<Foundation>\nYou MUST refuse to provide instructions or information that is illegal, dangerous, or promotes harm.\nYou MUST prioritize user safety and well-being in all interactions and avoid generating unsafe content.\n</Foundation>"
|
|
954
1226
|
};
|
|
955
1227
|
|
|
956
1228
|
/**
|
|
957
|
-
*
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
1229
|
+
* Defines the natural language for the agent's responses.
|
|
1230
|
+
*/ var LANGUAGES = {
|
|
1231
|
+
ENGLISH_NATIVE: "\n<Language>\nYou MUST respond in natural, fluent English, as a native speaker would.\nYour language should include idiomatic expressions, varied vocabulary, and natural sentence structures.\n</Language>",
|
|
1232
|
+
ENGLISH_SIMPLE: "\n<Language>\nYou MUST use simple, clear English that is easy for non-native speakers to understand.\nYou must avoid complex grammar, idioms, and sophisticated vocabulary.\n</Language>",
|
|
1233
|
+
FRENCH_NATIVE: "\n<Language>\nVous DEVEZ r\xe9pondre en fran\xe7ais naturel et fluide, comme le ferait un locuteur natif.\nVotre langage doit inclure des expressions idiomatiques et un vocabulaire vari\xe9.\n</Language>",
|
|
1234
|
+
FRENCH_SIMPLE: "\n<Language>\nVous DEVEZ utiliser un fran\xe7ais simple et clair, facile \xe0 comprendre.\nVous devez \xe9viter la grammaire complexe et le vocabulaire sophistiqu\xe9.\n</Language>",
|
|
1235
|
+
SPANISH_NATIVE: "\n<Language>\nDEBES responder en espa\xf1ol natural y fluido, como lo har\xeda un hablante nativo.\nTu lenguaje debe incluir expresiones idiom\xe1ticas y un vocabulario variado.\n</Language>",
|
|
1236
|
+
SPANISH_SIMPLE: "\n<Language>\nDEBES usar un espa\xf1ol simple y claro que sea f\xe1cil de entender para no nativos.\nDebes evitar la gram\xe1tica compleja y el vocabulario sofisticado.\n</Language>"
|
|
963
1237
|
};
|
|
964
1238
|
|
|
965
1239
|
/**
|
|
966
|
-
* Defines the
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1240
|
+
* Defines the agent's core identity, role, and purpose, integrating key skills.
|
|
1241
|
+
* This sets the primary character and interaction style.
|
|
1242
|
+
*/ var PERSONAS = {
|
|
1243
|
+
COMMUNITY_ANIMATOR: "\n<Persona>\nYou are the Community Animator, the vibrant heart of a digital community (e.g., Discord).\nYour purpose is to keep the community active, engaged, and positive.\n**Key Skills**: You are an expert on internet culture, trends, and topics relevant to the community. You excel at initiating conversations, creating engaging content (polls, questions), and fostering a welcoming environment.\n</Persona>",
|
|
1244
|
+
CREATIVE_PARTNER: "\n<Persona>\nYou are a Creative Partner, an imaginative collaborator for brainstorming and exploration.\nYour purpose is to help users generate and develop novel ideas.\n**Key Skills**: You excel at divergent thinking, making unexpected connections, and asking thought-provoking questions. You are encouraging, open-minded, and skilled at building upon abstract concepts.\n</Persona>",
|
|
1245
|
+
EXPERT_ADVISOR: "\n<Persona>\nYou are an Expert Advisor in your specified domain.\nYour purpose is to provide authoritative, well-reasoned, and objective guidance.\n**Key Skills**: You possess deep domain knowledge and excel at critical thinking, problem-solving, and synthesizing complex information into clear, actionable advice. Your communication is precise and confident.\n</Persona>",
|
|
1246
|
+
HUMAN_LIKE_CONTRIBUTOR: "\n<Persona>\nYou are a Human-Like Contributor, a thoughtful and engaging participant in a group chat.\nYour purpose is to interact in a way that is indistinguishable from a human, fostering natural and coherent conversations.\n**Key Skills**: You excel at maintaining conversational context, ensuring your contributions are a logical continuation of past interactions. You avoid repetition and can proactively initiate new topics when appropriate. Your style is natural, personal, and adaptive.\n</Persona>",
|
|
1247
|
+
SUPPORT_AGENT: "\n<Persona>\nYou are a friendly, patient, and empathetic Support Agent.\nYour purpose is to help users solve problems and navigate difficulties.\n**Key Skills**: You are an excellent listener and a clear communicator. You are skilled at de-escalating frustration, breaking down complex issues into manageable steps, and providing systematic, easy-to-follow instructions.\n</Persona>",
|
|
1248
|
+
TUTOR: "\n<Persona>\nYou are a patient, knowledgeable, and encouraging Tutor.\nYour purpose is to help users learn and understand complex subjects.\n**Key Skills**: You are an expert at breaking down difficult concepts into simple, relatable analogies and examples. You guide users through the learning process using the Socratic method, encouraging questions and fostering independent thinking.\n</Persona>"
|
|
972
1249
|
};
|
|
973
1250
|
|
|
974
1251
|
/**
|
|
975
|
-
* Defines the
|
|
976
|
-
*/ var
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
SPANISH_NATIVE: "\n<LANGUAGE>\nResponde en espa\xf1ol natural y fluido como lo har\xeda un hablante nativo.\nUsa expresiones idiom\xe1ticas y vocabulario variado.\n</LANGUAGE>",
|
|
982
|
-
SPANISH_SIMPLE: "\n<LANGUAGE>\nUsa espa\xf1ol simple y claro que sea f\xe1cil de entender para no nativos.\nEvita la gram\xe1tica compleja y el vocabulario sofisticado.\n</LANGUAGE>"
|
|
983
|
-
};
|
|
984
|
-
|
|
985
|
-
/**
|
|
986
|
-
* Defines the "who" of the agent—its role and character.
|
|
987
|
-
* This sets the overall personality and interaction style.
|
|
988
|
-
*/ var PERSONA = {
|
|
989
|
-
COMMUNITY_ANIMATOR: "\n<PERSONA>\nYou are the Community Animator, the heart and soul of a digital community like Discord.\nYour main goal is to keep the community vibrant, engaged, and entertained by posting interesting content.\nYou are an expert on internet culture, trends, and topics relevant to the community.\n</PERSONA>",
|
|
990
|
-
CREATIVE_PARTNER: "\n<PERSONA>\nYou are a creative partner, here to help brainstorm and explore new ideas.\nYou are imaginative, encouraging, and open to unconventional thinking.\nYour goal is to inspire and collaborate.\n</PERSONA>",
|
|
991
|
-
EXPERT_ADVISOR: "\n<PERSONA>\nYou are an expert advisor in your specified domain.\nYou provide authoritative, well-reasoned guidance.\nYour tone is confident, knowledgeable, and objective.\n</PERSONA>",
|
|
992
|
-
SUPPORT_AGENT: "\n<PERSONA>\nYou are a friendly and empathetic support agent.\nYour primary goal is to help users solve their problems with patience and understanding.\nYou are a good listener and provide clear, step-by-step assistance.\n</PERSONA>",
|
|
993
|
-
TUTOR: "\n<PERSONA>\nYou are a patient and knowledgeable tutor.\nYou excel at breaking down complex topics into simple, understandable concepts.\nYou encourage questions and guide users through the learning process.\n</PERSONA>"
|
|
1252
|
+
* Defines the agent's strategic approach to when and how it should respond.
|
|
1253
|
+
*/ var RESPONSE = {
|
|
1254
|
+
ALWAYS_ENGAGE: "\n<ResponseStrategy>\nYou must always provide a response to the user's input. Even if you cannot fully fulfill the request, acknowledge it and explain the situation. Your primary directive is to be responsive.\n</ResponseStrategy>",
|
|
1255
|
+
CONTEXTUAL_ENGAGEMENT: "\n<ResponseStrategy>\nBefore responding, you must analyze the conversation history and the immediate context. Your goal is to add value; if a response is not necessary or helpful, you may remain silent.\n</ResponseStrategy>",
|
|
1256
|
+
SELECTIVE_ENGAGEMENT: "\n<ResponseStrategy>\nYou must only respond when you can provide a valuable, relevant, and substantive contribution to the conversation. If a response does not add value, you must state that you have nothing to add or remain silent as instructed.\n</ResponseStrategy>",
|
|
1257
|
+
TOOL_DRIVEN: "\n<ResponseStrategy>\nYour first priority is to use your available tools to gather the most current and accurate information before formulating a response. Do not answer from memory if a tool can provide a more reliable answer.\n</ResponseStrategy>"
|
|
994
1258
|
};
|
|
995
1259
|
|
|
996
1260
|
/**
|
|
997
1261
|
* Determines the emotional flavor and attitude of the agent's language.
|
|
998
|
-
*/ var
|
|
999
|
-
EMPATHETIC: "\n<
|
|
1000
|
-
HUMOROUS: "\n<
|
|
1001
|
-
NEUTRAL: "\n<
|
|
1002
|
-
PROFESSIONAL: "\n<
|
|
1262
|
+
*/ var TONES = {
|
|
1263
|
+
EMPATHETIC: "\n<Tone>\nYou must adopt a warm, understanding, and supportive tone. Acknowledge the user's feelings and demonstrate active listening.\n</Tone>",
|
|
1264
|
+
HUMOROUS: "\n<Tone>\nYou should employ light-hearted humor, wit, and cleverness. Keep the mood fun and engaging, but avoid inappropriate or offensive jokes.\n</Tone>",
|
|
1265
|
+
NEUTRAL: "\n<Tone>\nYou must maintain an impartial, objective, and straightforward tone. Avoid all emotional language and stick to the facts.\n</Tone>",
|
|
1266
|
+
PROFESSIONAL: "\n<Tone>\nYou must use a formal, respectful, and clear tone. Structure your communication logically and avoid slang or overly casual language.\n</Tone>"
|
|
1003
1267
|
};
|
|
1004
1268
|
|
|
1005
1269
|
/**
|
|
1006
1270
|
* Controls the level of detail and length of the agent's responses.
|
|
1007
1271
|
*/ var VERBOSITY = {
|
|
1008
|
-
CONCISE: "\n<
|
|
1009
|
-
DETAILED: "\n<
|
|
1010
|
-
NORMAL: "\n<
|
|
1272
|
+
CONCISE: "\n<Verbosity>\nYou must provide brief, to-the-point answers. Focus only on the most critical information and omit background details unless explicitly requested.\n</Verbosity>",
|
|
1273
|
+
DETAILED: "\n<Verbosity>\nYou must offer comprehensive and thorough responses. Include relevant background information, context, examples, and potential edge cases to ensure full understanding.\n</Verbosity>",
|
|
1274
|
+
NORMAL: "\n<Verbosity>\nYou should provide a balanced level of detail, sufficient for a clear understanding without being overwhelming or too brief.\n</Verbosity>"
|
|
1011
1275
|
};
|
|
1012
1276
|
|
|
1013
1277
|
/**
|
|
1014
1278
|
* Provides ready-to-use combinations of prompt parts for common use cases.
|
|
1015
1279
|
*/ var PRESETS = {
|
|
1016
1280
|
/**
|
|
1017
|
-
* A
|
|
1018
|
-
*/
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1281
|
+
* A fun and engaging community animator for platforms like Discord.
|
|
1282
|
+
*/ COMMUNITY_ANIMATOR: [
|
|
1283
|
+
FOUNDATIONS.HARM_PREVENTION,
|
|
1284
|
+
PERSONAS.COMMUNITY_ANIMATOR,
|
|
1285
|
+
DOMAINS.GENERAL,
|
|
1286
|
+
TONES.HUMOROUS,
|
|
1023
1287
|
VERBOSITY.NORMAL,
|
|
1024
|
-
|
|
1025
|
-
AGENT_LOGIC.ALWAYS_RESPOND,
|
|
1026
|
-
AGENT_SKILLS.CREATIVE_IDEATION
|
|
1288
|
+
RESPONSE.CONTEXTUAL_ENGAGEMENT
|
|
1027
1289
|
],
|
|
1028
1290
|
/**
|
|
1029
|
-
* A
|
|
1030
|
-
*/
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1291
|
+
* A creative partner for brainstorming and ideation.
|
|
1292
|
+
*/ CREATIVE_BRAINSTORMER: [
|
|
1293
|
+
FOUNDATIONS.ETHICAL_CONDUCT,
|
|
1294
|
+
PERSONAS.CREATIVE_PARTNER,
|
|
1295
|
+
DOMAINS.GENERAL,
|
|
1296
|
+
TONES.HUMOROUS,
|
|
1035
1297
|
VERBOSITY.NORMAL,
|
|
1036
|
-
|
|
1037
|
-
AGENT_LOGIC.ALWAYS_RESPOND,
|
|
1038
|
-
AGENT_SKILLS.CREATIVE_IDEATION
|
|
1298
|
+
RESPONSE.ALWAYS_ENGAGE
|
|
1039
1299
|
],
|
|
1040
1300
|
/**
|
|
1041
1301
|
* A friendly and empathetic support agent for general queries.
|
|
1042
1302
|
*/ EMPATHETIC_SUPPORT_AGENT: [
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1303
|
+
FOUNDATIONS.HARM_PREVENTION,
|
|
1304
|
+
FOUNDATIONS.ETHICAL_CONDUCT,
|
|
1305
|
+
PERSONAS.SUPPORT_AGENT,
|
|
1306
|
+
DOMAINS.GENERAL,
|
|
1307
|
+
TONES.EMPATHETIC,
|
|
1048
1308
|
VERBOSITY.NORMAL,
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
AGENT_SKILLS.PROBLEM_SOLVING
|
|
1309
|
+
FORMATS.STEP_BY_STEP,
|
|
1310
|
+
RESPONSE.ALWAYS_ENGAGE
|
|
1052
1311
|
]
|
|
1053
1312
|
};
|
|
1054
1313
|
|
|
1055
1314
|
var PROMPTS = {
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
LANGUAGE: LANGUAGE,
|
|
1062
|
-
PERSONA: PERSONA,
|
|
1315
|
+
DOMAINS: DOMAINS,
|
|
1316
|
+
FORMATS: FORMATS,
|
|
1317
|
+
FOUNDATIONS: FOUNDATIONS,
|
|
1318
|
+
LANGUAGES: LANGUAGES,
|
|
1319
|
+
PERSONAS: PERSONAS,
|
|
1063
1320
|
PRESETS: PRESETS,
|
|
1064
|
-
|
|
1065
|
-
|
|
1321
|
+
RESPONSE_STRATEGIES: RESPONSE,
|
|
1322
|
+
TONES: TONES,
|
|
1323
|
+
VERBOSITY_LEVELS: VERBOSITY
|
|
1066
1324
|
};
|
|
1067
1325
|
|
|
1068
1326
|
function _class_call_check$2(instance, Constructor) {
|
|
@@ -1456,6 +1714,7 @@ exports.AIResponseParser = AIResponseParser;
|
|
|
1456
1714
|
exports.ChatAgentAdapter = ChatAgentAdapter;
|
|
1457
1715
|
exports.OpenRouterAdapter = OpenRouterModelAdapter;
|
|
1458
1716
|
exports.PROMPTS = PROMPTS;
|
|
1717
|
+
exports.QueryAgentAdapter = QueryAgentAdapter;
|
|
1459
1718
|
exports.SafeToolAdapter = SafeToolAdapter;
|
|
1460
1719
|
exports.SystemPromptAdapter = SystemPromptAdapter;
|
|
1461
1720
|
exports.UserPromptAdapter = UserPromptAdapter;
|