@botonic/plugin-ai-agents 0.44.0 → 0.45.0-alpha.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/lib/cjs/agent-builder.d.ts +3 -3
- package/lib/cjs/debug-logger.d.ts +2 -2
- package/lib/cjs/guardrails/input.d.ts +2 -2
- package/lib/cjs/guardrails/input.js.map +1 -1
- package/lib/cjs/hubtype-api-client.d.ts +2 -2
- package/lib/cjs/index.d.ts +2 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/runner.d.ts +3 -3
- package/lib/cjs/runner.js +1 -1
- package/lib/cjs/runner.js.map +1 -1
- package/lib/cjs/structured-output/bot-executor.d.ts +49 -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.d.ts +1 -1
- package/lib/cjs/structured-output/exit.d.ts +1 -1
- package/lib/cjs/structured-output/index.d.ts +64 -1
- package/lib/cjs/structured-output/index.js +8 -1
- package/lib/cjs/structured-output/index.js.map +1 -1
- package/lib/cjs/structured-output/text-with-buttons.d.ts +1 -1
- package/lib/cjs/structured-output/text.d.ts +1 -1
- package/lib/cjs/tools/index.d.ts +1 -1
- package/lib/cjs/tools/index.js.map +1 -1
- package/lib/cjs/tools/retrieve-knowledge.d.ts +1 -1
- package/lib/cjs/tools/retrieve-knowledge.js.map +1 -1
- package/lib/cjs/types.d.ts +4 -4
- package/lib/esm/agent-builder.d.ts +3 -3
- package/lib/esm/debug-logger.d.ts +2 -2
- package/lib/esm/guardrails/input.d.ts +2 -2
- package/lib/esm/guardrails/input.js.map +1 -1
- package/lib/esm/hubtype-api-client.d.ts +2 -2
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/runner.d.ts +3 -3
- package/lib/esm/runner.js +1 -1
- package/lib/esm/runner.js.map +1 -1
- package/lib/esm/structured-output/bot-executor.d.ts +49 -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 +1 -1
- package/lib/esm/structured-output/exit.d.ts +1 -1
- package/lib/esm/structured-output/index.d.ts +64 -1
- package/lib/esm/structured-output/index.js +8 -1
- package/lib/esm/structured-output/index.js.map +1 -1
- package/lib/esm/structured-output/text-with-buttons.d.ts +1 -1
- package/lib/esm/structured-output/text.d.ts +1 -1
- package/lib/esm/tools/index.d.ts +1 -1
- package/lib/esm/tools/index.js.map +1 -1
- package/lib/esm/tools/retrieve-knowledge.d.ts +1 -1
- package/lib/esm/tools/retrieve-knowledge.js.map +1 -1
- package/lib/esm/types.d.ts +4 -4
- package/package.json +5 -4
- package/src/agent-builder.ts +6 -6
- package/src/debug-logger.ts +2 -2
- package/src/guardrails/input.ts +7 -2
- package/src/hubtype-api-client.ts +2 -2
- package/src/index.ts +10 -4
- package/src/runner.ts +8 -4
- package/src/structured-output/bot-executor.ts +21 -0
- package/src/structured-output/carousel.ts +1 -1
- package/src/structured-output/exit.ts +1 -1
- package/src/structured-output/index.ts +9 -3
- package/src/structured-output/text-with-buttons.ts +1 -1
- package/src/structured-output/text.ts +1 -1
- package/src/tools/index.ts +2 -1
- package/src/tools/retrieve-knowledge.ts +2 -2
- package/src/types.ts +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CampaignV2, ContactInfo, ResolvedPlugins } from '@botonic/core';
|
|
2
|
-
import { DebugLogger } from './debug-logger';
|
|
3
|
-
import { AIAgent, GuardrailRule, Tool } from './types';
|
|
1
|
+
import type { CampaignV2, ContactInfo, ResolvedPlugins } from '@botonic/core';
|
|
2
|
+
import type { DebugLogger } from './debug-logger';
|
|
3
|
+
import type { AIAgent, GuardrailRule, Tool } from './types';
|
|
4
4
|
interface AIAgentBuilderOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
5
5
|
name: string;
|
|
6
6
|
instructions: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AiAgentArgs } from '@botonic/core';
|
|
2
|
-
import { AgenticInputMessage, MemoryOptions, RunResult } from './types';
|
|
1
|
+
import type { AiAgentArgs } from '@botonic/core';
|
|
2
|
+
import type { AgenticInputMessage, MemoryOptions, RunResult } from './types';
|
|
3
3
|
export interface DebugLoggerConfig {
|
|
4
4
|
messageHistoryApiVersion: string;
|
|
5
5
|
maxRetries: number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { InputGuardrail } from '@openai/agents';
|
|
2
|
-
import { GuardrailRule } from '../types';
|
|
1
|
+
import { type InputGuardrail } from '@openai/agents';
|
|
2
|
+
import type { GuardrailRule } from '../types';
|
|
3
3
|
export declare function createInputGuardrail(rules: GuardrailRule[]): InputGuardrail;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/guardrails/input.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/guardrails/input.ts"],"names":[],"mappings":";;AAUA,oDAiCC;AA3CD,2CAKuB;AACvB,6BAAuB;AAIvB,SAAgB,oBAAoB,CAAC,KAAsB;IACzD,MAAM,UAAU,GAAG,OAAC,CAAC,MAAM,CACzB,MAAM,CAAC,WAAW,CAChB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CACvE,CACF,CAAA;IAED,MAAM,KAAK,GAAG,IAAI,cAAK,CAAC;QACtB,IAAI,EAAE,gBAAgB;QACtB,YAAY,EACV,8DAA8D;QAChE,UAAU;KACX,CAAC,CAAA;IAEF,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE;YACpC,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAoB,CAAA;YAC9D,MAAM,MAAM,GAAG,MAAM,IAAA,YAAG,EAAC,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;YAC3D,MAAM,WAAW,GAAG,MAAM,CAAC,WAAsC,CAAA;YACjE,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;YAC7D,CAAC;YACD,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAA;YAC1E,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CACzD,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,IAAI,CACjC,CAAA;YACD,OAAO;gBACL,UAAU,EAAE,mBAAmB;gBAC/B,iBAAiB,EAAE,SAAS;aAC7B,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BotContext } from '@botonic/core';
|
|
2
|
-
import { AgenticInputMessage, Chunk } from './types';
|
|
1
|
+
import type { BotContext } from '@botonic/core';
|
|
2
|
+
import type { AgenticInputMessage, Chunk } from './types';
|
|
3
3
|
export interface GetMessagesV2Options {
|
|
4
4
|
maxMessages?: number;
|
|
5
5
|
includeToolCalls?: boolean;
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AiAgentArgs, BotContext, Plugin, ResolvedPlugins } from '@botonic/core';
|
|
2
|
-
import { CustomTool, InferenceResponse, PluginAiAgentOptions } from './types';
|
|
1
|
+
import type { AiAgentArgs, BotContext, Plugin, ResolvedPlugins } from '@botonic/core';
|
|
2
|
+
import type { CustomTool, InferenceResponse, PluginAiAgentOptions } from './types';
|
|
3
3
|
export default class BotonicPluginAiAgents<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> implements Plugin {
|
|
4
4
|
private readonly authToken?;
|
|
5
5
|
private readonly messageHistoryApiVersion;
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAMA,2CAAqC;AAErC,mDAAgD;AAChD,2CAAuD;AACvD,iDAAoE;AACpE,6DAAuD;AACvD,qCAAsC;AACtC,qCAAwC;AAYxC,MAAqB,qBAAqB;IAWxC,YAAY,OAAoD;QAFzD,oBAAe,GAAuC,EAAE,CAAA;QAG7D,IAAA,oBAAW,EAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;QAElD,IAAI,OAAO,EAAE,wBAAwB,KAAK,IAAI,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;YAClE,MAAM,IAAI,KAAK,CACb,2DAA2D;gBACzD,+DAA+D,CAClE,CAAA;QACH,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,OAAO,EAAE,SAAS,CAAA;QACnC,IAAI,CAAC,eAAe,GAAG,OAAO,EAAE,WAAW,IAAI,EAAE,CAAA;QACjD,IAAI,CAAC,wBAAwB,GAAG,OAAO,EAAE,wBAAwB,IAAI,IAAI,CAAA;QACzE,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,EAAE,CAAA;QACnC,IAAI,CAAC,MAAM,GAAG,IAAA,gCAAiB,EAAC,OAAO,EAAE,WAAW,IAAI,KAAK,CAAC,CAAA;QAE9D,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC;YAC3B,wBAAwB,EAAE,IA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K,IAAI,EAAE,CAAC;YAC3C,OAAO,MAAM,aAAa,CAAC,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;QAC/D,CAAC;QAED,gBAAgB;QAChB,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,aAAa,CAAC,OAAO,EAAE;YACxD,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI,YAAY;YACpD,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,IAAI,IAAI;YACtD,kBAAkB,EAAE,IAAI,CAAC,MAAM,CAAC,kBAAkB,IAAI,CAAC;YACvD,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,KAAK;SAC1C,CAAC,CAAA;QACF,OAAO,MAAM,CAAC,QAAQ,CAAA;IACxB,CAAC;IAEO,UAAU,CAAC,eAAyB;QAC1C,MAAM,cAAc,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CACxD,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CACpC,CAAA;QACD,OAAO,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE;YACzC,OAAO,IAAA,aAAI,EAA0C;gBACnD,IAAI,EAAE,cAAc,CAAC,IAAI;gBACzB,WAAW,EAAE,cAAc,CAAC,WAAW;gBACvC,UAAU,EAAE,cAAc,CAAC,MAAM;gBACjC,OAAO,EAAE,cAAc,CAAC,IAAI;aAC7B,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AA7ID,wCA6IC;AAED,kDAAuB"}
|
package/lib/cjs/runner.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ResolvedPlugins } from '@botonic/core';
|
|
2
|
-
import { DebugLogger } from './debug-logger';
|
|
3
|
-
import { AgenticInputMessage, AIAgent, Context, RunResult } from './types';
|
|
1
|
+
import type { ResolvedPlugins } from '@botonic/core';
|
|
2
|
+
import type { DebugLogger } from './debug-logger';
|
|
3
|
+
import type { AgenticInputMessage, AIAgent, Context, RunResult } from './types';
|
|
4
4
|
export declare class AIAgentRunner<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
5
5
|
private agent;
|
|
6
6
|
private logger;
|
package/lib/cjs/runner.js
CHANGED
package/lib/cjs/runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/runner.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/runner.ts"],"names":[],"mappings":";;;AAKA,2CAIuB;AAGvB,mCAA2C;AAkB3C,MAAa,aAAa;IAOxB,YAAY,KAAoC,EAAE,MAAmB;QACnE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,GAAG,CACP,QAA+B,EAC/B,OAAsC;QAEtC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAE5B,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAA;QAE5B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC;gBACxB,aAAa,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE;aAClC,CAAC,CAAA;YACF,2FAA2F;YAC3F,qFAAqF;YACrF,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE;gBACrD,OAAO;aACR,CAAC,CAAwB,CAAA;YAE1B,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,EAAE,QAAQ,IAAI,EAAE,CAAA;YACzD,MAAM,OAAO,GACX,cAAc,CAAC,MAAM,KAAK,CAAC;gBAC3B,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,KAA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from 'zod';
|
|
3
|
+
export type { BotExecutorMessage };
|
|
4
|
+
export declare const BotExecutorSchema: z.ZodObject<{
|
|
5
|
+
type: z.ZodEnum<["botExecutor"]>;
|
|
6
|
+
content: z.ZodObject<{
|
|
7
|
+
text: z.ZodString;
|
|
8
|
+
buttons: z.ZodArray<z.ZodObject<{
|
|
9
|
+
text: z.ZodString;
|
|
10
|
+
payload: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
text: string;
|
|
13
|
+
payload: string;
|
|
14
|
+
}, {
|
|
15
|
+
text: string;
|
|
16
|
+
payload: string;
|
|
17
|
+
}>, "many">;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
text: string;
|
|
20
|
+
buttons: {
|
|
21
|
+
text: string;
|
|
22
|
+
payload: string;
|
|
23
|
+
}[];
|
|
24
|
+
}, {
|
|
25
|
+
text: string;
|
|
26
|
+
buttons: {
|
|
27
|
+
text: string;
|
|
28
|
+
payload: string;
|
|
29
|
+
}[];
|
|
30
|
+
}>;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
type: "botExecutor";
|
|
33
|
+
content: {
|
|
34
|
+
text: string;
|
|
35
|
+
buttons: {
|
|
36
|
+
text: string;
|
|
37
|
+
payload: string;
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
40
|
+
}, {
|
|
41
|
+
type: "botExecutor";
|
|
42
|
+
content: {
|
|
43
|
+
text: string;
|
|
44
|
+
buttons: {
|
|
45
|
+
text: string;
|
|
46
|
+
payload: string;
|
|
47
|
+
}[];
|
|
48
|
+
};
|
|
49
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BotExecutorSchema = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const zod_1 = tslib_1.__importDefault(require("zod"));
|
|
6
|
+
exports.BotExecutorSchema = zod_1.default
|
|
7
|
+
.object({
|
|
8
|
+
type: zod_1.default.enum(['botExecutor']),
|
|
9
|
+
content: zod_1.default.object({
|
|
10
|
+
text: zod_1.default.string(),
|
|
11
|
+
buttons: zod_1.default.array(zod_1.default.object({
|
|
12
|
+
text: zod_1.default.string(),
|
|
13
|
+
payload: zod_1.default.string(),
|
|
14
|
+
})),
|
|
15
|
+
}),
|
|
16
|
+
})
|
|
17
|
+
.describe('A text message with buttons to allow the bot to execute a specific action. Use it only when asked explicitly in the prompt');
|
|
18
|
+
//# sourceMappingURL=bot-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bot-executor.js","sourceRoot":"","sources":["../../../src/structured-output/bot-executor.ts"],"names":[],"mappings":";;;;AACA,sDAAmB;AAIN,QAAA,iBAAiB,GAAG,aAAC;KAC/B,MAAM,CAAC;IACN,IAAI,EAAE,aAAC,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,CAAC;IAC7B,OAAO,EAAE,aAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,aAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,aAAC,CAAC,KAAK,CACd,aAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,aAAC,CAAC,MAAM,EAAE;YAChB,OAAO,EAAE,aAAC,CAAC,MAAM,EAAE;SACpB,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CACP,4HAA4H,CAC7H,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OutputMessage } from '@botonic/core';
|
|
1
|
+
import type { OutputMessage } from '@botonic/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
export interface Output {
|
|
4
4
|
messages: OutputMessage[];
|
|
@@ -160,9 +160,63 @@ export declare const OutputSchema: z.ZodObject<{
|
|
|
160
160
|
type: "exit";
|
|
161
161
|
}, {
|
|
162
162
|
type: "exit";
|
|
163
|
+
}>, z.ZodObject<{
|
|
164
|
+
type: z.ZodEnum<["botExecutor"]>;
|
|
165
|
+
content: z.ZodObject<{
|
|
166
|
+
text: z.ZodString;
|
|
167
|
+
buttons: z.ZodArray<z.ZodObject<{
|
|
168
|
+
text: z.ZodString;
|
|
169
|
+
payload: z.ZodString;
|
|
170
|
+
}, "strip", z.ZodTypeAny, {
|
|
171
|
+
text: string;
|
|
172
|
+
payload: string;
|
|
173
|
+
}, {
|
|
174
|
+
text: string;
|
|
175
|
+
payload: string;
|
|
176
|
+
}>, "many">;
|
|
177
|
+
}, "strip", z.ZodTypeAny, {
|
|
178
|
+
text: string;
|
|
179
|
+
buttons: {
|
|
180
|
+
text: string;
|
|
181
|
+
payload: string;
|
|
182
|
+
}[];
|
|
183
|
+
}, {
|
|
184
|
+
text: string;
|
|
185
|
+
buttons: {
|
|
186
|
+
text: string;
|
|
187
|
+
payload: string;
|
|
188
|
+
}[];
|
|
189
|
+
}>;
|
|
190
|
+
}, "strip", z.ZodTypeAny, {
|
|
191
|
+
type: "botExecutor";
|
|
192
|
+
content: {
|
|
193
|
+
text: string;
|
|
194
|
+
buttons: {
|
|
195
|
+
text: string;
|
|
196
|
+
payload: string;
|
|
197
|
+
}[];
|
|
198
|
+
};
|
|
199
|
+
}, {
|
|
200
|
+
type: "botExecutor";
|
|
201
|
+
content: {
|
|
202
|
+
text: string;
|
|
203
|
+
buttons: {
|
|
204
|
+
text: string;
|
|
205
|
+
payload: string;
|
|
206
|
+
}[];
|
|
207
|
+
};
|
|
163
208
|
}>]>, "many">;
|
|
164
209
|
}, "strip", z.ZodTypeAny, {
|
|
165
210
|
messages: ({
|
|
211
|
+
type: "botExecutor";
|
|
212
|
+
content: {
|
|
213
|
+
text: string;
|
|
214
|
+
buttons: {
|
|
215
|
+
text: string;
|
|
216
|
+
payload: string;
|
|
217
|
+
}[];
|
|
218
|
+
};
|
|
219
|
+
} | {
|
|
166
220
|
type: "carousel";
|
|
167
221
|
content: {
|
|
168
222
|
elements: {
|
|
@@ -195,6 +249,15 @@ export declare const OutputSchema: z.ZodObject<{
|
|
|
195
249
|
})[];
|
|
196
250
|
}, {
|
|
197
251
|
messages: ({
|
|
252
|
+
type: "botExecutor";
|
|
253
|
+
content: {
|
|
254
|
+
text: string;
|
|
255
|
+
buttons: {
|
|
256
|
+
text: string;
|
|
257
|
+
payload: string;
|
|
258
|
+
}[];
|
|
259
|
+
};
|
|
260
|
+
} | {
|
|
198
261
|
type: "carousel";
|
|
199
262
|
content: {
|
|
200
263
|
elements: {
|
|
@@ -2,13 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OutputSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const bot_executor_1 = require("./bot-executor");
|
|
5
6
|
const carousel_1 = require("./carousel");
|
|
6
7
|
const exit_1 = require("./exit");
|
|
7
8
|
const text_1 = require("./text");
|
|
8
9
|
const text_with_buttons_1 = require("./text-with-buttons");
|
|
9
10
|
exports.OutputSchema = zod_1.z
|
|
10
11
|
.object({
|
|
11
|
-
messages: zod_1.z.array(zod_1.z.union([
|
|
12
|
+
messages: zod_1.z.array(zod_1.z.union([
|
|
13
|
+
text_1.TextSchema,
|
|
14
|
+
text_with_buttons_1.TextWithButtonsSchema,
|
|
15
|
+
carousel_1.CarouselSchema,
|
|
16
|
+
exit_1.ExitSchema,
|
|
17
|
+
bot_executor_1.BotExecutorSchema,
|
|
18
|
+
])),
|
|
12
19
|
})
|
|
13
20
|
.describe('The messages to be sent to the user');
|
|
14
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structured-output/index.ts"],"names":[],"mappings":";;;AACA,6BAAuB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structured-output/index.ts"],"names":[],"mappings":";;;AACA,6BAAuB;AACvB,iDAAkD;AAClD,yCAA2C;AAC3C,iCAAmC;AACnC,iCAAmC;AACnC,2DAA2D;AAM9C,QAAA,YAAY,GAAG,OAAC;KAC1B,MAAM,CAAC;IACN,QAAQ,EAAE,OAAC,CAAC,KAAK,CACf,OAAC,CAAC,KAAK,CAAC;QACN,iBAAU;QACV,yCAAqB;QACrB,yBAAc;QACd,iBAAU;QACV,gCAAiB;KAClB,CAAC,CACH;CACF,CAAC;KACD,QAAQ,CAAC,qCAAqC,CAAC,CAAA"}
|
package/lib/cjs/tools/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":";;;AAEA,2DAAwD;AAA/C,uHAAA,iBAAiB,OAAA;AAEb,QAAA,cAAc,GAAW,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { Context } from '../types';
|
|
2
|
+
import type { Context } from '../types';
|
|
3
3
|
export declare const retrieveKnowledge: import("@openai/agents").FunctionTool<Context<import("@botonic/core").ResolvedPlugins, any>, z.ZodObject<{
|
|
4
4
|
query: z.ZodString;
|
|
5
5
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieve-knowledge.js","sourceRoot":"","sources":["../../../src/tools/retrieve-knowledge.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"retrieve-knowledge.js","sourceRoot":"","sources":["../../../src/tools/retrieve-knowledge.ts"],"names":[],"mappings":";;;AAAA,2CAAsD;AACtD,6BAAuB;AAEvB,8DAAwD;AAG3C,QAAA,iBAAiB,GAAG,IAAA,aAAI,EAAC;IACpC,IAAI,EAAE,oBAAoB;IAC1B,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,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;QACnC,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,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,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;YACxC,UAAU;SACX,CAAA;QAED,OAAO,UAAU,CAAA;IACnB,CAAC;CACF,CAAC,CAAA"}
|
package/lib/cjs/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AgenticOutputMessage, AiAgentArgs, BotContext, GuardrailRule, InferenceResponse, ResolvedPlugins, RunResult } from '@botonic/core';
|
|
2
|
-
import { Agent, AgentInputItem, AgentOutputType, RunContext as OpenAIRunContext, Tool as OpenAITool } from '@openai/agents';
|
|
3
|
-
import { ZodSchema } from 'zod';
|
|
4
|
-
import { OutputSchema } from './structured-output';
|
|
1
|
+
import { AgenticOutputMessage, AiAgentArgs, type BotContext, GuardrailRule, InferenceResponse, type ResolvedPlugins, RunResult } from '@botonic/core';
|
|
2
|
+
import type { Agent, AgentInputItem, AgentOutputType, RunContext as OpenAIRunContext, Tool as OpenAITool } from '@openai/agents';
|
|
3
|
+
import type { ZodSchema } from 'zod';
|
|
4
|
+
import type { OutputSchema } from './structured-output';
|
|
5
5
|
export interface Context<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
6
6
|
authToken: string;
|
|
7
7
|
sourceIds: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CampaignV2, ContactInfo, ResolvedPlugins } from '@botonic/core';
|
|
2
|
-
import { DebugLogger } from './debug-logger';
|
|
3
|
-
import { AIAgent, GuardrailRule, Tool } from './types';
|
|
1
|
+
import type { CampaignV2, ContactInfo, ResolvedPlugins } from '@botonic/core';
|
|
2
|
+
import type { DebugLogger } from './debug-logger';
|
|
3
|
+
import type { AIAgent, GuardrailRule, Tool } from './types';
|
|
4
4
|
interface AIAgentBuilderOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
5
5
|
name: string;
|
|
6
6
|
instructions: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AiAgentArgs } from '@botonic/core';
|
|
2
|
-
import { AgenticInputMessage, MemoryOptions, RunResult } from './types';
|
|
1
|
+
import type { AiAgentArgs } from '@botonic/core';
|
|
2
|
+
import type { AgenticInputMessage, MemoryOptions, RunResult } from './types';
|
|
3
3
|
export interface DebugLoggerConfig {
|
|
4
4
|
messageHistoryApiVersion: string;
|
|
5
5
|
maxRetries: number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { InputGuardrail } from '@openai/agents';
|
|
2
|
-
import { GuardrailRule } from '../types';
|
|
1
|
+
import { type InputGuardrail } from '@openai/agents';
|
|
2
|
+
import type { GuardrailRule } from '../types';
|
|
3
3
|
export declare function createInputGuardrail(rules: GuardrailRule[]): InputGuardrail;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/guardrails/input.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/guardrails/input.ts"],"names":[],"mappings":";;AAUA,oDAiCC;AA3CD,2CAKuB;AACvB,6BAAuB;AAIvB,SAAgB,oBAAoB,CAAC,KAAsB;IACzD,MAAM,UAAU,GAAG,OAAC,CAAC,MAAM,CACzB,MAAM,CAAC,WAAW,CAChB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CACvE,CACF,CAAA;IAED,MAAM,KAAK,GAAG,IAAI,cAAK,CAAC;QACtB,IAAI,EAAE,gBAAgB;QACtB,YAAY,EACV,8DAA8D;QAChE,UAAU;KACX,CAAC,CAAA;IAEF,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE;YACpC,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAoB,CAAA;YAC9D,MAAM,MAAM,GAAG,MAAM,IAAA,YAAG,EAAC,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;YAC3D,MAAM,WAAW,GAAG,MAAM,CAAC,WAAsC,CAAA;YACjE,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;YAC7D,CAAC;YACD,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAA;YAC1E,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CACzD,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,IAAI,CACjC,CAAA;YACD,OAAO;gBACL,UAAU,EAAE,mBAAmB;gBAC/B,iBAAiB,EAAE,SAAS;aAC7B,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BotContext } from '@botonic/core';
|
|
2
|
-
import { AgenticInputMessage, Chunk } from './types';
|
|
1
|
+
import type { BotContext } from '@botonic/core';
|
|
2
|
+
import type { AgenticInputMessage, Chunk } from './types';
|
|
3
3
|
export interface GetMessagesV2Options {
|
|
4
4
|
maxMessages?: number;
|
|
5
5
|
includeToolCalls?: boolean;
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AiAgentArgs, BotContext, Plugin, ResolvedPlugins } from '@botonic/core';
|
|
2
|
-
import { CustomTool, InferenceResponse, PluginAiAgentOptions } from './types';
|
|
1
|
+
import type { AiAgentArgs, BotContext, Plugin, ResolvedPlugins } from '@botonic/core';
|
|
2
|
+
import type { CustomTool, InferenceResponse, PluginAiAgentOptions } from './types';
|
|
3
3
|
export default class BotonicPluginAiAgents<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> implements Plugin {
|
|
4
4
|
private readonly authToken?;
|
|
5
5
|
private readonly messageHistoryApiVersion;
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAMA,2CAAqC;AAErC,mDAAgD;AAChD,2CAAuD;AACvD,iDAAoE;AACpE,6DAAuD;AACvD,qCAAsC;AACtC,qCAAwC;AAYxC,MAAqB,qBAAqB;IAWxC,YAAY,OAAoD;QAFzD,oBAAe,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AI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CACxD,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CACpC,CAAA;QACD,OAAO,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE;YACzC,OAAO,IAAA,aAAI,EAA0C;gBACnD,IAAI,EAAE,cAAc,CAAC,IAAI;gBACzB,WAAW,EAAE,cAAc,CAAC,WAAW;gBACvC,UAAU,EAAE,cAAc,CAAC,MAAM;gBACjC,OAAO,EAAE,cAAc,CAAC,IAAI;aAC7B,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AA7ID,wCA6IC;AAED,kDAAuB"}
|
package/lib/esm/runner.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ResolvedPlugins } from '@botonic/core';
|
|
2
|
-
import { DebugLogger } from './debug-logger';
|
|
3
|
-
import { AgenticInputMessage, AIAgent, Context, RunResult } from './types';
|
|
1
|
+
import type { ResolvedPlugins } from '@botonic/core';
|
|
2
|
+
import type { DebugLogger } from './debug-logger';
|
|
3
|
+
import type { AgenticInputMessage, AIAgent, Context, RunResult } from './types';
|
|
4
4
|
export declare class AIAgentRunner<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
5
5
|
private agent;
|
|
6
6
|
private logger;
|
package/lib/esm/runner.js
CHANGED
package/lib/esm/runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/runner.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/runner.ts"],"names":[],"mappings":";;;AAKA,2CAIuB;AAGvB,mCAA2C;AAkB3C,MAAa,aAAa;IAOxB,YAAY,KAAoC,EAAE,MAAmB;QACnE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,MAAM,GAAG,MAA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AI,CAAA;QAClC,MAAM,aAAa,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QAEvE,IAAI,QAAQ,KAAK,yBAAiB,CAAC,IAAI,EAAE,CAAC;YACxC,OAAO;gBACL,QAAQ;gBACR,aAAa;gBACb,uBAAuB,EAAE,OAAO,CAAC,aAAa,CAAC,SAAS;gBACxD,sBAAsB,EAAE,OAAO,CAAC,aAAa,CAAC,SAAS;aACxD,CAAA;QACH,CAAC;QAED,OAAO;YACL,QAAQ;YACR,aAAa;SACd,CAAA;IACH,CAAC;IAEO,oBAAoB,CAAC,gBAAwB;QACnD,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAA;QACrC,CAAC;QAAC,OAAO,MAAM,EAAE,CAAC;YAChB,OAAO,EAAE,CAAA;QACX,CAAC;IACH,CAAC;CACF;AAhID,sCAgIC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { BotExecutorMessage } from '@botonic/core';
|
|
2
|
+
import z from 'zod';
|
|
3
|
+
export type { BotExecutorMessage };
|
|
4
|
+
export declare const BotExecutorSchema: z.ZodObject<{
|
|
5
|
+
type: z.ZodEnum<["botExecutor"]>;
|
|
6
|
+
content: z.ZodObject<{
|
|
7
|
+
text: z.ZodString;
|
|
8
|
+
buttons: z.ZodArray<z.ZodObject<{
|
|
9
|
+
text: z.ZodString;
|
|
10
|
+
payload: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
text: string;
|
|
13
|
+
payload: string;
|
|
14
|
+
}, {
|
|
15
|
+
text: string;
|
|
16
|
+
payload: string;
|
|
17
|
+
}>, "many">;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
text: string;
|
|
20
|
+
buttons: {
|
|
21
|
+
text: string;
|
|
22
|
+
payload: string;
|
|
23
|
+
}[];
|
|
24
|
+
}, {
|
|
25
|
+
text: string;
|
|
26
|
+
buttons: {
|
|
27
|
+
text: string;
|
|
28
|
+
payload: string;
|
|
29
|
+
}[];
|
|
30
|
+
}>;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
type: "botExecutor";
|
|
33
|
+
content: {
|
|
34
|
+
text: string;
|
|
35
|
+
buttons: {
|
|
36
|
+
text: string;
|
|
37
|
+
payload: string;
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
40
|
+
}, {
|
|
41
|
+
type: "botExecutor";
|
|
42
|
+
content: {
|
|
43
|
+
text: string;
|
|
44
|
+
buttons: {
|
|
45
|
+
text: string;
|
|
46
|
+
payload: string;
|
|
47
|
+
}[];
|
|
48
|
+
};
|
|
49
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BotExecutorSchema = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const zod_1 = tslib_1.__importDefault(require("zod"));
|
|
6
|
+
exports.BotExecutorSchema = zod_1.default
|
|
7
|
+
.object({
|
|
8
|
+
type: zod_1.default.enum(['botExecutor']),
|
|
9
|
+
content: zod_1.default.object({
|
|
10
|
+
text: zod_1.default.string(),
|
|
11
|
+
buttons: zod_1.default.array(zod_1.default.object({
|
|
12
|
+
text: zod_1.default.string(),
|
|
13
|
+
payload: zod_1.default.string(),
|
|
14
|
+
})),
|
|
15
|
+
}),
|
|
16
|
+
})
|
|
17
|
+
.describe('A text message with buttons to allow the bot to execute a specific action. Use it only when asked explicitly in the prompt');
|
|
18
|
+
//# sourceMappingURL=bot-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bot-executor.js","sourceRoot":"","sources":["../../../src/structured-output/bot-executor.ts"],"names":[],"mappings":";;;;AACA,sDAAmB;AAIN,QAAA,iBAAiB,GAAG,aAAC;KAC/B,MAAM,CAAC;IACN,IAAI,EAAE,aAAC,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,CAAC;IAC7B,OAAO,EAAE,aAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,aAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,aAAC,CAAC,KAAK,CACd,aAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,aAAC,CAAC,MAAM,EAAE;YAChB,OAAO,EAAE,aAAC,CAAC,MAAM,EAAE;SACpB,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CACP,4HAA4H,CAC7H,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OutputMessage } from '@botonic/core';
|
|
1
|
+
import type { OutputMessage } from '@botonic/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
export interface Output {
|
|
4
4
|
messages: OutputMessage[];
|
|
@@ -160,9 +160,63 @@ export declare const OutputSchema: z.ZodObject<{
|
|
|
160
160
|
type: "exit";
|
|
161
161
|
}, {
|
|
162
162
|
type: "exit";
|
|
163
|
+
}>, z.ZodObject<{
|
|
164
|
+
type: z.ZodEnum<["botExecutor"]>;
|
|
165
|
+
content: z.ZodObject<{
|
|
166
|
+
text: z.ZodString;
|
|
167
|
+
buttons: z.ZodArray<z.ZodObject<{
|
|
168
|
+
text: z.ZodString;
|
|
169
|
+
payload: z.ZodString;
|
|
170
|
+
}, "strip", z.ZodTypeAny, {
|
|
171
|
+
text: string;
|
|
172
|
+
payload: string;
|
|
173
|
+
}, {
|
|
174
|
+
text: string;
|
|
175
|
+
payload: string;
|
|
176
|
+
}>, "many">;
|
|
177
|
+
}, "strip", z.ZodTypeAny, {
|
|
178
|
+
text: string;
|
|
179
|
+
buttons: {
|
|
180
|
+
text: string;
|
|
181
|
+
payload: string;
|
|
182
|
+
}[];
|
|
183
|
+
}, {
|
|
184
|
+
text: string;
|
|
185
|
+
buttons: {
|
|
186
|
+
text: string;
|
|
187
|
+
payload: string;
|
|
188
|
+
}[];
|
|
189
|
+
}>;
|
|
190
|
+
}, "strip", z.ZodTypeAny, {
|
|
191
|
+
type: "botExecutor";
|
|
192
|
+
content: {
|
|
193
|
+
text: string;
|
|
194
|
+
buttons: {
|
|
195
|
+
text: string;
|
|
196
|
+
payload: string;
|
|
197
|
+
}[];
|
|
198
|
+
};
|
|
199
|
+
}, {
|
|
200
|
+
type: "botExecutor";
|
|
201
|
+
content: {
|
|
202
|
+
text: string;
|
|
203
|
+
buttons: {
|
|
204
|
+
text: string;
|
|
205
|
+
payload: string;
|
|
206
|
+
}[];
|
|
207
|
+
};
|
|
163
208
|
}>]>, "many">;
|
|
164
209
|
}, "strip", z.ZodTypeAny, {
|
|
165
210
|
messages: ({
|
|
211
|
+
type: "botExecutor";
|
|
212
|
+
content: {
|
|
213
|
+
text: string;
|
|
214
|
+
buttons: {
|
|
215
|
+
text: string;
|
|
216
|
+
payload: string;
|
|
217
|
+
}[];
|
|
218
|
+
};
|
|
219
|
+
} | {
|
|
166
220
|
type: "carousel";
|
|
167
221
|
content: {
|
|
168
222
|
elements: {
|
|
@@ -195,6 +249,15 @@ export declare const OutputSchema: z.ZodObject<{
|
|
|
195
249
|
})[];
|
|
196
250
|
}, {
|
|
197
251
|
messages: ({
|
|
252
|
+
type: "botExecutor";
|
|
253
|
+
content: {
|
|
254
|
+
text: string;
|
|
255
|
+
buttons: {
|
|
256
|
+
text: string;
|
|
257
|
+
payload: string;
|
|
258
|
+
}[];
|
|
259
|
+
};
|
|
260
|
+
} | {
|
|
198
261
|
type: "carousel";
|
|
199
262
|
content: {
|
|
200
263
|
elements: {
|
|
@@ -2,13 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OutputSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const bot_executor_1 = require("./bot-executor");
|
|
5
6
|
const carousel_1 = require("./carousel");
|
|
6
7
|
const exit_1 = require("./exit");
|
|
7
8
|
const text_1 = require("./text");
|
|
8
9
|
const text_with_buttons_1 = require("./text-with-buttons");
|
|
9
10
|
exports.OutputSchema = zod_1.z
|
|
10
11
|
.object({
|
|
11
|
-
messages: zod_1.z.array(zod_1.z.union([
|
|
12
|
+
messages: zod_1.z.array(zod_1.z.union([
|
|
13
|
+
text_1.TextSchema,
|
|
14
|
+
text_with_buttons_1.TextWithButtonsSchema,
|
|
15
|
+
carousel_1.CarouselSchema,
|
|
16
|
+
exit_1.ExitSchema,
|
|
17
|
+
bot_executor_1.BotExecutorSchema,
|
|
18
|
+
])),
|
|
12
19
|
})
|
|
13
20
|
.describe('The messages to be sent to the user');
|
|
14
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structured-output/index.ts"],"names":[],"mappings":";;;AACA,6BAAuB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structured-output/index.ts"],"names":[],"mappings":";;;AACA,6BAAuB;AACvB,iDAAkD;AAClD,yCAA2C;AAC3C,iCAAmC;AACnC,iCAAmC;AACnC,2DAA2D;AAM9C,QAAA,YAAY,GAAG,OAAC;KAC1B,MAAM,CAAC;IACN,QAAQ,EAAE,OAAC,CAAC,KAAK,CACf,OAAC,CAAC,KAAK,CAAC;QACN,iBAAU;QACV,yCAAqB;QACrB,yBAAc;QACd,iBAAU;QACV,gCAAiB;KAClB,CAAC,CACH;CACF,CAAC;KACD,QAAQ,CAAC,qCAAqC,CAAC,CAAA"}
|
package/lib/esm/tools/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":";;;AAEA,2DAAwD;AAA/C,uHAAA,iBAAiB,OAAA;AAEb,QAAA,cAAc,GAAW,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { Context } from '../types';
|
|
2
|
+
import type { Context } from '../types';
|
|
3
3
|
export declare const retrieveKnowledge: import("@openai/agents").FunctionTool<Context<import("@botonic/core").ResolvedPlugins, any>, z.ZodObject<{
|
|
4
4
|
query: z.ZodString;
|
|
5
5
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieve-knowledge.js","sourceRoot":"","sources":["../../../src/tools/retrieve-knowledge.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"retrieve-knowledge.js","sourceRoot":"","sources":["../../../src/tools/retrieve-knowledge.ts"],"names":[],"mappings":";;;AAAA,2CAAsD;AACtD,6BAAuB;AAEvB,8DAAwD;AAG3C,QAAA,iBAAiB,GAAG,IAAA,aAAI,EAAC;IACpC,IAAI,EAAE,oBAAoB;IAC1B,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,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;QACnC,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,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,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;YACxC,UAAU;SACX,CAAA;QAED,OAAO,UAAU,CAAA;IACnB,CAAC;CACF,CAAC,CAAA"}
|
package/lib/esm/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AgenticOutputMessage, AiAgentArgs, BotContext, GuardrailRule, InferenceResponse, ResolvedPlugins, RunResult } from '@botonic/core';
|
|
2
|
-
import { Agent, AgentInputItem, AgentOutputType, RunContext as OpenAIRunContext, Tool as OpenAITool } from '@openai/agents';
|
|
3
|
-
import { ZodSchema } from 'zod';
|
|
4
|
-
import { OutputSchema } from './structured-output';
|
|
1
|
+
import { AgenticOutputMessage, AiAgentArgs, type BotContext, GuardrailRule, InferenceResponse, type ResolvedPlugins, RunResult } from '@botonic/core';
|
|
2
|
+
import type { Agent, AgentInputItem, AgentOutputType, RunContext as OpenAIRunContext, Tool as OpenAITool } from '@openai/agents';
|
|
3
|
+
import type { ZodSchema } from 'zod';
|
|
4
|
+
import type { OutputSchema } from './structured-output';
|
|
5
5
|
export interface Context<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
6
6
|
authToken: string;
|
|
7
7
|
sourceIds: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/plugin-ai-agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0-alpha.1",
|
|
4
4
|
"main": "./lib/cjs/index.js",
|
|
5
5
|
"module": "./lib/esm/index.js",
|
|
6
6
|
"description": "Use AI Agents to generate your contents",
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
"build:watch": "npm run build -- --watch",
|
|
10
10
|
"test": "../../node_modules/.bin/jest --coverage",
|
|
11
11
|
"prepublishOnly": "rm -rf lib && npm i && npm run build",
|
|
12
|
-
"lint": "
|
|
13
|
-
"
|
|
12
|
+
"lint": "biome check --write src/ tests/",
|
|
13
|
+
"lint:check": "biome check src/ tests/",
|
|
14
|
+
"format": "biome format --write src/ tests/"
|
|
14
15
|
},
|
|
15
16
|
"dependencies": {
|
|
16
|
-
"@botonic/core": "^0.
|
|
17
|
+
"@botonic/core": "^0.45.0-alpha.1",
|
|
17
18
|
"@openai/agents": "^0.3.9",
|
|
18
19
|
"axios": "^1.13.2",
|
|
19
20
|
"openai": "^6.0.0",
|
package/src/agent-builder.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { CampaignV2, ContactInfo, ResolvedPlugins } from '@botonic/core'
|
|
1
|
+
import type { CampaignV2, ContactInfo, ResolvedPlugins } from '@botonic/core'
|
|
2
2
|
import {
|
|
3
3
|
Agent,
|
|
4
|
-
AgentOutputType,
|
|
5
|
-
InputGuardrail,
|
|
6
|
-
ModelSettings,
|
|
4
|
+
type AgentOutputType,
|
|
5
|
+
type InputGuardrail,
|
|
6
|
+
type ModelSettings,
|
|
7
7
|
} from '@openai/agents'
|
|
8
8
|
|
|
9
9
|
import { OPENAI_MODEL, OPENAI_PROVIDER } from './constants'
|
|
10
|
-
import { DebugLogger } from './debug-logger'
|
|
10
|
+
import type { DebugLogger } from './debug-logger'
|
|
11
11
|
import { createInputGuardrail } from './guardrails'
|
|
12
12
|
import { OutputSchema } from './structured-output'
|
|
13
13
|
import { mandatoryTools, retrieveKnowledge } from './tools'
|
|
14
|
-
import { AIAgent, Context, GuardrailRule, Tool } from './types'
|
|
14
|
+
import type { AIAgent, Context, GuardrailRule, Tool } from './types'
|
|
15
15
|
|
|
16
16
|
interface AIAgentBuilderOptions<
|
|
17
17
|
TPlugins extends ResolvedPlugins = ResolvedPlugins,
|
package/src/debug-logger.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AiAgentArgs } from '@botonic/core'
|
|
1
|
+
import type { AiAgentArgs } from '@botonic/core'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
AZURE_OPENAI_API_BASE,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
OPENAI_MODEL,
|
|
8
8
|
OPENAI_PROVIDER,
|
|
9
9
|
} from './constants'
|
|
10
|
-
import { AgenticInputMessage, MemoryOptions, RunResult } from './types'
|
|
10
|
+
import type { AgenticInputMessage, MemoryOptions, RunResult } from './types'
|
|
11
11
|
|
|
12
12
|
const PREFIX = '[BotonicPluginAiAgents]'
|
|
13
13
|
|
package/src/guardrails/input.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Agent,
|
|
3
|
+
type InputGuardrail,
|
|
4
|
+
run,
|
|
5
|
+
type UserMessageItem,
|
|
6
|
+
} from '@openai/agents'
|
|
2
7
|
import { z } from 'zod'
|
|
3
8
|
|
|
4
|
-
import { GuardrailRule } from '../types'
|
|
9
|
+
import type { GuardrailRule } from '../types'
|
|
5
10
|
|
|
6
11
|
export function createInputGuardrail(rules: GuardrailRule[]): InputGuardrail {
|
|
7
12
|
const outputType = z.object(
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
-
import { BotContext } from '@botonic/core'
|
|
2
|
+
import type { BotContext } from '@botonic/core'
|
|
3
3
|
import axios from 'axios'
|
|
4
4
|
|
|
5
5
|
import { HUBTYPE_API_URL } from './constants'
|
|
6
|
-
import { AgenticInputMessage, Chunk } from './types'
|
|
6
|
+
import type { AgenticInputMessage, Chunk } from './types'
|
|
7
7
|
|
|
8
8
|
interface HubtypeAssistantMessage {
|
|
9
9
|
role: 'assistant'
|
package/src/index.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
AiAgentArgs,
|
|
3
|
+
BotContext,
|
|
4
|
+
Plugin,
|
|
5
|
+
ResolvedPlugins,
|
|
6
|
+
} from '@botonic/core'
|
|
2
7
|
import { tool } from '@openai/agents'
|
|
3
8
|
|
|
4
9
|
import { AIAgentBuilder } from './agent-builder'
|
|
5
10
|
import { isProd, MAX_MEMORY_LENGTH } from './constants'
|
|
6
|
-
import { createDebugLogger, DebugLogger } from './debug-logger'
|
|
11
|
+
import { createDebugLogger, type DebugLogger } from './debug-logger'
|
|
7
12
|
import { HubtypeApiClient } from './hubtype-api-client'
|
|
8
13
|
import { setUpOpenAI } from './openai'
|
|
9
14
|
import { AIAgentRunner } from './runner'
|
|
10
|
-
import {
|
|
15
|
+
import type {
|
|
11
16
|
AgenticInputMessage,
|
|
12
17
|
Context,
|
|
13
18
|
CustomTool,
|
|
@@ -21,7 +26,8 @@ import {
|
|
|
21
26
|
export default class BotonicPluginAiAgents<
|
|
22
27
|
TPlugins extends ResolvedPlugins = ResolvedPlugins,
|
|
23
28
|
TExtraData = any,
|
|
24
|
-
> implements Plugin
|
|
29
|
+
> implements Plugin
|
|
30
|
+
{
|
|
25
31
|
private readonly authToken?: string
|
|
26
32
|
private readonly messageHistoryApiVersion: MessageHistoryApiVersion
|
|
27
33
|
private readonly memory: MemoryOptions
|
package/src/runner.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
OutputMessage,
|
|
3
|
+
ResolvedPlugins,
|
|
4
|
+
ToolExecution,
|
|
5
|
+
} from '@botonic/core'
|
|
2
6
|
import {
|
|
3
7
|
InputGuardrailTripwireTriggered,
|
|
4
8
|
Runner,
|
|
5
9
|
RunToolCallItem,
|
|
6
10
|
} from '@openai/agents'
|
|
7
11
|
|
|
8
|
-
import { DebugLogger } from './debug-logger'
|
|
12
|
+
import type { DebugLogger } from './debug-logger'
|
|
9
13
|
import { retrieveKnowledge } from './tools'
|
|
10
|
-
import {
|
|
14
|
+
import type {
|
|
11
15
|
AgenticInputMessage,
|
|
12
16
|
AgenticOutputMessage,
|
|
13
17
|
AIAgent,
|
|
@@ -148,7 +152,7 @@ export class AIAgentRunner<
|
|
|
148
152
|
private getSafeToolArguments(rawToolArguments: string): Record<string, any> {
|
|
149
153
|
try {
|
|
150
154
|
return JSON.parse(rawToolArguments)
|
|
151
|
-
} catch (
|
|
155
|
+
} catch (_error) {
|
|
152
156
|
return {}
|
|
153
157
|
}
|
|
154
158
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BotExecutorMessage } from '@botonic/core'
|
|
2
|
+
import z from 'zod'
|
|
3
|
+
|
|
4
|
+
export type { BotExecutorMessage }
|
|
5
|
+
|
|
6
|
+
export const BotExecutorSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
type: z.enum(['botExecutor']),
|
|
9
|
+
content: z.object({
|
|
10
|
+
text: z.string(),
|
|
11
|
+
buttons: z.array(
|
|
12
|
+
z.object({
|
|
13
|
+
text: z.string(),
|
|
14
|
+
payload: z.string(),
|
|
15
|
+
})
|
|
16
|
+
),
|
|
17
|
+
}),
|
|
18
|
+
})
|
|
19
|
+
.describe(
|
|
20
|
+
'A text message with buttons to allow the bot to execute a specific action. Use it only when asked explicitly in the prompt'
|
|
21
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OutputMessage } from '@botonic/core'
|
|
1
|
+
import type { OutputMessage } from '@botonic/core'
|
|
2
2
|
import { z } from 'zod'
|
|
3
|
-
|
|
3
|
+
import { BotExecutorSchema } from './bot-executor'
|
|
4
4
|
import { CarouselSchema } from './carousel'
|
|
5
5
|
import { ExitSchema } from './exit'
|
|
6
6
|
import { TextSchema } from './text'
|
|
@@ -13,7 +13,13 @@ export interface Output {
|
|
|
13
13
|
export const OutputSchema = z
|
|
14
14
|
.object({
|
|
15
15
|
messages: z.array(
|
|
16
|
-
z.union([
|
|
16
|
+
z.union([
|
|
17
|
+
TextSchema,
|
|
18
|
+
TextWithButtonsSchema,
|
|
19
|
+
CarouselSchema,
|
|
20
|
+
ExitSchema,
|
|
21
|
+
BotExecutorSchema,
|
|
22
|
+
])
|
|
17
23
|
),
|
|
18
24
|
})
|
|
19
25
|
.describe('The messages to be sent to the user')
|
package/src/tools/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { RunContext, tool } from '@openai/agents'
|
|
1
|
+
import { type RunContext, tool } from '@openai/agents'
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
4
|
import { HubtypeApiClient } from '../hubtype-api-client'
|
|
5
|
-
import { Context } from '../types'
|
|
5
|
+
import type { Context } from '../types'
|
|
6
6
|
|
|
7
7
|
export const retrieveKnowledge = tool({
|
|
8
8
|
name: 'retrieve_knowledge',
|
package/src/types.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgenticOutputMessage,
|
|
3
3
|
AiAgentArgs,
|
|
4
|
-
BotContext,
|
|
4
|
+
type BotContext,
|
|
5
5
|
GuardrailRule,
|
|
6
6
|
InferenceResponse,
|
|
7
|
-
ResolvedPlugins,
|
|
7
|
+
type ResolvedPlugins,
|
|
8
8
|
RunResult,
|
|
9
9
|
} from '@botonic/core'
|
|
10
|
-
import {
|
|
10
|
+
import type {
|
|
11
11
|
Agent,
|
|
12
12
|
AgentInputItem,
|
|
13
13
|
AgentOutputType,
|
|
14
14
|
RunContext as OpenAIRunContext,
|
|
15
15
|
Tool as OpenAITool,
|
|
16
16
|
} from '@openai/agents'
|
|
17
|
-
import { ZodSchema } from 'zod'
|
|
17
|
+
import type { ZodSchema } from 'zod'
|
|
18
18
|
|
|
19
|
-
import { OutputSchema } from './structured-output'
|
|
19
|
+
import type { OutputSchema } from './structured-output'
|
|
20
20
|
|
|
21
21
|
export interface Context<
|
|
22
22
|
TPlugins extends ResolvedPlugins = ResolvedPlugins,
|