chat-agent-toolkit 1.2.54 → 1.2.55
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chat-agent-toolkit",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.55",
|
|
4
4
|
"description": "Multi-provider AI agent toolkit: generate language responses, search the web, extract content, and manage memory across 10+ LLM providers.",
|
|
5
5
|
"author": "vtempest <grokthiscontact@gmail.com>",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module research/agents/markdown-to-html
|
|
3
|
-
* @description Converts Markdown to HTML with Prism.js syntax highlighting.
|
|
4
|
-
*/
|
|
5
|
-
import { marked } from "marked";
|
|
6
|
-
import Prism from "prismjs";
|
|
7
|
-
import "prismjs/components/prism-markup";
|
|
8
|
-
import "prismjs/components/prism-css";
|
|
9
|
-
import "prismjs/components/prism-javascript";
|
|
10
|
-
import "prismjs/components/prism-typescript";
|
|
11
|
-
import "prismjs/components/prism-jsx";
|
|
12
|
-
import "prismjs/components/prism-tsx";
|
|
13
|
-
import "prismjs/components/prism-python";
|
|
14
|
-
import "prismjs/components/prism-bash";
|
|
15
|
-
import "prismjs/components/prism-json";
|
|
16
|
-
import "prismjs/components/prism-yaml";
|
|
17
|
-
import "prismjs/components/prism-markdown";
|
|
18
|
-
import "prismjs/components/prism-sql";
|
|
19
|
-
import "prismjs/components/prism-rust";
|
|
20
|
-
import "prismjs/components/prism-go";
|
|
21
|
-
import "prismjs/components/prism-java";
|
|
22
|
-
import "prismjs/components/prism-c";
|
|
23
|
-
import "prismjs/components/prism-cpp";
|
|
24
|
-
import { encode, decode } from "html-entities";
|
|
25
|
-
|
|
26
|
-
// Inline onclihttps://claude.com/cai/oauth/authorize?code=true&client_id=9d1c250a-e61b-44d9-88ed-5944d1962f5e&response_type=code&redirect_uri=https%3A%2F%2Fplatform.claude.com%2Foauth%2Fcode%2Fcallback&scope=org%3Acreate_api_key+user%3Aprofile+user%3Ainference+user%3Asessions%3Aclaude_code+user%3Amcp_servers+user%3Afile_upload&code_challenge=JsLfmO6Cp0S_Fj1HNLczEOzmJxqfR-u3FIM0FPBnIiI&code_challenge_method=S256&state=CGnY-CI-nZZ9HncJj4QLdYXu_LC_bnxUHhIDTD7QL6Yck: self-contained per button, works in dangerouslySetInnerHTML contexts
|
|
27
|
-
const COPY_ONCLICK = [
|
|
28
|
-
"(function(b){",
|
|
29
|
-
"var c=b.closest('figure.code-block')?.querySelector('pre code');",
|
|
30
|
-
"if(!c)return;",
|
|
31
|
-
"navigator.clipboard.writeText(c.innerText).then(function(){",
|
|
32
|
-
"var t=b.textContent;b.textContent='Copied!';",
|
|
33
|
-
"setTimeout(function(){b.textContent=t},2000)",
|
|
34
|
-
"})",
|
|
35
|
-
"})(this)",
|
|
36
|
-
].join("");
|
|
37
|
-
|
|
38
|
-
// Configure marked once at module load \u2014 stacking use() calls would duplicate extensions
|
|
39
|
-
marked.use({ breaks: true, gfm: true, async: true });
|
|
40
|
-
|
|
41
|
-
marked.use({
|
|
42
|
-
renderer: {
|
|
43
|
-
code({ text, lang }) {
|
|
44
|
-
const language = lang || "plaintext";
|
|
45
|
-
let highlighted: string;
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
if (language && Prism.languages[language]) {
|
|
49
|
-
highlighted = Prism.highlight(text, Prism.languages[language], language);
|
|
50
|
-
} else {
|
|
51
|
-
highlighted = encode(text);
|
|
52
|
-
}
|
|
53
|
-
} catch (e) {
|
|
54
|
-
highlighted = encode(text);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return `<figure class="code-block"><button class="code-copy-btn" type="button" onclick="${COPY_ONCLICK}">Copy</button><pre><code class="language-${language}">${highlighted}</code></pre></figure>`;
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Convert markdown text to HTML with Prism.js syntax highlighting.
|
|
64
|
-
* Unescapes HTML entities like `&` \u2192 `&`.
|
|
65
|
-
*/
|
|
66
|
-
export async function convertMarkdownToHTMLEscaped(
|
|
67
|
-
markdown: string,
|
|
68
|
-
): Promise<string> {
|
|
69
|
-
return (await marked.parse(decode(markdown))).trim();
|
|
70
|
-
}
|