chat-agent-toolkit 1.2.33 → 1.2.35

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 (42) hide show
  1. package/dist/research-agent.cjs.js.map +1 -1
  2. package/dist/research-agent.es.js.map +1 -1
  3. package/package.json +1 -1
  4. package/src/config/config-manager.ts +295 -295
  5. package/src/config/config-types.ts +65 -65
  6. package/src/config/environment-variables.ts +16 -16
  7. package/src/config/index.ts +26 -26
  8. package/src/config/language-models-database.ts +1434 -1434
  9. package/src/config/mcp-server-registry.ts +24 -24
  10. package/src/config/model-registry.ts +271 -271
  11. package/src/config/model-tester.ts +211 -211
  12. package/src/config/model-utils.ts +193 -193
  13. package/src/config/provider-ui-config.ts +196 -196
  14. package/src/connectors/open-connector.json +130 -130
  15. package/src/index.ts +26 -26
  16. package/src/memory/ARCHITECTURE.md +302 -302
  17. package/src/memory/README.md +224 -224
  18. package/src/memory/agent-memory-manager.ts +416 -416
  19. package/src/memory/example.ts +343 -343
  20. package/src/memory/index.ts +47 -47
  21. package/src/memory/mastra-integration.ts +604 -604
  22. package/src/memory/storage/drizzle-storage.ts +236 -236
  23. package/src/memory/storage/in-memory-storage.ts +551 -551
  24. package/src/memory/storage/storage-interface.ts +68 -68
  25. package/src/memory/types.ts +125 -125
  26. package/src/models/types.ts +4 -4
  27. package/src/tools/index.ts +13 -13
  28. package/src/tools/open-connector-mastra.ts +270 -270
  29. package/src/tools/open-connector-mcp.ts +170 -170
  30. package/src/tools/qwksearch-api-tools.ts +326 -326
  31. package/src/tools/search/doc-utils.ts +139 -139
  32. package/src/tools/search/document.ts +47 -47
  33. package/src/tools/search/index.ts +14 -14
  34. package/src/tools/search/link-summarizer.ts +112 -112
  35. package/src/tools/search/meta-search-types.ts +62 -62
  36. package/src/tools/search/metaSearchAgent.ts +465 -465
  37. package/src/tools/search/search-handlers.ts +97 -97
  38. package/src/tools/search/suggestionGeneratorAgent.ts +56 -56
  39. package/src/types.d.ts +137 -137
  40. package/src/utils/index.ts +2 -2
  41. package/src/utils/markdown-to-html.ts +53 -53
  42. 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;