@leuria/docusaurus 0.1.0 → 0.1.2
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/dist/client/index.js +4 -4
- package/dist/index.d.ts +31 -7
- package/dist/index.js +5 -0
- package/package.json +5 -5
package/dist/client/index.js
CHANGED
|
@@ -26,15 +26,15 @@ var leuria = new Promise((resolve) => {
|
|
|
26
26
|
started = resolve;
|
|
27
27
|
});
|
|
28
28
|
async function start(settings) {
|
|
29
|
-
const [{ bridge,
|
|
29
|
+
const [{ bridge, promptAPI, createAI, server }, { setDefaultAppearance, setDefaultClient }, { createDocs, setupDocs }] = await Promise.all([
|
|
30
30
|
import("@leuria/client"),
|
|
31
31
|
import("@leuria/connect"),
|
|
32
32
|
import("@leuria/docs")
|
|
33
33
|
]);
|
|
34
|
-
const providers = [bridge({ app: settings.app, needs: settings.needs }),
|
|
34
|
+
const providers = [bridge({ app: settings.app, needs: settings.needs, skills: settings.skills }), promptAPI()];
|
|
35
35
|
if (loadEmbedder) providers.push(await loadEmbedder());
|
|
36
|
-
if (settings.server) providers.push(server({
|
|
37
|
-
const ai =
|
|
36
|
+
if (settings.server) providers.push(server({ ...settings.server }));
|
|
37
|
+
const ai = createAI({ providers, fallback: settings.fallback });
|
|
38
38
|
setDefaultClient(ai);
|
|
39
39
|
followTheme(setDefaultAppearance);
|
|
40
40
|
const docs = createDocs(ai, {
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,24 @@ import { LoadContext, Plugin } from '@docusaurus/types';
|
|
|
13
13
|
* without a search can add Leuria's (`search: true`), by words and by meaning.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Your own Chat Completions endpoint, as the last resort. Everything here
|
|
18
|
+
* reaches the page: put no API key in it, add the key on the server.
|
|
19
|
+
*/
|
|
20
|
+
interface ServerOptions {
|
|
21
|
+
/** Chat Completions URL, e.g. `/api/ai/chat/completions`. */
|
|
22
|
+
url: string;
|
|
23
|
+
/** Sent as `model`. Needed by endpoints that don't pick one (LiteLLM, OpenRouter…). */
|
|
24
|
+
model?: string;
|
|
25
|
+
/** The endpoint supports `response_format: { type: "json_schema" }`. Default false. */
|
|
26
|
+
jsonSchema?: boolean;
|
|
27
|
+
/** The endpoint supports tool calls. Default true. */
|
|
28
|
+
tools?: boolean;
|
|
29
|
+
/** The endpoint accepts images. Default false. */
|
|
30
|
+
images?: boolean;
|
|
31
|
+
/** The name readers see when they pick it, e.g. "This site's AI". */
|
|
32
|
+
label?: string;
|
|
33
|
+
}
|
|
16
34
|
interface Options {
|
|
17
35
|
/** The name Leuria shows when the reader connects the site. Default: the site's title. */
|
|
18
36
|
app?: string;
|
|
@@ -57,10 +75,17 @@ interface Options {
|
|
|
57
75
|
effort?: "light" | "standard" | "deep";
|
|
58
76
|
context?: number;
|
|
59
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* Skills that guide the reader's AI on your site, in the `npx skills`
|
|
80
|
+
* syntax: `"/"` for your site's own `static/.well-known/agent-skills/`,
|
|
81
|
+
* `owner/repo`, `owner/repo@skill`, or `owner/repo/path#commit` pinned to
|
|
82
|
+
* a commit. Leuria fetches them, shows them to the reader when they
|
|
83
|
+
* connect, and gives them to their AI on your site only. Readers without
|
|
84
|
+
* the Leuria app don't get them.
|
|
85
|
+
*/
|
|
86
|
+
skills?: string[];
|
|
60
87
|
/** Your server as the last resort, for readers with no AI of their own. */
|
|
61
|
-
server?:
|
|
62
|
-
url: string;
|
|
63
|
-
};
|
|
88
|
+
server?: ServerOptions;
|
|
64
89
|
/**
|
|
65
90
|
* Readers without Leuria: `ask` (default) proposes Leuria first, and this
|
|
66
91
|
* browser's AI or your server answer only once the reader picks one (for
|
|
@@ -78,9 +103,8 @@ interface ClientConfig {
|
|
|
78
103
|
system?: string;
|
|
79
104
|
askButton: "navbar" | "floating" | "none";
|
|
80
105
|
webmcp: boolean;
|
|
81
|
-
server?:
|
|
82
|
-
|
|
83
|
-
};
|
|
106
|
+
server?: ServerOptions;
|
|
107
|
+
skills?: string[];
|
|
84
108
|
fallback: "ask" | "auto";
|
|
85
109
|
needs: {
|
|
86
110
|
tools?: boolean;
|
|
@@ -98,4 +122,4 @@ declare function validateOptions({ options }: {
|
|
|
98
122
|
id: string;
|
|
99
123
|
};
|
|
100
124
|
|
|
101
|
-
export { type ClientConfig, type Options, leuriaDocusaurus as default, validateOptions };
|
|
125
|
+
export { type ClientConfig, type Options, type ServerOptions, leuriaDocusaurus as default, validateOptions };
|
package/dist/index.js
CHANGED
|
@@ -60,6 +60,7 @@ function leuriaDocusaurus(context, options = {}) {
|
|
|
60
60
|
askButton,
|
|
61
61
|
webmcp: options.webmcp ?? true,
|
|
62
62
|
server: options.server,
|
|
63
|
+
skills: options.skills,
|
|
63
64
|
fallback: options.fallback ?? "ask",
|
|
64
65
|
needs: options.needs ?? { tools: true, effort: "light" }
|
|
65
66
|
};
|
|
@@ -118,6 +119,10 @@ function validateOptions({ options }) {
|
|
|
118
119
|
}
|
|
119
120
|
if (value.suggestions && !Array.isArray(value.suggestions)) throw new Error(`${NAME}: suggestions must be a list of questions.`);
|
|
120
121
|
if (value.server && typeof value.server.url !== "string") throw new Error(`${NAME}: server needs a url.`);
|
|
122
|
+
if (value.server?.model !== void 0 && typeof value.server.model !== "string") throw new Error(`${NAME}: server.model must be a string.`);
|
|
123
|
+
if (value.skills && (!Array.isArray(value.skills) || value.skills.some((ref) => typeof ref !== "string" || !ref))) {
|
|
124
|
+
throw new Error(`${NAME}: skills must be a list of skill refs, e.g. ["/"] or ["owner/repo/path#commit"].`);
|
|
125
|
+
}
|
|
121
126
|
if (value.fallback && !["ask", "auto"].includes(value.fallback)) throw new Error(`${NAME}: fallback must be "ask" or "auto".`);
|
|
122
127
|
return { ...value, id: value.id ?? "default" };
|
|
123
128
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leuria/docusaurus",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Ask AI for any Docusaurus site, on the reader's own AI: no API keys, nothing to pay per question. Plus the Connect button and WebMCP tools for the browser's agents.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"url": "git+https://github.com/leur-ia/leuria.git",
|
|
10
10
|
"directory": "packages/docusaurus"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://leuria.dev",
|
|
12
|
+
"homepage": "https://leuria.dev/docs/developers/docusaurus",
|
|
13
13
|
"keywords": [
|
|
14
14
|
"docusaurus",
|
|
15
15
|
"docusaurus-plugin",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@leuria/client": "^0.1.
|
|
38
|
-
"@leuria/connect": "^0.1.
|
|
37
|
+
"@leuria/client": "^0.1.4",
|
|
38
|
+
"@leuria/connect": "^0.1.4",
|
|
39
39
|
"@leuria/docs": "^0.1.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@docusaurus/core": "^3.6.0",
|
|
43
|
-
"@leuria/web-embed": "^0.1.
|
|
43
|
+
"@leuria/web-embed": "^0.1.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"@leuria/web-embed": {
|