@appium/mcp-documentation 1.0.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 (88) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/LICENSE +201 -0
  3. package/README.md +126 -0
  4. package/dist/answer-appium.d.ts +8 -0
  5. package/dist/answer-appium.d.ts.map +1 -0
  6. package/dist/answer-appium.js +38 -0
  7. package/dist/answer-appium.js.map +1 -0
  8. package/dist/appium-skills.d.ts +5 -0
  9. package/dist/appium-skills.d.ts.map +1 -0
  10. package/dist/appium-skills.js +168 -0
  11. package/dist/appium-skills.js.map +1 -0
  12. package/dist/index.d.ts +31 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +69 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/logger.d.ts +4 -0
  17. package/dist/logger.d.ts.map +1 -0
  18. package/dist/logger.js +5 -0
  19. package/dist/logger.js.map +1 -0
  20. package/dist/markdown-header-splitter.d.ts +32 -0
  21. package/dist/markdown-header-splitter.d.ts.map +1 -0
  22. package/dist/markdown-header-splitter.js +180 -0
  23. package/dist/markdown-header-splitter.js.map +1 -0
  24. package/dist/paths.d.ts +2 -0
  25. package/dist/paths.d.ts.map +1 -0
  26. package/dist/paths.js +22 -0
  27. package/dist/paths.js.map +1 -0
  28. package/dist/plugin.d.ts +19 -0
  29. package/dist/plugin.d.ts.map +1 -0
  30. package/dist/plugin.js +18 -0
  31. package/dist/plugin.js.map +1 -0
  32. package/dist/reasoning-rag.d.ts +89 -0
  33. package/dist/reasoning-rag.d.ts.map +1 -0
  34. package/dist/reasoning-rag.js +282 -0
  35. package/dist/reasoning-rag.js.map +1 -0
  36. package/dist/scripts/eval-documentation-rag.d.ts +50 -0
  37. package/dist/scripts/eval-documentation-rag.d.ts.map +1 -0
  38. package/dist/scripts/eval-documentation-rag.js +287 -0
  39. package/dist/scripts/eval-documentation-rag.js.map +1 -0
  40. package/dist/scripts/generate-embeddings-cache.d.ts +13 -0
  41. package/dist/scripts/generate-embeddings-cache.d.ts.map +1 -0
  42. package/dist/scripts/generate-embeddings-cache.js +24 -0
  43. package/dist/scripts/generate-embeddings-cache.js.map +1 -0
  44. package/dist/scripts/rag-eval-dataset.json +516 -0
  45. package/dist/scripts/simple-index-documentation.d.ts +21 -0
  46. package/dist/scripts/simple-index-documentation.d.ts.map +1 -0
  47. package/dist/scripts/simple-index-documentation.js +77 -0
  48. package/dist/scripts/simple-index-documentation.js.map +1 -0
  49. package/dist/scripts/simple-query-documentation.d.ts +13 -0
  50. package/dist/scripts/simple-query-documentation.d.ts.map +1 -0
  51. package/dist/scripts/simple-query-documentation.js +52 -0
  52. package/dist/scripts/simple-query-documentation.js.map +1 -0
  53. package/dist/sentence-transformers-embeddings.d.ts +40 -0
  54. package/dist/sentence-transformers-embeddings.d.ts.map +1 -0
  55. package/dist/sentence-transformers-embeddings.js +119 -0
  56. package/dist/sentence-transformers-embeddings.js.map +1 -0
  57. package/dist/simple-pdf-indexer.d.ts +47 -0
  58. package/dist/simple-pdf-indexer.d.ts.map +1 -0
  59. package/dist/simple-pdf-indexer.js +572 -0
  60. package/dist/simple-pdf-indexer.js.map +1 -0
  61. package/dist/tests/__mocks__/@appium/support.d.ts +92 -0
  62. package/dist/tests/__mocks__/@appium/support.d.ts.map +1 -0
  63. package/dist/tests/__mocks__/@appium/support.js +66 -0
  64. package/dist/tests/__mocks__/@appium/support.js.map +1 -0
  65. package/dist/tests/appium-skills.test.d.ts +2 -0
  66. package/dist/tests/appium-skills.test.d.ts.map +1 -0
  67. package/dist/tests/appium-skills.test.js +26 -0
  68. package/dist/tests/appium-skills.test.js.map +1 -0
  69. package/dist/tests/plugin.test.d.ts +2 -0
  70. package/dist/tests/plugin.test.d.ts.map +1 -0
  71. package/dist/tests/plugin.test.js +18 -0
  72. package/dist/tests/plugin.test.js.map +1 -0
  73. package/dist/tests/simple-pdf-indexer.test.d.ts +2 -0
  74. package/dist/tests/simple-pdf-indexer.test.d.ts.map +1 -0
  75. package/dist/tests/simple-pdf-indexer.test.js +37 -0
  76. package/dist/tests/simple-pdf-indexer.test.js.map +1 -0
  77. package/dist/tool-response.d.ts +4 -0
  78. package/dist/tool-response.d.ts.map +1 -0
  79. package/dist/tool-response.js +12 -0
  80. package/dist/tool-response.js.map +1 -0
  81. package/dist/tools.d.ts +3 -0
  82. package/dist/tools.d.ts.map +1 -0
  83. package/dist/tools.js +3 -0
  84. package/dist/tools.js.map +1 -0
  85. package/dist/uploads/documents.json +1 -0
  86. package/package.json +84 -0
  87. package/scripts/zip-assets.mjs +75 -0
  88. package/src/resources/submodules.zip +0 -0
package/dist/index.js ADDED
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Documentation tools for Appium
3
+ *
4
+ * This module provides tools for answering queries about Appium
5
+ * by retrieving relevant information from indexed documentation.
6
+ */
7
+ import { queryVectorStore, indexAllMarkdownFiles, } from './simple-pdf-indexer.js';
8
+ import log from './logger.js';
9
+ import { resolveAppiumResourcesPath } from './paths.js';
10
+ /**
11
+ * Initialize the Appium documentation index
12
+ * @param resourcesPath Path to the resources directory containing markdown files
13
+ */
14
+ export async function initializeAppiumDocumentation(resourcesPath) {
15
+ try {
16
+ // Default to submodules directory if not specified
17
+ const docsPath =
18
+ // Refer to the /src/resources/submodules directory where the markdown files are located.
19
+ resourcesPath || resolveAppiumResourcesPath('submodules');
20
+ log.info(`Initializing Appium documentation from: ${docsPath}`);
21
+ await indexAllMarkdownFiles(docsPath);
22
+ log.info('Appium documentation indexing completed');
23
+ }
24
+ catch (error) {
25
+ log.error('Error initializing Appium documentation:', error);
26
+ throw error;
27
+ }
28
+ }
29
+ /**
30
+ * Answer a query about Appium using indexed documentation
31
+ * @param options Query options
32
+ * @returns Response with relevant chunks for the client LLM to process
33
+ */
34
+ export async function answerAppiumQuery(options) {
35
+ try {
36
+ const { query } = options;
37
+ log.info(`Querying vector store for: "${query}"`);
38
+ const results = await queryVectorStore(query); // Get relevant chunks
39
+ if (!results || results.length === 0) {
40
+ return {
41
+ answer: 'No relevant information found in the Appium documentation. Please try rephrasing your query.',
42
+ chunks: [],
43
+ };
44
+ }
45
+ // Extract the content from all retrieved documents
46
+ const chunks = results.map((doc) => doc.pageContent);
47
+ const sources = results
48
+ .map((doc) => doc.metadata?.relativePath ||
49
+ doc.metadata?.filename ||
50
+ doc.metadata?.source)
51
+ .filter((source, index, arr) => source && arr.indexOf(source) === index); // Remove duplicates
52
+ log.info(`Found ${results.length} relevant chunks from ${sources.length} sources`);
53
+ // Return the chunks for the client LLM to process
54
+ // The client will use its own LLM to generate the final answer
55
+ return {
56
+ answer: `Found ${results.length} relevant documentation chunks. Here are the relevant sections:\n\n${chunks.join('\n\n---\n\n')}`,
57
+ sources,
58
+ chunks,
59
+ };
60
+ }
61
+ catch (error) {
62
+ log.error('Error querying Appium documentation:', error);
63
+ throw error;
64
+ }
65
+ }
66
+ export { appiumDocumentationQueryTool } from './answer-appium.js';
67
+ export { appiumSkillsTool } from './appium-skills.js';
68
+ export { AppiumDocumentation } from './plugin.js';
69
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAWxD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,aAAsB;IAEtB,IAAI,CAAC;QACH,mDAAmD;QACnD,MAAM,QAAQ;QACZ,yFAAyF;QACzF,aAAa,IAAI,0BAA0B,CAAC,YAAY,CAAC,CAAC;QAC5D,GAAG,CAAC,IAAI,CAAC,2CAA2C,QAAQ,EAAE,CAAC,CAAC;QAChE,MAAM,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QACtC,GAAG,C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L,MAAM,EAAE,SACN,OAAO,CAAC,MACV,sEAAsE,MAAM,CAAC,IAAI,CAC/E,aAAa,CACd,EAAE;YACH,OAAO;YACP,MAAM;SACP,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,KAAK,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;QACzD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ declare const log: import("@appium/types").AppiumLogger;
2
+ export default log;
3
+ export { log };
4
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,GAAG,sCAA+C,CAAC;AAEzD,eAAe,GAAG,CAAC;AACnB,OAAO,EAAE,GAAG,EAAE,CAAC"}
package/dist/logger.js ADDED
@@ -0,0 +1,5 @@
1
+ import { logger } from '@appium/support';
2
+ const log = logger.getLogger('appium-mcp-documentation');
3
+ export default log;
4
+ export { log };
5
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC;AAEzD,eAAe,GAAG,CAAC;AACnB,OAAO,EAAE,GAAG,EAAE,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Header-aware Markdown splitter (hybrid approach).
3
+ *
4
+ * The TS `@langchain/textsplitters` package only ships `MarkdownTextSplitter`,
5
+ * which is `RecursiveCharacterTextSplitter` with Markdown-priority separators —
6
+ * it is *greedy* and merges across topical boundaries when chunks are small.
7
+ *
8
+ * For Appium's header-dense docs (2098 h2 + 2263 h3 across 178 files; 92% of
9
+ * h2/h3 sections fit under 1000 chars), splitting on headers first preserves
10
+ * topical boundaries. We then:
11
+ * - Coalesce short adjacent sections so embeddings aren't computed on tiny
12
+ * (~50-token) chunks where vector quality degrades.
13
+ * - Recursively split sections that exceed `chunkSize` (e.g. long capability
14
+ * reference tables, big code dumps).
15
+ * - Prepend a header breadcrumb (`# Page > ## Section > ### Subsection`) to
16
+ * every chunk so the embedding sees topical context even when the body
17
+ * is recursive-split into mid-paragraph fragments.
18
+ *
19
+ * Files with no headers (or only an h1) fall through to a single recursive
20
+ * split of the whole body - no different from plain RCT for those.
21
+ */
22
+ import { Document } from '@langchain/core/documents';
23
+ export interface MarkdownHeaderSplitterOptions {
24
+ chunkSize: number;
25
+ chunkOverlap: number;
26
+ }
27
+ /**
28
+ * Split a single Markdown document into chunks using header-aware hybrid logic.
29
+ * See module docstring for the algorithm summary.
30
+ */
31
+ export declare function splitMarkdownByHeaders(markdown: string, options: MarkdownHeaderSplitterOptions): Promise<Document[]>;
32
+ //# sourceMappingURL=markdown-header-splitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-header-splitter.d.ts","sourceRoot":"","sources":["../src/markdown-header-splitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGrD,MAAM,WAAW,6BAA6B;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAUD;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAyErB"}
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Header-aware Markdown splitter (hybrid approach).
3
+ *
4
+ * The TS `@langchain/textsplitters` package only ships `MarkdownTextSplitter`,
5
+ * which is `RecursiveCharacterTextSplitter` with Markdown-priority separators —
6
+ * it is *greedy* and merges across topical boundaries when chunks are small.
7
+ *
8
+ * For Appium's header-dense docs (2098 h2 + 2263 h3 across 178 files; 92% of
9
+ * h2/h3 sections fit under 1000 chars), splitting on headers first preserves
10
+ * topical boundaries. We then:
11
+ * - Coalesce short adjacent sections so embeddings aren't computed on tiny
12
+ * (~50-token) chunks where vector quality degrades.
13
+ * - Recursively split sections that exceed `chunkSize` (e.g. long capability
14
+ * reference tables, big code dumps).
15
+ * - Prepend a header breadcrumb (`# Page > ## Section > ### Subsection`) to
16
+ * every chunk so the embedding sees topical context even when the body
17
+ * is recursive-split into mid-paragraph fragments.
18
+ *
19
+ * Files with no headers (or only an h1) fall through to a single recursive
20
+ * split of the whole body - no different from plain RCT for those.
21
+ */
22
+ import { Document } from '@langchain/core/documents';
23
+ import { RecursiveCharacterTextSplitter } from '@langchain/textsplitters';
24
+ const HEADER_RE = /^(#{1,6})\s+(.+?)\s*$/;
25
+ const FENCE_RE = /^\s{0,3}(```|~~~)/;
26
+ /**
27
+ * Split a single Markdown document into chunks using header-aware hybrid logic.
28
+ * See module docstring for the algorithm summary.
29
+ */
30
+ export async function splitMarkdownByHeaders(markdown, options) {
31
+ const { chunkSize, chunkOverlap } = options;
32
+ const sections = parseSections(markdown);
33
+ // Fallback splitter for sections that exceed chunkSize on their own.
34
+ // Reserve some room for the breadcrumb so the final chunk text still fits.
35
+ const recursive = new RecursiveCharacterTextSplitter({
36
+ chunkSize,
37
+ chunkOverlap,
38
+ keepSeparator: true,
39
+ });
40
+ const chunks = [];
41
+ // `buffer` holds rendered section texts (each with its own breadcrumb) that
42
+ // we plan to coalesce. We flush when adding the next section would overflow.
43
+ const buffer = [];
44
+ let bufferSize = 0;
45
+ const flushBuffer = () => {
46
+ if (buffer.length === 0) {
47
+ return;
48
+ }
49
+ const text = buffer.map(renderSection).join('\n\n');
50
+ chunks.push(new Document({
51
+ pageContent: text,
52
+ metadata: {
53
+ headerPath: breadcrumbFor(buffer[0].headerStack),
54
+ sectionCount: buffer.length,
55
+ },
56
+ }));
57
+ buffer.length = 0;
58
+ bufferSize = 0;
59
+ };
60
+ for (const section of sections) {
61
+ const rendered = renderSection(section);
62
+ if (rendered.length > chunkSize) {
63
+ // Section is too big to live in any single chunk: flush whatever we had
64
+ // buffered, then recursive-split this section's body, prepending the
65
+ // breadcrumb to each sub-chunk so context isn't lost.
66
+ flushBuffer();
67
+ const bc = breadcrumbFor(section.headerStack);
68
+ const subTexts = await recursive.splitText(section.body || '');
69
+ for (const sub of subTexts) {
70
+ const text = bc ? `${bc}\n\n${sub}` : sub;
71
+ chunks.push(new Document({
72
+ pageContent: text,
73
+ metadata: {
74
+ headerPath: bc,
75
+ sectionCount: 1,
76
+ recursiveSplit: true,
77
+ },
78
+ }));
79
+ }
80
+ continue;
81
+ }
82
+ // Would adding this section overflow the current buffer? If so, flush.
83
+ // The +2 accounts for the "\n\n" join between buffered sections.
84
+ if (bufferSize > 0 && bufferSize + rendered.length + 2 > chunkSize) {
85
+ flushBuffer();
86
+ }
87
+ buffer.push(section);
88
+ bufferSize += rendered.length + (bufferSize > 0 ? 2 : 0);
89
+ }
90
+ flushBuffer();
91
+ return chunks;
92
+ }
93
+ /**
94
+ * Parse Markdown into a flat list of sections delimited by ATX headers.
95
+ *
96
+ * - Respects fenced code blocks: `#` inside ``` ... ``` is not treated as a header.
97
+ * - Files without any headers produce a single section with empty headerStack.
98
+ * - The text before the first header (if any) is attached as a section with
99
+ * the file's eventual root headerStack (still empty until we see an h1).
100
+ */
101
+ function parseSections(markdown) {
102
+ const lines = markdown.split('\n');
103
+ const sections = [];
104
+ let inFence = false;
105
+ let currentBody = [];
106
+ // headerStack carries the live ancestor chain — when we see h(n), we pop
107
+ // everything at level >= n then push the new header.
108
+ const headerStack = [];
109
+ const flush = () => {
110
+ if (currentBody.length === 0 && headerStack.length === 0) {
111
+ return;
112
+ }
113
+ sections.push({
114
+ headerStack: [...headerStack],
115
+ body: currentBody.join('\n').trim(),
116
+ });
117
+ currentBody = [];
118
+ };
119
+ for (const line of lines) {
120
+ if (FENCE_RE.test(line)) {
121
+ inFence = !inFence;
122
+ currentBody.push(line);
123
+ continue;
124
+ }
125
+ if (inFence) {
126
+ currentBody.push(line);
127
+ continue;
128
+ }
129
+ const m = line.match(HEADER_RE);
130
+ if (m) {
131
+ // Flush whatever section we were in before opening a new one.
132
+ flush();
133
+ const level = m[1].length;
134
+ // Pop deeper-or-equal headers off the stack — siblings replace, deeper
135
+ // descendants are closed.
136
+ while (headerStack.length > 0) {
137
+ const top = headerStack[headerStack.length - 1];
138
+ const topLevel = top.match(/^(#{1,6})/)[1].length;
139
+ if (topLevel >= level) {
140
+ headerStack.pop();
141
+ }
142
+ else {
143
+ break;
144
+ }
145
+ }
146
+ headerStack.push(`${m[1]} ${m[2]}`);
147
+ continue;
148
+ }
149
+ currentBody.push(line);
150
+ }
151
+ flush();
152
+ return sections.filter((s) => s.headerStack.length > 0 || s.body.length > 0);
153
+ }
154
+ /**
155
+ * Build a single-line breadcrumb prefix for a chunk, e.g.
156
+ * "# XCUITest Driver Capabilities > ## Standard W3C > ### platformVersion"
157
+ * Falls back to empty string if the section has no ancestors.
158
+ */
159
+ function breadcrumbFor(headerStack) {
160
+ if (headerStack.length === 0) {
161
+ return '';
162
+ }
163
+ return headerStack.join(' > ');
164
+ }
165
+ /**
166
+ * Render a section as the text that will go into a chunk: breadcrumb on top,
167
+ * blank line, then body. Used both when emitting a single section as one chunk
168
+ * and when buffering for coalescence.
169
+ */
170
+ function renderSection(section) {
171
+ const bc = breadcrumbFor(section.headerStack);
172
+ if (!bc) {
173
+ return section.body;
174
+ }
175
+ if (!section.body) {
176
+ return bc;
177
+ }
178
+ return `${bc}\n\n${section.body}`;
179
+ }
180
+ //# sourceMappingURL=markdown-header-splitter.js.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EAAE,CAAC;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,GAAG,EAAE,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;AACpC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function resolveAppiumResourcesPath(...segments: string[]): string;
2
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAOA,wBAAgB,0BAA0B,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAExE"}
package/dist/paths.js ADDED
@@ -0,0 +1,22 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = path.dirname(__filename);
6
+ export function resolveAppiumResourcesPath(...segments) {
7
+ return path.join(findResourceRoot(), ...segments);
8
+ }
9
+ function findResourceRoot() {
10
+ if (process.env.APPIUM_MCP_RESOURCES_PATH) {
11
+ return process.env.APPIUM_MCP_RESOURCES_PATH;
12
+ }
13
+ const candidates = [
14
+ path.resolve(process.cwd(), 'src/resources'),
15
+ path.resolve(process.cwd(), 'dist/resources'),
16
+ path.resolve(__dirname, 'resources'),
17
+ path.resolve(__dirname, '../resources'),
18
+ ];
19
+ const existing = candidates.find((candidate) => fs.existsSync(candidate));
20
+ return existing ?? candidates[0];
21
+ }
22
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,MAAM,UAAU,0BAA0B,CAAC,GAAG,QAAkB;IAC9D,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,gBAAgB;IACvB,IAAI,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAAC;QAC1C,OAAO,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC;IAC/C,CAAC;IAED,MAAM,UAAU,GAAG;QACjB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,eAAe,CAAC;QAC5C,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,gBAAgB,CAAC;QAC7C,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC;QACpC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC;KACxC,CAAC;IAEF,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1E,OAAO,QAAQ,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { appiumDocumentationQueryTool } from './tools.js';
2
+ type ToolDef = typeof appiumDocumentationQueryTool;
3
+ type McpRegistry = {
4
+ addTool(toolDef: ToolDef): void;
5
+ };
6
+ /**
7
+ * Appium documentation plugin.
8
+ *
9
+ * This class is intentionally structural: it exposes the same shape expected by
10
+ * appium-mcp without importing appium-mcp types and creating a circular package
11
+ * dependency.
12
+ */
13
+ export declare class AppiumDocumentation {
14
+ readonly name = "appium-documentation";
15
+ readonly version: string;
16
+ register(registry: McpRegistry): void;
17
+ }
18
+ export {};
19
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAoB,MAAM,YAAY,CAAC;AAG5E,KAAK,OAAO,GAAG,OAAO,4BAA4B,CAAC;AAEnD,KAAK,WAAW,GAAG;IACjB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF;;;;;;GAMG;AACH,qBAAa,mBAAmB;IAC9B,QAAQ,CAAC,IAAI,0BAA0B;IACvC,QAAQ,CAAC,OAAO,SAAe;IAE/B,QAAQ,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI;CAItC"}
package/dist/plugin.js ADDED
@@ -0,0 +1,18 @@
1
+ import { appiumDocumentationQueryTool, appiumSkillsTool } from './tools.js';
2
+ import pkg from '../package.json' with { type: 'json' };
3
+ /**
4
+ * Appium documentation plugin.
5
+ *
6
+ * This class is intentionally structural: it exposes the same shape expected by
7
+ * appium-mcp without importing appium-mcp types and creating a circular package
8
+ * dependency.
9
+ */
10
+ export class AppiumDocumentation {
11
+ name = 'appium-documentation';
12
+ version = pkg.version;
13
+ register(registry) {
14
+ registry.addTool(appiumDocumentationQueryTool);
15
+ registry.addTool(appiumSkillsTool);
16
+ }
17
+ }
18
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,GAAG,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAQxD;;;;;;GAMG;AACH,MAAM,OAAO,mBAAmB;IACrB,IAAI,GAAG,sBAAsB,CAAC;IAC9B,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;IAE/B,QAAQ,CAAC,QAAqB;QAC5B,QAAQ,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;QAC/C,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACrC,CAAC;CACF"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Reasoning-Enhanced RAG System
3
+ *
4
+ * This module enhances the existing RAG system by adding reasoning capabilities
5
+ * using Xenova transformers during the document retrieval process.
6
+ * It can perform summarization, question-answering, and analysis on retrieved chunks.
7
+ */
8
+ import type { Document } from '@langchain/core/documents';
9
+ /**
10
+ * Reasoning task types supported by the system
11
+ */
12
+ export type ReasoningTask = 'summarization' | 'question-answering' | 'analysis' | 'classification';
13
+ /**
14
+ * Enhanced RAG response with reasoning
15
+ */
16
+ export interface EnhancedRAGResponse {
17
+ query: string;
18
+ retrievedChunks: Document[];
19
+ reasoningResults: ReasoningResult[];
20
+ summary: string;
21
+ answer: string;
22
+ sources: string[];
23
+ }
24
+ /**
25
+ * Configuration for reasoning models
26
+ */
27
+ interface ReasoningConfig {
28
+ task: ReasoningTask;
29
+ modelName: string;
30
+ maxLength?: number;
31
+ minLength?: number;
32
+ }
33
+ /**
34
+ * Result from reasoning process
35
+ */
36
+ interface ReasoningResult {
37
+ originalChunk: string;
38
+ reasoningOutput: string;
39
+ confidence?: number;
40
+ metadata: Record<string, any>;
41
+ }
42
+ /**
43
+ * Reasoning-enhanced RAG processor
44
+ */
45
+ export declare class ReasoningRAG {
46
+ private transformers;
47
+ private models;
48
+ private isInitialized;
49
+ constructor();
50
+ /**
51
+ * Enhanced RAG query with reasoning capabilities
52
+ */
53
+ queryWithReasoning(query: string, options?: {
54
+ topK?: number;
55
+ reasoningTasks?: ReasoningTask[];
56
+ customConfigs?: ReasoningConfig[];
57
+ }): Promise<EnhancedRAGResponse>;
58
+ /**
59
+ * Get available reasoning models and their capabilities
60
+ */
61
+ getAvailableModels(): Record<ReasoningTask, string[]>;
62
+ /**
63
+ * Clean up resources
64
+ */
65
+ cleanup(): Promise<void>;
66
+ /**
67
+ * Initialize the transformers library dynamically
68
+ */
69
+ private initializeTransformers;
70
+ /**
71
+ * Get or create a model pipeline for a specific task
72
+ */
73
+ private getModel;
74
+ /**
75
+ * Perform reasoning on a text chunk
76
+ */
77
+ private performReasoning;
78
+ /**
79
+ * Process multiple chunks with reasoning in parallel
80
+ */
81
+ private processChunksWithReasoning;
82
+ /**
83
+ * Generate a comprehensive summary from reasoning results
84
+ */
85
+ private generateComprehensiveSummary;
86
+ }
87
+ export declare const reasoningRAG: ReasoningRAG;
88
+ export {};
89
+ //# sourceMappingURL=reasoning-rag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reasoning-rag.d.ts","sourceRoot":"","sources":["../src/reasoning-rag.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAI1D;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,eAAe,GACf,oBAAoB,GACpB,UAAU,GACV,gBAAgB,CAAC;AAErB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,QAAQ,EAAE,CAAC;IAC5B,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,UAAU,eAAe;IACvB,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,UAAU,eAAe;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,qBAAa,YAAY;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