@lmcc-dev/mult-fetch-mcp-server 1.1.0 → 1.2.0

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 (216) hide show
  1. package/README.md +8 -8
  2. package/README.zh.md +16 -8
  3. package/dist/i18n-test-report.json +8 -0
  4. package/dist/i18n-unused-keys-report.json +8 -0
  5. package/dist/src/client.js +50 -35
  6. package/dist/src/index.js +0 -0
  7. package/dist/src/lib/BrowserFetcher.js +12 -12
  8. package/dist/src/lib/NodeFetcher.js +22 -22
  9. package/dist/src/lib/fetch.js +40 -0
  10. package/dist/src/lib/fetchers/FetcherFactory.js +43 -0
  11. package/dist/src/lib/fetchers/browser/BrowserFetcher.js +381 -0
  12. package/dist/src/lib/fetchers/browser/BrowserInstance.js +180 -0
  13. package/dist/src/lib/fetchers/browser/PageOperations.js +168 -0
  14. package/dist/src/lib/fetchers/common/types.js +41 -0
  15. package/dist/src/lib/fetchers/common/utils.js +141 -0
  16. package/dist/src/lib/fetchers/index.js +62 -0
  17. package/dist/src/lib/fetchers/node/HttpClient.js +239 -0
  18. package/dist/src/lib/fetchers/node/NodeFetcher.js +180 -0
  19. package/dist/src/lib/i18n/index.js +105 -17
  20. package/dist/src/lib/i18n/keys/base.js +41 -0
  21. package/dist/src/lib/i18n/keys/browser.js +91 -0
  22. package/dist/src/lib/i18n/keys/client.js +68 -0
  23. package/dist/src/lib/i18n/keys/errors.js +49 -0
  24. package/dist/src/lib/i18n/keys/factory.js +46 -0
  25. package/dist/src/lib/i18n/keys/fetcher.js +87 -0
  26. package/dist/src/lib/i18n/keys/index.js +16 -0
  27. package/dist/src/lib/i18n/keys/node.js +69 -0
  28. package/dist/src/lib/i18n/keys/prompts.js +79 -0
  29. package/dist/src/lib/i18n/keys/resources.js +53 -0
  30. package/dist/src/lib/i18n/keys/server.js +67 -0
  31. package/dist/src/lib/i18n/keys/tools.js +39 -0
  32. package/dist/src/lib/i18n/keys.js +488 -119
  33. package/dist/src/lib/i18n/locales/en/browser.js +67 -57
  34. package/dist/src/lib/i18n/locales/en/client.js +57 -33
  35. package/dist/src/lib/i18n/locales/en/errors.js +36 -12
  36. package/dist/src/lib/i18n/locales/en/factory.js +38 -0
  37. package/dist/src/lib/i18n/locales/en/fetcher.js +8 -2
  38. package/dist/src/lib/i18n/locales/en/index.js +10 -8
  39. package/dist/src/lib/i18n/locales/en/node.js +57 -35
  40. package/dist/src/lib/i18n/locales/en/prompts.js +42 -65
  41. package/dist/src/lib/i18n/locales/en/resources.js +52 -55
  42. package/dist/src/lib/i18n/locales/en/server.js +49 -24
  43. package/dist/src/lib/i18n/locales/en/tools.js +27 -19
  44. package/dist/src/lib/i18n/locales/zh/browser.js +71 -62
  45. package/dist/src/lib/i18n/locales/zh/client.js +57 -32
  46. package/dist/src/lib/i18n/locales/zh/errors.js +36 -12
  47. package/dist/src/lib/i18n/locales/zh/factory.js +38 -0
  48. package/dist/src/lib/i18n/locales/zh/fetcher.js +36 -30
  49. package/dist/src/lib/i18n/locales/zh/index.js +10 -8
  50. package/dist/src/lib/i18n/locales/zh/node.js +61 -36
  51. package/dist/src/lib/i18n/locales/zh/prompts.js +35 -57
  52. package/dist/src/lib/i18n/locales/zh/resources.js +52 -55
  53. package/dist/src/lib/i18n/locales/zh/server.js +51 -25
  54. package/dist/src/lib/i18n/locales/zh/tools.js +27 -19
  55. package/dist/src/lib/i18n/logger.js +90 -19
  56. package/dist/src/lib/logger.js +135 -14
  57. package/dist/src/lib/server/browser.js +2 -2
  58. package/dist/src/lib/server/fetcher.js +13 -34
  59. package/dist/src/lib/server/index.js +2 -2
  60. package/dist/src/lib/server/prompts.js +1 -1
  61. package/dist/src/lib/server/resources.js +1 -1
  62. package/dist/src/lib/server/tools.js +46 -10
  63. package/dist/src/lib/utils/ErrorHandler.js +125 -0
  64. package/dist/src/mcp-server.js +0 -0
  65. package/dist/src/test-i18n.js +139 -0
  66. package/dist/tests/BrowserFetcher.test.js +0 -0
  67. package/dist/tests/NodeFetcher.test.js +0 -0
  68. package/dist/tests/client.test.js +42 -81
  69. package/dist/tests/fetch.test.js +70 -0
  70. package/dist/tests/fetchers/Fetcher.test.js +108 -0
  71. package/dist/tests/fetchers/browser/BrowserFetcher.test.js +195 -0
  72. package/dist/tests/fetchers/browser/BrowserInstance.test.js +163 -0
  73. package/dist/tests/fetchers/node/NodeFetcher.test.js +211 -0
  74. package/dist/tests/i18n-missing-keys.js +364 -0
  75. package/dist/tests/i18n-remove-unused-keys.js +236 -0
  76. package/dist/tests/i18n-test-report.json +2004 -0
  77. package/dist/tests/i18n-unused-keys.js +425 -0
  78. package/dist/tests/i18n.test.js +6 -7
  79. package/dist/tests/logger.test.js +14 -13
  80. package/dist/tests/mcp-server.test.js +7 -7
  81. package/dist/tests/server/browser.test.js +25 -21
  82. package/dist/tests/server/fetcher.test.js +58 -101
  83. package/dist/tests/server/index.test.js +30 -30
  84. package/dist/tests/server/prompts.test.js +36 -33
  85. package/dist/tests/server/resources.test.js +120 -84
  86. package/dist/tests/server/tools.test.js +7 -6
  87. package/dist/tests/setup.js +36 -0
  88. package/dist/tests/src/lib/i18n/index.js +108 -0
  89. package/dist/tests/src/lib/i18n/keys/base.js +47 -0
  90. package/dist/tests/src/lib/i18n/keys/browser.js +93 -0
  91. package/dist/tests/src/lib/i18n/keys/client.js +70 -0
  92. package/dist/tests/src/lib/i18n/keys/errors.js +34 -0
  93. package/dist/tests/src/lib/i18n/keys/fetcher.js +84 -0
  94. package/dist/tests/src/lib/i18n/keys/index.js +31 -0
  95. package/dist/tests/src/lib/i18n/keys/node.js +56 -0
  96. package/dist/tests/src/lib/i18n/keys/prompts.js +82 -0
  97. package/dist/tests/src/lib/i18n/keys/resources.js +50 -0
  98. package/dist/tests/src/lib/i18n/keys/server.js +64 -0
  99. package/dist/tests/src/lib/i18n/keys/tools.js +34 -0
  100. package/dist/tests/src/lib/i18n/locales/en/browser.js +88 -0
  101. package/dist/tests/src/lib/i18n/locales/en/client.js +66 -0
  102. package/dist/tests/src/lib/i18n/locales/en/errors.js +28 -0
  103. package/dist/tests/src/lib/i18n/locales/en/fetcher.js +71 -0
  104. package/dist/tests/src/lib/i18n/locales/en/index.js +29 -0
  105. package/dist/tests/src/lib/i18n/locales/en/node.js +51 -0
  106. package/dist/tests/src/lib/i18n/locales/en/prompts.js +52 -0
  107. package/dist/tests/src/lib/i18n/locales/en/resources.js +50 -0
  108. package/dist/tests/src/lib/i18n/locales/en/server.js +56 -0
  109. package/dist/tests/src/lib/i18n/locales/en/tools.js +28 -0
  110. package/dist/tests/src/lib/i18n/locales/zh/browser.js +87 -0
  111. package/dist/tests/src/lib/i18n/locales/zh/client.js +66 -0
  112. package/dist/tests/src/lib/i18n/locales/zh/errors.js +28 -0
  113. package/dist/tests/src/lib/i18n/locales/zh/fetcher.js +71 -0
  114. package/dist/tests/src/lib/i18n/locales/zh/index.js +29 -0
  115. package/dist/tests/src/lib/i18n/locales/zh/node.js +51 -0
  116. package/dist/tests/src/lib/i18n/locales/zh/prompts.js +53 -0
  117. package/dist/tests/src/lib/i18n/locales/zh/resources.js +50 -0
  118. package/dist/tests/src/lib/i18n/locales/zh/server.js +57 -0
  119. package/dist/tests/src/lib/i18n/locales/zh/tools.js +28 -0
  120. package/dist/tests/src/lib/i18n/logger.js +114 -0
  121. package/dist/tests/src/lib/logger.js +181 -0
  122. package/dist/tests/test-direct-client.js +0 -0
  123. package/dist/tests/test-i18n.js +530 -0
  124. package/dist/tests/test-mcp-methods.js +1 -1
  125. package/dist/tests/test-mcp.js +0 -0
  126. package/dist/tests/test-mini4k.js +0 -0
  127. package/dist/tests/tests/test-i18n.js +588 -0
  128. package/dist/tests/types.test.js +1 -1
  129. package/dist/tests/utils/ErrorHandler.test.js +144 -0
  130. package/dist/vitest.config.js +29 -0
  131. package/package.json +31 -27
  132. package/dist/src/cli-language.js +0 -78
  133. package/dist/src/client.d.ts +0 -6
  134. package/dist/src/client.js.map +0 -1
  135. package/dist/src/index.d.ts +0 -15
  136. package/dist/src/index.js.map +0 -1
  137. package/dist/src/lib/BrowserFetcher.d.ts +0 -175
  138. package/dist/src/lib/BrowserFetcher.js.map +0 -1
  139. package/dist/src/lib/NodeFetcher.d.ts +0 -92
  140. package/dist/src/lib/NodeFetcher.js.map +0 -1
  141. package/dist/src/lib/example.js +0 -93
  142. package/dist/src/lib/i18n/index.js.map +0 -1
  143. package/dist/src/lib/i18n/locales/en/browser.d.ts +0 -61
  144. package/dist/src/lib/i18n/locales/en/browser.js.map +0 -1
  145. package/dist/src/lib/i18n/locales/en/client.d.ts +0 -39
  146. package/dist/src/lib/i18n/locales/en/client.js.map +0 -1
  147. package/dist/src/lib/i18n/locales/en/errors.d.ts +0 -17
  148. package/dist/src/lib/i18n/locales/en/errors.js.map +0 -1
  149. package/dist/src/lib/i18n/locales/en/fetcher.d.ts +0 -66
  150. package/dist/src/lib/i18n/locales/en/fetcher.js.map +0 -1
  151. package/dist/src/lib/i18n/locales/en/index.d.ts +0 -344
  152. package/dist/src/lib/i18n/locales/en/index.js.map +0 -1
  153. package/dist/src/lib/i18n/locales/en/node.d.ts +0 -41
  154. package/dist/src/lib/i18n/locales/en/node.js.map +0 -1
  155. package/dist/src/lib/i18n/locales/en/prompts.d.ts +0 -65
  156. package/dist/src/lib/i18n/locales/en/prompts.js.map +0 -1
  157. package/dist/src/lib/i18n/locales/en/resources.d.ts +0 -41
  158. package/dist/src/lib/i18n/locales/en/resources.js.map +0 -1
  159. package/dist/src/lib/i18n/locales/en/server.d.ts +0 -30
  160. package/dist/src/lib/i18n/locales/en/server.js.map +0 -1
  161. package/dist/src/lib/i18n/locales/en/tools.d.ts +0 -24
  162. package/dist/src/lib/i18n/locales/en/tools.js.map +0 -1
  163. package/dist/src/lib/i18n/locales/zh/browser.d.ts +0 -61
  164. package/dist/src/lib/i18n/locales/zh/browser.js.map +0 -1
  165. package/dist/src/lib/i18n/locales/zh/client.d.ts +0 -38
  166. package/dist/src/lib/i18n/locales/zh/client.js.map +0 -1
  167. package/dist/src/lib/i18n/locales/zh/errors.d.ts +0 -17
  168. package/dist/src/lib/i18n/locales/zh/errors.js.map +0 -1
  169. package/dist/src/lib/i18n/locales/zh/fetcher.d.ts +0 -66
  170. package/dist/src/lib/i18n/locales/zh/fetcher.js.map +0 -1
  171. package/dist/src/lib/i18n/locales/zh/index.d.ts +0 -343
  172. package/dist/src/lib/i18n/locales/zh/index.js.map +0 -1
  173. package/dist/src/lib/i18n/locales/zh/node.d.ts +0 -41
  174. package/dist/src/lib/i18n/locales/zh/node.js.map +0 -1
  175. package/dist/src/lib/i18n/locales/zh/prompts.d.ts +0 -65
  176. package/dist/src/lib/i18n/locales/zh/prompts.js.map +0 -1
  177. package/dist/src/lib/i18n/locales/zh/resources.d.ts +0 -41
  178. package/dist/src/lib/i18n/locales/zh/resources.js.map +0 -1
  179. package/dist/src/lib/i18n/locales/zh/server.d.ts +0 -30
  180. package/dist/src/lib/i18n/locales/zh/server.js.map +0 -1
  181. package/dist/src/lib/i18n/locales/zh/tools.d.ts +0 -24
  182. package/dist/src/lib/i18n/locales/zh/tools.js.map +0 -1
  183. package/dist/src/lib/i18n/logger.d.ts +0 -38
  184. package/dist/src/lib/i18n/logger.js.map +0 -1
  185. package/dist/src/lib/logger.d.ts +0 -32
  186. package/dist/src/lib/logger.js.map +0 -1
  187. package/dist/src/lib/server/browser.d.ts +0 -34
  188. package/dist/src/lib/server/browser.js.map +0 -1
  189. package/dist/src/lib/server/fetcher.d.ts +0 -20
  190. package/dist/src/lib/server/fetcher.js.map +0 -1
  191. package/dist/src/lib/server/index.d.ts +0 -10
  192. package/dist/src/lib/server/index.js.map +0 -1
  193. package/dist/src/lib/server/logger.js +0 -23
  194. package/dist/src/lib/server/prompts.d.ts +0 -11
  195. package/dist/src/lib/server/prompts.js.map +0 -1
  196. package/dist/src/lib/server/resources.d.ts +0 -11
  197. package/dist/src/lib/server/resources.js.map +0 -1
  198. package/dist/src/lib/server/tools.d.ts +0 -12
  199. package/dist/src/lib/server/tools.js.map +0 -1
  200. package/dist/src/lib/server/types.d.ts +0 -71
  201. package/dist/src/lib/server/types.js.map +0 -1
  202. package/dist/src/lib/types.d.ts +0 -119
  203. package/dist/src/lib/types.js.map +0 -1
  204. package/dist/src/mcp-server.d.ts +0 -6
  205. package/dist/src/mcp-server.js.map +0 -1
  206. package/dist/tests/jest.setup.d.ts +0 -6
  207. package/dist/tests/jest.setup.js +0 -30
  208. package/dist/tests/jest.setup.js.map +0 -1
  209. package/dist/tests/test-direct-client.d.ts +0 -6
  210. package/dist/tests/test-direct-client.js.map +0 -1
  211. package/dist/tests/test-mcp-methods.d.ts +0 -6
  212. package/dist/tests/test-mcp-methods.js.map +0 -1
  213. package/dist/tests/test-mcp.d.ts +0 -6
  214. package/dist/tests/test-mcp.js.map +0 -1
  215. package/dist/tests/test-mini4k.d.ts +0 -6
  216. package/dist/tests/test-mini4k.js.map +0 -1
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Author: Martin <lmccc.dev@gmail.com>
3
+ * Co-Author: AI Assistant (Claude)
4
+ * Description: This code was collaboratively developed by Martin and AI Assistant.
5
+ */
6
+ import { createKeyGenerator } from './base.js';
7
+ /**
8
+ * 获取器相关键 (Fetcher related keys)
9
+ */
10
+ export const FETCHER_KEYS = (() => {
11
+ const keyGen = createKeyGenerator('fetcher');
12
+ return {
13
+ // 延迟相关 (Delay related)
14
+ addingDelay: keyGen('addingDelay'),
15
+ delayCompleted: keyGen('delayCompleted'),
16
+ // 代理相关 (Proxy related)
17
+ usingProxy: keyGen('usingProxy'),
18
+ usingSpecifiedProxy: keyGen('usingSpecifiedProxy'),
19
+ attemptingToUseSystemProxy: keyGen('attemptingToUseSystemProxy'),
20
+ notUsingProxy: keyGen('notUsingProxy'),
21
+ finalProxyUsed: keyGen('finalProxyUsed'),
22
+ noProxy: keyGen('noProxy'),
23
+ foundNoProxy: keyGen('foundNoProxy'),
24
+ usingHttpsProxy: keyGen('usingHttpsProxy'),
25
+ usingHttpProxy: keyGen('usingHttpProxy'),
26
+ systemProxyDisabled: keyGen('systemProxyDisabled'),
27
+ // 请求相关 (Request related)
28
+ fetchingUrl: keyGen('fetchingUrl'),
29
+ usingUserAgent: keyGen('usingUserAgent'),
30
+ requestOptions: keyGen('requestOptions'),
31
+ startingFetch: keyGen('startingFetch'),
32
+ fetchCompleted: keyGen('fetchCompleted'),
33
+ // 响应相关 (Response related)
34
+ responseStatus: keyGen('responseStatus'),
35
+ redirectingTo: keyGen('redirectingTo'),
36
+ constructedFullRedirectUrl: keyGen('constructedFullRedirectUrl'),
37
+ requestSuccess: keyGen('requestSuccess'),
38
+ // 错误相关 (Error related)
39
+ errorResponse: keyGen('errorResponse'),
40
+ errorResponseBody: keyGen('errorResponseBody'),
41
+ errorReadingBody: keyGen('errorReadingBody'),
42
+ fetchError: keyGen('fetchError'),
43
+ requestAborted: keyGen('requestAborted'),
44
+ networkError: keyGen('networkError'),
45
+ requestTimeout: keyGen('requestTimeout'),
46
+ fetchFailed: keyGen('fetchFailed'),
47
+ tooManyRedirects: keyGen('tooManyRedirects'),
48
+ // 内容类型相关 (Content type related)
49
+ startingHtmlFetch: keyGen('startingHtmlFetch'),
50
+ fetchingHtml: keyGen('fetchingHtml'),
51
+ fetchingJson: keyGen('fetchingJson'),
52
+ fetchingTxt: keyGen('fetchingTxt'),
53
+ fetchingMarkdown: keyGen('fetchingMarkdown'),
54
+ readingText: keyGen('readingText'),
55
+ htmlContentLength: keyGen('htmlContentLength'),
56
+ startingJsonFetch: keyGen('startingJsonFetch'),
57
+ parsingJson: keyGen('parsingJson'),
58
+ jsonParsed: keyGen('jsonParsed'),
59
+ jsonParseError: keyGen('jsonParseError'),
60
+ startingTxtFetch: keyGen('startingTxtFetch'),
61
+ textContentLength: keyGen('textContentLength'),
62
+ startingMarkdownFetch: keyGen('startingMarkdownFetch'),
63
+ creatingTurndown: keyGen('creatingTurndown'),
64
+ convertingToMarkdown: keyGen('convertingToMarkdown'),
65
+ markdownContentLength: keyGen('markdownContentLength'),
66
+ // 系统代理相关 (System proxy related)
67
+ checkingProxyEnv: keyGen('checkingProxyEnv'),
68
+ envVarValue: keyGen('envVarValue'),
69
+ foundSystemProxy: keyGen('foundSystemProxy'),
70
+ systemCommandProxySettings: keyGen('systemCommandProxySettings'),
71
+ foundProxyFromCommand: keyGen('foundProxyFromCommand'),
72
+ errorGettingProxyFromCommand: keyGen('errorGettingProxyFromCommand'),
73
+ checkingSystemEnvVars: keyGen('checkingSystemEnvVars'),
74
+ windowsEnvVars: keyGen('windowsEnvVars'),
75
+ foundWindowsEnvProxy: keyGen('foundWindowsEnvProxy'),
76
+ errorGettingWindowsEnvVars: keyGen('errorGettingWindowsEnvVars'),
77
+ unixEnvVars: keyGen('unixEnvVars'),
78
+ foundUnixEnvProxy: keyGen('foundUnixEnvProxy'),
79
+ errorGettingUnixEnvVars: keyGen('errorGettingUnixEnvVars'),
80
+ errorGettingSystemEnvVars: keyGen('errorGettingSystemEnvVars'),
81
+ noSystemProxyFound: keyGen('noSystemProxyFound'),
82
+ // 通用 (General)
83
+ notSet: keyGen('notSet'),
84
+ debug: keyGen('debug'),
85
+ none: keyGen('none')
86
+ };
87
+ })();
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Author: Martin <lmccc.dev@gmail.com>
3
+ * Co-Author: AI Assistant (Claude)
4
+ * Description: This code was collaboratively developed by Martin and AI Assistant.
5
+ */
6
+ export * from './base.js';
7
+ export * from './browser.js';
8
+ export * from './client.js';
9
+ export * from './errors.js';
10
+ export * from './factory.js';
11
+ export * from './fetcher.js';
12
+ export * from './node.js';
13
+ export * from './prompts.js';
14
+ export * from './resources.js';
15
+ export * from './server.js';
16
+ export * from './tools.js';
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Author: Martin <lmccc.dev@gmail.com>
3
+ * Co-Author: AI Assistant (Claude)
4
+ * Description: This code was collaboratively developed by Martin and AI Assistant.
5
+ */
6
+ import { createKeyGenerator } from './base.js';
7
+ /**
8
+ * 节点相关键 (Node related keys)
9
+ */
10
+ export const NODE_KEYS = (() => {
11
+ const keyGen = createKeyGenerator('node');
12
+ return {
13
+ // 延迟和代理相关 (Delay and proxy related)
14
+ addingDelay: keyGen('addingDelay'),
15
+ noProxy: keyGen('noProxy'),
16
+ usingProxy: keyGen('usingProxy'),
17
+ usingHttpsProxy: keyGen('usingHttpsProxy'),
18
+ usingHttpProxy: keyGen('usingHttpProxy'),
19
+ // 系统代理相关 (System proxy related)
20
+ checkingProxyEnv: keyGen('checkingProxyEnv'),
21
+ envVarValue: keyGen('envVarValue'),
22
+ foundSystemProxy: keyGen('foundSystemProxy'),
23
+ checkingSystemEnvVars: keyGen('checkingSystemEnvVars'),
24
+ windowsEnvVars: keyGen('windowsEnvVars'),
25
+ foundWindowsEnvProxy: keyGen('foundWindowsEnvProxy'),
26
+ errorGettingWindowsEnvVars: keyGen('errorGettingWindowsEnvVars'),
27
+ unixEnvVars: keyGen('unixEnvVars'),
28
+ foundUnixEnvProxy: keyGen('foundUnixEnvProxy'),
29
+ errorGettingUnixEnvVars: keyGen('errorGettingUnixEnvVars'),
30
+ noSystemProxyFound: keyGen('noSystemProxyFound'),
31
+ errorGettingSystemEnvVars: keyGen('errorGettingSystemEnvVars'),
32
+ foundNoProxy: keyGen('foundNoProxy'),
33
+ // 请求相关 (Request related)
34
+ usingUserAgent: keyGen('usingUserAgent'),
35
+ requestDetails: keyGen('requestDetails'),
36
+ requestOptions: keyGen('requestOptions'),
37
+ startingFetch: keyGen('startingFetch'),
38
+ fetchingUrl: keyGen('fetchingUrl'),
39
+ // 响应相关 (Response related)
40
+ responseStatus: keyGen('responseStatus'),
41
+ redirectingTo: keyGen('redirectingTo'),
42
+ constructedFullRedirectUrl: keyGen('constructedFullRedirectUrl'),
43
+ requestSuccess: keyGen('requestSuccess'),
44
+ // 错误相关 (Error related)
45
+ errorResponse: keyGen('errorResponse'),
46
+ errorResponseBody: keyGen('errorResponseBody'),
47
+ errorReadingBody: keyGen('errorReadingBody'),
48
+ fetchError: keyGen('fetchError'),
49
+ requestAborted: keyGen('requestAborted'),
50
+ networkError: keyGen('networkError'),
51
+ tooManyRedirects: keyGen('tooManyRedirects'),
52
+ // 内容类型相关 (Content type related)
53
+ startingHtmlFetch: keyGen('startingHtmlFetch'),
54
+ readingText: keyGen('readingText'),
55
+ htmlContentLength: keyGen('htmlContentLength'),
56
+ htmlFetchError: keyGen('htmlFetchError'),
57
+ startingJsonFetch: keyGen('startingJsonFetch'),
58
+ parsingJson: keyGen('parsingJson'),
59
+ jsonParsed: keyGen('jsonParsed'),
60
+ jsonParseError: keyGen('jsonParseError'),
61
+ jsonFetchError: keyGen('jsonFetchError'),
62
+ startingTxtFetch: keyGen('startingTxtFetch'),
63
+ textContentLength: keyGen('textContentLength'),
64
+ startingMarkdownFetch: keyGen('startingMarkdownFetch'),
65
+ creatingTurndown: keyGen('creatingTurndown'),
66
+ convertingToMarkdown: keyGen('convertingToMarkdown'),
67
+ markdownContentLength: keyGen('markdownContentLength')
68
+ };
69
+ })();
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Author: Martin <lmccc.dev@gmail.com>
3
+ * Co-Author: AI Assistant (Claude)
4
+ * Description: This code was collaboratively developed by Martin and AI Assistant.
5
+ */
6
+ import { createKeyGenerator } from './base.js';
7
+ /**
8
+ * 提示相关键 (Prompts related keys)
9
+ */
10
+ export const PROMPTS_KEYS = (() => {
11
+ const keyGen = createKeyGenerator('prompts');
12
+ return {
13
+ // 提示列表和获取 (Prompt list and get)
14
+ list: {
15
+ request: keyGen('list.request')
16
+ },
17
+ get: {
18
+ request: keyGen('get.request')
19
+ },
20
+ // 错误消息 (Error messages)
21
+ notFound: keyGen('notFound'),
22
+ missingRequiredArg: keyGen('missingRequiredArg'),
23
+ useBrowserValue: keyGen('useBrowserValue'),
24
+ // 通用提示 (Generic prompt)
25
+ generic: {
26
+ result: keyGen('generic.result'),
27
+ message: keyGen('generic.message'),
28
+ args: keyGen('generic.args')
29
+ },
30
+ // 是/否 (Yes/No)
31
+ yes: keyGen('yes'),
32
+ no: keyGen('no'),
33
+ // 提示描述和参数 (Prompt descriptions and parameters)
34
+ url: {
35
+ description: keyGen('url.description')
36
+ },
37
+ format: {
38
+ description: keyGen('format.description')
39
+ },
40
+ useBrowser: {
41
+ description: keyGen('useBrowser.description')
42
+ },
43
+ selector: {
44
+ description: keyGen('selector.description')
45
+ },
46
+ dataType: {
47
+ description: keyGen('dataType.description')
48
+ },
49
+ error: {
50
+ description: keyGen('error.description')
51
+ },
52
+ // 获取网站提示 (Fetch website prompt)
53
+ fetchWebsite: {
54
+ description: keyGen('fetchWebsite.description'),
55
+ result: keyGen('fetchWebsite.result'),
56
+ message: keyGen('fetchWebsite.message'),
57
+ response: keyGen('fetchWebsite.response'),
58
+ instruction: keyGen('fetchWebsite.instruction'),
59
+ formatInstruction: keyGen('fetchWebsite.formatInstruction'),
60
+ browserInstruction: keyGen('fetchWebsite.browserInstruction')
61
+ },
62
+ // 提取内容提示 (Extract content prompt)
63
+ extractContent: {
64
+ description: keyGen('extractContent.description'),
65
+ result: keyGen('extractContent.result'),
66
+ message: keyGen('extractContent.message'),
67
+ selectorInstruction: keyGen('extractContent.selectorInstruction'),
68
+ dataTypeInstruction: keyGen('extractContent.dataTypeInstruction')
69
+ },
70
+ // 调试获取提示 (Debug fetch prompt)
71
+ debugFetch: {
72
+ description: keyGen('debugFetch.description'),
73
+ result: keyGen('debugFetch.result'),
74
+ message: keyGen('debugFetch.message'),
75
+ errorDetails: keyGen('debugFetch.errorDetails'),
76
+ instruction: keyGen('debugFetch.instruction')
77
+ }
78
+ };
79
+ })();
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Author: Martin <lmccc.dev@gmail.com>
3
+ * Co-Author: AI Assistant (Claude)
4
+ * Description: This code was collaboratively developed by Martin and AI Assistant.
5
+ */
6
+ import { createKeyGenerator, createResourceKeys } from './base.js';
7
+ /**
8
+ * 资源相关键 (Resources related keys)
9
+ */
10
+ export const RESOURCES_KEYS = (() => {
11
+ const keyGen = createKeyGenerator('resources');
12
+ const resourceKeys = createResourceKeys('resources');
13
+ return {
14
+ ...resourceKeys,
15
+ // 读取操作 (Read operations)
16
+ read: {
17
+ request: keyGen('read.request'),
18
+ success: keyGen('read.success'),
19
+ error: keyGen('read.error'),
20
+ notFound: keyGen('read.notFound')
21
+ },
22
+ // 额外的资源相关键 (Additional resource related keys)
23
+ fileReadError: keyGen('fileReadError'),
24
+ invalidUri: keyGen('invalidUri'),
25
+ notFound: keyGen('notFound'),
26
+ readError: keyGen('readError'),
27
+ // 资源描述 (Resource descriptions)
28
+ readme: {
29
+ description: keyGen('readme.description')
30
+ },
31
+ package: {
32
+ description: keyGen('package.description')
33
+ },
34
+ index: {
35
+ description: keyGen('index.description')
36
+ },
37
+ client: {
38
+ description: keyGen('client.description')
39
+ },
40
+ // 资源模板描述 (Resource template descriptions)
41
+ sourceFile: {
42
+ name: keyGen('sourceFile.name'),
43
+ description: keyGen('sourceFile.description')
44
+ },
45
+ docFile: {
46
+ name: keyGen('docFile.name'),
47
+ description: keyGen('docFile.description')
48
+ },
49
+ filename: {
50
+ description: keyGen('filename.description')
51
+ }
52
+ };
53
+ })();
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Author: Martin <lmccc.dev@gmail.com>
3
+ * Co-Author: AI Assistant (Claude)
4
+ * Description: This code was collaboratively developed by Martin and AI Assistant.
5
+ */
6
+ import { createKeyGenerator } from './base.js';
7
+ /**
8
+ * 服务器相关键 (Server related keys)
9
+ */
10
+ export const SERVER_KEYS = (() => {
11
+ const keyGen = createKeyGenerator('server');
12
+ return {
13
+ // 服务器状态 (Server status)
14
+ starting: keyGen('starting'),
15
+ started: keyGen('started'),
16
+ stopping: keyGen('stopping'),
17
+ stopped: keyGen('stopped'),
18
+ error: keyGen('error'),
19
+ startupError: keyGen('startupError'),
20
+ // 连接相关 (Connection related)
21
+ connecting: keyGen('connecting'),
22
+ connected: keyGen('connected'),
23
+ connectionFailed: keyGen('connectionFailed'),
24
+ disconnected: keyGen('disconnected'),
25
+ connectionError: keyGen('connectionError'),
26
+ // 错误相关 (Error related)
27
+ serverError: keyGen('serverError'),
28
+ transportError: keyGen('transportError'),
29
+ // 请求处理 (Request handling)
30
+ receivedRequest: keyGen('receivedRequest'),
31
+ processingRequest: keyGen('processingRequest'),
32
+ requestCompleted: keyGen('requestCompleted'),
33
+ requestError: keyGen('requestError'),
34
+ requestReceived: keyGen('requestReceived'),
35
+ requestProcessed: keyGen('requestProcessed'),
36
+ requestFailed: keyGen('requestFailed'),
37
+ // 浏览器相关 (Browser related)
38
+ initializingBrowser: keyGen('initializingBrowser'),
39
+ browserInitialized: keyGen('browserInitialized'),
40
+ browserInitFailed: keyGen('browserInitFailed'),
41
+ closingBrowser: keyGen('closingBrowser'),
42
+ browserClosed: keyGen('browserClosed'),
43
+ // 工具相关 (Tool related)
44
+ tool: {
45
+ requestReceived: keyGen('tool.requestReceived'),
46
+ requestProcessed: keyGen('tool.requestProcessed'),
47
+ requestError: keyGen('tool.requestError')
48
+ },
49
+ // 系统相关 (System related)
50
+ receivedInterruptSignal: keyGen('receivedInterruptSignal'),
51
+ receivedTerminateSignal: keyGen('receivedTerminateSignal'),
52
+ uncaughtException: keyGen('uncaughtException'),
53
+ debug: keyGen('debug'),
54
+ listeningOn: keyGen('listeningOn'),
55
+ // 入口相关 (Entry related)
56
+ entry: {
57
+ loaded: keyGen('entry.loaded')
58
+ },
59
+ // 其他键 (Other keys)
60
+ receivedToolRequest: keyGen('receivedToolRequest'),
61
+ processingToolRequestError: keyGen('processingToolRequestError'),
62
+ usingBrowserMode: keyGen('usingBrowserMode'),
63
+ usingAutoDetectMode: keyGen('usingAutoDetectMode'),
64
+ switchingToBrowserMode: keyGen('switchingToBrowserMode'),
65
+ fetchError: keyGen('fetchError')
66
+ };
67
+ })();
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Author: Martin <lmccc.dev@gmail.com>
3
+ * Co-Author: AI Assistant (Claude)
4
+ * Description: This code was collaboratively developed by Martin and AI Assistant.
5
+ */
6
+ import { createKeyGenerator } from './base.js';
7
+ /**
8
+ * 工具相关键 (Tools related keys)
9
+ */
10
+ export const TOOLS_KEYS = (() => {
11
+ const keyGen = createKeyGenerator('tools');
12
+ return {
13
+ // 通用工具描述 (General tool descriptions)
14
+ fetchHtmlDescription: keyGen('fetchHtmlDescription'),
15
+ fetchJsonDescription: keyGen('fetchJsonDescription'),
16
+ fetchTxtDescription: keyGen('fetchTxtDescription'),
17
+ fetchMarkdownDescription: keyGen('fetchMarkdownDescription'),
18
+ // 参数描述 (Parameter descriptions)
19
+ urlDescription: keyGen('urlDescription'),
20
+ // 错误消息 (Error messages)
21
+ fetchHtmlError: keyGen('fetchHtmlError'),
22
+ fetchJsonError: keyGen('fetchJsonError'),
23
+ fetchTxtError: keyGen('fetchTxtError'),
24
+ fetchMarkdownError: keyGen('fetchMarkdownError'),
25
+ jsonParseWarning: keyGen('jsonParseWarning'),
26
+ // 成功消息 (Success messages)
27
+ fetchHtmlSuccess: keyGen('fetchHtmlSuccess'),
28
+ fetchJsonSuccess: keyGen('fetchJsonSuccess'),
29
+ fetchTxtSuccess: keyGen('fetchTxtSuccess'),
30
+ fetchMarkdownSuccess: keyGen('fetchMarkdownSuccess'),
31
+ // 工具调用相关 (Tool call related)
32
+ callReceived: keyGen('callReceived'),
33
+ unknownTool: keyGen('unknownTool'),
34
+ callError: keyGen('callError'),
35
+ missingUrl: keyGen('missingUrl'),
36
+ fetchRequest: keyGen('fetchRequest'),
37
+ fetchError: keyGen('fetchError')
38
+ };
39
+ })();