@botonic/plugin-ai-agents 0.57.0-rslib-esm.2 → 0.57.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/lib/{agents → cjs/agents}/base-agent.d.ts +4 -4
- package/lib/cjs/agents/base-agent.js +39 -0
- package/lib/cjs/agents/base-agent.js.map +1 -0
- package/lib/cjs/agents/index.d.ts +2 -0
- package/lib/cjs/agents/index.js +8 -0
- package/lib/cjs/agents/index.js.map +1 -0
- package/lib/{agents → cjs/agents}/router-agent.d.ts +5 -5
- package/lib/cjs/agents/router-agent.js +33 -0
- package/lib/cjs/agents/router-agent.js.map +1 -0
- package/lib/{agents → cjs/agents}/specialist-agent.d.ts +5 -5
- package/lib/{agents → cjs/agents}/specialist-agent.js +45 -65
- package/lib/cjs/agents/specialist-agent.js.map +1 -0
- package/lib/{bot-config-tools.d.ts → cjs/bot-config-tools.d.ts} +1 -1
- package/lib/cjs/bot-config-tools.js +18 -0
- package/lib/cjs/bot-config-tools.js.map +1 -0
- package/lib/cjs/constants.js +25 -0
- package/lib/cjs/constants.js.map +1 -0
- package/lib/{debug-logger.d.ts → cjs/debug-logger.d.ts} +1 -1
- package/lib/{debug-logger.js → cjs/debug-logger.js} +9 -14
- package/lib/cjs/debug-logger.js.map +1 -0
- package/lib/cjs/guardrails/index.d.ts +1 -0
- package/lib/cjs/guardrails/index.js +5 -0
- package/lib/cjs/guardrails/index.js.map +1 -0
- package/lib/{guardrails → cjs/guardrails}/input.d.ts +2 -2
- package/lib/cjs/guardrails/input.js +96 -0
- package/lib/cjs/guardrails/input.js.map +1 -0
- package/lib/{index.d.ts → cjs/index.d.ts} +3 -3
- package/lib/{index.js → cjs/index.js} +75 -114
- package/lib/cjs/index.js.map +1 -0
- package/lib/{llm-config.d.ts → cjs/llm-config.d.ts} +1 -1
- package/lib/cjs/llm-config.js +121 -0
- package/lib/cjs/llm-config.js.map +1 -0
- package/lib/{runners → cjs/runners}/base-runner.d.ts +4 -4
- package/lib/{runners → cjs/runners}/base-runner.js +74 -81
- package/lib/cjs/runners/base-runner.js.map +1 -0
- package/lib/cjs/runners/index.d.ts +2 -0
- package/lib/cjs/runners/index.js +8 -0
- package/lib/cjs/runners/index.js.map +1 -0
- package/lib/{runners → cjs/runners}/router-runner.d.ts +2 -2
- package/lib/{runners → cjs/runners}/router-runner.js +14 -19
- package/lib/cjs/runners/router-runner.js.map +1 -0
- package/lib/{runners → cjs/runners}/specialist-runner.d.ts +1 -1
- package/lib/cjs/runners/specialist-runner.js +8 -0
- package/lib/cjs/runners/specialist-runner.js.map +1 -0
- package/lib/{services → cjs/services}/hubtype-api-client.d.ts +2 -2
- package/lib/cjs/services/hubtype-api-client.js +176 -0
- package/lib/cjs/services/hubtype-api-client.js.map +1 -0
- package/lib/{services → cjs/services}/types.d.ts +1 -1
- package/lib/cjs/services/types.js +13 -0
- package/lib/cjs/services/types.js.map +1 -0
- package/lib/cjs/structured-output/bot-executor.js +18 -0
- package/lib/cjs/structured-output/bot-executor.js.map +1 -0
- package/lib/cjs/structured-output/carousel.js +23 -0
- package/lib/cjs/structured-output/carousel.js.map +1 -0
- package/lib/cjs/structured-output/do-nothing.d.ts +6 -0
- package/lib/cjs/structured-output/do-nothing.js +11 -0
- package/lib/cjs/structured-output/do-nothing.js.map +1 -0
- package/lib/cjs/structured-output/exit.js +11 -0
- package/lib/cjs/structured-output/exit.js.map +1 -0
- package/lib/{structured-output → cjs/structured-output}/index.d.ts +4 -0
- package/lib/cjs/structured-output/index.js +47 -0
- package/lib/cjs/structured-output/index.js.map +1 -0
- package/lib/cjs/structured-output/request-contact-info.js +14 -0
- package/lib/cjs/structured-output/request-contact-info.js.map +1 -0
- package/lib/cjs/structured-output/text-with-buttons.js +24 -0
- package/lib/cjs/structured-output/text-with-buttons.js.map +1 -0
- package/lib/cjs/structured-output/text.js +14 -0
- package/lib/cjs/structured-output/text.js.map +1 -0
- package/lib/{tools → cjs/tools}/index.d.ts +2 -2
- package/lib/cjs/tools/index.js +8 -0
- package/lib/cjs/tools/index.js.map +1 -0
- package/lib/{tools → cjs/tools}/retrieve-knowledge.d.ts +2 -2
- package/lib/cjs/tools/retrieve-knowledge.js +34 -0
- package/lib/cjs/tools/retrieve-knowledge.js.map +1 -0
- package/lib/{types.d.ts → cjs/types.d.ts} +1 -1
- package/lib/cjs/types.js +3 -0
- package/lib/cjs/types.js.map +1 -0
- package/lib/esm/agents/base-agent.d.ts +28 -0
- package/lib/esm/agents/base-agent.js +39 -0
- package/lib/esm/agents/base-agent.js.map +1 -0
- package/lib/esm/agents/index.d.ts +2 -0
- package/lib/esm/agents/index.js +8 -0
- package/lib/esm/agents/index.js.map +1 -0
- package/lib/esm/agents/router-agent.d.ts +25 -0
- package/lib/esm/agents/router-agent.js +33 -0
- package/lib/esm/agents/router-agent.js.map +1 -0
- package/lib/esm/agents/specialist-agent.d.ts +39 -0
- package/lib/esm/agents/specialist-agent.js +108 -0
- package/lib/esm/agents/specialist-agent.js.map +1 -0
- package/lib/esm/bot-config-tools.d.ts +7 -0
- package/lib/esm/bot-config-tools.js +18 -0
- package/lib/esm/bot-config-tools.js.map +1 -0
- package/lib/esm/constants.d.ts +21 -0
- package/lib/esm/constants.js +25 -0
- package/lib/esm/constants.js.map +1 -0
- package/lib/esm/debug-logger.d.ts +33 -0
- package/lib/esm/debug-logger.js +116 -0
- package/lib/esm/debug-logger.js.map +1 -0
- package/lib/esm/guardrails/index.d.ts +1 -0
- package/lib/esm/guardrails/index.js +5 -0
- package/lib/esm/guardrails/index.js.map +1 -0
- package/lib/esm/guardrails/input.d.ts +10 -0
- package/lib/esm/guardrails/input.js +96 -0
- package/lib/esm/guardrails/input.js.map +1 -0
- package/lib/esm/index.d.ts +22 -0
- package/lib/esm/index.js +220 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/llm-config.d.ts +30 -0
- package/lib/esm/llm-config.js +121 -0
- package/lib/esm/llm-config.js.map +1 -0
- package/lib/esm/runners/base-runner.d.ts +31 -0
- package/lib/esm/runners/base-runner.js +194 -0
- package/lib/esm/runners/base-runner.js.map +1 -0
- package/lib/esm/runners/index.d.ts +2 -0
- package/lib/esm/runners/index.js +8 -0
- package/lib/esm/runners/index.js.map +1 -0
- package/lib/esm/runners/router-runner.d.ts +8 -0
- package/lib/esm/runners/router-runner.js +44 -0
- package/lib/esm/runners/router-runner.js.map +1 -0
- package/lib/esm/runners/specialist-runner.d.ts +4 -0
- package/lib/esm/runners/specialist-runner.js +8 -0
- package/lib/esm/runners/specialist-runner.js.map +1 -0
- package/lib/esm/services/hubtype-api-client.d.ts +13 -0
- package/lib/esm/services/hubtype-api-client.js +176 -0
- package/lib/esm/services/hubtype-api-client.js.map +1 -0
- package/lib/esm/services/types.d.ts +72 -0
- package/lib/esm/services/types.js +13 -0
- package/lib/esm/services/types.js.map +1 -0
- package/lib/esm/structured-output/bot-executor.d.ts +13 -0
- package/lib/esm/structured-output/bot-executor.js +18 -0
- package/lib/esm/structured-output/bot-executor.js.map +1 -0
- package/lib/esm/structured-output/carousel.d.ts +18 -0
- package/lib/esm/structured-output/carousel.js +23 -0
- package/lib/esm/structured-output/carousel.js.map +1 -0
- package/lib/esm/structured-output/do-nothing.d.ts +6 -0
- package/lib/esm/structured-output/do-nothing.js +11 -0
- package/lib/esm/structured-output/do-nothing.js.map +1 -0
- package/lib/esm/structured-output/exit.d.ts +6 -0
- package/lib/esm/structured-output/exit.js +11 -0
- package/lib/esm/structured-output/exit.js.map +1 -0
- package/lib/esm/structured-output/index.d.ts +112 -0
- package/lib/esm/structured-output/index.js +47 -0
- package/lib/esm/structured-output/index.js.map +1 -0
- package/lib/esm/structured-output/request-contact-info.d.ts +9 -0
- package/lib/esm/structured-output/request-contact-info.js +14 -0
- package/lib/esm/structured-output/request-contact-info.js.map +1 -0
- package/lib/esm/structured-output/text-with-buttons.d.ts +17 -0
- package/lib/esm/structured-output/text-with-buttons.js +24 -0
- package/lib/esm/structured-output/text-with-buttons.js.map +1 -0
- package/lib/esm/structured-output/text.d.ts +9 -0
- package/lib/esm/structured-output/text.js +14 -0
- package/lib/esm/structured-output/text.js.map +1 -0
- package/lib/esm/tools/index.d.ts +3 -0
- package/lib/esm/tools/index.js +8 -0
- package/lib/esm/tools/index.js.map +1 -0
- package/lib/esm/tools/retrieve-knowledge.d.ts +6 -0
- package/lib/esm/tools/retrieve-knowledge.js +34 -0
- package/lib/esm/tools/retrieve-knowledge.js.map +1 -0
- package/lib/esm/types.d.ts +53 -0
- package/lib/esm/types.js +3 -0
- package/lib/esm/types.js.map +1 -0
- package/package.json +10 -12
- package/src/index.ts +1 -0
- package/src/runners/base-runner.ts +20 -10
- package/src/structured-output/do-nothing.ts +12 -0
- package/src/structured-output/index.ts +2 -0
- package/lib/agents/base-agent.js +0 -66
- package/lib/agents/base-agent.js.map +0 -1
- package/lib/agents/index.d.ts +0 -2
- package/lib/agents/index.js +0 -9
- package/lib/agents/index.js.map +0 -1
- package/lib/agents/router-agent.js +0 -50
- package/lib/agents/router-agent.js.map +0 -1
- package/lib/agents/specialist-agent.js.map +0 -1
- package/lib/bot-config-tools.js +0 -20
- package/lib/bot-config-tools.js.map +0 -1
- package/lib/constants.js +0 -26
- package/lib/constants.js.map +0 -1
- package/lib/debug-logger.js.map +0 -1
- package/lib/guardrails/index.d.ts +0 -1
- package/lib/guardrails/index.js +0 -6
- package/lib/guardrails/index.js.map +0 -1
- package/lib/guardrails/input.js +0 -119
- package/lib/guardrails/input.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/llm-config.js +0 -150
- package/lib/llm-config.js.map +0 -1
- package/lib/runners/base-runner.js.map +0 -1
- package/lib/runners/index.d.ts +0 -2
- package/lib/runners/index.js +0 -9
- package/lib/runners/index.js.map +0 -1
- package/lib/runners/router-runner.js.map +0 -1
- package/lib/runners/specialist-runner.js +0 -10
- package/lib/runners/specialist-runner.js.map +0 -1
- package/lib/services/hubtype-api-client.js +0 -191
- package/lib/services/hubtype-api-client.js.map +0 -1
- package/lib/services/types.js +0 -13
- package/lib/services/types.js.map +0 -1
- package/lib/structured-output/bot-executor.js +0 -21
- package/lib/structured-output/bot-executor.js.map +0 -1
- package/lib/structured-output/carousel.js +0 -26
- package/lib/structured-output/carousel.js.map +0 -1
- package/lib/structured-output/exit.js +0 -14
- package/lib/structured-output/exit.js.map +0 -1
- package/lib/structured-output/index.js +0 -59
- package/lib/structured-output/index.js.map +0 -1
- package/lib/structured-output/request-contact-info.js +0 -17
- package/lib/structured-output/request-contact-info.js.map +0 -1
- package/lib/structured-output/text-with-buttons.js +0 -25
- package/lib/structured-output/text-with-buttons.js.map +0 -1
- package/lib/structured-output/text.js +0 -17
- package/lib/structured-output/text.js.map +0 -1
- package/lib/tools/index.js +0 -8
- package/lib/tools/index.js.map +0 -1
- package/lib/tools/retrieve-knowledge.js +0 -40
- package/lib/tools/retrieve-knowledge.js.map +0 -1
- package/lib/types.js +0 -5
- package/lib/types.js.map +0 -1
- /package/lib/{constants.d.ts → cjs/constants.d.ts} +0 -0
- /package/lib/{structured-output → cjs/structured-output}/bot-executor.d.ts +0 -0
- /package/lib/{structured-output → cjs/structured-output}/carousel.d.ts +0 -0
- /package/lib/{structured-output → cjs/structured-output}/exit.d.ts +0 -0
- /package/lib/{structured-output → cjs/structured-output}/request-contact-info.d.ts +0 -0
- /package/lib/{structured-output → cjs/structured-output}/text-with-buttons.d.ts +0 -0
- /package/lib/{structured-output → cjs/structured-output}/text.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.js","sourceRoot":"","sources":["../../../src/structured-output/carousel.ts"],"names":[],"mappings":";;;AAAA,wCAAuE;AACvE,6BAAuB;AAIV,QAAA,cAAc,GAAG,OAAC;KAC5B,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,QAAQ,CAAC;IAC3C,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QACtC,QAAQ,EAAE,OAAC,CAAC,KAAK,CACf,OAAC,CAAC,MAAM,CAAC;YACP,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;YACjB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;YACpB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;YACjB,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;gBACf,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;gBAChB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;aACtC,CAAC;SACH,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CAAC,kDAAkD,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DoNothingSchema = void 0;
|
|
4
|
+
const core_1 = require("@botonic/core");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.DoNothingSchema = zod_1.z
|
|
7
|
+
.object({
|
|
8
|
+
type: zod_1.z.literal(core_1.OutputMessageType.DoNothing),
|
|
9
|
+
})
|
|
10
|
+
.describe('A do nothing message is used to end the conversation without send a reply. Use it only when asked explicitly in the prompt.');
|
|
11
|
+
//# sourceMappingURL=do-nothing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"do-nothing.js","sourceRoot":"","sources":["../../../src/structured-output/do-nothing.ts"],"names":[],"mappings":";;;AAAA,wCAAwE;AACxE,6BAAuB;AAIV,QAAA,eAAe,GAAG,OAAC;KAC7B,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,SAAS,CAAC;CAC7C,CAAC;KACD,QAAQ,CACP,6HAA6H,CAC9H,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExitSchema = void 0;
|
|
4
|
+
const core_1 = require("@botonic/core");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.ExitSchema = zod_1.z
|
|
7
|
+
.object({
|
|
8
|
+
type: zod_1.z.literal(core_1.OutputMessageType.Exit),
|
|
9
|
+
})
|
|
10
|
+
.describe('An exit message. This message should only be used to exit the agent due to out of context or the user asking to exit the conversation');
|
|
11
|
+
//# sourceMappingURL=exit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../../../src/structured-output/exit.ts"],"names":[],"mappings":";;;AAAA,wCAAmE;AACnE,6BAAuB;AAIV,QAAA,UAAU,GAAG,OAAC;KACxB,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,IAAI,CAAC;CACxC,CAAC;KACD,QAAQ,CACP,uIAAuI,CACxI,CAAA"}
|
|
@@ -36,6 +36,8 @@ export declare const OutputSchema: z.ZodObject<{
|
|
|
36
36
|
}, z.core.$strip>;
|
|
37
37
|
}, z.core.$strip>>;
|
|
38
38
|
}, z.core.$strip>;
|
|
39
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
40
|
+
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.DoNothing>;
|
|
39
41
|
}, z.core.$strip>, z.ZodObject<{
|
|
40
42
|
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Exit>;
|
|
41
43
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -87,6 +89,8 @@ export declare function getOutputSchema(externalOutputMessagesSchemas: z.ZodObje
|
|
|
87
89
|
}, z.core.$strip>;
|
|
88
90
|
}, z.core.$strip>>;
|
|
89
91
|
}, z.core.$strip>;
|
|
92
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
93
|
+
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.DoNothing>;
|
|
90
94
|
}, z.core.$strip>, z.ZodObject<{
|
|
91
95
|
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Exit>;
|
|
92
96
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OutputSchema = void 0;
|
|
4
|
+
exports.getOutputSchema = getOutputSchema;
|
|
5
|
+
exports.getOutputInstructions = getOutputInstructions;
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const bot_executor_1 = require("./bot-executor");
|
|
8
|
+
const carousel_1 = require("./carousel");
|
|
9
|
+
const do_nothing_1 = require("./do-nothing");
|
|
10
|
+
const exit_1 = require("./exit");
|
|
11
|
+
const request_contact_info_1 = require("./request-contact-info");
|
|
12
|
+
const text_1 = require("./text");
|
|
13
|
+
const text_with_buttons_1 = require("./text-with-buttons");
|
|
14
|
+
const baseMessageSchemas = [
|
|
15
|
+
text_1.TextSchema,
|
|
16
|
+
text_with_buttons_1.TextWithButtonsSchema,
|
|
17
|
+
carousel_1.CarouselSchema,
|
|
18
|
+
do_nothing_1.DoNothingSchema,
|
|
19
|
+
exit_1.ExitSchema,
|
|
20
|
+
bot_executor_1.BotExecutorSchema,
|
|
21
|
+
request_contact_info_1.RequestContactInfoSchema,
|
|
22
|
+
];
|
|
23
|
+
exports.OutputSchema = zod_1.z
|
|
24
|
+
.object({
|
|
25
|
+
messages: zod_1.z.array(zod_1.z.union(baseMessageSchemas)),
|
|
26
|
+
})
|
|
27
|
+
.describe('The messages to be sent to the user');
|
|
28
|
+
function getOutputSchema(externalOutputMessagesSchemas) {
|
|
29
|
+
return zod_1.z.object({
|
|
30
|
+
messages: zod_1.z.array(zod_1.z.union([...baseMessageSchemas, ...externalOutputMessagesSchemas])),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function getOutputInstructions() {
|
|
34
|
+
const example = {
|
|
35
|
+
messages: [
|
|
36
|
+
{
|
|
37
|
+
type: 'text',
|
|
38
|
+
content: {
|
|
39
|
+
text: 'Hello, how can I help you today?',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
const output = `Return a JSON that follows the output schema provided. Never return multiple output schemas concatenated by a line break.\n<example>\n${JSON.stringify(example)}\n</example>`;
|
|
45
|
+
return `<output>\n${output}\n</output>`;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structured-output/index.ts"],"names":[],"mappings":";;;AA6BA,0CAQC;AAED,sDAaC;AAnDD,6BAAuB;AACvB,iDAAkD;AAClD,yCAA2C;AAC3C,6CAA8C;AAC9C,iCAAmC;AACnC,iEAAiE;AACjE,iCAAmC;AACnC,2DAA2D;AAM3D,MAAM,kBAAkB,GAAG;IACzB,iBAAU;IACV,yCAAqB;IACrB,yBAAc;IACd,4BAAe;IACf,iBAAU;IACV,gCAAiB;IACjB,+CAAwB;CAChB,CAAA;AACG,QAAA,YAAY,GAAG,OAAC;KAC1B,MAAM,CAAC;IACN,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;CAC/C,CAAC;KACD,QAAQ,CAAC,qCAAqC,CAAC,CAAA;AAElD,SAAgB,eAAe,CAC7B,6BAAiD;IAEjD,OAAO,OAAC,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,OAAC,CAAC,KAAK,CACf,OAAC,CAAC,KAAK,CAAC,CAAC,GAAG,kBAAkB,EAAE,GAAG,6BAA6B,CAAC,CAAC,CACnE;KACF,CAAC,CAAA;AACJ,CAAC;AAED,SAAgB,qBAAqB;IACnC,MAAM,OAAO,GAAG;QACd,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,kCAAkC;iBACzC;aACF;SACF;KACF,CAAA;IACD,MAAM,MAAM,GAAG,yIAAyI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,cAAc,CAAA;IAC7L,OAAO,aAAa,MAAM,aAAa,CAAA;AACzC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequestContactInfoSchema = void 0;
|
|
4
|
+
const core_1 = require("@botonic/core");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.RequestContactInfoSchema = zod_1.z
|
|
7
|
+
.object({
|
|
8
|
+
type: zod_1.z.literal(core_1.OutputMessageType.RequestContactInfo),
|
|
9
|
+
content: zod_1.z.object({
|
|
10
|
+
text: zod_1.z.string().describe('The text of the message'),
|
|
11
|
+
}),
|
|
12
|
+
})
|
|
13
|
+
.describe('A message to request phone number from the user. Use it only when asked explicitly in the prompt.');
|
|
14
|
+
//# sourceMappingURL=request-contact-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-contact-info.js","sourceRoot":"","sources":["../../../src/structured-output/request-contact-info.ts"],"names":[],"mappings":";;;AAAA,wCAGsB;AACtB,6BAAuB;AAIV,QAAA,wBAAwB,GAAG,OAAC;KACtC,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,kBAAkB,CAAC;IACrD,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;KACrD,CAAC;CACH,CAAC;KACD,QAAQ,CACP,mGAAmG,CACpG,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextWithButtonsSchema = void 0;
|
|
4
|
+
const core_1 = require("@botonic/core");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.TextWithButtonsSchema = zod_1.z
|
|
7
|
+
.object({
|
|
8
|
+
type: zod_1.z.literal(core_1.OutputMessageType.TextWithButtons),
|
|
9
|
+
content: zod_1.z.object({
|
|
10
|
+
text: zod_1.z.string(),
|
|
11
|
+
buttons: zod_1.z.array(zod_1.z.object({
|
|
12
|
+
text: zod_1.z.string(),
|
|
13
|
+
url: zod_1.z.string().nullable().optional(),
|
|
14
|
+
target: zod_1.z
|
|
15
|
+
.enum(['_blank', '_self'])
|
|
16
|
+
.default('_blank')
|
|
17
|
+
.nullable()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('The target of the button when it has an url. If not provided, it will default to _blank.'),
|
|
20
|
+
})),
|
|
21
|
+
}),
|
|
22
|
+
})
|
|
23
|
+
.describe('A text message with buttons to allow the user to use quick replies');
|
|
24
|
+
//# sourceMappingURL=text-with-buttons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-with-buttons.js","sourceRoot":"","sources":["../../../src/structured-output/text-with-buttons.ts"],"names":[],"mappings":";;;AAAA,wCAA8E;AAC9E,6BAAuB;AAIV,QAAA,qBAAqB,GAAG,OAAC;KACnC,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,eAAe,CAAC;IAClD,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,OAAC,CAAC,KAAK,CACd,OAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;YAChB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;YACrC,MAAM,EAAE,OAAC;iBACN,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;iBACzB,OAAO,CAAC,QAAQ,CAAC;iBACjB,QAAQ,EAAE;iBACV,QAAQ,EAAE;iBACV,QAAQ,CACP,0FAA0F,CAC3F;SACJ,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CACP,oEAAoE,CACrE,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextSchema = void 0;
|
|
4
|
+
const core_1 = require("@botonic/core");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.TextSchema = zod_1.z
|
|
7
|
+
.object({
|
|
8
|
+
type: zod_1.z.literal(core_1.OutputMessageType.Text),
|
|
9
|
+
content: zod_1.z.object({
|
|
10
|
+
text: zod_1.z.string(),
|
|
11
|
+
}),
|
|
12
|
+
})
|
|
13
|
+
.describe('A text message');
|
|
14
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/structured-output/text.ts"],"names":[],"mappings":";;;AAAA,wCAAmE;AACnE,6BAAuB;AAIV,QAAA,UAAU,GAAG,OAAC;KACxB,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,IAAI,CAAC;IACvC,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;KACjB,CAAC;CACH,CAAC;KACD,QAAQ,CAAC,gBAAgB,CAAC,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Tool } from '../types
|
|
2
|
-
export { createRetrieveKnowledge, RETRIEVE_KNOWLEDGE_TOOL_NAME, } from './retrieve-knowledge
|
|
1
|
+
import type { Tool } from '../types';
|
|
2
|
+
export { createRetrieveKnowledge, RETRIEVE_KNOWLEDGE_TOOL_NAME, } from './retrieve-knowledge';
|
|
3
3
|
export declare const mandatoryTools: Tool[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mandatoryTools = exports.RETRIEVE_KNOWLEDGE_TOOL_NAME = exports.createRetrieveKnowledge = void 0;
|
|
4
|
+
var retrieve_knowledge_1 = require("./retrieve-knowledge");
|
|
5
|
+
Object.defineProperty(exports, "createRetrieveKnowledge", { enumerable: true, get: function () { return retrieve_knowledge_1.createRetrieveKnowledge; } });
|
|
6
|
+
Object.defineProperty(exports, "RETRIEVE_KNOWLEDGE_TOOL_NAME", { enumerable: true, get: function () { return retrieve_knowledge_1.RETRIEVE_KNOWLEDGE_TOOL_NAME; } });
|
|
7
|
+
exports.mandatoryTools = [];
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":";;;AAEA,2DAG6B;AAF3B,6HAAA,uBAAuB,OAAA;AACvB,kIAAA,4BAA4B,OAAA;AAGjB,QAAA,cAAc,GAAW,EAAE,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type { Context } from '../types
|
|
2
|
+
import type { Context } from '../types';
|
|
3
3
|
export declare const RETRIEVE_KNOWLEDGE_TOOL_NAME = "retrieve_knowledge";
|
|
4
|
-
export declare const createRetrieveKnowledge: (sourceIds: string[]) => import("@openai/agents
|
|
4
|
+
export declare const createRetrieveKnowledge: (sourceIds: string[]) => import("@openai/agents").FunctionTool<Context<import("@botonic/core").ResolvedPlugins, any>, z.ZodObject<{
|
|
5
5
|
query: z.ZodString;
|
|
6
6
|
}, z.core.$strip>, string>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRetrieveKnowledge = exports.RETRIEVE_KNOWLEDGE_TOOL_NAME = void 0;
|
|
4
|
+
const agents_1 = require("@openai/agents");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const hubtype_api_client_1 = require("../services/hubtype-api-client");
|
|
7
|
+
exports.RETRIEVE_KNOWLEDGE_TOOL_NAME = 'retrieve_knowledge';
|
|
8
|
+
const createRetrieveKnowledge = (sourceIds) => (0, agents_1.tool)({
|
|
9
|
+
name: exports.RETRIEVE_KNOWLEDGE_TOOL_NAME,
|
|
10
|
+
description: 'Consult the knowledge base for information before answering. Use this tool to make sure the information you provide is faithful.',
|
|
11
|
+
parameters: zod_1.z.object({
|
|
12
|
+
query: zod_1.z.string().describe('The query to search the knowledge base for'),
|
|
13
|
+
}),
|
|
14
|
+
execute: async (input, runContext) => {
|
|
15
|
+
const context = runContext?.context;
|
|
16
|
+
const query = input.query;
|
|
17
|
+
if (!context) {
|
|
18
|
+
throw new Error('Context is required');
|
|
19
|
+
}
|
|
20
|
+
const client = new hubtype_api_client_1.HubtypeApiClient(context.authToken);
|
|
21
|
+
const chunks = await client.retrieveSimilarChunks(query, sourceIds);
|
|
22
|
+
const chunksIds = chunks.map(chunk => chunk.id);
|
|
23
|
+
const chunkTexts = chunks.map(chunk => chunk.text);
|
|
24
|
+
context.knowledgeUsed = {
|
|
25
|
+
query,
|
|
26
|
+
sourceIds,
|
|
27
|
+
chunksIds,
|
|
28
|
+
chunkTexts,
|
|
29
|
+
};
|
|
30
|
+
return chunkTexts;
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
exports.createRetrieveKnowledge = createRetrieveKnowledge;
|
|
34
|
+
//# sourceMappingURL=retrieve-knowledge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieve-knowledge.js","sourceRoot":"","sources":["../../../src/tools/retrieve-knowledge.ts"],"names":[],"mappings":";;;AAAA,2CAAsD;AACtD,6BAAuB;AAEvB,uEAAiE;AAGpD,QAAA,4BAA4B,GAAG,oBAAoB,CAAA;AAEzD,MAAM,uBAAuB,GAAG,CAAC,SAAmB,EAAE,EAAE,CAC7D,IAAA,aAAI,EAAC;IACH,IAAI,EAAE,oCAA4B;IAClC,WAAW,EACT,kIAAkI;IACpI,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC;QACnB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;KACzE,CAAC;IACF,OAAO,EAAE,KAAK,EACZ,KAAwB,EACxB,UAAgC,EACb,EAAE;QACrB,MAAM,OAAO,GAAG,UAAU,EAAE,OAAO,CAAA;QACnC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;QACzB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;QACxC,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,qCAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QACtD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;QACnE,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC/C,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAElD,OAAO,CAAC,aAAa,GAAG;YACtB,KAAK;YACL,SAAS;YACT,SAAS;YACT,UAAU;SACX,CAAA;QAED,OAAO,UAAU,CAAA;IACnB,CAAC;CACF,CAAC,CAAA;AA/BS,QAAA,uBAAuB,2BA+BhC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AgenticOutputMessage, AiAgentArgs, BotContext, GuardrailRule, InferenceResponse, ResolvedPlugins, RunResult } from '@botonic/core';
|
|
2
2
|
import type { Agent, AgentInputItem, AgentOutputType, RunContext as OpenAIRunContext, Tool as OpenAITool } from '@openai/agents';
|
|
3
3
|
import type { ZodType } from 'zod';
|
|
4
|
-
import type { OutputSchema } from './structured-output
|
|
4
|
+
import type { OutputSchema } from './structured-output';
|
|
5
5
|
export interface Context<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
6
6
|
authToken: string;
|
|
7
7
|
knowledgeUsed: {
|
package/lib/cjs/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AgentOutputType, InputGuardrail, Model, ModelSettings } from '@openai/agents';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
import type { GuardrailTrackingContext } from '../guardrails/input';
|
|
4
|
+
import type { LLMConfig } from '../llm-config';
|
|
5
|
+
import { type OutputSchema } from '../structured-output';
|
|
6
|
+
import type { GuardrailRule } from '../types';
|
|
7
|
+
export interface BaseAgentOptions {
|
|
8
|
+
name: string;
|
|
9
|
+
instructions: string;
|
|
10
|
+
llmConfig: LLMConfig;
|
|
11
|
+
inputGuardrailRules: GuardrailRule[];
|
|
12
|
+
outputMessagesSchemas?: z.ZodObject[];
|
|
13
|
+
guardrailTrackingContext: GuardrailTrackingContext;
|
|
14
|
+
}
|
|
15
|
+
export declare abstract class BaseAgent {
|
|
16
|
+
protected name: string;
|
|
17
|
+
protected instructions: string;
|
|
18
|
+
protected llmConfig: LLMConfig;
|
|
19
|
+
private inputGuardrailRules;
|
|
20
|
+
private outputMessagesSchemas;
|
|
21
|
+
private guardrailTrackingContext;
|
|
22
|
+
constructor(options: BaseAgentOptions);
|
|
23
|
+
protected getAgentModelSettings(): ModelSettings;
|
|
24
|
+
protected getInputGuardrails(): Promise<InputGuardrail[]>;
|
|
25
|
+
protected getOutputType(): AgentOutputType<typeof OutputSchema>;
|
|
26
|
+
protected addOutputInstructions(instructions: string): string;
|
|
27
|
+
protected getModel(): Promise<string | Model>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseAgent = void 0;
|
|
4
|
+
const guardrails_1 = require("../guardrails");
|
|
5
|
+
const structured_output_1 = require("../structured-output");
|
|
6
|
+
class BaseAgent {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.name = options.name;
|
|
9
|
+
this.instructions = options.instructions;
|
|
10
|
+
this.llmConfig = options.llmConfig;
|
|
11
|
+
this.inputGuardrailRules = options.inputGuardrailRules;
|
|
12
|
+
this.outputMessagesSchemas = options.outputMessagesSchemas || [];
|
|
13
|
+
this.guardrailTrackingContext = options.guardrailTrackingContext;
|
|
14
|
+
}
|
|
15
|
+
getAgentModelSettings() {
|
|
16
|
+
const modelSettings = { ...this.llmConfig.modelSettings };
|
|
17
|
+
if (this.llmConfig.modelSettings.reasoning) {
|
|
18
|
+
modelSettings.reasoning = { ...this.llmConfig.modelSettings.reasoning };
|
|
19
|
+
}
|
|
20
|
+
if (this.llmConfig.modelSettings.text) {
|
|
21
|
+
modelSettings.text = { ...this.llmConfig.modelSettings.text };
|
|
22
|
+
}
|
|
23
|
+
return modelSettings;
|
|
24
|
+
}
|
|
25
|
+
async getInputGuardrails() {
|
|
26
|
+
return await (0, guardrails_1.createInputGuardrails)(this.inputGuardrailRules, this.llmConfig, this.guardrailTrackingContext);
|
|
27
|
+
}
|
|
28
|
+
getOutputType() {
|
|
29
|
+
return (0, structured_output_1.getOutputSchema)(this.outputMessagesSchemas);
|
|
30
|
+
}
|
|
31
|
+
addOutputInstructions(instructions) {
|
|
32
|
+
return `${instructions}\n\n${(0, structured_output_1.getOutputInstructions)()}`;
|
|
33
|
+
}
|
|
34
|
+
async getModel() {
|
|
35
|
+
return await this.llmConfig.getModel();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.BaseAgent = BaseAgent;
|
|
39
|
+
//# sourceMappingURL=base-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-agent.js","sourceRoot":"","sources":["../../../src/agents/base-agent.ts"],"names":[],"mappings":";;;AAQA,8CAAqD;AAGrD,4DAI6B;AAY7B,MAAsB,SAAS;IAQ7B,YAAY,OAAyB;QACnC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAA;QACxC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;QAClC,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAA;QACtD,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,IAAI,EAAE,CAAA;QAChE,IAAI,CAAC,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAA;IAClE,CAAC;IAES,qBAAqB;QAC7B,MAAM,aAAa,GAAkB,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAA;QAExE,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC;YAC3C,aAAa,CAAC,SAAS,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,SAAS,EAAE,CAAA;QACzE,CAAC;QAED,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;YACtC,aAAa,CAAC,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,CAAA;QAC/D,CAAC;QAED,OAAO,aAAa,CAAA;IACtB,CAAC;IAES,KAAK,CAAC,kBAAkB;QAChC,OAAO,MAAM,IAAA,kCAAqB,EAChC,IAAI,CAAC,mBAAmB,EACxB,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,wBAAwB,CAC9B,CAAA;IACH,CAAC;IAES,aAAa;QACrB,OAAO,IAAA,mCAAe,EAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA;IACpD,CAAC;IAES,qBAAqB,CAAC,YAAoB;QAClD,OAAO,GAAG,YAAY,OAAO,IAAA,yCAAqB,GAAE,EAAE,CAAA;IACxD,CAAC;IAES,KAAK,CAAC,QAAQ;QACtB,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAA;IACxC,CAAC;CACF;AAlDD,8BAkDC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpecialistAgent = exports.RouterAgent = void 0;
|
|
4
|
+
var router_agent_1 = require("./router-agent");
|
|
5
|
+
Object.defineProperty(exports, "RouterAgent", { enumerable: true, get: function () { return router_agent_1.RouterAgent; } });
|
|
6
|
+
var specialist_agent_1 = require("./specialist-agent");
|
|
7
|
+
Object.defineProperty(exports, "SpecialistAgent", { enumerable: true, get: function () { return specialist_agent_1.SpecialistAgent; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/index.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAAnC,2GAAA,WAAW,OAAA;AACpB,uDAAoD;AAA3C,mHAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ResolvedPlugins } from '@botonic/core';
|
|
2
|
+
import { type AgentOutputType, type Handoff } from '@openai/agents';
|
|
3
|
+
import type { z } from 'zod';
|
|
4
|
+
import type { GuardrailTrackingContext } from '../guardrails/input';
|
|
5
|
+
import type { LLMConfig } from '../llm-config';
|
|
6
|
+
import type { OutputSchema } from '../structured-output';
|
|
7
|
+
import type { AIAgent, Context, GuardrailRule } from '../types';
|
|
8
|
+
import { BaseAgent } from './base-agent';
|
|
9
|
+
interface RouterAgentOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = unknown> {
|
|
10
|
+
name: string;
|
|
11
|
+
instructions: string;
|
|
12
|
+
llmConfig: LLMConfig;
|
|
13
|
+
handoffs: Handoff<Context<TPlugins, TExtraData>, AgentOutputType<typeof OutputSchema>>[];
|
|
14
|
+
inputGuardrailRules: GuardrailRule[];
|
|
15
|
+
outputMessagesSchemas?: z.ZodObject[];
|
|
16
|
+
guardrailTrackingContext: GuardrailTrackingContext;
|
|
17
|
+
}
|
|
18
|
+
export declare class RouterAgent<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = unknown> extends BaseAgent {
|
|
19
|
+
private handoffs;
|
|
20
|
+
private agent;
|
|
21
|
+
private constructor();
|
|
22
|
+
static create<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = unknown>(options: RouterAgentOptions<TPlugins, TExtraData>): Promise<RouterAgent<TPlugins, TExtraData>>;
|
|
23
|
+
getAgent(): AIAgent<TPlugins, TExtraData>;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RouterAgent = void 0;
|
|
4
|
+
const agents_1 = require("@openai/agents");
|
|
5
|
+
const extensions_1 = require("@openai/agents-core/extensions");
|
|
6
|
+
const base_agent_1 = require("./base-agent");
|
|
7
|
+
class RouterAgent extends base_agent_1.BaseAgent {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
super(options);
|
|
10
|
+
this.handoffs = options.handoffs;
|
|
11
|
+
}
|
|
12
|
+
static async create(options) {
|
|
13
|
+
const routerAgent = new RouterAgent(options);
|
|
14
|
+
const inputGuardrails = await routerAgent.getInputGuardrails();
|
|
15
|
+
// Agent.create is typed as Agent<UnknownContext>; we run with Context<TPlugins, TExtraData>.
|
|
16
|
+
const agent = agents_1.Agent.create({
|
|
17
|
+
name: routerAgent.name,
|
|
18
|
+
model: await routerAgent.getModel(),
|
|
19
|
+
modelSettings: routerAgent.getAgentModelSettings(),
|
|
20
|
+
instructions: routerAgent.addOutputInstructions(`${extensions_1.RECOMMENDED_PROMPT_PREFIX}${routerAgent.instructions}`),
|
|
21
|
+
handoffs: routerAgent.handoffs,
|
|
22
|
+
outputType: routerAgent.getOutputType(),
|
|
23
|
+
inputGuardrails,
|
|
24
|
+
});
|
|
25
|
+
routerAgent.agent = agent;
|
|
26
|
+
return routerAgent;
|
|
27
|
+
}
|
|
28
|
+
getAgent() {
|
|
29
|
+
return this.agent;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.RouterAgent = RouterAgent;
|
|
33
|
+
//# sourceMappingURL=router-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-agent.js","sourceRoot":"","sources":["../../../src/agents/router-agent.ts"],"names":[],"mappings":";;;AACA,2CAA0E;AAC1E,+DAA0E;AAM1E,6CAAwC;AAkBxC,MAAa,WAGX,SAAQ,sBAAS;IAOjB,YAAoB,OAAiD;QACnE,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IAClC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CAIjB,OAAiD;QAEjD,MAAM,WAAW,GAAG,IAAI,WAAW,CAAuB,OAAO,CAAC,CAAA;QAClE,MAAM,eAAe,GAAG,MAAM,WAAW,CAAC,kBAAkB,EAAE,CAAA;QAE9D,6FAA6F;QAC7F,MAAM,KAAK,GAAG,cAAK,CAAC,MAAM,CAAC;YACzB,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,KAAK,EAAE,MAAM,WAAW,CAAC,QAAQ,EAAE;YACnC,aAAa,EAAE,WAAW,CAAC,qBAAqB,EAAE;YAClD,YAAY,EAAE,WAAW,CAAC,qBAAqB,CAC7C,GAAG,sCAAyB,GAAG,WAAW,CAAC,YAAY,EAAE,CAC1D;YACD,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,UAAU,EAAE,WAAW,CAAC,aAAa,EAAE;YACvC,eAAe;SAChB,CAAkC,CAAA;QAEnC,WAAW,CAAC,KAAK,GAAG,KAAK,CAAA;QACzB,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;CACF;AA5CD,kCA4CC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CampaignV2, ContactInfo, ResolvedPlugins } from '@botonic/core';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
import type { DebugLogger } from '../debug-logger';
|
|
4
|
+
import type { GuardrailTrackingContext } from '../guardrails/input';
|
|
5
|
+
import type { LLMConfig } from '../llm-config';
|
|
6
|
+
import type { AIAgent, GuardrailRule, Tool } from '../types';
|
|
7
|
+
import { BaseAgent } from './base-agent';
|
|
8
|
+
interface SpecialistAgentOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = unknown> {
|
|
9
|
+
name: string;
|
|
10
|
+
instructions: string;
|
|
11
|
+
tools: Tool<TPlugins, TExtraData>[];
|
|
12
|
+
campaignsContext?: CampaignV2[];
|
|
13
|
+
contactInfo: ContactInfo[];
|
|
14
|
+
inputGuardrailRules: GuardrailRule[];
|
|
15
|
+
sourceIds: string[];
|
|
16
|
+
outputMessagesSchemas?: z.ZodObject[];
|
|
17
|
+
llmConfig: LLMConfig;
|
|
18
|
+
logger: DebugLogger;
|
|
19
|
+
guardrailTrackingContext: GuardrailTrackingContext;
|
|
20
|
+
forceToolNameOverride?: string;
|
|
21
|
+
disableForceRetrieveKnowledge?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare class SpecialistAgent<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = unknown> extends BaseAgent {
|
|
24
|
+
private tools;
|
|
25
|
+
private logger;
|
|
26
|
+
private agent;
|
|
27
|
+
private forceToolNameOverride?;
|
|
28
|
+
private disableForceRetrieveKnowledge?;
|
|
29
|
+
private constructor();
|
|
30
|
+
static create<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = unknown>(options: SpecialistAgentOptions<TPlugins, TExtraData>): Promise<SpecialistAgent<TPlugins, TExtraData>>;
|
|
31
|
+
getAgent(): AIAgent<TPlugins, TExtraData>;
|
|
32
|
+
private getSpecialistModelSettings;
|
|
33
|
+
private addExtraInstructions;
|
|
34
|
+
private getContactInfoInstructions;
|
|
35
|
+
private getMetadataInstructions;
|
|
36
|
+
private getCampaignInstructions;
|
|
37
|
+
private addHubtypeTools;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpecialistAgent = void 0;
|
|
4
|
+
const agents_1 = require("@openai/agents");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const tools_1 = require("../tools");
|
|
7
|
+
const base_agent_1 = require("./base-agent");
|
|
8
|
+
class SpecialistAgent extends base_agent_1.BaseAgent {
|
|
9
|
+
constructor(options) {
|
|
10
|
+
super({
|
|
11
|
+
name: options.name,
|
|
12
|
+
instructions: options.instructions,
|
|
13
|
+
llmConfig: options.llmConfig,
|
|
14
|
+
inputGuardrailRules: options.inputGuardrailRules,
|
|
15
|
+
outputMessagesSchemas: options.outputMessagesSchemas,
|
|
16
|
+
guardrailTrackingContext: options.guardrailTrackingContext,
|
|
17
|
+
});
|
|
18
|
+
this.instructions = this.addExtraInstructions(options.instructions, options.contactInfo, options.campaignsContext);
|
|
19
|
+
this.tools = this.addHubtypeTools(options.tools, options.sourceIds);
|
|
20
|
+
this.logger = options.logger;
|
|
21
|
+
this.forceToolNameOverride = options.forceToolNameOverride;
|
|
22
|
+
this.disableForceRetrieveKnowledge = options.disableForceRetrieveKnowledge;
|
|
23
|
+
}
|
|
24
|
+
static async create(options) {
|
|
25
|
+
const specialistAgent = new SpecialistAgent(options);
|
|
26
|
+
const model = specialistAgent.llmConfig.modelName;
|
|
27
|
+
const resolvedModel = await specialistAgent.getModel();
|
|
28
|
+
const hasRetrieveKnowledge = specialistAgent.tools.some(tool => tool.name === tools_1.RETRIEVE_KNOWLEDGE_TOOL_NAME);
|
|
29
|
+
const modelSettings = specialistAgent.getSpecialistModelSettings(hasRetrieveKnowledge);
|
|
30
|
+
const inputGuardrails = await specialistAgent.getInputGuardrails();
|
|
31
|
+
specialistAgent.logger.logModelSettings({
|
|
32
|
+
provider: constants_1.LLM_PROVIDER,
|
|
33
|
+
model,
|
|
34
|
+
reasoning: modelSettings.reasoning,
|
|
35
|
+
text: modelSettings.text,
|
|
36
|
+
toolChoice: modelSettings.toolChoice,
|
|
37
|
+
hasRetrieveKnowledge,
|
|
38
|
+
});
|
|
39
|
+
const agent = new agents_1.Agent({
|
|
40
|
+
name: specialistAgent.name,
|
|
41
|
+
model: resolvedModel,
|
|
42
|
+
modelSettings,
|
|
43
|
+
instructions: specialistAgent.instructions,
|
|
44
|
+
tools: specialistAgent.tools,
|
|
45
|
+
outputType: specialistAgent.getOutputType(),
|
|
46
|
+
inputGuardrails,
|
|
47
|
+
outputGuardrails: [],
|
|
48
|
+
});
|
|
49
|
+
specialistAgent.agent = agent;
|
|
50
|
+
return specialistAgent;
|
|
51
|
+
}
|
|
52
|
+
getAgent() {
|
|
53
|
+
return this.agent;
|
|
54
|
+
}
|
|
55
|
+
getSpecialistModelSettings(hasRetrieveKnowledge) {
|
|
56
|
+
const modelSettings = this.getAgentModelSettings();
|
|
57
|
+
const forceRetrieveKnowledge = hasRetrieveKnowledge &&
|
|
58
|
+
!this.forceToolNameOverride &&
|
|
59
|
+
!this.disableForceRetrieveKnowledge;
|
|
60
|
+
if (forceRetrieveKnowledge) {
|
|
61
|
+
modelSettings.toolChoice = tools_1.RETRIEVE_KNOWLEDGE_TOOL_NAME;
|
|
62
|
+
}
|
|
63
|
+
if (this.forceToolNameOverride) {
|
|
64
|
+
modelSettings.toolChoice = this.forceToolNameOverride;
|
|
65
|
+
}
|
|
66
|
+
return modelSettings;
|
|
67
|
+
}
|
|
68
|
+
addExtraInstructions(initialInstructions, contactInfo, campaignsContext) {
|
|
69
|
+
const sections = [
|
|
70
|
+
`<instructions>\n${initialInstructions.trim()}\n</instructions>`,
|
|
71
|
+
this.getMetadataInstructions(),
|
|
72
|
+
this.getContactInfoInstructions(contactInfo),
|
|
73
|
+
this.getCampaignInstructions(campaignsContext),
|
|
74
|
+
].filter(section => section.length > 0);
|
|
75
|
+
return this.addOutputInstructions(sections.join('\n\n'));
|
|
76
|
+
}
|
|
77
|
+
getContactInfoInstructions(contactInfo) {
|
|
78
|
+
return `<contact_info_fields>${JSON.stringify(contactInfo.map(info => ({
|
|
79
|
+
name: info.name,
|
|
80
|
+
value: info.value,
|
|
81
|
+
})), null, 0)}</contact_info_fields>`;
|
|
82
|
+
}
|
|
83
|
+
getMetadataInstructions() {
|
|
84
|
+
const metadata = `Current Date: ${new Date().toISOString()}`;
|
|
85
|
+
return `<metadata>\n${metadata}\n</metadata>`;
|
|
86
|
+
}
|
|
87
|
+
getCampaignInstructions(campaignsContext) {
|
|
88
|
+
if (!campaignsContext || campaignsContext.length === 0) {
|
|
89
|
+
return '';
|
|
90
|
+
}
|
|
91
|
+
const campaignsWithContext = campaignsContext.filter(campaign => campaign.agent_context);
|
|
92
|
+
if (campaignsWithContext.length === 0) {
|
|
93
|
+
return '';
|
|
94
|
+
}
|
|
95
|
+
return campaignsWithContext
|
|
96
|
+
.map((campaign, index) => `<campaign_context_${index + 1}>\n${campaign.agent_context}\n</campaign_context_${index + 1}>`)
|
|
97
|
+
.join('\n');
|
|
98
|
+
}
|
|
99
|
+
addHubtypeTools(tools, sourceIds) {
|
|
100
|
+
const hubtypeTools = [...tools_1.mandatoryTools];
|
|
101
|
+
if (sourceIds.length > 0) {
|
|
102
|
+
hubtypeTools.push((0, tools_1.createRetrieveKnowledge)(sourceIds));
|
|
103
|
+
}
|
|
104
|
+
return [...hubtypeTools, ...tools];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.SpecialistAgent = SpecialistAgent;
|
|
108
|
+
//# sourceMappingURL=specialist-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specialist-agent.js","sourceRoot":"","sources":["../../../src/agents/specialist-agent.ts"],"names":[],"mappings":";;;AACA,2CAAgF;AAEhF,4CAA2C;AAK3C,oCAIiB;AAEjB,6CAAwC;AAqBxC,MAAa,eAGX,SAAQ,sBAAS;IAOjB,YAAoB,OAAqD;QACvE,KAAK,CAAC;YACJ,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;YAChD,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;YACpD,wBAAwB,EAAE,OAAO,CAAC,wBAAwB;SAC3D,CAAC,CAAA;QACF,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,oBAAoB,CAC3C,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,gBAAgB,CACzB,CAAA;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;QACnE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAA;QAC1D,IAAI,CAAC,6BAA6B,GAAG,OAAO,CAAC,6BAA6B,CAAA;IAC5E,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CAIjB,OAAqD;QAErD,MAAM,eAAe,GAAG,IAAI,eAAe,CAAuB,OAAO,CAAC,CAAA;QAC1E,MAAM,KAAK,GAAG,eAAe,CAAC,SAAS,CAAC,SAAS,CAAA;QACjD,MAAM,aAAa,GAAG,MAAM,eAAe,CAAC,QAAQ,EAAE,CAAA;QACtD,MAAM,oBAAoB,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,CACrD,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,oCAA4B,CACnD,CAAA;QACD,MAAM,aAAa,GACjB,eAAe,CAAC,0BAA0B,CAAC,oBAAoB,CAAC,CAAA;QAClE,MAAM,eAAe,GAAG,MAAM,eAAe,CAAC,kBAAkB,EAAE,CAAA;QAElE,eAAe,CAAC,MAAM,CAAC,gBAAgB,CAAC;YACtC,QAAQ,EAAE,wBAAY;YACtB,KAAK;YACL,SAAS,EAAE,aAAa,CAAC,SAA2C;YACpE,IAAI,EAAE,aAAa,CAAC,IAAyC;YAC7D,UAAU,EAAE,aAAa,CAAC,UAAU;YACpC,oBAAoB;SACrB,CAAC,CAAA;QAEF,MAAM,KAAK,GAAG,IAAI,cAAK,CAGrB;YACA,IAAI,EAAE,eAAe,CAAC,IAAI;YAC1B,KAAK,EAAE,aAAa;YACpB,aAAa;YACb,YAAY,EAAE,eAAe,CAAC,YAAY;YAC1C,KAAK,EAAE,eAAe,CAAC,KAAK;YAC5B,UAAU,EAAE,eAAe,CAAC,aAAa,EAAE;YAC3C,eAAe;YACf,gBAAgB,EAAE,EAAE;SACrB,CAAC,CAAA;QAEF,eAAe,CAAC,KAAK,GAAG,KAAK,CAAA;QAC7B,OAAO,eAAe,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAEO,0BAA0B,CAChC,oBAA6B;QAE7B,MAAM,aAAa,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAA;QAClD,MAAM,sBAAsB,GAC1B,oBAAoB;YACpB,CAAC,IAAI,CAAC,qBAAqB;YAC3B,CAAC,IAAI,CAAC,6BAA6B,CAAA;QAErC,IAAI,sBAAsB,EAAE,CAAC;YAC3B,aAAa,CAAC,UAAU,GAAG,oCAA4B,CAAA;QACzD,CAAC;QAED,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC/B,aAAa,CAAC,UAAU,GAAG,IAAI,CAAC,qBAAqB,CAAA;QACvD,CAAC;QAED,OAAO,aAAa,CAAA;IACtB,CAAC;IAEO,oBAAoB,CAC1B,mBAA2B,EAC3B,WAA0B,EAC1B,gBAA+B;QAE/B,MAAM,QAAQ,GAAG;YACf,mBAAmB,mBAAmB,CAAC,IAAI,EAAE,mBAAmB;YAChE,IAAI,CAAC,uBAAuB,EAAE;YAC9B,IAAI,CAAC,0BAA0B,CAAC,WAAW,CAAC;YAC5C,IAAI,CAAC,uBAAuB,CAAC,gBAAgB,CAAC;SAC/C,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QAEvC,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IAC1D,CAAC;IAEO,0BAA0B,CAAC,WAA0B;QAC3D,OAAO,wBAAwB,IAAI,CAAC,SAAS,CAC3C,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC,EACH,IAAI,EACJ,CAAC,CACF,wBAAwB,CAAA;IAC3B,CAAC;IAEO,uBAAuB;QAC7B,MAAM,QAAQ,GAAG,iBAAiB,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAA;QAC5D,OAAO,eAAe,QAAQ,eAAe,CAAA;IAC/C,CAAC;IAEO,uBAAuB,CAAC,gBAA+B;QAC7D,IAAI,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvD,OAAO,EAAE,CAAA;QACX,CAAC;QACD,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,MAAM,CAClD,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,aAAa,CACnC,CAAA;QACD,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtC,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,oBAAoB;aACxB,GAAG,CACF,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAClB,qBAAqB,KAAK,GAAG,CAAC,MAAM,QAAQ,CAAC,aAAa,wBAAwB,KAAK,GAAG,CAAC,GAAG,CACjG;aACA,IAAI,CAAC,IAAI,CAAC,CAAA;IACf,CAAC;IAEO,eAAe,CACrB,KAAmC,EACnC,SAAmB;QAEnB,MAAM,YAAY,GAAW,CAAC,GAAG,sBAAc,CAAC,CAAA;QAChD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,YAAY,CAAC,IAAI,CAAC,IAAA,+BAAuB,EAAC,SAAS,CAAC,CAAC,CAAA;QACvD,CAAC;QACD,OAAO,CAAC,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC,CAAA;IACpC,CAAC;CACF;AA5JD,0CA4JC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ToolConfigJSON } from '@botonic/core';
|
|
2
|
+
import type { CustomTool } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Maps custom AI agent tools to the format expected by bot config (e.g. for flow-builder).
|
|
5
|
+
* Converts each tool's Zod schema to JSON Schema so it can be serialized in the config.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getToolsForBotConfig(customTools: CustomTool[]): ToolConfigJSON[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getToolsForBotConfig = getToolsForBotConfig;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Maps custom AI agent tools to the format expected by bot config (e.g. for flow-builder).
|
|
7
|
+
* Converts each tool's Zod schema to JSON Schema so it can be serialized in the config.
|
|
8
|
+
*/
|
|
9
|
+
function getToolsForBotConfig(customTools) {
|
|
10
|
+
return customTools.map(tool => ({
|
|
11
|
+
name: tool.name,
|
|
12
|
+
description: tool.description,
|
|
13
|
+
schema: zod_1.z.toJSONSchema(tool.schema, {
|
|
14
|
+
target: 'draft-07',
|
|
15
|
+
}),
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=bot-config-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bot-config-tools.js","sourceRoot":"","sources":["../../src/bot-config-tools.ts"],"names":[],"mappings":";;AASA,oDAUC;AAlBD,6BAAuB;AAIvB;;;GAGG;AACH,SAAgB,oBAAoB,CAClC,WAAyB;IAEzB,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9B,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,MAAM,EAAE,OAAC,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE;YAClC,MAAM,EAAE,UAAU;SACnB,CAA6B;KAC/B,CAAC,CAAC,CAAA;AACL,CAAC"}
|