chat-agent-toolkit 1.2.32 → 1.2.34

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 (67) hide show
  1. package/dist/research-agent.cjs.js +1 -1
  2. package/dist/research-agent.cjs.js.map +1 -1
  3. package/dist/research-agent.es.js +1 -1
  4. package/dist/research-agent.es.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/config/config-manager.ts +295 -295
  7. package/src/config/config-types.ts +65 -65
  8. package/src/config/environment-variables.ts +16 -16
  9. package/src/config/index.ts +26 -26
  10. package/src/config/language-models-database.ts +1434 -1434
  11. package/src/config/mcp-server-registry.ts +24 -24
  12. package/src/config/model-registry.ts +271 -271
  13. package/src/config/model-tester.ts +211 -211
  14. package/src/config/model-utils.ts +193 -193
  15. package/src/config/provider-ui-config.ts +196 -196
  16. package/src/connectors/open-connector.json +130 -130
  17. package/src/index.ts +26 -26
  18. package/src/memory/ARCHITECTURE.md +302 -302
  19. package/src/memory/README.md +224 -224
  20. package/src/memory/agent-memory-manager.ts +416 -416
  21. package/src/memory/example.ts +343 -343
  22. package/src/memory/index.ts +47 -47
  23. package/src/memory/mastra-integration.ts +604 -604
  24. package/src/memory/storage/drizzle-storage.ts +236 -236
  25. package/src/memory/storage/in-memory-storage.ts +551 -551
  26. package/src/memory/storage/storage-interface.ts +68 -68
  27. package/src/memory/types.ts +125 -125
  28. package/src/models/types.ts +4 -4
  29. package/src/provider-logos/01-ai.png +0 -0
  30. package/src/provider-logos/anthropic.png +0 -0
  31. package/src/provider-logos/aws-bedrock.png +0 -0
  32. package/src/provider-logos/aws-sagemaker.png +0 -0
  33. package/src/provider-logos/azure-openai-service.png +0 -0
  34. package/src/provider-logos/chatglm.png +0 -0
  35. package/src/provider-logos/cohere.png +0 -0
  36. package/src/provider-logos/gemini.png +0 -0
  37. package/src/provider-logos/groqcloud.png +0 -0
  38. package/src/provider-logos/huggingface.png +0 -0
  39. package/src/provider-logos/jina.png +0 -0
  40. package/src/provider-logos/localai.png +0 -0
  41. package/src/provider-logos/mistral-ai.png +0 -0
  42. package/src/provider-logos/moonshot-ai.png +0 -0
  43. package/src/provider-logos/ollama.png +0 -0
  44. package/src/provider-logos/openai.png +0 -0
  45. package/src/provider-logos/openllm.png +0 -0
  46. package/src/provider-logos/openrouter.png +0 -0
  47. package/src/provider-logos/replicate.png +0 -0
  48. package/src/provider-logos/together-ai.png +0 -0
  49. package/src/provider-logos/tongyi.png +0 -0
  50. package/src/provider-logos/xorbits-inference.png +0 -0
  51. package/src/provider-logos/zhipu-ai.png +0 -0
  52. package/src/tools/index.ts +13 -13
  53. package/src/tools/open-connector-mastra.ts +270 -270
  54. package/src/tools/open-connector-mcp.ts +170 -170
  55. package/src/tools/qwksearch-api-tools.ts +326 -326
  56. package/src/tools/search/doc-utils.ts +139 -139
  57. package/src/tools/search/document.ts +47 -47
  58. package/src/tools/search/index.ts +14 -14
  59. package/src/tools/search/link-summarizer.ts +112 -112
  60. package/src/tools/search/meta-search-types.ts +62 -62
  61. package/src/tools/search/metaSearchAgent.ts +465 -465
  62. package/src/tools/search/search-handlers.ts +97 -97
  63. package/src/tools/search/suggestionGeneratorAgent.ts +56 -56
  64. package/src/types.d.ts +137 -137
  65. package/src/utils/index.ts +2 -2
  66. package/src/utils/markdown-to-html.ts +53 -53
  67. package/src/utils/outputParser.ts +73 -73
@@ -1,53 +1,53 @@
1
- /**
2
- * @module research/agents/markdown-to-html
3
- * @description Converts Markdown to HTML with Highlight.js syntax highlighting.
4
- */
5
- import { marked } from "marked";
6
- import hljs from "highlight.js";
7
- import { encode, decode } from "html-entities";
8
-
9
- // Inline onclick: self-contained per button, works in dangerouslySetInnerHTML contexts
10
- const COPY_ONCLICK = [
11
- "(function(b){",
12
- "var c=b.closest('figure.code-block')?.querySelector('pre code');",
13
- "if(!c)return;",
14
- "navigator.clipboard.writeText(c.innerText).then(function(){",
15
- "var t=b.textContent;b.textContent='Copied!';",
16
- "setTimeout(function(){b.textContent=t},2000)",
17
- "})",
18
- "})(this)",
19
- ].join("");
20
-
21
- // Configure marked once at module load \u2014 stacking use() calls would duplicate extensions
22
- marked.use({ breaks: true, gfm: true, async: true });
23
-
24
- marked.use({
25
- renderer: {
26
- code({ text, lang }) {
27
- const language = lang || "plaintext";
28
- let highlighted: string;
29
-
30
- try {
31
- if (language && hljs.getLanguage(language)) {
32
- highlighted = hljs.highlight(text, { language }).value;
33
- } else {
34
- highlighted = hljs.highlightAuto(text).value;
35
- }
36
- } catch (e) {
37
- highlighted = encode(text);
38
- }
39
-
40
- return `<figure class="code-block"><button class="code-copy-btn" type="button" onclick="${COPY_ONCLICK}">Copy</button><pre><code class="hljs language-${language}">${highlighted}</code></pre></figure>`;
41
- },
42
- },
43
- });
44
-
45
- /**
46
- * Convert markdown text to HTML with Highlight.js syntax highlighting.
47
- * Unescapes HTML entities like `&amp;` \u2192 `&`.
48
- */
49
- export async function convertMarkdownToHTMLEscaped(
50
- markdown: string,
51
- ): Promise<string> {
52
- return (await marked.parse(decode(markdown))).trim();
53
- }
1
+ /**
2
+ * @module research/agents/markdown-to-html
3
+ * @description Converts Markdown to HTML with Highlight.js syntax highlighting.
4
+ */
5
+ import { marked } from "marked";
6
+ import hljs from "highlight.js";
7
+ import { encode, decode } from "html-entities";
8
+
9
+ // Inline onclick: self-contained per button, works in dangerouslySetInnerHTML contexts
10
+ const COPY_ONCLICK = [
11
+ "(function(b){",
12
+ "var c=b.closest('figure.code-block')?.querySelector('pre code');",
13
+ "if(!c)return;",
14
+ "navigator.clipboard.writeText(c.innerText).then(function(){",
15
+ "var t=b.textContent;b.textContent='Copied!';",
16
+ "setTimeout(function(){b.textContent=t},2000)",
17
+ "})",
18
+ "})(this)",
19
+ ].join("");
20
+
21
+ // Configure marked once at module load \u2014 stacking use() calls would duplicate extensions
22
+ marked.use({ breaks: true, gfm: true, async: true });
23
+
24
+ marked.use({
25
+ renderer: {
26
+ code({ text, lang }) {
27
+ const language = lang || "plaintext";
28
+ let highlighted: string;
29
+
30
+ try {
31
+ if (language && hljs.getLanguage(language)) {
32
+ highlighted = hljs.highlight(text, { language }).value;
33
+ } else {
34
+ highlighted = hljs.highlightAuto(text).value;
35
+ }
36
+ } catch (e) {
37
+ highlighted = encode(text);
38
+ }
39
+
40
+ return `<figure class="code-block"><button class="code-copy-btn" type="button" onclick="${COPY_ONCLICK}">Copy</button><pre><code class="hljs language-${language}">${highlighted}</code></pre></figure>`;
41
+ },
42
+ },
43
+ });
44
+
45
+ /**
46
+ * Convert markdown text to HTML with Highlight.js syntax highlighting.
47
+ * Unescapes HTML entities like `&amp;` \u2192 `&`.
48
+ */
49
+ export async function convertMarkdownToHTMLEscaped(
50
+ markdown: string,
51
+ ): Promise<string> {
52
+ return (await marked.parse(decode(markdown))).trim();
53
+ }
@@ -1,73 +1,73 @@
1
- /**
2
- * @module agent-toolkit/utils/outputParser
3
- * @description Parsers that extract values from XML-tagged sections of LLM
4
- * output (e.g. `<links>...</links>`, `<question>...</question>`).
5
- */
6
-
7
- const LIST_MARKER_REGEX = /^(\s*(-|\*|\d+\.\s|\d+\)\s|•)\s*)+/;
8
-
9
- interface LineListOutputParserArgs {
10
- key?: string;
11
- }
12
-
13
- export class LineListOutputParser {
14
- private key = "questions";
15
-
16
- constructor(args?: LineListOutputParserArgs) {
17
- this.key = args?.key ?? this.key;
18
- }
19
-
20
- async parse(text: string): Promise<string[]> {
21
- text = text.trim() || "";
22
-
23
- const startKeyIndex = text.indexOf(`<${this.key}>`);
24
- const endKeyIndex = text.indexOf(`</${this.key}>`);
25
-
26
- if (startKeyIndex === -1 || endKeyIndex === -1) {
27
- return [];
28
- }
29
-
30
- const questionsStartIndex = startKeyIndex + `<${this.key}>`.length;
31
- const lines = text
32
- .slice(questionsStartIndex, endKeyIndex)
33
- .trim()
34
- .split("\n")
35
- .filter((line) => line.trim() !== "")
36
- .map((line) => line.replace(LIST_MARKER_REGEX, ""));
37
-
38
- return lines;
39
- }
40
- }
41
-
42
- interface LineOutputParserArgs {
43
- key?: string;
44
- }
45
-
46
- export class LineOutputParser {
47
- private key = "questions";
48
-
49
- constructor(args?: LineOutputParserArgs) {
50
- this.key = args?.key ?? this.key;
51
- }
52
-
53
- async parse(text: string): Promise<string | undefined> {
54
- text = text.trim() || "";
55
-
56
- const startKeyIndex = text.indexOf(`<${this.key}>`);
57
- const endKeyIndex = text.indexOf(`</${this.key}>`);
58
-
59
- if (startKeyIndex === -1 || endKeyIndex === -1) {
60
- return undefined;
61
- }
62
-
63
- const questionsStartIndex = startKeyIndex + `<${this.key}>`.length;
64
- const line = text
65
- .slice(questionsStartIndex, endKeyIndex)
66
- .trim()
67
- .replace(LIST_MARKER_REGEX, "");
68
-
69
- return line;
70
- }
71
- }
72
-
73
- export default LineOutputParser;
1
+ /**
2
+ * @module agent-toolkit/utils/outputParser
3
+ * @description Parsers that extract values from XML-tagged sections of LLM
4
+ * output (e.g. `<links>...</links>`, `<question>...</question>`).
5
+ */
6
+
7
+ const LIST_MARKER_REGEX = /^(\s*(-|\*|\d+\.\s|\d+\)\s|•)\s*)+/;
8
+
9
+ interface LineListOutputParserArgs {
10
+ key?: string;
11
+ }
12
+
13
+ export class LineListOutputParser {
14
+ private key = "questions";
15
+
16
+ constructor(args?: LineListOutputParserArgs) {
17
+ this.key = args?.key ?? this.key;
18
+ }
19
+
20
+ async parse(text: string): Promise<string[]> {
21
+ text = text.trim() || "";
22
+
23
+ const startKeyIndex = text.indexOf(`<${this.key}>`);
24
+ const endKeyIndex = text.indexOf(`</${this.key}>`);
25
+
26
+ if (startKeyIndex === -1 || endKeyIndex === -1) {
27
+ return [];
28
+ }
29
+
30
+ const questionsStartIndex = startKeyIndex + `<${this.key}>`.length;
31
+ const lines = text
32
+ .slice(questionsStartIndex, endKeyIndex)
33
+ .trim()
34
+ .split("\n")
35
+ .filter((line) => line.trim() !== "")
36
+ .map((line) => line.replace(LIST_MARKER_REGEX, ""));
37
+
38
+ return lines;
39
+ }
40
+ }
41
+
42
+ interface LineOutputParserArgs {
43
+ key?: string;
44
+ }
45
+
46
+ export class LineOutputParser {
47
+ private key = "questions";
48
+
49
+ constructor(args?: LineOutputParserArgs) {
50
+ this.key = args?.key ?? this.key;
51
+ }
52
+
53
+ async parse(text: string): Promise<string | undefined> {
54
+ text = text.trim() || "";
55
+
56
+ const startKeyIndex = text.indexOf(`<${this.key}>`);
57
+ const endKeyIndex = text.indexOf(`</${this.key}>`);
58
+
59
+ if (startKeyIndex === -1 || endKeyIndex === -1) {
60
+ return undefined;
61
+ }
62
+
63
+ const questionsStartIndex = startKeyIndex + `<${this.key}>`.length;
64
+ const line = text
65
+ .slice(questionsStartIndex, endKeyIndex)
66
+ .trim()
67
+ .replace(LIST_MARKER_REGEX, "");
68
+
69
+ return line;
70
+ }
71
+ }
72
+
73
+ export default LineOutputParser;