research-powerpack-mcp 3.3.0 → 3.3.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/clients/reddit.d.ts +5 -5
- package/dist/clients/reddit.d.ts.map +1 -1
- package/dist/clients/reddit.js +29 -10
- package/dist/clients/reddit.js.map +1 -1
- package/dist/clients/research.d.ts +12 -2
- package/dist/clients/research.d.ts.map +1 -1
- package/dist/clients/research.js +109 -37
- package/dist/clients/research.js.map +1 -1
- package/dist/clients/scraper.d.ts +4 -3
- package/dist/clients/scraper.d.ts.map +1 -1
- package/dist/clients/search.d.ts +3 -2
- package/dist/clients/search.d.ts.map +1 -1
- package/dist/config/index.d.ts +4 -3
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +37 -5
- package/dist/config/index.js.map +1 -1
- package/dist/index.js +57 -22
- package/dist/index.js.map +1 -1
- package/dist/schemas/deep-research.d.ts +1 -37
- package/dist/schemas/deep-research.d.ts.map +1 -1
- package/dist/schemas/deep-research.js +205 -40
- package/dist/schemas/deep-research.js.map +1 -1
- package/dist/schemas/scrape-links.d.ts +1 -7
- package/dist/schemas/scrape-links.d.ts.map +1 -1
- package/dist/schemas/scrape-links.js +17 -9
- package/dist/schemas/scrape-links.js.map +1 -1
- package/dist/schemas/web-search.d.ts +2 -4
- package/dist/schemas/web-search.d.ts.map +1 -1
- package/dist/schemas/web-search.js +15 -6
- package/dist/schemas/web-search.js.map +1 -1
- package/dist/services/llm-processor.d.ts +0 -10
- package/dist/services/llm-processor.d.ts.map +1 -1
- package/dist/services/llm-processor.js +2 -1
- package/dist/services/llm-processor.js.map +1 -1
- package/dist/services/markdown-cleaner.d.ts +4 -0
- package/dist/services/markdown-cleaner.d.ts.map +1 -1
- package/dist/services/markdown-cleaner.js +26 -13
- package/dist/services/markdown-cleaner.js.map +1 -1
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +40 -2
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/reddit.d.ts +3 -1
- package/dist/tools/reddit.d.ts.map +1 -1
- package/dist/tools/reddit.js +68 -48
- package/dist/tools/reddit.js.map +1 -1
- package/dist/tools/scrape.js.map +1 -1
- package/dist/tools/search.d.ts +1 -0
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +11 -3
- package/dist/tools/search.js.map +1 -1
- package/dist/utils/errors.d.ts +31 -40
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +84 -10
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/url-aggregator.d.ts +5 -4
- package/dist/utils/url-aggregator.d.ts.map +1 -1
- package/dist/utils/url-aggregator.js +30 -3
- package/dist/utils/url-aggregator.js.map +1 -1
- package/dist/version.d.ts +19 -12
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +22 -14
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
package/dist/config/index.js
CHANGED
|
@@ -3,8 +3,37 @@
|
|
|
3
3
|
* All environment variables, constants, and LLM config in one place
|
|
4
4
|
*/
|
|
5
5
|
import { VERSION, PACKAGE_NAME, PACKAGE_DESCRIPTION } from '../version.js';
|
|
6
|
-
//
|
|
7
|
-
|
|
6
|
+
// Import version utilities (not re-exported - use directly from version.ts if needed externally)
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Safe Integer Parsing Helper
|
|
9
|
+
// ============================================================================
|
|
10
|
+
/**
|
|
11
|
+
* Safely parse an integer from environment variable with bounds checking
|
|
12
|
+
* @param value - The string value to parse (from process.env)
|
|
13
|
+
* @param defaultVal - Default value if parsing fails or value is undefined
|
|
14
|
+
* @param min - Minimum allowed value (clamped if below)
|
|
15
|
+
* @param max - Maximum allowed value (clamped if above)
|
|
16
|
+
* @returns Parsed integer within bounds, or default value
|
|
17
|
+
*/
|
|
18
|
+
function safeParseInt(value, defaultVal, min, max) {
|
|
19
|
+
if (!value) {
|
|
20
|
+
return defaultVal;
|
|
21
|
+
}
|
|
22
|
+
const parsed = parseInt(value, 10);
|
|
23
|
+
if (isNaN(parsed)) {
|
|
24
|
+
console.warn(`[Config] Invalid number "${value}", using default ${defaultVal}`);
|
|
25
|
+
return defaultVal;
|
|
26
|
+
}
|
|
27
|
+
if (parsed < min) {
|
|
28
|
+
console.warn(`[Config] Value ${parsed} below minimum ${min}, clamping to ${min}`);
|
|
29
|
+
return min;
|
|
30
|
+
}
|
|
31
|
+
if (parsed > max) {
|
|
32
|
+
console.warn(`[Config] Value ${parsed} above maximum ${max}, clamping to ${max}`);
|
|
33
|
+
return max;
|
|
34
|
+
}
|
|
35
|
+
return parsed;
|
|
36
|
+
}
|
|
8
37
|
export function parseEnv() {
|
|
9
38
|
return {
|
|
10
39
|
SCRAPER_API_KEY: process.env.SCRAPEDO_API_KEY || '',
|
|
@@ -18,11 +47,14 @@ export function parseEnv() {
|
|
|
18
47
|
// ============================================================================
|
|
19
48
|
export const RESEARCH = {
|
|
20
49
|
BASE_URL: process.env.OPENROUTER_BASE_URL || 'https://openrouter.ai/api/v1',
|
|
21
|
-
MODEL: process.env.RESEARCH_MODEL || '
|
|
50
|
+
MODEL: process.env.RESEARCH_MODEL || 'x-ai/grok-4-fast',
|
|
51
|
+
FALLBACK_MODEL: process.env.RESEARCH_FALLBACK_MODEL || 'google/gemini-2.5-flash',
|
|
22
52
|
API_KEY: process.env.OPENROUTER_API_KEY || '',
|
|
23
|
-
|
|
53
|
+
// Timeout: min 1s, max 1hr, default 30min
|
|
54
|
+
TIMEOUT_MS: safeParseInt(process.env.API_TIMEOUT_MS, 1800000, 1000, 3600000),
|
|
24
55
|
REASONING_EFFORT: process.env.DEFAULT_REASONING_EFFORT || 'high',
|
|
25
|
-
|
|
56
|
+
// Max URLs in search results: min 10, max 200, default 100
|
|
57
|
+
MAX_URLS: safeParseInt(process.env.DEFAULT_MAX_URLS, 100, 10, 200),
|
|
26
58
|
};
|
|
27
59
|
// ============================================================================
|
|
28
60
|
// MCP Server Configuration
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE3E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE3E,iGAAiG;AAEjG,+EAA+E;AAC/E,8BAA8B;AAC9B,+EAA+E;AAE/E;;;;;;;GAOG;AACH,SAAS,YAAY,CACnB,KAAyB,EACzB,UAAkB,EAClB,GAAW,EACX,GAAW;IAEX,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAEnC,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,4BAA4B,KAAK,oBAAoB,UAAU,EAAE,CAAC,CAAC;QAChF,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,kBAAkB,MAAM,kBAAkB,GAAG,iBAAiB,GAAG,EAAE,CAAC,CAAC;QAClF,OAAO,GAAG,CAAC;IACb,CAAC;IAED,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,kBAAkB,MAAM,kBAAkB,GAAG,iBAAiB,GAAG,EAAE,CAAC,CAAC;QAClF,OAAO,GAAG,CAAC;IACb,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAaD,MAAM,UAAU,QAAQ;IACtB,OAAO;QACL,eAAe,EAAE,OAAO,C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,CAAC;AAEX,+EAA+E;AAC/E,2DAA2D;AAC3D,+EAA+E;AAE/E,MAAM,CAAC,MAAM,WAAW,GAA2B;IACjD,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;IACR,EAAE,EAAE,KAAK;CACD,CAAC;AAEX,+EAA+E;AAC/E,wEAAwE;AACxE,+EAA+E;AAE/E,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,2BAA2B;IACtE,UAAU,EAAE,IAAI;IAChB,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,KAAK,OAAO,EAAE,6CAA6C;CACrG,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
7
7
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
8
|
-
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, McpError, ErrorCode as McpErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
9
9
|
import { TOOLS } from './tools/definitions.js';
|
|
10
10
|
import { handleSearchReddit, handleGetRedditPosts } from './tools/reddit.js';
|
|
11
11
|
import { handleDeepResearch } from './tools/research.js';
|
|
@@ -14,7 +14,7 @@ import { handleWebSearch } from './tools/search.js';
|
|
|
14
14
|
import { deepResearchParamsSchema } from './schemas/deep-research.js';
|
|
15
15
|
import { scrapeLinksParamsSchema } from './schemas/scrape-links.js';
|
|
16
16
|
import { webSearchParamsSchema } from './schemas/web-search.js';
|
|
17
|
-
import { classifyError } from './utils/errors.js';
|
|
17
|
+
import { classifyError, createToolErrorFromStructured } from './utils/errors.js';
|
|
18
18
|
import { parseEnv, SERVER, getCapabilities, getMissingEnvMessage } from './config/index.js';
|
|
19
19
|
// ============================================================================
|
|
20
20
|
// Capability Detection (no ENV required - tools fail gracefully when called)
|
|
@@ -138,9 +138,18 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
138
138
|
}
|
|
139
139
|
return { content: [{ type: 'text', text: content }] };
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Protocol Error: Unknown tool requested
|
|
143
|
+
* Per MCP spec, use McpError for protocol-level errors (tool not found, invalid params)
|
|
144
|
+
* vs isError:true for tool execution failures (network, API, timeout)
|
|
145
|
+
*/
|
|
146
|
+
throw new McpError(McpErrorCode.MethodNotFound, `Method not found: ${name}. Available tools: search_reddit, get_reddit_post, deep_research, scrape_links, web_search`);
|
|
142
147
|
}
|
|
143
148
|
catch (error) {
|
|
149
|
+
// McpError should propagate to client as protocol error
|
|
150
|
+
if (error instanceof McpError) {
|
|
151
|
+
throw error;
|
|
152
|
+
}
|
|
144
153
|
// Classify the error for helpful messaging
|
|
145
154
|
const structuredError = classifyError(error);
|
|
146
155
|
// Log for debugging
|
|
@@ -149,36 +158,62 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
149
158
|
message: structuredError.message,
|
|
150
159
|
retryable: structuredError.retryable,
|
|
151
160
|
});
|
|
152
|
-
//
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
// ALWAYS return a valid response - never let the server crash
|
|
156
|
-
return { content: [{ type: 'text', text: errorText }], isError: true };
|
|
161
|
+
// Create standardized error response with errorCode for client programmatic handling
|
|
162
|
+
// This response includes: content (markdown), isError: true, errorCode, and retryAfter (for rate limits)
|
|
163
|
+
return createToolErrorFromStructured(structuredError);
|
|
157
164
|
}
|
|
158
165
|
});
|
|
159
166
|
// ============================================================================
|
|
160
|
-
// Global Error Handlers -
|
|
167
|
+
// Global Error Handlers - MUST EXIT on fatal errors per Node.js best practices
|
|
168
|
+
// See: https://nodejs.org/api/process.html#warning-using-uncaughtexception-correctly
|
|
161
169
|
// ============================================================================
|
|
162
|
-
//
|
|
170
|
+
// Track shutdown state to prevent double shutdown
|
|
171
|
+
let isShuttingDown = false;
|
|
172
|
+
/**
|
|
173
|
+
* Graceful shutdown handler - closes server and exits
|
|
174
|
+
* @param exitCode - Exit code (0 for clean shutdown, 1 for error)
|
|
175
|
+
*/
|
|
176
|
+
async function gracefulShutdown(exitCode) {
|
|
177
|
+
if (isShuttingDown)
|
|
178
|
+
return;
|
|
179
|
+
isShuttingDown = true;
|
|
180
|
+
try {
|
|
181
|
+
await server.close();
|
|
182
|
+
console.error(`[MCP Server] Server closed at ${new Date().toISOString()}`);
|
|
183
|
+
}
|
|
184
|
+
catch (closeError) {
|
|
185
|
+
console.error('[MCP Server] Error closing server:', closeError);
|
|
186
|
+
}
|
|
187
|
+
finally {
|
|
188
|
+
process.exit(exitCode);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// Handle uncaught exceptions - MUST EXIT per Node.js docs
|
|
192
|
+
// The VM is in an unstable state after uncaught exception
|
|
163
193
|
process.on('uncaughtException', (error) => {
|
|
164
|
-
console.error(
|
|
165
|
-
|
|
194
|
+
console.error(`[MCP Server] FATAL uncaughtException at ${new Date().toISOString()}:`);
|
|
195
|
+
console.error(` Message: ${error.message}`);
|
|
196
|
+
console.error(` Stack: ${error.stack}`);
|
|
197
|
+
gracefulShutdown(1);
|
|
166
198
|
});
|
|
167
|
-
// Handle unhandled promise rejections
|
|
199
|
+
// Handle unhandled promise rejections - MUST EXIT (Node v15+ behavior)
|
|
200
|
+
// Suppressing this risks memory leaks and corrupted state
|
|
168
201
|
process.on('unhandledRejection', (reason) => {
|
|
169
202
|
const error = classifyError(reason);
|
|
170
|
-
console.error(
|
|
171
|
-
|
|
203
|
+
console.error(`[MCP Server] FATAL unhandledRejection at ${new Date().toISOString()}:`);
|
|
204
|
+
console.error(` Message: ${error.message}`);
|
|
205
|
+
console.error(` Code: ${error.code}`);
|
|
206
|
+
gracefulShutdown(1);
|
|
172
207
|
});
|
|
173
|
-
// Handle SIGTERM gracefully
|
|
208
|
+
// Handle SIGTERM gracefully (Docker/Kubernetes stop signal)
|
|
174
209
|
process.on('SIGTERM', () => {
|
|
175
|
-
console.error(
|
|
176
|
-
|
|
210
|
+
console.error(`[MCP Server] Received SIGTERM at ${new Date().toISOString()}, shutting down gracefully`);
|
|
211
|
+
gracefulShutdown(0);
|
|
177
212
|
});
|
|
178
|
-
// Handle SIGINT gracefully (Ctrl+C)
|
|
179
|
-
process.
|
|
180
|
-
console.error(
|
|
181
|
-
|
|
213
|
+
// Handle SIGINT gracefully (Ctrl+C) - use once() to prevent double-fire
|
|
214
|
+
process.once('SIGINT', () => {
|
|
215
|
+
console.error(`[MCP Server] Received SIGINT at ${new Date().toISOString()}, shutting down gracefully`);
|
|
216
|
+
gracefulShutdown(0);
|
|
182
217
|
});
|
|
183
218
|
// ============================================================================
|
|
184
219
|
// Start Server
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAA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,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,CAAC,KAAK,CAAC,iCAAiC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -1,44 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Deep research schema - batch research with dynamic token allocation
|
|
3
|
+
* Enhanced with comprehensive prompting for bugs, programming questions, and general research
|
|
3
4
|
*/
|
|
4
5
|
import { z } from 'zod';
|
|
5
|
-
export declare const deepResearchParamsShape: {
|
|
6
|
-
questions: z.ZodArray<z.ZodObject<{
|
|
7
|
-
question: z.ZodString;
|
|
8
|
-
file_attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
9
|
-
path: z.ZodString;
|
|
10
|
-
start_line: z.ZodOptional<z.ZodNumber>;
|
|
11
|
-
end_line: z.ZodOptional<z.ZodNumber>;
|
|
12
|
-
description: z.ZodOptional<z.ZodString>;
|
|
13
|
-
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
path: string;
|
|
15
|
-
start_line?: number | undefined;
|
|
16
|
-
end_line?: number | undefined;
|
|
17
|
-
description?: string | undefined;
|
|
18
|
-
}, {
|
|
19
|
-
path: string;
|
|
20
|
-
start_line?: number | undefined;
|
|
21
|
-
end_line?: number | undefined;
|
|
22
|
-
description?: string | undefined;
|
|
23
|
-
}>, "many">>;
|
|
24
|
-
}, "strip", z.ZodTypeAny, {
|
|
25
|
-
question: string;
|
|
26
|
-
file_attachments?: {
|
|
27
|
-
path: string;
|
|
28
|
-
start_line?: number | undefined;
|
|
29
|
-
end_line?: number | undefined;
|
|
30
|
-
description?: string | undefined;
|
|
31
|
-
}[] | undefined;
|
|
32
|
-
}, {
|
|
33
|
-
question: string;
|
|
34
|
-
file_attachments?: {
|
|
35
|
-
path: string;
|
|
36
|
-
start_line?: number | undefined;
|
|
37
|
-
end_line?: number | undefined;
|
|
38
|
-
description?: string | undefined;
|
|
39
|
-
}[] | undefined;
|
|
40
|
-
}>, "many">;
|
|
41
|
-
};
|
|
42
6
|
export declare const deepResearchParamsSchema: z.ZodObject<{
|
|
43
7
|
questions: z.ZodArray<z.ZodObject<{
|
|
44
8
|
question: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-research.d.ts","sourceRoot":"","sources":["../../src/schemas/deep-research.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"deep-research.d.ts","sourceRoot":"","sources":["../../src/schemas/deep-research.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4OxB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAoC,CAAC;AAC1E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -1,59 +1,224 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Deep research schema - batch research with dynamic token allocation
|
|
3
|
+
* Enhanced with comprehensive prompting for bugs, programming questions, and general research
|
|
3
4
|
*/
|
|
4
5
|
import { z } from 'zod';
|
|
6
|
+
// File attachment schema with comprehensive descriptions to guide LLM usage
|
|
7
|
+
const fileAttachmentSchema = z.object({
|
|
8
|
+
path: z
|
|
9
|
+
.string({ required_error: 'deep_research: File path is required' })
|
|
10
|
+
.min(1, { message: 'deep_research: File path cannot be empty' })
|
|
11
|
+
.describe(`**[REQUIRED] Absolute file path to attach.**
|
|
12
|
+
|
|
13
|
+
⚠️ **YOU MUST USE ABSOLUTE PATHS** - e.g., "/Users/john/project/src/utils/auth.ts" NOT "src/utils/auth.ts"
|
|
14
|
+
|
|
15
|
+
The file will be read from the filesystem and included as context for the research question. This is CRITICAL for:
|
|
16
|
+
- Bug investigations (attach the failing code)
|
|
17
|
+
- Code reviews (attach the code to review)
|
|
18
|
+
- Refactoring questions (attach current implementation)
|
|
19
|
+
- Architecture decisions (attach relevant modules)
|
|
20
|
+
- Performance issues (attach the slow code path)
|
|
21
|
+
|
|
22
|
+
**IMPORTANT:** Always use the full absolute path as shown in your IDE or terminal.`),
|
|
23
|
+
start_line: z
|
|
24
|
+
.number({ invalid_type_error: 'deep_research: start_line must be a number' })
|
|
25
|
+
.int({ message: 'deep_research: start_line must be an integer' })
|
|
26
|
+
.positive({ message: 'deep_research: start_line must be a positive integer (1-indexed)' })
|
|
27
|
+
.optional()
|
|
28
|
+
.describe(`**[OPTIONAL] Start line number (1-indexed).**
|
|
29
|
+
|
|
30
|
+
Use this to focus on a specific section of a large file. If omitted, reads from line 1.
|
|
31
|
+
Example: start_line=50 with end_line=100 reads lines 50-100 only.`),
|
|
32
|
+
end_line: z
|
|
33
|
+
.number({ invalid_type_error: 'deep_research: end_line must be a number' })
|
|
34
|
+
.int({ message: 'deep_research: end_line must be an integer' })
|
|
35
|
+
.positive({ message: 'deep_research: end_line must be a positive integer (1-indexed)' })
|
|
36
|
+
.optional()
|
|
37
|
+
.describe(`**[OPTIONAL] End line number (1-indexed).**
|
|
38
|
+
|
|
39
|
+
Use this to limit the scope to relevant code sections. If omitted, reads to end of file.
|
|
40
|
+
For large files (>500 lines), consider specifying a range to focus the research.`),
|
|
41
|
+
description: z
|
|
42
|
+
.string()
|
|
43
|
+
.optional()
|
|
44
|
+
.describe(`**[HIGHLY RECOMMENDED] Comprehensive description of why this file is attached and what to focus on.**
|
|
45
|
+
|
|
46
|
+
⚠️ **THIS IS CRITICAL FOR EFFECTIVE RESEARCH.** Write a detailed description explaining:
|
|
47
|
+
|
|
48
|
+
1. **What this file is:** "This is the main authentication middleware that handles JWT validation"
|
|
49
|
+
2. **Why it's relevant:** "The bug occurs when tokens expire during long-running requests"
|
|
50
|
+
3. **What to focus on:** "Pay attention to the refreshToken() function on lines 45-80"
|
|
51
|
+
4. **Known issues/context:** "We suspect the race condition happens in the async validation"
|
|
52
|
+
5. **Related files:** "This interacts with /src/services/token-service.ts for token refresh"
|
|
53
|
+
|
|
54
|
+
**GOOD EXAMPLE:**
|
|
55
|
+
"This is our Redis caching layer (cache-service.ts). The bug manifests as stale data being returned after cache invalidation. Focus on the invalidatePattern() method (lines 120-150) and how it interacts with the pub/sub mechanism. We're using Redis Cluster and suspect the issue is related to cross-node invalidation timing."
|
|
56
|
+
|
|
57
|
+
**BAD EXAMPLE:**
|
|
58
|
+
"cache file" ← Too vague, research will be unfocused`),
|
|
59
|
+
});
|
|
60
|
+
// Research question schema with structured template guidance
|
|
5
61
|
const researchQuestionSchema = z.object({
|
|
6
62
|
question: z
|
|
7
|
-
.string()
|
|
8
|
-
.min(10, '
|
|
9
|
-
.describe(
|
|
63
|
+
.string({ required_error: 'deep_research: Question is required' })
|
|
64
|
+
.min(10, { message: 'deep_research: Question must be at least 10 characters' })
|
|
65
|
+
.describe(`**[REQUIRED] Your research question - MUST follow this structured template:**
|
|
66
|
+
|
|
67
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
68
|
+
📋 **STRUCTURED QUESTION TEMPLATE** (You MUST use this format)
|
|
69
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
70
|
+
|
|
71
|
+
**1. 🎯 WHAT I NEED:**
|
|
72
|
+
[Clearly state what you're trying to achieve, solve, or understand]
|
|
73
|
+
|
|
74
|
+
**2. 🤔 WHY I'M RESEARCHING THIS:**
|
|
75
|
+
[Explain the context - what decision does this inform? What problem are you solving?]
|
|
76
|
+
|
|
77
|
+
**3. 📚 WHAT I ALREADY KNOW:**
|
|
78
|
+
[Share your current understanding so research fills gaps, not repeats basics]
|
|
79
|
+
|
|
80
|
+
**4. 🔧 HOW I PLAN TO USE THIS:**
|
|
81
|
+
[Describe the practical application - implementation, debugging, architecture, etc.]
|
|
82
|
+
|
|
83
|
+
**5. ❓ SPECIFIC QUESTIONS (2-5):**
|
|
84
|
+
- Question 1: [Specific, pointed question]
|
|
85
|
+
- Question 2: [Another specific question]
|
|
86
|
+
- Question 3: [etc.]
|
|
87
|
+
|
|
88
|
+
**6. 🌐 PRIORITY SOURCES (optional):**
|
|
89
|
+
[Sites/docs to prioritize: "Prefer official React docs, GitHub issues, Stack Overflow"]
|
|
90
|
+
|
|
91
|
+
**7. ⚡ PRIORITY INFO (optional):**
|
|
92
|
+
[What matters most: "Focus on performance implications" or "Prioritize security best practices"]
|
|
93
|
+
|
|
94
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
95
|
+
|
|
96
|
+
**EXAMPLE FOR BUG INVESTIGATION:**
|
|
97
|
+
"🎯 WHAT I NEED: Debug why our WebSocket connections drop after exactly 60 seconds of inactivity.
|
|
98
|
+
|
|
99
|
+
🤔 WHY: Production users are losing real-time updates, causing data sync issues and support tickets.
|
|
100
|
+
|
|
101
|
+
📚 WHAT I KNOW: We use Socket.io v4.6 with Redis adapter. The 60s timeout suggests a proxy/load balancer issue, but we've checked nginx configs.
|
|
102
|
+
|
|
103
|
+
🔧 HOW I'LL USE THIS: Implement the fix in our connection-manager.ts (attached) and update our deployment configs.
|
|
104
|
+
|
|
105
|
+
❓ SPECIFIC QUESTIONS:
|
|
106
|
+
1. What are common causes of exactly 60-second WebSocket timeouts?
|
|
107
|
+
2. How should Socket.io heartbeat/ping intervals be configured to prevent this?
|
|
108
|
+
3. Are there AWS ALB-specific settings we need to consider?
|
|
109
|
+
4. How do other production apps handle WebSocket keep-alive?
|
|
110
|
+
|
|
111
|
+
🌐 PRIORITY: Socket.io official docs, AWS documentation, GitHub issues with similar problems
|
|
112
|
+
|
|
113
|
+
⚡ FOCUS: Production-ready solutions, not development workarounds"
|
|
114
|
+
|
|
115
|
+
**EXAMPLE FOR ARCHITECTURE RESEARCH:**
|
|
116
|
+
"🎯 WHAT I NEED: Best practices for implementing CQRS pattern with Event Sourcing in Node.js/TypeScript.
|
|
117
|
+
|
|
118
|
+
🤔 WHY: Our monolithic API is hitting scaling limits. We need to separate read/write paths for our order processing system.
|
|
119
|
+
|
|
120
|
+
📚 WHAT I KNOW: Familiar with basic event-driven architecture, used RabbitMQ before. New to full CQRS/ES implementation.
|
|
121
|
+
|
|
122
|
+
🔧 HOW I'LL USE THIS: Design the new order-service architecture, select appropriate libraries, plan migration strategy.
|
|
123
|
+
|
|
124
|
+
❓ SPECIFIC QUESTIONS:
|
|
125
|
+
1. What are the recommended Node.js libraries for CQRS/ES? (Pros/cons of each)
|
|
126
|
+
2. How should we handle eventual consistency in read models?
|
|
127
|
+
3. What's the best event store for our scale (~10k events/day)?
|
|
128
|
+
4. How do we handle schema evolution for events over time?
|
|
129
|
+
5. What are common pitfalls teams encounter when adopting CQRS/ES?
|
|
130
|
+
|
|
131
|
+
🌐 PRIORITY: Microsoft docs (they coined CQRS), Martin Fowler, real-world case studies
|
|
132
|
+
|
|
133
|
+
⚡ FOCUS: Production patterns, not theoretical explanations. Include code examples."`),
|
|
10
134
|
file_attachments: z
|
|
11
|
-
.array(
|
|
12
|
-
path: z.string().describe('File path (absolute or relative)'),
|
|
13
|
-
start_line: z.number().int().positive().optional().describe('Start line (1-indexed)'),
|
|
14
|
-
end_line: z.number().int().positive().optional().describe('End line (1-indexed)'),
|
|
15
|
-
description: z.string().optional().describe('What to focus on'),
|
|
16
|
-
}))
|
|
135
|
+
.array(fileAttachmentSchema)
|
|
17
136
|
.optional()
|
|
18
|
-
.describe(
|
|
19
|
-
});
|
|
20
|
-
export const deepResearchParamsShape = {
|
|
21
|
-
questions: z
|
|
22
|
-
.array(researchQuestionSchema)
|
|
23
|
-
.min(1, 'At least one research question required, but you should keep it around 6-7 at each round')
|
|
24
|
-
.max(10, 'Maximum 10 research questions per batch')
|
|
25
|
-
.describe(`**BATCH RESEARCH (1-10 questions) with dynamic token allocation.**
|
|
137
|
+
.describe(`**[CRITICAL FOR BUGS/CODE QUESTIONS] File attachments to include as research context.**
|
|
26
138
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- 5-7 questions: ~4-6K tokens/question (balanced breadth, ideal for domain exploration)
|
|
31
|
-
- 8-10 questions: ~3-4K tokens/question (quick multi-topic scan)
|
|
139
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
140
|
+
⚠️ **YOU MUST ATTACH FILES WHEN:**
|
|
141
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
32
142
|
|
|
33
|
-
**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
**
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
143
|
+
✅ **MANDATORY file attachment scenarios:**
|
|
144
|
+
- 🐛 **Bug investigation** → Attach the buggy code file(s)
|
|
145
|
+
- 🔍 **Code review** → Attach the code to be reviewed
|
|
146
|
+
- ♻️ **Refactoring** → Attach current implementation
|
|
147
|
+
- 🏗️ **Architecture questions about YOUR code** → Attach relevant modules
|
|
148
|
+
- ⚡ **Performance issues** → Attach the slow code paths
|
|
149
|
+
- 🔒 **Security review** → Attach the security-sensitive code
|
|
150
|
+
- 🧪 **Testing questions** → Attach both the code AND test files
|
|
151
|
+
- 🔗 **Integration issues** → Attach files from both sides of the integration
|
|
152
|
+
|
|
153
|
+
❌ **File attachments NOT needed for:**
|
|
154
|
+
- General concept questions ("What is CQRS?")
|
|
155
|
+
- Technology comparisons ("React vs Vue")
|
|
156
|
+
- Best practices research (unless about your specific code)
|
|
157
|
+
- Documentation lookups
|
|
158
|
+
|
|
159
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
160
|
+
📎 **HOW TO ATTACH FILES:**
|
|
161
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
162
|
+
|
|
163
|
+
**Each attachment requires:**
|
|
164
|
+
1. \`path\` (REQUIRED): **Absolute path** like "/Users/dev/project/src/auth.ts"
|
|
165
|
+
2. \`start_line\` (optional): Focus on specific section
|
|
166
|
+
3. \`end_line\` (optional): Limit scope for large files
|
|
167
|
+
4. \`description\` (HIGHLY RECOMMENDED): Explain what this file is and why it matters
|
|
168
|
+
|
|
169
|
+
**EXAMPLE - Bug with multiple related files:**
|
|
47
170
|
\`\`\`json
|
|
48
171
|
{
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
{
|
|
172
|
+
"question": "🎯 WHAT I NEED: Fix the race condition in our order processing...",
|
|
173
|
+
"file_attachments": [
|
|
174
|
+
{
|
|
175
|
+
"path": "/Users/dev/ecommerce/src/services/order-processor.ts",
|
|
176
|
+
"description": "Main order processing service. The race condition occurs in processOrder() when two requests hit simultaneously. Lines 45-120 contain the critical section."
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"path": "/Users/dev/ecommerce/src/repositories/inventory-repo.ts",
|
|
180
|
+
"start_line": 30,
|
|
181
|
+
"end_line": 80,
|
|
182
|
+
"description": "Inventory repository - the decrementStock() method (lines 30-80) is called by order-processor and we suspect it's not properly locked."
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"path": "/Users/dev/ecommerce/src/utils/db-transaction.ts",
|
|
186
|
+
"description": "Our transaction wrapper utility. Need to verify if it properly handles concurrent transactions."
|
|
187
|
+
}
|
|
52
188
|
]
|
|
53
189
|
}
|
|
54
190
|
\`\`\`
|
|
55
191
|
|
|
56
|
-
|
|
192
|
+
**Attach as many files as needed for complete context - there is no limit!**`),
|
|
193
|
+
});
|
|
194
|
+
// Shape object for external consumers who need individual field schemas
|
|
195
|
+
const deepResearchParamsShape = {
|
|
196
|
+
questions: z
|
|
197
|
+
.array(researchQuestionSchema, {
|
|
198
|
+
required_error: 'deep_research: Questions array is required',
|
|
199
|
+
invalid_type_error: 'deep_research: Questions must be an array'
|
|
200
|
+
})
|
|
201
|
+
.min(1, { message: 'deep_research: At least 1 question is required (recommend 2-7 for optimal depth)' })
|
|
202
|
+
.max(10, { message: 'deep_research: Maximum 10 questions allowed per batch' })
|
|
203
|
+
.describe(`**Batch deep research (2-10 questions) with dynamic token allocation.**
|
|
204
|
+
|
|
205
|
+
**TOKEN BUDGET:** 32,000 tokens distributed across all questions:
|
|
206
|
+
- 2 questions: 16,000 tokens/question (deep dive)
|
|
207
|
+
- 5 questions: 6,400 tokens/question (balanced)
|
|
208
|
+
- 10 questions: 3,200 tokens/question (rapid multi-topic)
|
|
209
|
+
|
|
210
|
+
**WHEN TO USE:**
|
|
211
|
+
- Need multi-perspective analysis on related topics
|
|
212
|
+
- Researching a domain from multiple angles
|
|
213
|
+
- Validating understanding across different aspects
|
|
214
|
+
- Comparing approaches/technologies side-by-side
|
|
215
|
+
|
|
216
|
+
**EACH QUESTION SHOULD INCLUDE:**
|
|
217
|
+
- Topic & context (what decision it informs)
|
|
218
|
+
- Your current understanding (to fill gaps)
|
|
219
|
+
- Specific sub-questions (2-5 per topic)
|
|
220
|
+
|
|
221
|
+
**USE:** Maximize question count for comprehensive coverage. All questions run in parallel. Group related questions for coherent research.`),
|
|
57
222
|
};
|
|
58
223
|
export const deepResearchParamsSchema = z.object(deepResearchParamsShape);
|
|
59
224
|
//# sourceMappingURL=deep-research.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-research.js","sourceRoot":"","sources":["../../src/schemas/deep-research.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"deep-research.js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ACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oFAoE8E,CAC/E;IACH,gBAAgB,EAAE,CAAC;SAChB,KAAK,CAAC,oBAAoB,CAAC;SAC3B,QAAQ,EAAE;SACV,QAAQ,CACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6EAuDuE,CACxE;CACJ,CAAC,CAAC;AAEH,wEAAwE;AACxE,MAAM,uBAAuB,GAAG;IAC9B,SAAS,EAAE,CAAC;SACT,KAAK,CAAC,sBAAsB,EAAE;QAC7B,cAAc,EAAE,4CAA4C;QAC5D,kBAAkB,EAAE,2CAA2C;KAChE,CAAC;SACD,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,kFAAkF,EAAE,CAAC;SACvG,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,uDAAuD,EAAE,CAAC;SAC7E,QAAQ,CACP;;;;;;;;;;;;;;;;;;2IAkBqI,CACtI;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const scrapeLinksParamsShape: {
|
|
3
|
-
urls: z.ZodArray<z.ZodString, "many">;
|
|
4
|
-
timeout: z.ZodDefault<z.ZodNumber>;
|
|
5
|
-
use_llm: z.ZodDefault<z.ZodBoolean>;
|
|
6
|
-
what_to_extract: z.ZodOptional<z.ZodString>;
|
|
7
|
-
};
|
|
8
2
|
export declare const scrapeLinksParamsSchema: z.ZodObject<{
|
|
9
|
-
urls: z.ZodArray<z.ZodString, "many">;
|
|
3
|
+
urls: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
10
4
|
timeout: z.ZodDefault<z.ZodNumber>;
|
|
11
5
|
use_llm: z.ZodDefault<z.ZodBoolean>;
|
|
12
6
|
what_to_extract: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrape-links.d.ts","sourceRoot":"","sources":["../../src/schemas/scrape-links.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"scrape-links.d.ts","sourceRoot":"","sources":["../../src/schemas/scrape-links.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsCxB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;EAAmC,CAAC;AACxE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAGxE,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QACR,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,aAAa,EAAE,MAAM,CAAC;QACtB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;CACH"}
|