docus 5.10.0 → 5.10.1

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.
@@ -1,9 +1,27 @@
1
1
  import { streamText, convertToModelMessages, createUIMessageStream, createUIMessageStreamResponse } from 'ai'
2
2
  import type { UIMessageStreamWriter, ToolCallPart, ToolSet } from 'ai'
3
3
  import { createMCPClient } from '@ai-sdk/mcp'
4
+ import type { H3Event } from 'h3'
4
5
 
5
6
  const MAX_STEPS = 10
6
7
 
8
+ function createLocalFetch(event: H3Event): typeof fetch {
9
+ const origin = getRequestURL(event).origin
10
+
11
+ return (input, init) => {
12
+ const requestUrl = input instanceof URL
13
+ ? input
14
+ : typeof input === 'string'
15
+ ? new URL(input, origin)
16
+ : new URL(input.url)
17
+ const localPath = requestUrl.origin === origin
18
+ ? `${requestUrl.pathname}${requestUrl.search}`
19
+ : requestUrl.toString()
20
+
21
+ return event.fetch(localPath, init)
22
+ }
23
+ }
24
+
7
25
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
26
  function stopWhenResponseComplete({ steps }: { steps: any[] }): boolean {
9
27
  const lastStep = steps.at(-1)
@@ -66,15 +84,29 @@ export default defineEventHandler(async (event) => {
66
84
  const mcpServer = config.assistant.mcpServer
67
85
  const isExternalUrl = mcpServer.startsWith('http://') || mcpServer.startsWith('https://')
68
86
  const baseURL = config.app?.baseURL?.replace(/\/$/, '') || ''
69
- const mcpUrl = isExternalUrl
70
- ? mcpServer
71
- : import.meta.dev
72
- ? `http://localhost:3000${baseURL}${mcpServer}`
73
- : `${getRequestURL(event).origin}${baseURL}${mcpServer}`
74
-
75
- const httpClient = await createMCPClient({
76
- transport: { type: 'http', url: mcpUrl },
77
- })
87
+
88
+ let transport: Parameters<typeof createMCPClient>[0]['transport']
89
+ if (isExternalUrl) {
90
+ transport = {
91
+ type: 'http',
92
+ url: mcpServer,
93
+ }
94
+ }
95
+ else if (import.meta.dev) {
96
+ transport = {
97
+ type: 'http',
98
+ url: `http://localhost:3000${baseURL}${mcpServer}`,
99
+ }
100
+ }
101
+ else {
102
+ transport = {
103
+ type: 'http',
104
+ url: `${getRequestURL(event).origin}${baseURL}${mcpServer}`,
105
+ fetch: createLocalFetch(event),
106
+ }
107
+ }
108
+
109
+ const httpClient = await createMCPClient({ transport })
78
110
  const mcpTools = await httpClient.tools()
79
111
 
80
112
  const stream = createUIMessageStream({
package/modules/config.ts CHANGED
@@ -39,7 +39,7 @@ export default defineNuxtModule({
39
39
  url,
40
40
  name: siteName,
41
41
  debug: false,
42
- })
42
+ }) as typeof nuxt.options.site
43
43
 
44
44
  nuxt.options.appConfig.header = defu(nuxt.options.appConfig.header, {
45
45
  title: siteName,
@@ -32,16 +32,22 @@ export default defineNuxtModule({
32
32
  return
33
33
  }
34
34
 
35
- // Always redirect / to /llms.txt
35
+ // Always redirect / to /llms.txt and ensure plain text content type
36
+ const markdownHeaders = {
37
+ 'content-type': 'text/markdown; charset=utf-8',
38
+ }
39
+
36
40
  const routes = [
37
41
  {
38
42
  src: '^/$',
39
43
  dest: '/llms.txt',
44
+ headers: markdownHeaders,
40
45
  has: [{ type: 'header', key: 'accept', value: '(.*)text/markdown(.*)' }],
41
46
  },
42
47
  {
43
48
  src: '^/$',
44
49
  dest: '/llms.txt',
50
+ headers: markdownHeaders,
45
51
  has: [{ type: 'header', key: 'user-agent', value: 'curl/.*' }],
46
52
  },
47
53
  ]
@@ -66,11 +72,13 @@ export default defineNuxtModule({
66
72
  {
67
73
  src: `^/(${localePattern})$`,
68
74
  dest: '/llms.txt',
75
+ headers: markdownHeaders,
69
76
  has: [{ type: 'header', key: 'accept', value: '(.*)text/markdown(.*)' }],
70
77
  },
71
78
  {
72
79
  src: `^/(${localePattern})$`,
73
80
  dest: '/llms.txt',
81
+ headers: markdownHeaders,
74
82
  has: [{ type: 'header', key: 'user-agent', value: 'curl/.*' }],
75
83
  },
76
84
  )
@@ -109,11 +117,13 @@ export default defineNuxtModule({
109
117
  {
110
118
  src: `^${pagePath}$`,
111
119
  dest: rawPath,
120
+ headers: markdownHeaders,
112
121
  has: [{ type: 'header', key: 'accept', value: '(.*)text/markdown(.*)' }],
113
122
  },
114
123
  {
115
124
  src: `^${pagePath}$`,
116
125
  dest: rawPath,
126
+ headers: markdownHeaders,
117
127
  has: [{ type: 'header', key: 'user-agent', value: 'curl/.*' }],
118
128
  },
119
129
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docus",
3
3
  "description": "Nuxt layer for Docus documentation theme",
4
- "version": "5.10.0",
4
+ "version": "5.10.1",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
7
7
  "repository": {
@@ -23,39 +23,39 @@
23
23
  "README.md"
24
24
  ],
25
25
  "dependencies": {
26
- "@ai-sdk/gateway": "^3.0.83",
27
- "@ai-sdk/mcp": "^1.0.30",
28
- "@ai-sdk/vue": "3.0.141",
29
- "@iconify-json/lucide": "^1.2.100",
30
- "@iconify-json/simple-icons": "^1.2.75",
26
+ "@ai-sdk/gateway": "^3.0.104",
27
+ "@ai-sdk/mcp": "^1.0.36",
28
+ "@ai-sdk/vue": "3.0.168",
29
+ "@iconify-json/lucide": "^1.2.102",
30
+ "@iconify-json/simple-icons": "^1.2.79",
31
31
  "@iconify-json/vscode-icons": "^1.2.45",
32
- "@nuxt/content": "^3.12.0",
32
+ "@nuxt/content": "^3.13.0",
33
33
  "@nuxt/image": "^2.0.0",
34
34
  "@nuxt/kit": "^4.4.2",
35
- "@nuxt/ui": "^4.6.0",
35
+ "@nuxt/ui": "^4.7.1",
36
36
  "@nuxtjs/i18n": "^10.2.4",
37
- "@nuxtjs/mcp-toolkit": "^0.13.2",
38
- "@nuxtjs/mdc": "^0.21.0",
39
- "@nuxtjs/robots": "^6.0.6",
37
+ "@nuxtjs/mcp-toolkit": "^0.13.4",
38
+ "@nuxtjs/mdc": "^0.21.1",
39
+ "@nuxtjs/robots": "^6.0.7",
40
40
  "@shikijs/core": "^4.0.2",
41
41
  "@shikijs/engine-javascript": "^4.0.2",
42
42
  "@shikijs/langs": "^4.0.2",
43
43
  "@shikijs/themes": "^4.0.2",
44
- "@takumi-rs/core": "^0.73.1",
44
+ "@takumi-rs/core": "^1.0.15",
45
45
  "@vueuse/core": "^14.2.1",
46
- "ai": "6.0.141",
47
- "defu": "^6.1.4",
46
+ "ai": "6.0.168",
47
+ "defu": "^6.1.7",
48
48
  "exsolve": "^1.0.8",
49
49
  "git-url-parse": "^16.1.0",
50
- "motion-v": "^2.2.0",
50
+ "motion-v": "^2.2.1",
51
51
  "nuxt-llms": "^0.2.0",
52
- "nuxt-og-image": "^6.3.1",
52
+ "nuxt-og-image": "^6.4.5",
53
53
  "pkg-types": "^2.3.0",
54
54
  "scule": "^1.3.0",
55
55
  "shiki-stream": "^0.1.4",
56
- "tailwindcss": "^4.2.2",
56
+ "tailwindcss": "^4.2.3",
57
57
  "ufo": "^1.6.3",
58
- "yaml": "^2.7.1",
58
+ "yaml": "^2.8.3",
59
59
  "zod": "^4.3.6",
60
60
  "zod-to-json-schema": "^3.25.2"
61
61
  },