@botonic/plugin-ai-agents 0.56.0-alpha.0 → 0.57.0-rslib-esm.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.
Files changed (161) hide show
  1. package/lib/esm/agents/base-agent.d.ts +4 -4
  2. package/lib/esm/agents/base-agent.js +47 -20
  3. package/lib/esm/agents/base-agent.js.map +1 -1
  4. package/lib/esm/agents/index.d.ts +2 -2
  5. package/lib/esm/agents/index.js +8 -7
  6. package/lib/esm/agents/index.js.map +1 -1
  7. package/lib/esm/agents/router-agent.d.ts +5 -5
  8. package/lib/esm/agents/router-agent.js +32 -15
  9. package/lib/esm/agents/router-agent.js.map +1 -1
  10. package/lib/esm/agents/specialist-agent.d.ts +5 -5
  11. package/lib/esm/agents/specialist-agent.js +65 -45
  12. package/lib/esm/agents/specialist-agent.js.map +1 -1
  13. package/lib/esm/bot-config-tools.d.ts +1 -1
  14. package/lib/esm/bot-config-tools.js +15 -13
  15. package/lib/esm/bot-config-tools.js.map +1 -1
  16. package/lib/esm/constants.js +18 -17
  17. package/lib/esm/constants.js.map +1 -1
  18. package/lib/esm/debug-logger.d.ts +1 -1
  19. package/lib/esm/debug-logger.js +14 -9
  20. package/lib/esm/debug-logger.js.map +1 -1
  21. package/lib/esm/guardrails/index.d.ts +1 -1
  22. package/lib/esm/guardrails/index.js +5 -4
  23. package/lib/esm/guardrails/index.js.map +1 -1
  24. package/lib/esm/guardrails/input.d.ts +2 -2
  25. package/lib/esm/guardrails/input.js +65 -42
  26. package/lib/esm/guardrails/input.js.map +1 -1
  27. package/lib/esm/index.d.ts +3 -3
  28. package/lib/esm/index.js +114 -74
  29. package/lib/esm/index.js.map +1 -1
  30. package/lib/esm/llm-config.d.ts +1 -1
  31. package/lib/esm/llm-config.js +81 -52
  32. package/lib/esm/llm-config.js.map +1 -1
  33. package/lib/esm/package.json +3 -0
  34. package/lib/esm/runners/base-runner.d.ts +3 -3
  35. package/lib/esm/runners/base-runner.js +81 -69
  36. package/lib/esm/runners/base-runner.js.map +1 -1
  37. package/lib/esm/runners/index.d.ts +2 -2
  38. package/lib/esm/runners/index.js +8 -7
  39. package/lib/esm/runners/index.js.map +1 -1
  40. package/lib/esm/runners/router-runner.d.ts +2 -2
  41. package/lib/esm/runners/router-runner.js +19 -14
  42. package/lib/esm/runners/router-runner.js.map +1 -1
  43. package/lib/esm/runners/specialist-runner.d.ts +1 -1
  44. package/lib/esm/runners/specialist-runner.js +8 -6
  45. package/lib/esm/runners/specialist-runner.js.map +1 -1
  46. package/lib/esm/services/hubtype-api-client.d.ts +2 -2
  47. package/lib/esm/services/hubtype-api-client.js +110 -95
  48. package/lib/esm/services/hubtype-api-client.js.map +1 -1
  49. package/lib/esm/services/types.d.ts +1 -1
  50. package/lib/esm/services/types.js +9 -9
  51. package/lib/esm/services/types.js.map +1 -1
  52. package/lib/esm/structured-output/bot-executor.js +20 -17
  53. package/lib/esm/structured-output/bot-executor.js.map +1 -1
  54. package/lib/esm/structured-output/carousel.js +25 -22
  55. package/lib/esm/structured-output/carousel.js.map +1 -1
  56. package/lib/esm/structured-output/exit.js +13 -10
  57. package/lib/esm/structured-output/exit.js.map +1 -1
  58. package/lib/esm/structured-output/index.d.ts +0 -10
  59. package/lib/esm/structured-output/index.js +39 -29
  60. package/lib/esm/structured-output/index.js.map +1 -1
  61. package/lib/esm/structured-output/text-with-buttons.js +24 -23
  62. package/lib/esm/structured-output/text-with-buttons.js.map +1 -1
  63. package/lib/esm/structured-output/text.js +16 -13
  64. package/lib/esm/structured-output/text.js.map +1 -1
  65. package/lib/esm/tools/index.d.ts +2 -2
  66. package/lib/esm/tools/index.js +7 -7
  67. package/lib/esm/tools/index.js.map +1 -1
  68. package/lib/esm/tools/retrieve-knowledge.d.ts +2 -2
  69. package/lib/esm/tools/retrieve-knowledge.js +38 -32
  70. package/lib/esm/tools/retrieve-knowledge.js.map +1 -1
  71. package/lib/esm/types.d.ts +3 -3
  72. package/lib/esm/types.js +4 -2
  73. package/lib/esm/types.js.map +1 -1
  74. package/package.json +8 -7
  75. package/src/structured-output/index.ts +0 -2
  76. package/src/types.ts +4 -4
  77. package/lib/cjs/agents/base-agent.d.ts +0 -28
  78. package/lib/cjs/agents/base-agent.js +0 -39
  79. package/lib/cjs/agents/base-agent.js.map +0 -1
  80. package/lib/cjs/agents/index.d.ts +0 -2
  81. package/lib/cjs/agents/index.js +0 -8
  82. package/lib/cjs/agents/index.js.map +0 -1
  83. package/lib/cjs/agents/router-agent.d.ts +0 -25
  84. package/lib/cjs/agents/router-agent.js +0 -33
  85. package/lib/cjs/agents/router-agent.js.map +0 -1
  86. package/lib/cjs/agents/specialist-agent.d.ts +0 -39
  87. package/lib/cjs/agents/specialist-agent.js +0 -108
  88. package/lib/cjs/agents/specialist-agent.js.map +0 -1
  89. package/lib/cjs/bot-config-tools.d.ts +0 -7
  90. package/lib/cjs/bot-config-tools.js +0 -18
  91. package/lib/cjs/bot-config-tools.js.map +0 -1
  92. package/lib/cjs/constants.d.ts +0 -21
  93. package/lib/cjs/constants.js +0 -25
  94. package/lib/cjs/constants.js.map +0 -1
  95. package/lib/cjs/debug-logger.d.ts +0 -33
  96. package/lib/cjs/debug-logger.js +0 -116
  97. package/lib/cjs/debug-logger.js.map +0 -1
  98. package/lib/cjs/guardrails/index.d.ts +0 -1
  99. package/lib/cjs/guardrails/index.js +0 -5
  100. package/lib/cjs/guardrails/index.js.map +0 -1
  101. package/lib/cjs/guardrails/input.d.ts +0 -10
  102. package/lib/cjs/guardrails/input.js +0 -96
  103. package/lib/cjs/guardrails/input.js.map +0 -1
  104. package/lib/cjs/index.d.ts +0 -22
  105. package/lib/cjs/index.js +0 -219
  106. package/lib/cjs/index.js.map +0 -1
  107. package/lib/cjs/llm-config.d.ts +0 -30
  108. package/lib/cjs/llm-config.js +0 -121
  109. package/lib/cjs/llm-config.js.map +0 -1
  110. package/lib/cjs/runners/base-runner.d.ts +0 -31
  111. package/lib/cjs/runners/base-runner.js +0 -189
  112. package/lib/cjs/runners/base-runner.js.map +0 -1
  113. package/lib/cjs/runners/index.d.ts +0 -2
  114. package/lib/cjs/runners/index.js +0 -8
  115. package/lib/cjs/runners/index.js.map +0 -1
  116. package/lib/cjs/runners/router-runner.d.ts +0 -8
  117. package/lib/cjs/runners/router-runner.js +0 -44
  118. package/lib/cjs/runners/router-runner.js.map +0 -1
  119. package/lib/cjs/runners/specialist-runner.d.ts +0 -4
  120. package/lib/cjs/runners/specialist-runner.js +0 -8
  121. package/lib/cjs/runners/specialist-runner.js.map +0 -1
  122. package/lib/cjs/services/hubtype-api-client.d.ts +0 -13
  123. package/lib/cjs/services/hubtype-api-client.js +0 -176
  124. package/lib/cjs/services/hubtype-api-client.js.map +0 -1
  125. package/lib/cjs/services/types.d.ts +0 -72
  126. package/lib/cjs/services/types.js +0 -13
  127. package/lib/cjs/services/types.js.map +0 -1
  128. package/lib/cjs/structured-output/bot-executor.d.ts +0 -13
  129. package/lib/cjs/structured-output/bot-executor.js +0 -18
  130. package/lib/cjs/structured-output/bot-executor.js.map +0 -1
  131. package/lib/cjs/structured-output/carousel.d.ts +0 -18
  132. package/lib/cjs/structured-output/carousel.js +0 -23
  133. package/lib/cjs/structured-output/carousel.js.map +0 -1
  134. package/lib/cjs/structured-output/exit.d.ts +0 -6
  135. package/lib/cjs/structured-output/exit.js +0 -11
  136. package/lib/cjs/structured-output/exit.js.map +0 -1
  137. package/lib/cjs/structured-output/index.d.ts +0 -108
  138. package/lib/cjs/structured-output/index.js +0 -45
  139. package/lib/cjs/structured-output/index.js.map +0 -1
  140. package/lib/cjs/structured-output/request-contact-info.d.ts +0 -9
  141. package/lib/cjs/structured-output/request-contact-info.js +0 -14
  142. package/lib/cjs/structured-output/request-contact-info.js.map +0 -1
  143. package/lib/cjs/structured-output/text-with-buttons.d.ts +0 -17
  144. package/lib/cjs/structured-output/text-with-buttons.js +0 -24
  145. package/lib/cjs/structured-output/text-with-buttons.js.map +0 -1
  146. package/lib/cjs/structured-output/text.d.ts +0 -9
  147. package/lib/cjs/structured-output/text.js +0 -14
  148. package/lib/cjs/structured-output/text.js.map +0 -1
  149. package/lib/cjs/tools/index.d.ts +0 -3
  150. package/lib/cjs/tools/index.js +0 -8
  151. package/lib/cjs/tools/index.js.map +0 -1
  152. package/lib/cjs/tools/retrieve-knowledge.d.ts +0 -6
  153. package/lib/cjs/tools/retrieve-knowledge.js +0 -34
  154. package/lib/cjs/tools/retrieve-knowledge.js.map +0 -1
  155. package/lib/cjs/types.d.ts +0 -53
  156. package/lib/cjs/types.js +0 -3
  157. package/lib/cjs/types.js.map +0 -1
  158. package/lib/esm/structured-output/request-contact-info.d.ts +0 -9
  159. package/lib/esm/structured-output/request-contact-info.js +0 -14
  160. package/lib/esm/structured-output/request-contact-info.js.map +0 -1
  161. package/src/structured-output/request-contact-info.ts +0 -18
@@ -1,9 +1,9 @@
1
1
  import type { AgentOutputType, InputGuardrail, Model, ModelSettings } from '@openai/agents';
2
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';
3
+ import type { GuardrailTrackingContext } from '../guardrails/input.js';
4
+ import type { LLMConfig } from '../llm-config.js';
5
+ import { type OutputSchema } from '../structured-output/index.js';
6
+ import type { GuardrailRule } from '../types.js';
7
7
  export interface BaseAgentOptions {
8
8
  name: string;
9
9
  instructions: string;
@@ -1,39 +1,66 @@
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");
1
+ import { createInputGuardrails } from "../guardrails/index.js";
2
+ import { getOutputInstructions, getOutputSchema } from "../structured-output/index.js";
3
+
4
+
5
+
6
+ function _define_property(obj, key, value) {
7
+ if (key in obj) {
8
+ Object.defineProperty(obj, key, {
9
+ value: value,
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true
13
+ });
14
+ } else obj[key] = value;
15
+ return obj;
16
+ }
17
+
18
+
6
19
  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
20
  getAgentModelSettings() {
16
- const modelSettings = { ...this.llmConfig.modelSettings };
21
+ const modelSettings = {
22
+ ...this.llmConfig.modelSettings
23
+ };
17
24
  if (this.llmConfig.modelSettings.reasoning) {
18
- modelSettings.reasoning = { ...this.llmConfig.modelSettings.reasoning };
25
+ modelSettings.reasoning = {
26
+ ...this.llmConfig.modelSettings.reasoning
27
+ };
19
28
  }
20
29
  if (this.llmConfig.modelSettings.text) {
21
- modelSettings.text = { ...this.llmConfig.modelSettings.text };
30
+ modelSettings.text = {
31
+ ...this.llmConfig.modelSettings.text
32
+ };
22
33
  }
23
34
  return modelSettings;
24
35
  }
25
36
  async getInputGuardrails() {
26
- return await (0, guardrails_1.createInputGuardrails)(this.inputGuardrailRules, this.llmConfig, this.guardrailTrackingContext);
37
+ return await createInputGuardrails(this.inputGuardrailRules, this.llmConfig, this.guardrailTrackingContext);
27
38
  }
28
39
  getOutputType() {
29
- return (0, structured_output_1.getOutputSchema)(this.outputMessagesSchemas);
40
+ return getOutputSchema(this.outputMessagesSchemas);
30
41
  }
31
42
  addOutputInstructions(instructions) {
32
- return `${instructions}\n\n${(0, structured_output_1.getOutputInstructions)()}`;
43
+ return `${instructions}\n\n${getOutputInstructions()}`;
33
44
  }
34
45
  async getModel() {
35
46
  return await this.llmConfig.getModel();
36
47
  }
48
+ constructor(options){
49
+ _define_property(this, "name", void 0);
50
+ _define_property(this, "instructions", void 0);
51
+ _define_property(this, "llmConfig", void 0);
52
+ _define_property(this, "inputGuardrailRules", void 0);
53
+ _define_property(this, "outputMessagesSchemas", void 0);
54
+ _define_property(this, "guardrailTrackingContext", void 0);
55
+ this.name = options.name;
56
+ this.instructions = options.instructions;
57
+ this.llmConfig = options.llmConfig;
58
+ this.inputGuardrailRules = options.inputGuardrailRules;
59
+ this.outputMessagesSchemas = options.outputMessagesSchemas || [];
60
+ this.guardrailTrackingContext = options.guardrailTrackingContext;
61
+ }
37
62
  }
38
- exports.BaseAgent = BaseAgent;
63
+
64
+ export { BaseAgent };
65
+
39
66
  //# sourceMappingURL=base-agent.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"agents/base-agent.js","sources":["../../../src/agents/base-agent.ts"],"sourcesContent":["import type {\n AgentOutputType,\n InputGuardrail,\n Model,\n ModelSettings,\n} from '@openai/agents'\nimport type { z } from 'zod'\n\nimport { createInputGuardrails } from '../guardrails'\nimport type { GuardrailTrackingContext } from '../guardrails/input'\nimport type { LLMConfig } from '../llm-config'\nimport {\n getOutputInstructions,\n getOutputSchema,\n type OutputSchema,\n} from '../structured-output'\nimport type { GuardrailRule } from '../types'\n\nexport interface BaseAgentOptions {\n name: string\n instructions: string\n llmConfig: LLMConfig\n inputGuardrailRules: GuardrailRule[]\n outputMessagesSchemas?: z.ZodObject[]\n guardrailTrackingContext: GuardrailTrackingContext\n}\n\nexport abstract class BaseAgent {\n protected name: string\n protected instructions: string\n protected llmConfig: LLMConfig\n private inputGuardrailRules: GuardrailRule[]\n private outputMessagesSchemas: z.ZodObject[]\n private guardrailTrackingContext: GuardrailTrackingContext\n\n constructor(options: BaseAgentOptions) {\n this.name = options.name\n this.instructions = options.instructions\n this.llmConfig = options.llmConfig\n this.inputGuardrailRules = options.inputGuardrailRules\n this.outputMessagesSchemas = options.outputMessagesSchemas || []\n this.guardrailTrackingContext = options.guardrailTrackingContext\n }\n\n protected getAgentModelSettings(): ModelSettings {\n const modelSettings: ModelSettings = { ...this.llmConfig.modelSettings }\n\n if (this.llmConfig.modelSettings.reasoning) {\n modelSettings.reasoning = { ...this.llmConfig.modelSettings.reasoning }\n }\n\n if (this.llmConfig.modelSettings.text) {\n modelSettings.text = { ...this.llmConfig.modelSettings.text }\n }\n\n return modelSettings\n }\n\n protected async getInputGuardrails(): Promise<InputGuardrail[]> {\n return await createInputGuardrails(\n this.inputGuardrailRules,\n this.llmConfig,\n this.guardrailTrackingContext\n )\n }\n\n protected getOutputType(): AgentOutputType<typeof OutputSchema> {\n return getOutputSchema(this.outputMessagesSchemas)\n }\n\n protected addOutputInstructions(instructions: string): string {\n return `${instructions}\\n\\n${getOutputInstructions()}`\n }\n\n protected async getModel(): Promise<string | Model> {\n return await this.llmConfig.getModel()\n }\n}\n"],"names":["createInputGuardrails","getOutputInstructions","getOutputSchema","BaseAgent","modelSettings","instructions","options"],"mappings":";;;;;;;;;;;;;;;;AAQqD;AAOxB;AAYtB,MAAeG,SAASA;IAiBnB,wBAAuC;QAC/C,MAAMC,gBAA+B;YAAE,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa;QAAC;QAEvE,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,SAAS,EAAE;YAC1CA,cAAc,SAAS,GAAG;gBAAE,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,SAAS;YAAC;QACxE;QAEA,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE;YACrCA,cAAc,IAAI,GAAG;gBAAE,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI;YAAC;QAC9D;QAEA,OAAOA;IACT;IAEA,MAAgB,qBAAgD;QAC9D,OAAO,MAAMJ,qBAAqBA,CAChC,IAAI,CAAC,mBAAmB,EACxB,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,wBAAwB;IAEjC;IAEU,gBAAsD;QAC9D,OAAOE,eAAeA,CAAC,IAAI,CAAC,qBAAqB;IACnD;IAEU,sBAAsBG,YAAoB,EAAU;QAC5D,OAAO,GAAGA,aAAa,IAAI,EAAEJ,qBAAqBA,IAAI;IACxD;IAEA,MAAgB,WAAoC;QAClD,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ;IACtC;IAzCA,YAAYK,OAAyB,CAAE;QAPvC,uBAAU,QAAV;QACA,uBAAU,gBAAV;QACA,uBAAU,aAAV;QACA,uBAAQ,uBAAR;QACA,uBAAQ,yBAAR;QACA,uBAAQ,4BAAR;QAGE,IAAI,CAAC,IAAI,GAAGA,QAAQ,IAAI;QACxB,IAAI,CAAC,YAAY,GAAGA,QAAQ,YAAY;QACxC,IAAI,CAAC,SAAS,GAAGA,QAAQ,SAAS;QAClC,IAAI,CAAC,mBAAmB,GAAGA,QAAQ,mBAAmB;QACtD,IAAI,CAAC,qBAAqB,GAAGA,QAAQ,qBAAqB,IAAI,EAAE;QAChE,IAAI,CAAC,wBAAwB,GAAGA,QAAQ,wBAAwB;IAClE;AAmCF"}
@@ -1,2 +1,2 @@
1
- export { RouterAgent } from './router-agent';
2
- export { SpecialistAgent } from './specialist-agent';
1
+ export { RouterAgent } from './router-agent.js';
2
+ export { SpecialistAgent } from './specialist-agent.js';
@@ -1,8 +1,9 @@
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; } });
1
+
2
+
3
+
4
+
5
+
6
+ export { RouterAgent } from "./router-agent.js";
7
+ export { SpecialistAgent } from "./specialist-agent.js";
8
+
8
9
  //# sourceMappingURL=index.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"agents/index.js","sources":["../../../src/agents/index.ts"],"sourcesContent":["export { RouterAgent } from './router-agent'\nexport { SpecialistAgent } from './specialist-agent'\n"],"names":["RouterAgent","SpecialistAgent"],"mappings":";;AAA4C;AACQ"}
@@ -1,11 +1,11 @@
1
1
  import type { ResolvedPlugins } from '@botonic/core';
2
2
  import { type AgentOutputType, type Handoff } from '@openai/agents';
3
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';
4
+ import type { GuardrailTrackingContext } from '../guardrails/input.js';
5
+ import type { LLMConfig } from '../llm-config.js';
6
+ import type { OutputSchema } from '../structured-output/index.js';
7
+ import type { AIAgent, Context, GuardrailRule } from '../types.js';
8
+ import { BaseAgent } from './base-agent.js';
9
9
  interface RouterAgentOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = unknown> {
10
10
  name: string;
11
11
  instructions: string;
@@ -1,26 +1,37 @@
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
- }
1
+ import { Agent } from "@openai/agents";
2
+ import { RECOMMENDED_PROMPT_PREFIX } from "@openai/agents-core/extensions";
3
+ import { BaseAgent } from "./base-agent.js";
4
+
5
+
6
+
7
+
8
+ function _define_property(obj, key, value) {
9
+ if (key in obj) {
10
+ Object.defineProperty(obj, key, {
11
+ value: value,
12
+ enumerable: true,
13
+ configurable: true,
14
+ writable: true
15
+ });
16
+ } else obj[key] = value;
17
+ return obj;
18
+ }
19
+
20
+
21
+
22
+ class RouterAgent extends BaseAgent {
12
23
  static async create(options) {
13
24
  const routerAgent = new RouterAgent(options);
14
25
  const inputGuardrails = await routerAgent.getInputGuardrails();
15
26
  // Agent.create is typed as Agent<UnknownContext>; we run with Context<TPlugins, TExtraData>.
16
- const agent = agents_1.Agent.create({
27
+ const agent = Agent.create({
17
28
  name: routerAgent.name,
18
29
  model: await routerAgent.getModel(),
19
30
  modelSettings: routerAgent.getAgentModelSettings(),
20
- instructions: routerAgent.addOutputInstructions(`${extensions_1.RECOMMENDED_PROMPT_PREFIX}${routerAgent.instructions}`),
31
+ instructions: routerAgent.addOutputInstructions(`${RECOMMENDED_PROMPT_PREFIX}${routerAgent.instructions}`),
21
32
  handoffs: routerAgent.handoffs,
22
33
  outputType: routerAgent.getOutputType(),
23
- inputGuardrails,
34
+ inputGuardrails
24
35
  });
25
36
  routerAgent.agent = agent;
26
37
  return routerAgent;
@@ -28,6 +39,12 @@ class RouterAgent extends base_agent_1.BaseAgent {
28
39
  getAgent() {
29
40
  return this.agent;
30
41
  }
42
+ constructor(options){
43
+ super(options), _define_property(this, "handoffs", void 0), _define_property(this, "agent", void 0);
44
+ this.handoffs = options.handoffs;
45
+ }
31
46
  }
32
- exports.RouterAgent = RouterAgent;
47
+
48
+ export { RouterAgent };
49
+
33
50
  //# sourceMappingURL=router-agent.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"agents/router-agent.js","sources":["../../../src/agents/router-agent.ts"],"sourcesContent":["import type { ResolvedPlugins } from '@botonic/core'\nimport { Agent, type AgentOutputType, type Handoff } from '@openai/agents'\nimport { RECOMMENDED_PROMPT_PREFIX } from '@openai/agents-core/extensions'\nimport type { z } from 'zod'\nimport type { GuardrailTrackingContext } from '../guardrails/input'\nimport type { LLMConfig } from '../llm-config'\nimport type { OutputSchema } from '../structured-output'\nimport type { AIAgent, Context, GuardrailRule } from '../types'\nimport { BaseAgent } from './base-agent'\n\ninterface RouterAgentOptions<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = unknown,\n> {\n name: string\n instructions: string\n llmConfig: LLMConfig\n handoffs: Handoff<\n Context<TPlugins, TExtraData>,\n AgentOutputType<typeof OutputSchema>\n >[]\n inputGuardrailRules: GuardrailRule[]\n outputMessagesSchemas?: z.ZodObject[]\n guardrailTrackingContext: GuardrailTrackingContext\n}\n\nexport class RouterAgent<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = unknown,\n> extends BaseAgent {\n private handoffs: Handoff<\n Context<TPlugins, TExtraData>,\n AgentOutputType<typeof OutputSchema>\n >[]\n private agent!: AIAgent<TPlugins, TExtraData>\n\n private constructor(options: RouterAgentOptions<TPlugins, TExtraData>) {\n super(options)\n this.handoffs = options.handoffs\n }\n\n static async create<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = unknown,\n >(\n options: RouterAgentOptions<TPlugins, TExtraData>\n ): Promise<RouterAgent<TPlugins, TExtraData>> {\n const routerAgent = new RouterAgent<TPlugins, TExtraData>(options)\n const inputGuardrails = await routerAgent.getInputGuardrails()\n\n // Agent.create is typed as Agent<UnknownContext>; we run with Context<TPlugins, TExtraData>.\n const agent = Agent.create({\n name: routerAgent.name,\n model: await routerAgent.getModel(),\n modelSettings: routerAgent.getAgentModelSettings(),\n instructions: routerAgent.addOutputInstructions(\n `${RECOMMENDED_PROMPT_PREFIX}${routerAgent.instructions}`\n ),\n handoffs: routerAgent.handoffs,\n outputType: routerAgent.getOutputType(),\n inputGuardrails,\n }) as AIAgent<TPlugins, TExtraData>\n\n routerAgent.agent = agent\n return routerAgent\n }\n\n getAgent(): AIAgent<TPlugins, TExtraData> {\n return this.agent\n }\n}\n"],"names":["Agent","RECOMMENDED_PROMPT_PREFIX","BaseAgent","RouterAgent","options","routerAgent","inputGuardrails","agent"],"mappings":";;;;;;;;;;;;;;;;;;AAC0E;AACA;AAMlC;AAkBjC,MAAMG,WAAWA,SAGdD,SAASA;IAYjB,aAAa,OAIXE,OAAiD,EACL;QAC5C,MAAMC,cAAc,IAAIF,WAAWA,CAAuBC;QAC1D,MAAME,kBAAkB,MAAMD,YAAY,kBAAkB;QAE5D,6FAA6F;QAC7F,MAAME,QAAQP,YAAY,CAAC;YACzB,MAAMK,YAAY,IAAI;YACtB,OAAO,MAAMA,YAAY,QAAQ;YACjC,eAAeA,YAAY,qBAAqB;YAChD,cAAcA,YAAY,qBAAqB,CAC7C,GAAGJ,yBAAyBA,GAAGI,YAAY,YAAY,EAAE;YAE3D,UAAUA,YAAY,QAAQ;YAC9B,YAAYA,YAAY,aAAa;YACrCC;QACF;QAEAD,YAAY,KAAK,GAAGE;QACpB,OAAOF;IACT;IAEA,WAA0C;QACxC,OAAO,IAAI,CAAC,KAAK;IACnB;IAjCA,YAAoBD,OAAiD,CAAE;QACrE,KAAK,CAACA,UAPR,uBAAQ,YAAR,SAIA,uBAAQ,SAAR;QAIE,IAAI,CAAC,QAAQ,GAAGA,QAAQ,QAAQ;IAClC;AA+BF"}
@@ -1,10 +1,10 @@
1
1
  import type { CampaignV2, ContactInfo, ResolvedPlugins } from '@botonic/core';
2
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';
3
+ import type { DebugLogger } from '../debug-logger.js';
4
+ import type { GuardrailTrackingContext } from '../guardrails/input.js';
5
+ import type { LLMConfig } from '../llm-config.js';
6
+ import type { AIAgent, GuardrailRule, Tool } from '../types.js';
7
+ import { BaseAgent } from './base-agent.js';
8
8
  interface SpecialistAgentOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = unknown> {
9
9
  name: string;
10
10
  instructions: string;
@@ -1,42 +1,44 @@
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,
1
+ import { Agent } from "@openai/agents";
2
+ import { LLM_PROVIDER } from "../constants.js";
3
+ import { RETRIEVE_KNOWLEDGE_TOOL_NAME, createRetrieveKnowledge, mandatoryTools } from "../tools/index.js";
4
+ import { BaseAgent } from "./base-agent.js";
5
+
6
+
7
+
8
+
9
+
10
+ function _define_property(obj, key, value) {
11
+ if (key in obj) {
12
+ Object.defineProperty(obj, key, {
13
+ value: value,
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true
17
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
- }
18
+ } else obj[key] = value;
19
+ return obj;
20
+ }
21
+
22
+
23
+
24
+
25
+ class SpecialistAgent extends BaseAgent {
24
26
  static async create(options) {
25
27
  const specialistAgent = new SpecialistAgent(options);
26
28
  const model = specialistAgent.llmConfig.modelName;
27
29
  const resolvedModel = await specialistAgent.getModel();
28
- const hasRetrieveKnowledge = specialistAgent.tools.some(tool => tool.name === tools_1.RETRIEVE_KNOWLEDGE_TOOL_NAME);
30
+ const hasRetrieveKnowledge = specialistAgent.tools.some((tool)=>tool.name === RETRIEVE_KNOWLEDGE_TOOL_NAME);
29
31
  const modelSettings = specialistAgent.getSpecialistModelSettings(hasRetrieveKnowledge);
30
32
  const inputGuardrails = await specialistAgent.getInputGuardrails();
31
33
  specialistAgent.logger.logModelSettings({
32
- provider: constants_1.LLM_PROVIDER,
34
+ provider: LLM_PROVIDER,
33
35
  model,
34
36
  reasoning: modelSettings.reasoning,
35
37
  text: modelSettings.text,
36
38
  toolChoice: modelSettings.toolChoice,
37
- hasRetrieveKnowledge,
39
+ hasRetrieveKnowledge
38
40
  });
39
- const agent = new agents_1.Agent({
41
+ const agent = new Agent({
40
42
  name: specialistAgent.name,
41
43
  model: resolvedModel,
42
44
  modelSettings,
@@ -44,7 +46,7 @@ class SpecialistAgent extends base_agent_1.BaseAgent {
44
46
  tools: specialistAgent.tools,
45
47
  outputType: specialistAgent.getOutputType(),
46
48
  inputGuardrails,
47
- outputGuardrails: [],
49
+ outputGuardrails: []
48
50
  });
49
51
  specialistAgent.agent = agent;
50
52
  return specialistAgent;
@@ -54,11 +56,9 @@ class SpecialistAgent extends base_agent_1.BaseAgent {
54
56
  }
55
57
  getSpecialistModelSettings(hasRetrieveKnowledge) {
56
58
  const modelSettings = this.getAgentModelSettings();
57
- const forceRetrieveKnowledge = hasRetrieveKnowledge &&
58
- !this.forceToolNameOverride &&
59
- !this.disableForceRetrieveKnowledge;
59
+ const forceRetrieveKnowledge = hasRetrieveKnowledge && !this.forceToolNameOverride && !this.disableForceRetrieveKnowledge;
60
60
  if (forceRetrieveKnowledge) {
61
- modelSettings.toolChoice = tools_1.RETRIEVE_KNOWLEDGE_TOOL_NAME;
61
+ modelSettings.toolChoice = RETRIEVE_KNOWLEDGE_TOOL_NAME;
62
62
  }
63
63
  if (this.forceToolNameOverride) {
64
64
  modelSettings.toolChoice = this.forceToolNameOverride;
@@ -70,15 +70,15 @@ class SpecialistAgent extends base_agent_1.BaseAgent {
70
70
  `<instructions>\n${initialInstructions.trim()}\n</instructions>`,
71
71
  this.getMetadataInstructions(),
72
72
  this.getContactInfoInstructions(contactInfo),
73
- this.getCampaignInstructions(campaignsContext),
74
- ].filter(section => section.length > 0);
73
+ this.getCampaignInstructions(campaignsContext)
74
+ ].filter((section)=>section.length > 0);
75
75
  return this.addOutputInstructions(sections.join('\n\n'));
76
76
  }
77
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>`;
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
82
  }
83
83
  getMetadataInstructions() {
84
84
  const metadata = `Current Date: ${new Date().toISOString()}`;
@@ -88,21 +88,41 @@ class SpecialistAgent extends base_agent_1.BaseAgent {
88
88
  if (!campaignsContext || campaignsContext.length === 0) {
89
89
  return '';
90
90
  }
91
- const campaignsWithContext = campaignsContext.filter(campaign => campaign.agent_context);
91
+ const campaignsWithContext = campaignsContext.filter((campaign)=>campaign.agent_context);
92
92
  if (campaignsWithContext.length === 0) {
93
93
  return '';
94
94
  }
95
- return campaignsWithContext
96
- .map((campaign, index) => `<campaign_context_${index + 1}>\n${campaign.agent_context}\n</campaign_context_${index + 1}>`)
97
- .join('\n');
95
+ return campaignsWithContext.map((campaign, index)=>`<campaign_context_${index + 1}>\n${campaign.agent_context}\n</campaign_context_${index + 1}>`).join('\n');
98
96
  }
99
97
  addHubtypeTools(tools, sourceIds) {
100
- const hubtypeTools = [...tools_1.mandatoryTools];
98
+ const hubtypeTools = [
99
+ ...mandatoryTools
100
+ ];
101
101
  if (sourceIds.length > 0) {
102
- hubtypeTools.push((0, tools_1.createRetrieveKnowledge)(sourceIds));
102
+ hubtypeTools.push(createRetrieveKnowledge(sourceIds));
103
103
  }
104
- return [...hubtypeTools, ...tools];
104
+ return [
105
+ ...hubtypeTools,
106
+ ...tools
107
+ ];
108
+ }
109
+ constructor(options){
110
+ super({
111
+ name: options.name,
112
+ instructions: options.instructions,
113
+ llmConfig: options.llmConfig,
114
+ inputGuardrailRules: options.inputGuardrailRules,
115
+ outputMessagesSchemas: options.outputMessagesSchemas,
116
+ guardrailTrackingContext: options.guardrailTrackingContext
117
+ }), _define_property(this, "tools", void 0), _define_property(this, "logger", void 0), _define_property(this, "agent", void 0), _define_property(this, "forceToolNameOverride", void 0), _define_property(this, "disableForceRetrieveKnowledge", void 0);
118
+ this.instructions = this.addExtraInstructions(options.instructions, options.contactInfo, options.campaignsContext);
119
+ this.tools = this.addHubtypeTools(options.tools, options.sourceIds);
120
+ this.logger = options.logger;
121
+ this.forceToolNameOverride = options.forceToolNameOverride;
122
+ this.disableForceRetrieveKnowledge = options.disableForceRetrieveKnowledge;
105
123
  }
106
124
  }
107
- exports.SpecialistAgent = SpecialistAgent;
125
+
126
+ export { SpecialistAgent };
127
+
108
128
  //# sourceMappingURL=specialist-agent.js.map
@@ -1 +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,qBAA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AiB,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"}
1
+ {"version":3,"file":"agents/specialist-agent.js","sources":["../../../src/agents/specialist-agent.ts"],"sourcesContent":["import type { CampaignV2, ContactInfo, ResolvedPlugins } from '@botonic/core'\nimport { Agent, type AgentOutputType, type ModelSettings } from '@openai/agents'\nimport type { z } from 'zod'\nimport { LLM_PROVIDER } from '../constants'\nimport type { DebugLogger } from '../debug-logger'\nimport type { GuardrailTrackingContext } from '../guardrails/input'\nimport type { LLMConfig } from '../llm-config'\nimport type { OutputSchema } from '../structured-output'\nimport {\n createRetrieveKnowledge,\n mandatoryTools,\n RETRIEVE_KNOWLEDGE_TOOL_NAME,\n} from '../tools'\nimport type { AIAgent, Context, GuardrailRule, Tool } from '../types'\nimport { BaseAgent } from './base-agent'\n\ninterface SpecialistAgentOptions<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = unknown,\n> {\n name: string\n instructions: string\n tools: Tool<TPlugins, TExtraData>[]\n campaignsContext?: CampaignV2[]\n contactInfo: ContactInfo[]\n inputGuardrailRules: GuardrailRule[]\n sourceIds: string[]\n outputMessagesSchemas?: z.ZodObject[]\n llmConfig: LLMConfig\n logger: DebugLogger\n guardrailTrackingContext: GuardrailTrackingContext\n forceToolNameOverride?: string\n disableForceRetrieveKnowledge?: boolean\n}\n\nexport class SpecialistAgent<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = unknown,\n> extends BaseAgent {\n private tools: Tool<TPlugins, TExtraData>[]\n private logger: DebugLogger\n private agent!: AIAgent<TPlugins, TExtraData>\n private forceToolNameOverride?: string\n private disableForceRetrieveKnowledge?: boolean\n\n private constructor(options: SpecialistAgentOptions<TPlugins, TExtraData>) {\n super({\n name: options.name,\n instructions: options.instructions,\n llmConfig: options.llmConfig,\n inputGuardrailRules: options.inputGuardrailRules,\n outputMessagesSchemas: options.outputMessagesSchemas,\n guardrailTrackingContext: options.guardrailTrackingContext,\n })\n this.instructions = this.addExtraInstructions(\n options.instructions,\n options.contactInfo,\n options.campaignsContext\n )\n this.tools = this.addHubtypeTools(options.tools, options.sourceIds)\n this.logger = options.logger\n this.forceToolNameOverride = options.forceToolNameOverride\n this.disableForceRetrieveKnowledge = options.disableForceRetrieveKnowledge\n }\n\n static async create<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = unknown,\n >(\n options: SpecialistAgentOptions<TPlugins, TExtraData>\n ): Promise<SpecialistAgent<TPlugins, TExtraData>> {\n const specialistAgent = new SpecialistAgent<TPlugins, TExtraData>(options)\n const model = specialistAgent.llmConfig.modelName\n const resolvedModel = await specialistAgent.getModel()\n const hasRetrieveKnowledge = specialistAgent.tools.some(\n tool => tool.name === RETRIEVE_KNOWLEDGE_TOOL_NAME\n )\n const modelSettings =\n specialistAgent.getSpecialistModelSettings(hasRetrieveKnowledge)\n const inputGuardrails = await specialistAgent.getInputGuardrails()\n\n specialistAgent.logger.logModelSettings({\n provider: LLM_PROVIDER,\n model,\n reasoning: modelSettings.reasoning as { effort: string } | undefined,\n text: modelSettings.text as { verbosity: string } | undefined,\n toolChoice: modelSettings.toolChoice,\n hasRetrieveKnowledge,\n })\n\n const agent = new Agent<\n Context<TPlugins, TExtraData>,\n AgentOutputType<typeof OutputSchema>\n >({\n name: specialistAgent.name,\n model: resolvedModel,\n modelSettings,\n instructions: specialistAgent.instructions,\n tools: specialistAgent.tools,\n outputType: specialistAgent.getOutputType(),\n inputGuardrails,\n outputGuardrails: [],\n })\n\n specialistAgent.agent = agent\n return specialistAgent\n }\n\n getAgent(): AIAgent<TPlugins, TExtraData> {\n return this.agent\n }\n\n private getSpecialistModelSettings(\n hasRetrieveKnowledge: boolean\n ): ModelSettings {\n const modelSettings = this.getAgentModelSettings()\n const forceRetrieveKnowledge =\n hasRetrieveKnowledge &&\n !this.forceToolNameOverride &&\n !this.disableForceRetrieveKnowledge\n\n if (forceRetrieveKnowledge) {\n modelSettings.toolChoice = RETRIEVE_KNOWLEDGE_TOOL_NAME\n }\n\n if (this.forceToolNameOverride) {\n modelSettings.toolChoice = this.forceToolNameOverride\n }\n\n return modelSettings\n }\n\n private addExtraInstructions(\n initialInstructions: string,\n contactInfo: ContactInfo[],\n campaignsContext?: CampaignV2[]\n ): string {\n const sections = [\n `<instructions>\\n${initialInstructions.trim()}\\n</instructions>`,\n this.getMetadataInstructions(),\n this.getContactInfoInstructions(contactInfo),\n this.getCampaignInstructions(campaignsContext),\n ].filter(section => section.length > 0)\n\n return this.addOutputInstructions(sections.join('\\n\\n'))\n }\n\n private getContactInfoInstructions(contactInfo: ContactInfo[]): string {\n return `<contact_info_fields>${JSON.stringify(\n contactInfo.map(info => ({\n name: info.name,\n value: info.value,\n })),\n null,\n 0\n )}</contact_info_fields>`\n }\n\n private getMetadataInstructions(): string {\n const metadata = `Current Date: ${new Date().toISOString()}`\n return `<metadata>\\n${metadata}\\n</metadata>`\n }\n\n private getCampaignInstructions(campaignsContext?: CampaignV2[]): string {\n if (!campaignsContext || campaignsContext.length === 0) {\n return ''\n }\n const campaignsWithContext = campaignsContext.filter(\n campaign => campaign.agent_context\n )\n if (campaignsWithContext.length === 0) {\n return ''\n }\n return campaignsWithContext\n .map(\n (campaign, index) =>\n `<campaign_context_${index + 1}>\\n${campaign.agent_context}\\n</campaign_context_${index + 1}>`\n )\n .join('\\n')\n }\n\n private addHubtypeTools(\n tools: Tool<TPlugins, TExtraData>[],\n sourceIds: string[]\n ): Tool<TPlugins, TExtraData>[] {\n const hubtypeTools: Tool[] = [...mandatoryTools]\n if (sourceIds.length > 0) {\n hubtypeTools.push(createRetrieveKnowledge(sourceIds))\n }\n return [...hubtypeTools, ...tools]\n }\n}\n"],"names":["Agent","LLM_PROVIDER","createRetrieveKnowledge","mandatoryTools","RETRIEVE_KNOWLEDGE_TOOL_NAME","BaseAgent","SpecialistAgent","options","specialistAgent","model","resolvedModel","hasRetrieveKnowledge","tool","modelSettings","inputGuardrails","agent","forceRetrieveKnowledge","initialInstructions","contactInfo","campaignsContext","sections","section","JSON","info","metadata","Date","campaignsWithContext","campaign","index","tools","sourceIds","hubtypeTools"],"mappings":";;;;;;;;;;;;;;;;;;;;AACgF;AAErC;AAS1B;AAEuB;AAqBjC,MAAMM,eAAeA,SAGlBD,SAASA;IA2BjB,aAAa,OAIXE,OAAqD,EACL;QAChD,MAAMC,kBAAkB,IAAIF,eAAeA,CAAuBC;QAClE,MAAME,QAAQD,gBAAgB,SAAS,CAAC,SAAS;QACj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,SAAS;YAC5B,qBAAqBA,QAAQ,mBAAmB;YAChD,uBAAuBA,QAAQ,qBAAqB;YACpD,0BAA0BA,QAAQ,wBAAwB;QAC5D,IAdF,uBAAQ,SAAR,SACA,uBAAQ,UAAR,SACA,uBAAQ,SAAR,SACA,uBAAQ,yBAAR,SACA,uBAAQ,iCAAR;QAWE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,oBAAoB,CAC3CA,QAAQ,YAAY,EACpBA,QAAQ,WAAW,EACnBA,QAAQ,gBAAgB;QAE1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAACA,QAAQ,KAAK,EAAEA,QAAQ,SAAS;QAClE,IAAI,CAAC,MAAM,GAAGA,QAAQ,MAAM;QAC5B,IAAI,CAAC,qBAAqB,GAAGA,QAAQ,qBAAqB;QAC1D,IAAI,CAAC,6BAA6B,GAAGA,QAAQ,6BAA6B;IAC5E;AAgIF"}
@@ -1,5 +1,5 @@
1
1
  import type { ToolConfigJSON } from '@botonic/core';
2
- import type { CustomTool } from './types';
2
+ import type { CustomTool } from './types.js';
3
3
  /**
4
4
  * Maps custom AI agent tools to the format expected by bot config (e.g. for flow-builder).
5
5
  * Converts each tool's Zod schema to JSON Schema so it can be serialized in the config.
@@ -1,18 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getToolsForBotConfig = getToolsForBotConfig;
4
- const zod_1 = require("zod");
1
+ import { z } from "zod";
2
+
3
+
4
+
5
5
  /**
6
6
  * Maps custom AI agent tools to the format expected by bot config (e.g. for flow-builder).
7
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
- }));
8
+ */ function getToolsForBotConfig(customTools) {
9
+ return customTools.map((tool)=>({
10
+ name: tool.name,
11
+ description: tool.description,
12
+ schema: z.toJSONSchema(tool.schema, {
13
+ target: 'draft-07'
14
+ })
15
+ }));
17
16
  }
17
+
18
+ export { getToolsForBotConfig };
19
+
18
20
  //# sourceMappingURL=bot-config-tools.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"bot-config-tools.js","sources":["../../src/bot-config-tools.ts"],"sourcesContent":["import type { ToolConfigJSON } from '@botonic/core'\nimport { z } from 'zod'\n\nimport type { CustomTool } from './types'\n\n/**\n * Maps custom AI agent tools to the format expected by bot config (e.g. for flow-builder).\n * Converts each tool's Zod schema to JSON Schema so it can be serialized in the config.\n */\nexport function getToolsForBotConfig(\n customTools: CustomTool[]\n): ToolConfigJSON[] {\n return customTools.map(tool => ({\n name: tool.name,\n description: tool.description,\n schema: z.toJSONSchema(tool.schema, {\n target: 'draft-07',\n }) as ToolConfigJSON['schema'],\n }))\n}\n"],"names":["z","getToolsForBotConfig","customTools","tool"],"mappings":";;;AACuB;AAIvB;;;CAGC,GACM,SAASC,oBAAoBA,CAClCC,WAAyB;IAEzB,OAAOA,YAAY,GAAG,CAACC,CAAAA,OAAS;YAC9B,MAAMA,KAAK,IAAI;YACf,aAAaA,KAAK,WAAW;YAC7B,QAAQH,cAAc,CAACG,KAAK,MAAM,EAAE;gBAClC,QAAQ;YACV;QACF;AACF"}
@@ -1,25 +1,26 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_TIMEOUT_16_SECONDS = exports.MAX_MEMORY_LENGTH = exports.isProd = exports.LLM_OPENAI_MODEL = exports.LLM_AZURE_API_VERSION = exports.LLM_API_URL = exports.LLM_API_KEY = exports.LLM_PROVIDER = exports.LITELLM_TAG_KEYS = exports.LLM_PROVIDERS = exports.HUBTYPE_API_URL = void 0;
4
- exports.HUBTYPE_API_URL = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com';
1
+ const HUBTYPE_API_URL = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com';
5
2
  // LLM Configuration (provider-agnostic; set LLM_PROVIDER=azure|openai)
6
- exports.LLM_PROVIDERS = {
3
+ const LLM_PROVIDERS = {
7
4
  AZURE: 'azure',
8
5
  OPENAI: 'openai',
9
- LITELLM: 'litellm',
6
+ LITELLM: 'litellm'
10
7
  };
11
- exports.LITELLM_TAG_KEYS = {
8
+ const LITELLM_TAG_KEYS = {
12
9
  BOT_ID: 'bot_id',
13
10
  ORG_ID: 'org_id',
14
- SEPARATOR: ',',
11
+ SEPARATOR: ','
15
12
  };
16
- exports.LLM_PROVIDER = process.env.LLM_PROVIDER || exports.LLM_PROVIDERS.AZURE;
17
- exports.LLM_API_KEY = process.env.LLM_API_KEY; // pragma: allowlist secret
18
- exports.LLM_API_URL = process.env.LLM_API_URL;
19
- exports.LLM_AZURE_API_VERSION = process.env.LLM_AZURE_API_VERSION || '2025-01-01-preview';
20
- exports.LLM_OPENAI_MODEL = process.env.LLM_OPENAI_MODEL || 'gpt-4.1-mini';
21
- exports.isProd = process.env.NODE_ENV === 'production';
22
- exports.MAX_MEMORY_LENGTH = 25;
23
- exports.DEFAULT_TIMEOUT_16_SECONDS = 16000;
24
- exports.DEFAULT_MAX_RETRIES = 2;
13
+ const LLM_PROVIDER = process.env.LLM_PROVIDER || LLM_PROVIDERS.AZURE;
14
+ const LLM_API_KEY = process.env.LLM_API_KEY // pragma: allowlist secret
15
+ ;
16
+ const LLM_API_URL = process.env.LLM_API_URL;
17
+ const LLM_AZURE_API_VERSION = process.env.LLM_AZURE_API_VERSION || '2025-01-01-preview';
18
+ const LLM_OPENAI_MODEL = process.env.LLM_OPENAI_MODEL || 'gpt-4.1-mini';
19
+ const isProd = process.env.NODE_ENV === 'production';
20
+ const MAX_MEMORY_LENGTH = 25;
21
+ const DEFAULT_TIMEOUT_16_SECONDS = 16000;
22
+ const DEFAULT_MAX_RETRIES = 2;
23
+
24
+ export { DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_16_SECONDS, HUBTYPE_API_URL, LITELLM_TAG_KEYS, LLM_API_KEY, LLM_API_URL, LLM_AZURE_API_VERSION, LLM_OPENAI_MODEL, LLM_PROVIDER, LLM_PROVIDERS, MAX_MEMORY_LENGTH, isProd };
25
+
25
26
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAC1B,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,yBAAyB,CAAA;AAE1D,uEAAuE;AAC1D,QAAA,aAAa,GAAG;IAC3B,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;CACV,CAAA;AAIG,QAAA,gBAAgB,GAAG;IAC9B,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,GAAG;CACN,CAAA;AAEG,QAAA,YAAY,GACtB,OAAO,CAAC,GAAG,CAAC,YAAgC,IAAI,qBAAa,CAAC,KAAK,CAAA;AACzD,QAAA,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAA,CAAC,2BAA2B;AACjE,QAAA,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAA;AACrC,QAAA,qBAAqB,GAChC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,oBAAoB,CAAA;AAC9C,QAAA,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,cAAc,CAAA;AAEjE,QAAA,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAA;AAE9C,QAAA,iBAAiB,GAAG,EAAE,CAAA;AAEtB,QAAA,0BAA0B,GAAG,KAAK,CAAA;AAClC,QAAA,mBAAmB,GAAG,CAAC,CAAA"}
1
+ {"version":3,"file":"constants.js","sources":["../../src/constants.ts"],"sourcesContent":["export const HUBTYPE_API_URL =\n process.env.HUBTYPE_API_URL || 'https://api.hubtype.com'\n\n// LLM Configuration (provider-agnostic; set LLM_PROVIDER=azure|openai)\nexport const LLM_PROVIDERS = {\n AZURE: 'azure',\n OPENAI: 'openai',\n LITELLM: 'litellm',\n} as const\n\nexport type LLMProviderType = (typeof LLM_PROVIDERS)[keyof typeof LLM_PROVIDERS]\n\nexport const LITELLM_TAG_KEYS = {\n BOT_ID: 'bot_id',\n ORG_ID: 'org_id',\n SEPARATOR: ',',\n} as const\n\nexport const LLM_PROVIDER: LLMProviderType =\n (process.env.LLM_PROVIDER as LLMProviderType) || LLM_PROVIDERS.AZURE\nexport const LLM_API_KEY = process.env.LLM_API_KEY // pragma: allowlist secret\nexport const LLM_API_URL = process.env.LLM_API_URL\nexport const LLM_AZURE_API_VERSION =\n process.env.LLM_AZURE_API_VERSION || '2025-01-01-preview'\nexport const LLM_OPENAI_MODEL = process.env.LLM_OPENAI_MODEL || 'gpt-4.1-mini'\n\nexport const isProd = process.env.NODE_ENV === 'production'\n\nexport const MAX_MEMORY_LENGTH = 25\n\nexport const DEFAULT_TIMEOUT_16_SECONDS = 16000\nexport const DEFAULT_MAX_RETRIES = 2\n"],"names":["HUBTYPE_API_URL","process","LLM_PROVIDERS","LITELLM_TAG_KEYS","LLM_PROVIDER","LLM_API_KEY","LLM_API_URL","LLM_AZURE_API_VERSION","LLM_OPENAI_MODEL","isProd","MAX_MEMORY_LENGTH","DEFAULT_TIMEOUT_16_SECONDS","DEFAULT_MAX_RETRIES"],"mappings":"AAAO,MAAMA,eAAeA,GAC1BC,QAAQ,GAAG,CAAC,eAAe,IAAI,0BAAyB;AAE1D,uEAAuE;AAChE,MAAMC,aAAaA,GAAG;IAC3B,OAAO;IACP,QAAQ;IACR,SAAS;AACX,EAAU;AAIH,MAAMC,gBAAgBA,GAAG;IAC9B,QAAQ;IACR,QAAQ;IACR,WAAW;AACb,EAAU;AAEH,MAAMC,YAAYA,GACtBH,QAAQ,GAAG,CAAC,YAAY,IAAwBC,aAAaA,CAAC,KAAK;AAC/D,MAAMG,WAAWA,GAAGJ,QAAQ,GAAG,CAAC,WAAW,CAAC,2BAA2B;CAA5B;AAC3C,MAAMK,WAAWA,GAAGL,QAAQ,GAAG,CAAC,WAAW;AAC3C,MAAMM,qBAAqBA,GAChCN,QAAQ,GAAG,CAAC,qBAAqB,IAAI,qBAAoB;AACpD,MAAMO,gBAAgBA,GAAGP,QAAQ,GAAG,CAAC,gBAAgB,IAAI,eAAc;AAEvE,MAAMQ,MAAMA,GAAGR,oBAAoB,KAAK,aAAY;AAEpD,MAAMS,iBAAiBA,GAAG,GAAE;AAE5B,MAAMC,0BAA0BA,GAAG,MAAK;AACxC,MAAMC,mBAAmBA,GAAG,EAAC"}
@@ -1,6 +1,6 @@
1
1
  import { type AiAgentArgs, type ToolExecution } from '@botonic/core';
2
2
  import type { ModelSettings } from '@openai/agents';
3
- import type { AgenticInputMessage, MemoryOptions, RunResult } from './types';
3
+ import type { AgenticInputMessage, MemoryOptions, RunResult } from './types.js';
4
4
  export interface DebugLoggerConfig {
5
5
  messageHistoryApiVersion: string;
6
6
  maxRetries: number;